diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2016-12-08 06:19:47 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2016-12-08 06:19:47 +0000 |
commit | 6a4eb75c46dc11578c4dd47db82c7a69a8f65839 (patch) | |
tree | 9a50dbfc11005e8467a0eb307636cf528d9a7a83 /lld/ELF/Relocations.cpp | |
parent | f4257528e967dae1cf49328f2a8cfdc28815a2f3 (diff) | |
download | bcm5719-llvm-6a4eb75c46dc11578c4dd47db82c7a69a8f65839.tar.gz bcm5719-llvm-6a4eb75c46dc11578c4dd47db82c7a69a8f65839.zip |
[ELF][MIPS] Make _gp, _gp_disp, __gnu_local_gp global symbols
These MIPS specific symbols should be global because in general they can
have an arbitrary value. By default this value is a fixed offset from .got
section.
This patch adds more checks to the mips-gp-local.s test case but marks
it as XFAIL because LLD does not allow redefinition of absolute symbols
value by a linker script. This should be fixed by D27276.
Differential revision: https://reviews.llvm.org/D27524
llvm-svn: 289025
Diffstat (limited to 'lld/ELF/Relocations.cpp')
-rw-r--r-- | lld/ELF/Relocations.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 4f39f3c06b5..a3945690a45 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -348,9 +348,14 @@ static bool isStaticLinkTimeConstant(RelExpr E, uint32_t Type, // resolve to the image base. This is a little strange, but it allows us to // link function calls to such symbols. Normally such a call will be guarded // with a comparison, which will load a zero from the GOT. + // Another special case is MIPS _gp_disp symbol which represents offset + // between start of a function and '_gp' value and defined as absolute just + // to simplify the code. if (AbsVal && RelE) { if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak()) return true; + if (&Body == ElfSym<ELFT>::MipsGpDisp) + return true; error(S.getLocation(RelOff) + ": relocation " + toString(Type) + " cannot refer to absolute symbol '" + toString(Body) + "' defined in " + toString(Body.File)); |