-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to compile c program in tests directory with 32bit configuration #23
Comments
Compile the compiler with following config ./configure --prefix=$RISCV --enable-multilib
make -j4 You will have riscv64-unknown-elf-gcc installed to which if you pass |
I fix the issue, thanks. |
Hello @codelec, Seems that this issue persists even with --enable-multilib..... /home/aignacio/riscv_multilib/bin/riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -mcmodel=medany -std=gnu99 -O2 -fno-common -fno-builtin-printf -Wall -save-temps=obj -Iinc -c src/rocc_ha.c -o obj/rocc_ha.o
Linking...output/mm.baremetal
/home/aignacio/riscv_multilib/bin/riscv64-unknown-elf-gcc -Tld/link.ld -static -nostdlib -nostartfiles -lgcc -march=rv32imac -mabi=ilp32 -mcmodel=medany -std=gnu99 -O2 -fno-common -fno-builtin-printf -Wall -Iinc obj/crt.o obj/syscalls.o obj/mm.o obj/rocc_ha.o -o output/mm.baremetal
/home/aignacio/riscv_multilib/lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: obj/syscalls.o: in function `.L48':
syscalls.c:(.text+0x102): undefined reference to `__umoddi3'
/home/aignacio/riscv_multilib/lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: obj/syscalls.o: in function `.L59':
syscalls.c:(.text+0x122): undefined reference to `__udivdi3'
/home/aignacio/riscv_multilib/lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: syscalls.c:(.text+0x132): undefined reference to `__umoddi3'
collect2: error: ld returned 1 exit status
Makefile:32: recipe for target 'output/mm.baremetal' failed
make: *** [output/mm.baremetal] Error 1
Update: It was a silly error in makefiles, I forgot to put LDFLAGS after the compiled objects, so it now finds the correspondent functions. |
Hi,
I set XLEN=32 for whole system, so I intend to run 32 bit ELF on that system.
I just modify Makefile(in project-template/tests/)configuration to generate 32 bit ELF file.
revision part:
GCC=riscv32-unknown-elf-gcc
OBJDUMP=riscv32-unknown-elf-objdump
I only revise two statements shown above, and remain part still as original version.
However, I get errors when I utilize new Makefile.
error message:
riscv32-unknown-elf-gcc -T link.ld -static -nostdlib -nostartfiles -lgcc pwm.o crt.o syscalls.o -o pwm.riscv
syscalls.o: In function
.L48': syscalls.c:(.text+0x13c): undefined reference to
__umoddi3'syscalls.o: In function
.L59': syscalls.c:(.text+0x168): undefined reference to
__udivdi3'syscalls.c:(.text+0x180): undefined reference to `__umoddi3'
collect2: error: ld returned 1 exit status
make: *** [pwm.riscv] Error 1
It fails in linking stage. Obviously, it seems there are some program in systemcall.c with 32bit configuration.
Can anyone tell me how to fix it for compiling successfully?
The text was updated successfully, but these errors were encountered: