[PATCH] D14090: [ELF2] R_X86_64_COPY relocation implemented

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 08:31:00 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/OutputSections.cpp:627
@@ +626,3 @@
+  case SymbolBody::SharedKind: {
+    const auto &SS = cast<SharedSymbol<ELFT>>(S);
+    if (SS.NeedsCopy)
----------------
Drop `const`.

================
Comment at: ELF/Writer.cpp:203-209
@@ -202,2 +202,9 @@
     if (Body) {
+      bool NeedsCopy = false;
+      if (auto *E = dyn_cast<SharedSymbol<ELFT>>(Body)) {
+        NeedsCopy = Target->relocNeedsCopy(Type, *Body);
+        if (NeedsCopy && E->NeedsCopy)
+          continue;
+        E->NeedsCopy = NeedsCopy;
+      }
       NeedsPlt = Target->relocNeedsPlt(Type, *Body);
----------------
I'm trying to understand this. So, if two or more relocations exist for a shared symbol, the last relocation's NeedsCopy may override the previous results? Is this correct?


http://reviews.llvm.org/D14090





More information about the llvm-commits mailing list