This is the mail archive of the binutils@sourceware.org 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: ELF symbol aliasing in


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


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