[PATCH] D24298: [ELF] Linkerscript: Implement LOADADDR

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 14:32:15 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:429
@@ -419,2 +428,3 @@
 
+      Sec->setLMAOffset(LMAOff);
       if ((Sec->getFlags() & SHF_TLS) && Sec->getType() == SHT_NOBITS) {
----------------
Please add a comment about that with a reference to the GNU manual.

================
Comment at: ELF/LinkerScript.cpp:1269
@@ +1268,3 @@
+  expect("(");
+  StringRef Name = next();
+  expect(")");
----------------
It may not be a name, so I'd name `Tok`.

================
Comment at: ELF/Writer.cpp:949
@@ -948,3 +948,3 @@
   std::vector<Phdr> Ret;
-
+  bool HasLma = false;
   auto AddHdr = [&](unsigned Type, unsigned Flags) -> Phdr * {
----------------
`HasLMA` for the sake of consistency.

================
Comment at: ELF/Writer.cpp:993-995
@@ -992,4 +992,5 @@
     uintX_t NewFlags = Sec->getPhdrFlags();
-    if (Script<ELFT>::X->getLma(Sec->getName()) || Flags != NewFlags) {
+    HasLma = HasLma || Script<ELFT>::X->hasLMA(Sec->getName());
+    if (HasLma || Flags != NewFlags) {
       Load = AddHdr(PT_LOAD, NewFlags);
       Flags = NewFlags;
----------------
Please add a comment about that so that people who read this code can understand why it checks `HasLma`.


https://reviews.llvm.org/D24298





More information about the llvm-commits mailing list