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: bugdal at aerifal dot cx
Subject: [Bug gas/16858] weak external reference has wrong value
Date: Sat, 13 Jun 2015 03:02:01 +0000

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

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |bugdal at aerifal dot cx
         Resolution|FIXED                       |---

--- Comment #20 from Rich Felker <bugdal at aerifal dot cx> ---
The fix that was applied only fixed PC-relative relocations (direct calls).
Global data containing a function pointer to a weak function is still broken
exactly the same way it was broken before: the value is off by the offset of
the definition in the object file's .text section. The proper fix should have
been removing the ENTIRE top-level #if block containing the offending code,
which is wrong in all cases, not simply disabling it in the case
!fixP->fx_pcrel.

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

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