[PATCH] D40026: [ELF] - Allow applying SHF_MERGE optimization for relocatable output.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 00:22:24 PST 2017


grimar added inline comments.


================
Comment at: ELF/InputSection.cpp:414
       if (Config->IsRela) {
-        P->r_addend += Sym.getVA() - Section->getOutputSection()->Addr;
+        int64_t Addend = getAddend<ELFT>(Rel);
+        P->r_addend = Sym.getVA(Addend) - Section->getOutputSection()->Addr;
----------------
ruiu wrote:
> Do you need this temporary variable?
No, but then code will be 2 lines anyways because of clang-format, IMO looks better with it.


================
Comment at: ELF/Writer.cpp:494
+    // which is used for -r.
+    if (isa<SyntheticSection>(IS) && !(IS->Flags & SHF_MERGE))
+      continue;
----------------
ruiu wrote:
> I wonder if you really need to handle this as a special case.
Do you mean we can create symbols for all synthetic sections instead ? I think that is at least confusing to see in output and excessive.


https://reviews.llvm.org/D40026





More information about the llvm-commits mailing list