[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/12131] ARM ABI violations in both assembler and linker
From: |
amodra at gmail dot com |
Subject: |
[Bug ld/12131] ARM ABI violations in both assembler and linker |
Date: |
Thu, 25 Aug 2022 23:17:10 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=12131
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |arm*-*-*
CC| |amodra at gmail dot com
Summary|Using R_ARM_MOV[WT]_PREL to |ARM ABI violations in both
|load address of |assembler and linker
|_GLOBAL_OFFSET_TABLE_ |
--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
Yes, the GNU ARM assembler and linker make assumptions about the layout of the
GOT section. So if you write your own linker scripts you are likely to trip
over those bugs. Worse, linker relocation processing does not follow the ARM
ABI.
The testcase ".word _GLOBAL_OFFSET_TABLE_-(here+8)" is going wrong firstly in
the assembler. This dodgy code, which I think should be deleted:
#ifdef OBJ_ELF
if ((code == BFD_RELOC_32_PCREL || code == BFD_RELOC_32)
&& GOT_symbol
&& fixp->fx_addsy == GOT_symbol)
{
code = BFD_RELOC_ARM_GOTPC;
reloc->addend = fixp->fx_offset = reloc->address;
}
#endif
converts what would be R_ARM_REL32 or R_ARM_ABS32 relocations against
_GLOBAL_OFFSET_TABLE_ into an R_ARM_BASE_PREL against _GLOBAL_OFFSET_TABLE_.
This is wrong for two reasons:
1) It cannot be correct to do this for both R_ARM_REL32 and R_ARM_ABS32
regardless of how the linker treats the final relocation.
2) If the linker correctly implements R_ARM_BASE_PREL then the assembler is
assuming that _GLOBAL_OFFSET_TABLE_ is defined at the start of the GOT output
section.
Then the GNU ARM linker violates the ABI by ignoring the symbol on
R_ARM_BASE_PREL, assuming the reloc is only used with symbols defined in the
GOT output section. It also assumes _GLOBAL_OFFSET_TABLE_ is defined at the
start of the GOT output section in relocations like R_ARM_GOTOFF32.
Am I going to do anything about this? No. Not being an ARM maintainer, I
don't know enough history to judge the likelihood of breaking people's code
that might rely on these bugs being present.
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/12131] ARM ABI violations in both assembler and linker,
amodra at gmail dot com <=