[lld] [ELF] Support relocatable files using CREL (PR #98115)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 09:02:56 PDT 2024
================
@@ -1474,37 +1476,39 @@ template <class ELFT, class RelTy> void RelocationScanner::scanOne(RelTy *&i) {
maybeReportUndefined(cast<Undefined>(sym), *sec, offset))
return;
- if (config->emachine == EM_PPC64) {
- // 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 (type == R_PPC64_TOC16 || type == R_PPC64_TOC16_DS)
- sec->file->ppc64SmallCodeModelTocRelocs = true;
-
- // Record the TOC entry (.toc + addend) as not relaxable. See the comment in
- // InputSectionBase::relocateAlloc().
- if (type == R_PPC64_TOC16_LO && sym.isSection() && isa<Defined>(sym) &&
- cast<Defined>(sym).section->name == ".toc")
- ppc64noTocRelax.insert({&sym, addend});
-
- if ((type == R_PPC64_TLSGD && expr == R_TLSDESC_CALL) ||
- (type == R_PPC64_TLSLD && expr == R_TLSLD_HINT)) {
- if (i == end) {
- errorOrWarn("R_PPC64_TLSGD/R_PPC64_TLSLD may not be the last "
- "relocation" +
- getLocation(*sec, sym, offset));
- return;
- }
+ if constexpr (!RelTy::IsCrel) {
+ if (config->emachine == EM_PPC64) {
----------------
smithp35 wrote:
For the benefit of other reviewers, the following part of the diff is just indendation change.
https://github.com/llvm/llvm-project/pull/98115
More information about the llvm-commits
mailing list