[PATCH] D33824: [ELF] - Do not merge relocation sections by name when using --emit-relocs.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 07:51:47 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/OutputSections.cpp:345
+      (IS->Type == SHT_REL || IS->Type == SHT_RELA)) {
+    InputSection *Sec = cast<InputSection>(IS);
+    OutputSection *Out = Sec->getRelocatedSection()->getOutputSection();
----------------
Use `auto`.


================
Comment at: ELF/OutputSections.h:70-71
 
+  // Pointer to relocation section. Used for --emit-relocs, where we about to
+  // merge relocation sections if their target sections were merged.
+  OutputSection *RelocationSection = nullptr;
----------------
Pointer to a relocation section for this section. Usually nullptr because we consume relocations, but if --emit-relocs is specified (which is rare), it may have a non-null value.


================
Comment at: test/ELF/emit-relocs-merge.test:1
+# RUN: yaml2obj %s -o %t.o
+# RUN: ld.lld %t.o -o %t --emit-relocs
----------------
Can you create this using llvm-mc?


https://reviews.llvm.org/D33824





More information about the llvm-commits mailing list