On Sun, 12 Jul 2020, Maciej W. Rozycki wrote: > I don't think we have a way to redirect the reference to `__GI_memset'.
Additionally, I need to mention that where `libgcc.a' has been built at `-O0', RV32 `ld.so' fails linking due to unresolved `malloc' and `free' references from numerous `libgcc.a' objects. This is because those objects pull in the exception unwinder; specifically `__divdi3', `__moddi3', and `__umoddi3' all include a call to `_Unwind_Resume' each. Arguably this might probably be called a deficiency in libgcc, however the objects are built with `-fexceptions -fnon-call-exceptions' and at `-O0' GCC might not be able to see through code that no exception may happen there. Therefore I am not sure offhand if this needs to be considered a GCC or glibc bug. Maciej .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../obj/glibc-boot/ilp32/elf/librtld.os: in function `init_dwarf_reg_size_table': .../src/gcc/libgcc/unwind-dw2.c:1572: undefined reference to `malloc' .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../obj/glibc-boot/ilp32/elf/librtld.os: in function `uw_init_context_1': .../src/gcc/libgcc/unwind-dw2.c:1613: undefined reference to `malloc' .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../obj/glibc-boot/ilp32/elf/librtld.os: in function `uw_install_context_1': .../src/gcc/libgcc/unwind-dw2.c:1694: undefined reference to `free' .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../src/gcc/libgcc/unwind-dw2.c:1711: undefined reference to `free' .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../obj/glibc-boot/ilp32/elf/librtld.os: in function `_Unwind_ForcedUnwind_Phase2': .../src/gcc/libgcc/unwind.inc:152: undefined reference to `malloc' .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../src/gcc/libgcc/unwind.inc:163: undefined reference to `malloc' .../bin/../lib/gcc/riscv64-linux-gnu/10.0.1/../../../../riscv64-linux-gnu/bin/ld: .../obj/glibc-boot/ilp32/elf/librtld.os: in function `_Unwind_DeleteException': .../src/gcc/libgcc/unwind.inc:281: undefined reference to `free' collect2: error: ld returned 1 exit status Makefile:554: recipe for target '.../obj/glibc-boot/ilp32/elf/ld.so' failed make[2]: *** [.../obj/glibc-boot/ilp32/elf/ld.so] Error 1