[PATCH] D17269: [ELF] - Implemented linkerscript sections padding.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 12:53:08 PST 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:413-420
@@ -390,1 +412,10 @@
+  if (Tok[0] == '=') {
+    Tok = Tok.substr(1);
+    uint32_t Val;
+    if (Tok.getAsInteger(0, Val)) {
+      error("Integer can't be parsed: " + Tok);
+      return;
+    }
+    OutSec.Filler = llvm::support::ubig32_t(Val);
+    next();
   }
----------------
So you cannot use getAsInteger because it may be larger than the integer size.

================
Comment at: ELF/LinkerScript.h:42
@@ +41,3 @@
+  StringRef Name;
+  llvm::support::ubig32_t Filler = (llvm::support::ubig32_t)0;
+};
----------------
I realized that I didn't actually understand what you said until now (because my approach should work and memcpy is the right way to copy filler to the section). You seems to misunderstand the feature.

If a filler is of the form 0x<hex digits>, then it is an arbitrary long sequence of hex digits. It is not a four byte value.

So this type needs to be std::vector<uint8_t>.


http://reviews.llvm.org/D17269





More information about the llvm-commits mailing list