ELF symbol aliasing in

Nick Clifton nickc@redhat.com
Wed Nov 18 15:43:00 GMT 2009


Hi Matthias,

> which I just noticed my alias table _does_ contain references to.

Ah, so now you need --defsym.  As in:

   % cat foo.c
   int foo(void) { return 42; }
   int datum = 7;

   % cat bar.c
   #include <stdio.h>
   extern int foo_alias (void);
   extern int datum_alias;
   int main (void) { printf ("%d\n",foo_alias () + datum_alias ); }

   % cat aliases.s
         .global foo_alias
   foo_alias:
         jmp foo

   % gcc foo.c bar.c aliases.s -Wl,--defsym=datum_alias=alias

   % ./a.out
   49

Cheers
   Nick



More information about the Binutils mailing list