[PATCH] D22683: [ELF] Symbol assignment within input section list

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 14:41:10 PDT 2016


ruiu added a comment.

Let's submit this soon. After submitting this, we could probably simplify things, but this patch provides a real value and is a good start. But before doing this, I think this needs to be fixed...


================
Comment at: ELF/LinkerScript.cpp:186
@@ +185,3 @@
+  this->Live = true;
+  this->Repl = nullptr;
+  Hdr.sh_type = SHT_NOBITS;
----------------
`Repl` is not expected to be null, so it seems dangerous. Why don't you just leave as is?

================
Comment at: ELF/LinkerScript.cpp:327
@@ +326,3 @@
+  uintX_t Off = 0;
+  OutputSection<ELFT> *OutSec = static_cast<OutputSection<ELFT> *>(Sec);
+
----------------
Use `cast` instead of `static_cast`.

================
Comment at: ELF/LinkerScript.cpp:330
@@ +329,3 @@
+  for (InputSection<ELFT> *I : OutSec->Sections) {
+    if (!I->Repl) {
+      LayoutInputSection<ELFT> *L = static_cast<LayoutInputSection<ELFT> *>(I);
----------------
Ahh, so you are using the absence of `Repl` as a marker of your input section. It's a bad use of this field. Please just define a new Kind and use it.


https://reviews.llvm.org/D22683





More information about the llvm-commits mailing list