[PATCH] D22811: [ELF] Linkerscript: allow setting custom output section for common symbols, instead of .bss

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 13:26:58 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/InputSection.cpp:689
@@ +688,3 @@
+      Hdr.sh_size = alignTo(Hdr.sh_size, C->Alignment);
+      Hdr.sh_size += C->Size;
+    }
----------------
The size computed here is not always going to be the same as the actual size, because actual size is computed after sorting common symbols.

================
Comment at: ELF/InputSection.h:259-261
@@ -258,1 +258,5 @@
 
+// A special kind of section used to store common symbols
+template <class ELFT> class CommonInputSection : public InputSection<ELFT> {
+  typedef typename ELFT::uint uintX_t;
+
----------------
You introduced this class, but you are using this only for the linker script. If linker scirpts are not used, common symbols directly belong to .bss, but if there are, they belong to some output sectino through this CommonInputSection.

Why don't you use this section both in LinkerScript.cpp and in Writer.cpp? You could create a CommonInputSection, which virtually contains all common symbols in Writer.cpp and add that input sectino to .bss, no?


Repository:
  rL LLVM

https://reviews.llvm.org/D22811





More information about the llvm-commits mailing list