summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Relocations.cpp
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2019-02-12 15:35:49 +0000
committerSean Fertile <sfertile@ca.ibm.com>2019-02-12 15:35:49 +0000
commitd694160e665eb3cefc93a07af8232aec0b7d2410 (patch)
tree67f22df3db4d2681b33dc6163f484f9097c8023b /lld/ELF/Relocations.cpp
parenta1805540205b9852117fa54716a54940c2af465d (diff)
downloadbcm5719-llvm-d694160e665eb3cefc93a07af8232aec0b7d2410.tar.gz
bcm5719-llvm-d694160e665eb3cefc93a07af8232aec0b7d2410.zip
[PPC64] Sort .toc sections accessed with small code model relocs.
A follow up to the intial patch that unblocked linking against libgcc. For lld we don't need to bother tracking which objects have got based small code model relocations. This is due to the fact that the compilers on powerpc64 use the .toc section to generate indirections to symbols (rather then using got relocations) which keeps the got small. This makes overflowing a small code model got relocation very unlikely. Differential Revision: https://reviews.llvm.org/D57245 llvm-svn: 353849
Diffstat (limited to 'lld/ELF/Relocations.cpp')
-rw-r--r--lld/ELF/Relocations.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 70aa7ba5594..7de2c05ffc6 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1000,8 +1000,16 @@ static void scanReloc(InputSectionBase &Sec, OffsetGetter &GetOffset, RelTy *&I,
if (isRelExprOneOf<R_HINT, R_NONE>(Expr))
return;
- if (Config->EMachine == EM_PPC64 && isPPC64SmallCodeModelReloc(Type))
- Sec.File->PPC64SmallCodeModelRelocs = true;
+ // We can separate the small code model relocations into 2 categories:
+ // 1) Those that access the compiler generated .toc sections.
+ // 2) Those that access the linker allocated got entries.
+ // lld allocates got entries to symbols on demand. Since we don't try to sort
+ // the got entries in any way, we don't have to track which objects have
+ // got-based small code model relocs. The .toc sections get placed after the
+ // end of the linker allocated .got section and we do sort those so sections
+ // addressed with small code model relocations come first.
+ if (Config->EMachine == EM_PPC64 && isPPC64SmallCodeModelTocReloc(Type))
+ Sec.File->PPC64SmallCodeModelTocRelocs = true;
// Strengthen or relax relocations.
//
OpenPOWER on IntegriCloud