[PATCH] D24230: [ELF] Linkerscript: Fix handling of empty sections

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 15:56:20 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:318
@@ +317,3 @@
+
+    Regular = dyn_cast<DefinedRegular<ELFT>>(AssignCmd->Sym);
+    if (!Regular) {
----------------
  DefinedRegular<ELFT> *Regular = ...;

================
Comment at: ELF/LinkerScript.cpp:322-323
@@ +321,4 @@
+      Symbol *S = Synthetic->symbol();
+      auto GotIndex = Synthetic->GotIndex;
+      auto DynsymIndex = Synthetic->DynsymIndex;
+
----------------
Is this uintX_t? Please use real types.

================
Comment at: ELF/LinkerScript.cpp:331
@@ +330,3 @@
+    }
+    Regular->Value = AssignCmd->Expression(Sec->getVA());
+  }
----------------
What does Sec->getVA() do? I think Sec is always empty here, so I'm not sure what this returns.

================
Comment at: ELF/LinkerScript.cpp:610
@@ -558,4 +609,3 @@
 uint64_t LinkerScript<ELFT>::getOutputSectionAddress(StringRef Name) {
-  for (OutputSectionBase<ELFT> *Sec : *OutputSections)
-    if (Sec->getName() == Name)
-      return Sec->getVA();
+  const auto &Sections = findSections(Name, ConstraintKind::NoConstraint);
+  if (!Sections.empty())
----------------
Please use real type instead of auto.


https://reviews.llvm.org/D24230





More information about the llvm-commits mailing list