Pre-link static binaries/remove

Thomas Richter thomas.richter@iis.fraunhofer.de
Tue Nov 11 15:02:15 GMT 2025


Hi Simon,

> If you want to turn the hidden symbols local, there is objcopy
> 
>      $ objcopy --localize-hidden test.o test2.o
> 
> That will still not resolve these symbols or apply relaxations, but that 
> is fine, all of that is handled during final link.
> 
> For more aggressive optimization, use -flto to link before compiling. I 
> think it should be possible to combine that with "ld -r" and "objcopy -- 
> localize-hidden", and it should also remove unused functions.
Thanks, this sounds plausible. I'll give it a try.

Greetings,
	Thomas



More information about the Binutils mailing list