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]

Re: ld-auto-import documentation update


Ralf Habacker wrote:

I've tried the testcase with  gcc version 2.95.3-5 (cygwin special).

Any idead where we should document this feature ? In the cygwin do or in the ld
or ??? At least this is an gcc feature.
Well, probably in gcc. But, the ld documentation could be changed also:

2. Sometimes, it is useful to rename exports. For instance, the cygwin
kernel does this regularly: a symbol @samp{_foo} will be exported as
@samp{_foo}, but also as @samp{foo} by using special directives in the
DEF file when creating the import library. This ability is not
present without import libs.

Remove the last sentence, and continue:

----
It is possible to mimic this behavior by using the following recipe: in your source code,

void thefunction () { /* do something */; }
void aliasforfunction () __attribute__ ((weak, alias ("thefunction")));
----

Now, last question: can you REALLY do this alias:

foo -> _foo

e.g. no underscore and with underscore, as in libcygwin.a:

00000000 I __imp___sqrt
00000000 T __sqrt
00000000 I __imp__sqrt
00000000 T _sqrt

If not, then you need one more sentence:

----
Unfortunately, the specific use in cygwin's kernel, exporting a symbol both with and without and underscore, is not possible; in that specific case you still need to use a .def file and import lib.
----

--Chuck



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