This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C_WEAKEXT Weak Externals in i386-pe COFF


Hi,

I'm trying to get GNU ld to link objects produced from
MSVC, and I beleive I have found a problem with binutils'
C_WEAKEXT support:

Weak externals, apparently known within binutils as
C_WEAKEXT, to Win32 as IMAGE_SYM_CLASS_WEAK_EXTERNAL,
and documented in the Win32 PE COFF spec in section 5.5.3,
are a loose analog of ELF weak symbols.  Binutils seems
to treat them the same way as their ELF counterparts, however,
they are actually substancially different.

Quoting from the spec:
"If a definition of sym1 is linked, then an external reference to the symbol is resolved normally. If a definition of sym1 is not linked, then all references to the weak external for sym1 refer to sym2 instead. The external symbol, sym2, must always be linked; typically it is defined in the module containing the weak reference to sym1."

In other words, where ELF weak symbols default to zero if
not resolved, COFF weak symbols default to some other
symbol.

Is there some way to get binutils to correctly resolve
these kinds of symbols?  Has anyone worked on this, or
had any luck getting these kinds of things to link?

If no to the above, how difficult would it be to add this
support?  (I am unfamiliar with binutils internals.)

(I'm trying to avoid using the MS linker, in part because
it doesn't seem to support GCC as well as GNU ld does.)


Any help or pointers would be appreciated,

Aaron


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]