[PATCH] D17502: [ELF] - Fix of 22906, referencing __start or __stop should keep the section from GC.

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 05:13:47 PST 2016

emaste added inline comments.

Comment at: ELF/MarkLive.cpp:83
@@ +82,3 @@
+static bool isRetained(SymbolTable<ELFT> *Symtab, InputSectionBase<ELFT> *Sec) {
+  StringRef Name = Sec->getOutputSectionName();
+  if (!isValidCIdentifier(Name))
grimar wrote:
> emaste wrote:
> > Is the input->output section name mapping necessary? Those section names are not valid C identifiers anyhow.
> I think it is. Thats mirrors logic of
> ```
> void Writer<ELFT>::addStartStopSymbols(OutputSectionBase<ELFT> *Sec) {
>   StringRef S = Sec->getName();
>   if (!isValidCIdentifier(S))
>     return;
> ...
> ```
> which uses output section name to create start/stop identificator name. 
> Also since we can use linker script to place sections to any output section, it seems to be correct for me.
Ah yes, sorry - I glossed over the arbitrary mapping that might come from the linker script and only looked at the built-in set of `.text.` etc.


More information about the llvm-commits mailing list