New flag --keep-section <section_name> to prevent certain sections from being linker garbage collected.

Alan Modra
Wed Apr 4 01:57:00 GMT 2012

On Tue, Apr 03, 2012 at 05:48:47PM -0700, Sriraman Tallam wrote:
>   This patch adds a new flag, --keep-section to allow specifying
> section names that should not be gc'ed.

I think this is a useful hack for ld developers,

>   For use cases, as an example,  a statically linked executable with
> pthreads needs .rodata.nptl_version to be debuggable with gdb but

but really, ld should have knowledge about this section built in, bfd
ld too.  And both linkers ought to have the option if one has it.
Which is not to say I think your patch ought to be blocked unless you
also submit bfd ld support for the option, but just that the
usefulness of such an option is limited if only one ld has it.

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list