ld-auto-import documentation update
Ralf Habacker
Ralf.Habacker@freenet.de
Sun Dec 22 05:33:00 GMT 2002
Charles Wilson writes:
+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.
This isn't true. The gcc manual in
http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html#Function%20At
tributes says:
alias ("target")
The alias attribute causes the declaration to be emitted as an alias for another
symbol, which must be specified. For instance,
void __f () { /* do something */; }
void f () __attribute__ ((weak, alias ("__f")));
declares f to be a weak alias for __f. In C++, the mangled name for the target
must be used.
I've added a testcase, which shows that this work: see the objdump printing,
where Export [4] is a redirection of [2]
Export Address Table -- Ordinal Base 1
[ 0] +base[ 1] 2004 Export RVA
[ 1] +base[ 2] 2010 Export RVA
[ 2] +base[ 3] 1048 Export RVA
[ 3] +base[ 4] 1014 Export RVA
[ 4] +base[ 5] 1048 Export RVA
[ 5] +base[ 6] 2000 Export RVA
[ 6] +base[ 7] 2008 Export RVA
[ 7] +base[ 8] 1068 Export RVA
[Ordinal/Name Pointer] Table
[ 0] foo
[ 1] func_ptr
[ 2] print_foo
[ 3] print_var
[ 4] redirected_func
[ 5] var
[ 6] var2
[ 7] x
Ralf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-redirect-symbols.tar.bz2
Type: application/octet-stream
Size: 1123 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20021222/d4d8a171/attachment.obj>
More information about the Binutils
mailing list