-
-
Notifications
You must be signed in to change notification settings - Fork 65
Description
cedev-obj only checks if lto.s directly links _abort. If it doesn't then HAS_ABORT = 0. This prevents _abort from being linked if a function linked by lto.s links _abort, such as __ZNSt3__122__libcpp_verbose_abortEPKcz. The problem goes away if lto.s directly links _abort (i.e. if I just place abort() at the end of main)
although calling ___assert_fail_loc allows abort to be linked normally. So it might be something to do with stuff in libc/libcxx?
There are other problems that need to be resolved. I think if lto.s does not directly link _abort, then HAS_ABORT = 0. However, lto.s calls __ZNSt3__122__libcpp_verbose_abortEPKcz which does call _abort, but since HAS_ABORT = 0 there is no way for _abort to be emitted:
$ make
[cc] src/main.cpp
[lto] obj/lto.bc
[convimg] description
[linking] bin/DEMO.obj
C:\Users\zerico\Programming\ez80\toolchain\CEdev\binutils\bin\z80-none-elf-ld.exe: C:/Users/zerico/Programming/ez80/toolchain/CEdev/lib/libcxx/libcxx.a(abort_message.cpp.o): in function `___abort_message':
abort_message.cpp:(.text.___abort_message+0x1a): undefined reference to `_abort'
C:\Users\zerico\Programming\ez80\toolchain\CEdev\binutils\bin\z80-none-elf-ld.exe: C:/Users/zerico/Programming/ez80/toolchain/CEdev/lib/libcxx/libcxx.a(verbose_abort.o): in function `__ZNSt3__122__libcpp_verbose_abortEPKcz':
(.text+0xa): undefined reference to `_abort'
mingw32-make: *** [C:\Users\zerico\Programming\ez80\toolchain\CEdev\meta\makefile.mk:354: bin/DEMO.obj] Error 1
Originally posted by @ZERICO2005 in #735 (comment)