[PATCH,PE-COFF,PR11603] Allow ld to export symbols containing dots from DLLs.
Sat May 15 13:46:00 GMT 2010
In GCC PR44139(*) - now relocated to sourceware bugzilla as PR 11603(**) -
a failure was reported when exporting emutls symbols from a DLL.
The cause turns out to be the presence of a dot in the exported symbol name
(in this case the name of an emulated tls control variable): this is the
standard syntax in a windows DEF file for declaring a "forwarded export", a
kind of alias by which a DLL may export a function that is actually defined in
a different DLL.
There isn't actually any problem with exporting a symbol that contains a
dot; it's not actually the presence of the dot that causes the run-time loader
to interpret a particular export as a forwarder rather than a normal export,
but where the export table entry points to: if it points to an address that is
inside the export section itself, this means that it is a forwarder and points
to an ASCII string of a forwarded name; an export address that points anywhere
else in the DLL is assumed to be a regular function or data export.
At the moment, when ld sees a dot in the name, it always generates the
forwarder form of export table entry, regardless that there may in fact really
be a matching symbol containing a dot in the DLL in being linked. The simple
solution seemed to me to be that we test for a real defined symbol export
first, before we even consider whether there is a dot in the symbol name or
not; if so, we let it generate a regular export for that symbol.
* pe-dll.c (process_def_file_and_drectve): Reorder check for
forwarded export name after check for ordinary export.
I'll give this a day or three of testing before I commit it, to give time
for any hiccups to manifest themselves or for anyone who has any comments or
objections to speak up.
(*) - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44139
(**) - http://sourceware.org/bugzilla/show_bug.cgi?id=11603
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2249 bytes
Desc: not available
More information about the Binutils