[ELF] - Referencing __start or __stop should keep the section from GC.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 25 Feb 2016 08:40:26 +0000 (08:40 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 25 Feb 2016 08:40:26 +0000 (08:40 +0000)
commit12737b7f7290218e93ac658d1ea24f7adf997143
tree5d57b681cab6863d43966192ef4384623fad48a0
parent3d3d0f41516dcef0992bedb37d35ce6db1b31847
[ELF] - Referencing __start or __stop should keep the section from GC.

This fixes the https://llvm.org/bugs/show_bug.cgi?id=22906 bug.

In GNU Binutils, a reference to start or stop is sufficient to
prevent the section from being garbage collected.
Patch implements the same behavior for lld.

Differential revision: http://reviews.llvm.org/D17502

llvm-svn: 261840
lld/ELF/MarkLive.cpp
lld/ELF/OutputSections.cpp
lld/ELF/OutputSections.h
lld/ELF/Writer.cpp
lld/test/ELF/gc-sections-local-sym.s
lld/test/ELF/startstop-gccollect.s [new file with mode: 0644]