COFF GAS internals help: Unique symbol names, creating a symbol late in assembly

Aaron W. LaFramboise aaron98wiridge9@aaronwl.com
Sat Jul 17 19:24:00 GMT 2004


I have figured out how to fix all of the problems I was having formerly
with relocations and other things with PECOFF weak symbols.  I have
noticed a few problems with the way I've implemented weaks, though, and
am having some problems the final impl into an acceptable form:

1) PECOFF weak symbols are only weak aliases.  They do not have values
themselves.  The index to the alias is stored in the aux entry.  So in
coff_frob_symbol if the weak symbol is equated to another symbol, I just
put that index into the aux entry; otherwise, I put the value of the
symbol into another helper symbol I have created, and refer to that in
the aux entry instead.

  a) Ideally, when the helper symbol would not be needed, it would not
be emitted.  I am not sure if i can create new symbols as late as
coff_frob_symbol, and by the time I get to the weak symbol, the helper
alias may already have been processed, so its too late to mark it as
unused.  Any ideas how to work with this?

  b) What should I name this helper symbol?  Names based on the actual
name of the variable might colide with other source files with different
weak symbols for the same variable.  A purely random name (or even one
based on the name of the source file) will cause symbol names to be
nondeterministic, and cause, for eg, GCC object comparison to fail if
weak symbols are used.

So I guess its just one question with two parts.  Any helpful comments
would be greatly appreciated!

Aaron W. LaFramboise



More information about the Binutils mailing list