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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 17:45:13 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:435
@@ -425,2 +434,3 @@
 
+    Sec->setLMAOffset(LMAOff);
     if ((Sec->getFlags() & SHF_TLS) && Sec->getType() == SHT_NOBITS) {
----------------
Do you need to set an LMA to sections without AT command?

================
Comment at: ELF/LinkerScript.h:161
@@ -160,3 +160,3 @@
   ArrayRef<uint8_t> getFiller(StringRef Name);
-  Expr getLma(StringRef Name);
+  bool hasLma(StringRef Name);
   bool shouldKeep(InputSectionBase<ELFT> *S);
----------------
LMA is fine with me as we write VA instead of Va, so please rename this function.

================
Comment at: ELF/Writer.cpp:949
@@ -948,3 +948,3 @@
   std::vector<Phdr> Ret;
-
+  bool bHasLma = false;
   auto AddHdr = [&](unsigned Type, unsigned Flags) -> Phdr * {
----------------
What is `b` in `bHasLma`?

================
Comment at: ELF/Writer.cpp:993-994
@@ -992,3 +992,4 @@
     uintX_t NewFlags = Sec->getPhdrFlags();
-    if (Script<ELFT>::X->getLma(Sec->getName()) || Flags != NewFlags) {
+    bHasLma = bHasLma || Script<ELFT>::X->hasLma(Sec->getName());
+    if (bHasLma || Flags != NewFlags) {
       Load = AddHdr(PT_LOAD, NewFlags);
----------------
Why do we have to create a new segment if there's a section with a LMA?


Repository:
  rL LLVM

https://reviews.llvm.org/D24298





More information about the llvm-commits mailing list