This is the mail archive of the 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

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
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


Attachment: ld-redirect-symbols.tar.bz2
Description: Binary data

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