Tags: libhal/libhal-exceptions
Tags
🐛 ACTUALLY Fix undefined references in GCC The error looks like this: ``` arm-none-eabi/picolibc/arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_stdlib_abort.c.o): in function `abort': newlib/libc/stdlib/abort.c:63: undefined reference to `_exit' arm-none-eabi/lib/thumb/v7e-m+fp/hard/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()': vterminate.cc:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xf4): undefined reference to `_impure_ptr' arm-none-eabi/picolibc/arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_signal_signal.c.o): in function `raise': newlib/libc/signal/signal.c:151: undefined reference to `_exit' ``` The solution, have conan add these flags to the link stage of the binary: ``` -Wl,--whole-archive <insert_archive_file.a> -Wl,--no-whole-archive ``` The GCC linker will find unknown symbols and resolve them by searching the .a archive files. If it doesn't find one, then it complains. Here is the problem. Because we never call any of these functions, the linker never searches for them. Then at final link stage, it finds some symbols like abort() that calls _exit(), realizes it never saw it in any of our code, then yells at us. Now I'm not sure why it doesn't try to find `_exit` through `abort`. But with `whole-archive` it forces all of the symbols to be in the symbol table to be added to the linker's symbol list ensuring that they are available for resolution. :arrow_up: to 1.0.0 because I want to get the full benefit of semver version control
🐛 Fix undefined references in GCC GCC needs a call to throw to force it to link in the exception handling code. For code size, this a great, but the linker then complains that the -Wl,wrap= commands are undefined. Those undefined symbols result in additional functions like _exit not being defined causing a few linker error messages. - ⬆️ 0.0.2