-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 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
- Loading branch information
Showing
5 changed files
with
23 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: 🚀 Deploy 1.0.0 | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
uses: libhal/ci/.github/workflows/[email protected] | ||
with: | ||
version: 1.0.0 | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters