Showing results for 
Search instead for 
Did you mean: 

Why do the standard libraries discard at the end of the linker file /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) }


Probably to remove any clutter or associativity brought along by inference or use elsewhere.

Think garbage collection, or dead-code removal.

You could perhaps not do that, and see what clutter ends up in the .ELF file?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

Because the ARM and CubeIDE gcc toolchains come with other standard libraries. They don't have names "libc" or "libgcc" or "libm".

This snippet in the linker script can be safely removed, unless you use some other toolchain.