summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Relocations.cpp
diff options
context:
space:
mode:
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