summaryrefslogtreecommitdiff
path: root/lld/ELF/MarkLive.cpp
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-03-17 22:04:52 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-03-17 22:04:52 +0000
commit6f8d5e68a9e0017954210317b9b56890ff39287b (patch)
treea1c832c6e07fc6e44a33347944c798a7ca9da162 /lld/ELF/MarkLive.cpp
parentb61bbe927de5ce3077bb164b57ca95a509076137 (diff)
[ELF] Restore GC handling of LINK_ORDER, C-named sections.
__start_xxx symbol keeps section xxx alive only if it is not SHF_LINK_ORDER. Such sections can be used for user metadata, when __start_xxx is used to iterate over section contents at runtime, and the liveness is determined solely by the linked (associated) section. This was earlier implemented in r294592, and broken in r296723. Differential Revision: https://reviews.llvm.org/D30964
Diffstat (limited to 'lld/ELF/MarkLive.cpp')
-rw-r--r--lld/ELF/MarkLive.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index e1bc64d925c..adee7516913 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -175,9 +175,6 @@ template <class ELFT> static bool isReserved(InputSectionBase *Sec) {
case SHT_PREINIT_ARRAY:
return true;
default:
- if (Sec->Flags & SHF_LINK_ORDER)
- return false;
-
if (!(Sec->Flags & SHF_ALLOC))
return true;
@@ -247,6 +244,8 @@ template <class ELFT> void elf::markLive() {
// referred by .eh_frame here.
if (auto *EH = dyn_cast_or_null<EhInputSection>(Sec))
scanEhFrameSection<ELFT>(*EH, Enqueue);
+ if (Sec->Flags & SHF_LINK_ORDER)
+ continue;
if (isReserved<ELFT>(Sec) || Script<ELFT>::X->shouldKeep(Sec))
Enqueue({Sec, 0});
else if (isValidCIdentifier(Sec->Name)) {