bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/22589] aarch64: adrp relocation gets filled with non-zero addres


From: rearnsha at gcc dot gnu.org
Subject: [Bug ld/22589] aarch64: adrp relocation gets filled with non-zero address for undefined weak symbol
Date: Mon, 18 Dec 2017 10:39:24 +0000

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu.org

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
It's simply not safe to use adrp to reference a weak symbol.  If you're
hand-writing assembly you have to be aware of this.

adrp is a position-independent address-forming instruction; as such it cannot
ever resolve to zero and still be position independent; that would require
dynamic relocation which would in turn imply having a writable text section. 
Furthermore, the offset range of adrp is such that it probably could not
generate zero.

It might be nice if the assembler/linker could detect this case and emit an
out-of-bounds error - it's essentially a relocation overflow.  I'm not sure if
that's a generic issue or a back-end one.

Anyway, it's still invalid to use adrp to form a reference to a weak symbol.

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