bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/16858] weak external reference has wrong value


From: nickc at redhat dot com
Subject: [Bug gas/16858] weak external reference has wrong value
Date: Tue, 16 Jun 2015 13:23:22 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=16858

--- Comment #21 from Nick Clifton <nickc at redhat dot com> ---
Hi Rich,

> Minimal test case (use -O0 to ensure non-reordering so the offset of f in 
> .text
> is not 0):
>
> void dummy() {}
> void f() {}
> void g() __attribute__((weak,alias("f")));
> void *p = (void*)f;
> void *q = (void*)g;
>
> With the offending code/bug present, p contains &f and q contains &dummy. With
> it removed, both p and q contain &f(==&g). (Observed with objdump.)

I was unable to reproduce this problem using the latest FSF GCC and 
binutils sources:

   % nm a.exe
   [...]
   00401006 T _f
   [...]
   00402000 D _p
   00402004 D _q
   [...]

   % objdump -Dz a.exe
   [...]
   00402000 <__data_start__>:
     402000:    06                      push   %es
     402001:    10 40 00                adc    %al,0x0(%eax)

   00402004 <_q>:
     402004:    06                      push   %es
     402005:    10 40 00                adc    %al,0x0(%eax)

So both p and q contain the address of f.

Which versions of the tools are you using ?

Cheers
   Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]