conditional linkage ?

Nick Clifton
Fri Mar 5 14:27:23 GMT 2021

Hi Jim,

> Id like to allow this linker script language:
>         KEEP( *(sectA_contents AND .gnu.linkonce.*.sectA_header) )

I do not think that this is going to work.  The nearest equivalent
would be section groups where if both .sectA and .gnu.linkonce.sectA
are in a group, then if .sectA is discarded (by linker garbage collection,
because it is unused) then .gnu.linkonce.sectA will also be discarded.

But in general I do not think that the idea will work because this
is not the sort of thing that the linker is built to do.  If you can
break your table down into lots of small sections and then link them
with garbage collection enabled you may achieve some of what you need.
But I doubt if it will be a complete solution.  Sorry.


More information about the Binutils mailing list