[PATCH] D28612: [ELF] - Added support for --emit-relocs.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 13:44:00 PST 2017


ruiu added inline comments.


================
Comment at: ELF/InputFiles.cpp:403-404
+
+    if (Config->EmitRelocs)
+      return make<InputSection<ELFT>>(this, &Sec, Name);
+
----------------
Needs comment.

  // Relocation sections processed by the linker are usually removed
  // from the output, so returning `nullptr` for the normal case.
  // However, if -emit-relocs is given, we need to leave them in the output.
  // (Some post link analysis tools need this information.)



================
Comment at: ELF/LinkerScript.cpp:266-277
+    if (!Config->EmitRelocs)
+      continue;
+
+    ArrayRef<InputSectionBase<ELFT> *> Sections = S->getFile()->getSections();
+    for (InputSectionBase<ELFT> *IS : Sections) {
+      if (!IS || !IS->Live || (IS->Type != SHT_REL && IS->Type != SHT_RELA))
+        continue;
----------------
What is this?


https://reviews.llvm.org/D28612





More information about the llvm-commits mailing list