.symver

Nick Clifton nickc@redhat.com
Wed Jan 13 11:23:38 GMT 2021


Hi Tom,

> I am in the process of building some software were I inject .symver
> instructions into the assembly generated by GCC, then assembly it.  What I
> found is .symver actually inserts the symbol that is
> referred to in the instruction into the object code, which causes problems
> later down the road.

You could make the .symver directive conditional upon the symbol already
being defined by:

   .ifdef SYM
   .symver SYM, NAME2
   .endif

> Is there a way to tell the linker to
> not use those symbols if they are
> not used  in the generated object code?

Well if the symbol is in an archive library (eg libfoo.a) then it will only
be pulled into the link if it is needed, or other symbols in object file
containing it are needed.

You might also be able to use the visibility argument to .symver to solve
the problem.  If you make the symbols internal for example then they should
not trigger the loading of other libraries.

Cheers
   Nick



More information about the Binutils mailing list