[PATCH] D56782: [PPC64] Preserve LocalEntry when linkingOn PowerPC64, it is necessary to keep the LocalEntry bits in st_other, especially when -r is used. Otherwise, when the resulting object isused in a posterior linking, LocalEntry info will be unavailable...

Leandro Lupori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 16 06:25:01 PST 2019


luporl created this revision.
Herald added subscribers: llvm-commits, jsji, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.

...and
functions may be called through the wrong entrypoint.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D56782

Files:
  ELF/SyntheticSections.cpp
  ELF/Target.h


Index: ELF/Target.h
===================================================================
--- ELF/Target.h
+++ ELF/Target.h
@@ -177,6 +177,12 @@
 // to the local entry-point.
 unsigned getPPC64GlobalEntryToLocalEntryOffset(uint8_t StOther);
 
+// Return only the StOther bits used to encode PPC64
+// GlobalEntryToLocalEntry offset.
+static inline uint8_t getPPC64GlobalEntryToLocalEntryBits(uint8_t StOther) {
+  return StOther & 0xE0;
+}
+
 uint64_t getPPC64TocBase();
 uint64_t getAArch64Page(uint64_t Expr);
 
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -1999,6 +1999,9 @@
       ESym->setVisibility(Sym->Visibility);
     }
 
+    if (Config->EMachine == EM_PPC64)
+      ESym->st_other |= getPPC64GlobalEntryToLocalEntryBits(Sym->StOther);
+
     ESym->st_name = Ent.StrTabOffset;
     ESym->st_shndx = getSymSectionIndex(Ent.Sym);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56782.182027.patch
Type: text/x-patch
Size: 958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190116/2159694c/attachment.bin>


More information about the llvm-commits mailing list