Giter Site home page Giter Site logo

Comments (13)

jackyliu16 avatar jackyliu16 commented on September 19, 2024

Current Application Support: make test ARCH=$(ARCH)

Application x86_64 aarch64 riscv64
hello ✔️ ✔️ ✔️
memtest ✔️ ✔️ ✔️
exception ✔️ ✔️ ✔️
task/yield ✔️ ✔️ ✔️
task/parallel ✔️ ✔️ ✔️
task/sleep ✔️ ✔️ ✔️
task/priority ✔️ ✔️ ✔️
net/httpclient ? ✔️ ✔️
c/helloworld ✔️ ✔️ ✔️
c/memtest ✔️ ✔️ ✔️
c/sqlite3 ✔️ ✔️ ✔️
c/httpclient ✔️ ✔️ ✔️

from arceos.

jackyliu16 avatar jackyliu16 commented on September 19, 2024

Solved

c/sqlite3: Could not open 'disk.img': No such file or directory

#TODO

The file didn't say anything about the generate of disk.img will not be run automatic.
Not much is known about what the FS in the passed-in parameter does

ARCH=riscv64 LOG=info FS=y
    Building App: sqlite3, Arch: aarch64, Platform: qemu-virt-aarch64, Language: c
cargo rustc --target aarch64-unknown-none-softfloat --target-dir /home/jacky/Coding/arceos/target --release --crate-type staticlib --features "libax/platform-qemu-virt-aarch64 libax/log-level-warn libax/fs libax/default libax/fp_simd libax/alloc libax/paging libax/fs libax/cbindings"  --no-default-features -p libax -- -Clink-args="-T/home/jacky/Coding/arceos/modules/axhal/linker_aarch64.lds -no-pie"
    Finished release [optimized] target(s) in 0.20s
rm -f ulib/c_libax/build_aarch64/libc.a
aarch64-unknown-linux-musl-ar rc ulib/c_libax/build_aarch64/libc.a ulib/c_libax/build_aarch64/assert.o ulib/c_libax/build_aarch64/ctype.o ulib/c_libax/build_aarch64/errno.o ulib/c_libax/build_aarch64/fcntl.o ulib/c_libax/build_aarch64/mmap.o ulib/c_libax/build_aarch64/network.o ulib/c_libax/build_aarch64/pthread.o ulib/c_libax/build_aarch64/resource.o ulib/c_libax/build_aarch64/signal.o ulib/c_libax/build_aarch64/socket.o ulib/c_libax/build_aarch64/stat.o ulib/c_libax/build_aarch64/stdio.o ulib/c_libax/build_aarch64/stdlib.o ulib/c_libax/build_aarch64/string.o ulib/c_libax/build_aarch64/time.o ulib/c_libax/build_aarch64/unistd.o
aarch64-unknown-linux-musl-ranlib ulib/c_libax/build_aarch64/libc.a
    Linking apps/c/sqlite3/sqlite3_qemu-virt-aarch64.elf
rust-lld -flavor gnu -nostdlib -static -no-pie --gc-sections -T/home/jacky/Coding/arceos/modules/axhal/linker_aarch64.lds apps/c/sqlite3/main.o apps/c/sqlite3/sqlite3.o ulib/c_libax/build_aarch64/libc.a target/aarch64-unknown-none-softfloat/release/liblibax.a -o apps/c/sqlite3/sqlite3_qemu-virt-aarch64.elf
rust-objcopy --binary-architecture=aarch64 apps/c/sqlite3/sqlite3_qemu-virt-aarch64.elf --strip-all -O binary apps/c/sqlite3/sqlite3_qemu-virt-aarch64.bin
    Running qemu-system-aarch64 -m 128M -smp 1 -cpu cortex-a72 -machine virt -kernel apps/c/sqlite3/sqlite3_qemu-virt-aarch64.bin -device virtio-blk-device,drive=disk0 -drive id=disk0,if=none,format=raw,file=disk.img -nographic 
qemu-system-aarch64: -drive id=disk0,if=none,format=raw,file=disk.img: Could not open 'disk.img': No such file or directory
make: *** [Makefile:94:justrun] 错误 1

Complete process from build: source

ARCH=riscv64 LOG=info FS=y
    Building App: sqlite3, Arch: riscv64, Platform: qemu-virt-riscv, Language: c
cargo rustc --target riscv64gc-unknown-none-elf --target-dir /home/jacky/Coding/arceos/target --release --crate-type staticlib --features "libax/platform-qemu-virt-riscv libax/log-level-info libax/fs libax/default libax/fp_simd libax/alloc libax/paging libax/fs libax/cbindings"  --no-default-features -p libax -- -Clink-args="-T/home/jacky/Coding/arceos/modules/axhal/linker_riscv64.lds -no-pie"
   Compiling axconfig v0.1.0 (/home/jacky/Coding/arceos/modules/axconfig)
   Compiling axhal v0.1.0 (/home/jacky/Coding/arceos/modules/axhal)
   Compiling libax v0.1.0 (/home/jacky/Coding/arceos/ulib/libax)
   Compiling axtask v0.1.0 (/home/jacky/Coding/arceos/modules/axtask)
   Compiling axdriver v0.1.0 (/home/jacky/Coding/arceos/modules/axdriver)
   Compiling axsync v0.1.0 (/home/jacky/Coding/arceos/modules/axsync)
   Compiling axfs v0.1.0 (/home/jacky/Coding/arceos/modules/axfs)
   Compiling axruntime v0.1.0 (/home/jacky/Coding/arceos/modules/axruntime)
    Finished release [optimized] target(s) in 8.57s
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_FLOATING_POINT -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEBUG -w -c -o apps/c/sqlite3/sqlite3.o apps/c/sqlite3/sqlite3.c
mkdir -p ulib/c_libax/build_riscv64
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/assert.o ulib/c_libax/src/assert.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/ctype.o ulib/c_libax/src/ctype.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/errno.o ulib/c_libax/src/errno.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/fcntl.o ulib/c_libax/src/fcntl.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/mmap.o ulib/c_libax/src/mmap.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/network.o ulib/c_libax/src/network.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/pthread.o ulib/c_libax/src/pthread.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/resource.o ulib/c_libax/src/resource.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/signal.o ulib/c_libax/src/signal.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/socket.o ulib/c_libax/src/socket.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/stat.o ulib/c_libax/src/stat.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/stdio.o ulib/c_libax/src/stdio.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/stdlib.o ulib/c_libax/src/stdlib.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/string.o ulib/c_libax/src/string.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/time.o ulib/c_libax/src/time.c
riscv64-unknown-linux-musl-gcc -DAX_CONFIG_DEFAULT -DAX_CONFIG_FP_SIMD -DAX_CONFIG_ALLOC -DAX_CONFIG_PAGING -DAX_CONFIG_FS -nostdinc -static -no-pie -fno-builtin -ffreestanding -Wall -Iulib/c_libax/include -Iulib/c_libax/../libax -O3 -march=rv64gc -mabi=lp64d -mcmodel=medany -c -o ulib/c_libax/build_riscv64/unistd.o ulib/c_libax/src/unistd.c
rm -f ulib/c_libax/build_riscv64/libc.a
riscv64-unknown-linux-musl-ar rc ulib/c_libax/build_riscv64/libc.a ulib/c_libax/build_riscv64/assert.o ulib/c_libax/build_riscv64/ctype.o ulib/c_libax/build_riscv64/errno.o ulib/c_libax/build_riscv64/fcntl.o ulib/c_libax/build_riscv64/mmap.o ulib/c_libax/build_riscv64/network.o ulib/c_libax/build_riscv64/pthread.o ulib/c_libax/build_riscv64/resource.o ulib/c_libax/build_riscv64/signal.o ulib/c_libax/build_riscv64/socket.o ulib/c_libax/build_riscv64/stat.o ulib/c_libax/build_riscv64/stdio.o ulib/c_libax/build_riscv64/stdlib.o ulib/c_libax/build_riscv64/string.o ulib/c_libax/build_riscv64/time.o ulib/c_libax/build_riscv64/unistd.o
riscv64-unknown-linux-musl-ranlib ulib/c_libax/build_riscv64/libc.a
    Linking apps/c/sqlite3/sqlite3_qemu-virt-riscv.elf
rust-lld -flavor gnu -nostdlib -static -no-pie --gc-sections -T/home/jacky/Coding/arceos/modules/axhal/linker_riscv64.lds --no-relax apps/c/sqlite3/main.o apps/c/sqlite3/sqlite3.o ulib/c_libax/build_riscv64/libc.a target/riscv64gc-unknown-none-elf/release/liblibax.a -o apps/c/sqlite3/sqlite3_qemu-virt-riscv.elf
rust-objcopy --binary-architecture=riscv64 apps/c/sqlite3/sqlite3_qemu-virt-riscv.elf --strip-all -O binary apps/c/sqlite3/sqlite3_qemu-virt-riscv.bin
    Running qemu-system-riscv64 -m 128M -smp 1 -machine virt -bios default -kernel apps/c/sqlite3/sqlite3_qemu-virt-riscv.bin -device virtio-blk-device,drive=disk0 -drive id=disk0,if=none,format=raw,file=disk.img -nographic 
qemu-system-riscv64: -drive id=disk0,if=none,format=raw,file=disk.img: Could not open 'disk.img': No such file or directory
make: *** [Makefile:94:justrun] 错误 1

Complete process from build: source

from arceos.

jackyliu16 avatar jackyliu16 commented on September 19, 2024

Solved

c/helloworld: relocation R_X86_64_32 out of range
It looks a little bit like Relocation R_X86_64_32S out of range #70992, maybe required further analysis of internal links.

ARCH=x86_64 LOG=info FS=y
rm -f ulib/c_libax/build_x86_64/libc.a
x86_64-unknown-linux-musl-ar rc ulib/c_libax/build_x86_64/libc.a ulib/c_libax/build_x86_64/assert.o ulib/c_libax/build_x86_64/ctype.o ulib/c_libax/build_x86_64/errno.o ulib/c_libax/build_x86_64/fcntl.o ulib/c_libax/build_x86_64/mmap.o ulib/c_libax/build_x86_64/network.o ulib/c_libax/build_x86_64/pthread.o ulib/c_libax/build_x86_64/resource.o ulib/c_libax/build_x86_64/signal.o ulib/c_libax/build_x86_64/socket.o ulib/c_libax/build_x86_64/stat.o ulib/c_libax/build_x86_64/stdio.o ulib/c_libax/build_x86_64/stdlib.o ulib/c_libax/build_x86_64/string.o ulib/c_libax/build_x86_64/time.o ulib/c_libax/build_x86_64/unistd.o
x86_64-unknown-linux-musl-ranlib ulib/c_libax/build_x86_64/libc.a
    Linking apps/c/helloworld//helloworld_pc-x86.elf
rust-lld -flavor gnu -nostdlib -static -no-pie --gc-sections -T/home/jacky/Coding/arceos/modules/axhal/linker_x86_64.lds apps/c/helloworld//main.o ulib/c_libax/build_x86_64/libc.a target/x86_64-unknown-none/release/liblibax.a -o apps/c/helloworld//helloworld_pc-x86.elf
rust-lld: error: apps/c/helloworld//main.o:(function main: .text.startup+0x11): relocation R_X86_64_32 out of range: 18446743523956043783 is not in [0, 4294967295]
>>> referenced by main.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function parsenint: .text+0x46): relocation R_X86_64_32S out of range: -549753507376 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function parsenint: .text+0xc9): relocation R_X86_64_32 out of range: 18446743523956044208 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function parsenint: .text+0xd3): relocation R_X86_64_32 out of range: 18446743523956043806 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function parsenint: .text+0xd8): relocation R_X86_64_32 out of range: 18446743523956043776 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function printint: .text+0x135): relocation R_X86_64_32S out of range: -549753507376 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function printint: .text+0x19d): relocation R_X86_64_32S out of range: -549753167840 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function printint: .text+0x1b3): relocation R_X86_64_32 out of range: 18446743523956383776 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function printint: .text+0x1ec): relocation R_X86_64_32 out of range: 18446743523956044224 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function printint: .text+0x1f6): relocation R_X86_64_32 out of range: 18446743523956043806 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function printint: .text+0x1fb): relocation R_X86_64_32 out of range: 18446743523956043776 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fflush: .text+0x240): relocation R_X86_64_32 out of range: 18446743523956383776 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function putchar: .text+0x26d): relocation R_X86_64_32S out of range: -549753167840 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function putchar: .text+0x298): relocation R_X86_64_32 out of range: 18446743523956383776 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fprintf: .text+0x3ad): relocation R_X86_64_32S out of range: -549753167840 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fprintf: .text+0x3c3): relocation R_X86_64_32 out of range: 18446743523956383776 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fprintf: .text+0x415): relocation R_X86_64_32S out of range: -549753507760 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fprintf: .text+0x42c): relocation R_X86_64_32S out of range: -549753167840 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fprintf: .text+0x452): relocation R_X86_64_32S out of range: -549753167840 is not in [-2147483648, 2147483647]
>>> referenced by stdio.c

rust-lld: error: ulib/c_libax/build_x86_64/libc.a(stdio.o):(function fprintf: .text+0x500): relocation R_X86_64_32 out of range: 18446743523956043799 is not in [0, 4294967295]
>>> referenced by stdio.c

rust-lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
make: *** [ulib/c_libax/build.mk:74:apps/c/helloworld//helloworld_pc-x86.elf] 错误 1

Complete process from build: source

from arceos.

equation314 avatar equation314 commented on September 19, 2024

Solved

c/sqlite3: Could not open 'disk.img': No such file or directory

#TODO

The file didn't say anything about the generate of disk.img will not be run automatic.
Not much is known about what the FS in the passed-in parameter does

ARCH=riscv64 LOG=info FS=y
Complete process from build: source

ARCH=riscv64 LOG=info FS=y
Complete process from build: source

Run make disk_img before.

from arceos.

jackyliu16 avatar jackyliu16 commented on September 19, 2024

Run make disk_img before.

Yes, the problem has been solved by that ways, I was thinking if we should change Makefile to make disk_img as a dependence of build, just like this.

from arceos.

equation314 avatar equation314 commented on September 19, 2024

It should not be a dependency, otherwise redundant warning information will be output, and not all applications use disk.img.

from arceos.

jackyliu16 avatar jackyliu16 commented on September 19, 2024

It seems that when developing on a environment haven't install rust before, will cases cargo --version does not specify a version and therefore cannot be debugged properly using rust-analyzer

from arceos.

leelingrui avatar leelingrui commented on September 19, 2024

c/helloworld: relocation R_X86_64_32 out of range It looks a little bit like Relocation R_X86_64_32S out of range #70992, maybe required further analysis of internal links.

ARCH=x86_64 LOG=info FS=y
Complete process from build: source

have you solved this problem?

from arceos.

equation314 avatar equation314 commented on September 19, 2024

Add --no-relax to LDFLAGS?

from arceos.

jackyliu16 avatar jackyliu16 commented on September 19, 2024

c/helloworld: relocation R_X86_64_32 out of range It looks a little bit like Relocation R_X86_64_32S out of range #70992, maybe required further analysis of internal links.
ARCH=x86_64 LOG=info FS=y
Complete process from build: source

have you solved this problem?

Actually, the problem has been solved when I'm trying not to use the musl tool chain provide by nixpkgs.
This is my current script and it's lock file, it has been test in the arceos (rcore-os/arceos:79ecfaa40ec68b8f6081619bcdf0fa111762b7d9)
Because I downloaded the recommended tool chain directly using fetchurl

by the ways, this is the commands to using the devShells, if you just only have one, you can just using full as default and using direnv:

$ nix develop .#full --option substituters https://mirror.iscas.ac.cn/nix-channels/store --ignore-environment 

from arceos.

leelingrui avatar leelingrui commented on September 19, 2024

Actually, the problem has been solved when I'm trying not to use the musl tool chain provide by nixpkgs. This is my current script and it's lock file, it has been test in the arceos (rcore-os/arceos:79ecfaa40ec68b8f6081619bcdf0fa111762b7d9) Because I downloaded the recommended tool chain directly using fetchurl

by the ways, this is the commands to using the devShells, if you just only have one, you can just using full as default and using direnv:

$ nix develop .#full --option substituters https://mirror.iscas.ac.cn/nix-channels/store --ignore-environment 

my tool chain is x86_64-unknown-none
i want to link my kernel to high address but encounter relocation R_X86_64_32S out of range is happened at inline assembly

        asm!(
            "lgdt [GDT_PTR]" 
        ); //GDT_PTR is gdt entry
        asm!(
            "lidt [IDT_PTR]" 
        ); //IDT_PTR is idt entry
        call [HANDLER_TABLE + rax * 8]

it works properly at 0x100000, but when i change linker.ld link it to 0xffff800000100000 error occured

OUTPUT_ARCH(x86_64)
ENTRY(_start)
BASE_ADDRESS = 0xffff800000100000;

SECTIONS
{
    . = BASE_ADDRESS;
    skernel = .;

    stext = .;
    .text : {
        *(.text.entry)
        *(.text .text.*)
    }

    . = ALIGN(4K);
    .dynamic : {
        *(.dynamic)
    }
    
    . = ALIGN(4K);
    .got : {
        *(.got)
    }

    . = ALIGN(4K);
    erodata = .;
    sdata = .;
    .data : {
        *(.data .data.*)
        *(.sdata .sdata.*)
    }

    . = ALIGN(4K);
    etext = .;
    srodata = .;
    .rodata : {
        *(.rodata .rodata.*)
        *(.srodata .srodata.*)
    }

    . = ALIGN(4K);
    edata = .;
    .bss : {
        *(.bss.stack)
        sbss = .;
        *(.bss .bss.*)
        *(.sbss .sbss.*)
    }
    . = ALIGN(4K);
    dyn = .;
    .dynsym :
    {
        *(.dynsym)
    }
    .gnu.hash : {
        *(.gnu.hash)
    }
    .hash :
    {
        *(.hash)
    }
    . = ALIGN(4K);
    ebss = .;
    ekernel = .;

    /DISCARD/ : {
        *(.eh_frame)
    }
}

this afternoon i watched binary code of lgdt [GDT_PTR] i found the binary code is
image
image
i have searched some information the 0x0F 0x01 is LGDT Opcode 0x14 means use SIB addressing mode 0x25,
means SIB form is disp32, last 4 bytes is address of GDT_PTR.
that's why it can work at 0x100000 but can't work at 0xffff800000100000.

but i don't know how to tell complier reserve 8 bytes for me.

from arceos.

jackyliu16 avatar jackyliu16 commented on September 19, 2024

@leelingrui Maybe it's because my knowledge is relatively narrow, I can't quite understand what you said (

from arceos.

leelingrui avatar leelingrui commented on September 19, 2024

@jackyliu16 may be my expressive ability is too bad, I already solved this problem.I still appreciate your help.

from arceos.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.