Skip to main content
BHuss.2
Visitor II
May 18, 2023
Question

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 ( * ) }

  • May 18, 2023
  • 2 replies
  • 1280 views

..

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
May 18, 2023

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 VenmoUp vote any posts that you find helpful, it shows what's working..
Pavel A.
Super User
May 18, 2023

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.