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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 05:22:02 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:111
@@ +110,3 @@
+
+  if (llvm::find(Patterns, "COMMON") && Common->getSize())
+    Ret.push_back(Common);
----------------
llvm::find(Patterns, "COMMON") returns iterator. Condition is always true,
for cases when Patterns does not contain COMMON it is equal to

```
if (Patterns.end() && ... )
```
You probably want to update testcase also.

================
Comment at: ELF/Symbols.h:188
@@ -187,1 +187,3 @@
+  // Output section for this symbol (default is .bss)
+  OutputSectionBase<ELFT> *Section = nullptr;
 };
----------------
Since you always call fixSymbols() I think you can skip initialization.

================
Comment at: ELF/Writer.cpp:225
@@ -225,4 +224,3 @@
 
-  OutputSections = ScriptConfig->DoLayout
-                       ? Script<ELFT>::X->createSections(Factory)
-                       : createSections();
+  CommonSection = llvm::make_unique<CommonInputSection<ELFT>>();
+  OutputSections =
----------------
May be factory should own and create this ?
That way it would be consistent with OwningSections it has and also
you'll dont need to add argument in call below, you will be able to take it directly from factory.


https://reviews.llvm.org/D22811





More information about the llvm-commits mailing list