This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/42568] [Cygwin] BLOCKDATA referenced in EXTERNAL not loading from library



------- Comment #22 from ian at airs dot com  2010-01-05 16:09 -------
For ELF, when the GNU linker has seen a common symbol, and then sees that
symbol in the archive map, it will look in the object to see whether the object
defines the symbol (rather than simply providing another common definition). 
If the object does define the symbol, then it is pulled into the link.  See
http://sourceware.org/ml/binutils/1999-12/msg00015.html .  This was done for
compatibility with the SunOS and HP/UX linkers, but in retrospect I think it
may have been a mistake.

For the PE target used on cygwin, the GNU linker does not do this.  It follows
the simpler rule.  For that matter, the gold linker also does not do this.

So, yes, the linkers behave differently.  If you need to provide a common
definition, and you also need to force that common definition to pull in a
definition from an archive, then the compiler should arrange for that to
happen.  The easy way is: whenever you have a definition, also define some
other symbol.  Whenever you have a common symbol, also include an undefined
reference to that definition.


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42568


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