[all-commits] [llvm/llvm-project] 31c8e1: [MC][ARM] Emit R_ARM_BASE_PREL for _GLOBAL_OFFSET_...
Peter Smith via All-commits
all-commits at lists.llvm.org
Tue Apr 14 02:39:20 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 31c8e118961913341e4f5c066bbdcf9b3d2109c7
https://github.com/llvm/llvm-project/commit/31c8e118961913341e4f5c066bbdcf9b3d2109c7
Author: Peter Smith <peter.smith at arm.com>
Date: 2020-04-14 (Tue, 14 Apr 2020)
Changed paths:
M llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
M llvm/test/MC/ARM/symbol-variants.s
Log Message:
-----------
[MC][ARM] Emit R_ARM_BASE_PREL for _GLOBAL_OFFSET_TABLE_ expressions
The _GLOBAL_OFFSET_TABLE_ in SysVr4 ELF is conventionally the base of the
.got or .got.prel sections. Expressions such as _GLOBAL_OFFSET_TABLE_
- (.L1 +8) are used in assembler code to calculate offsets into the .got.
At present MC outputs a R_ARM_REL32 with respect to the
_GLOBAL_OFFSET_TABLE_ symbol, whereas gas outputs a R_ARM_BASE_PREL
relocation with respect to the _GLOBAL_OFFSET_TABLE_ symbol. While both are
correct the R_ARM_REL32 depends on the value of the _GLOBAL_OFFSET_TABLE_
symbol, wheras te R_ARM_BASE_PREL relocation is idependent of the symbol.
The R_ARM_BASE_PREL is therefore slightly more robust to linker's that may
not follow the conventional placement of _GLOBAL_OFFSET_TABLE_; for example
LLD for some time defined _GLOBAL_OFFSET_TABLE_ to 0.
Differential Revision: https://reviews.llvm.org/D46319
More information about the All-commits
mailing list