[PATCH] D14382: [ELF2] - Basic implementation of -r/--relocatable

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 09:01:17 PST 2015


ruiu added a comment.

I took a quick look at the code. This patch doesn't remove relocations that were successfully resolved within an object file the linker is writing, does this? Is it hard to support that? I think that's the reason why users want to use -r in the first place (so that the number of relocations in a combined object file is much smaller than the total number of relocations in the input files.) If it's going to be more code, it's fine to do in a follow up patch, though.


================
Comment at: ELF/Driver.cpp:155
@@ -152,1 +154,3 @@
 
+  Config->Relocatable = Args.hasArg(OPT_relocatable);
+  if (Config->Relocatable) {
----------------
Move this into the code block above and sort.

================
Comment at: ELF/InputFiles.cpp:211-213
@@ +210,5 @@
+        InputSection<ELFT> *S = new (this->Alloc) InputSection<ELFT>(this, &Sec);
+        S->RelocatingSection = dyn_cast<InputSection<ELFT>>(RelocatedSection);
+        if (!S->RelocatingSection)
+          error("Unsupported relocating section");
+        Sections[I] = S;
----------------
I'd use cast<> instead of dyn_cast<> and remove the check.


http://reviews.llvm.org/D14382





More information about the llvm-commits mailing list