[PATCH] D89841: [ELF] --gc-sections: retain dependent sections of non-SHF_ALLOC sections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 18:14:02 PDT 2020
MaskRay updated this revision to Diff 299532.
MaskRay added a comment.
Drop an unneeded change
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89841/new/
https://reviews.llvm.org/D89841
Files:
lld/ELF/MarkLive.cpp
lld/test/ELF/gc-sections-linkorder2.s
Index: lld/test/ELF/gc-sections-linkorder2.s
===================================================================
--- lld/test/ELF/gc-sections-linkorder2.s
+++ lld/test/ELF/gc-sections-linkorder2.s
@@ -14,3 +14,9 @@
.quad 0
.section .zed,"ao", at progbits,.foo
.quad 0
+
+.section .nonalloc
+.quad 0
+
+.section .nonalloc_linkorder,"o", at progbits,.nonalloc
+.quad 0
Index: lld/ELF/MarkLive.cpp
===================================================================
--- lld/ELF/MarkLive.cpp
+++ lld/ELF/MarkLive.cpp
@@ -370,8 +370,11 @@
bool isLinkOrder = (sec->flags & SHF_LINK_ORDER);
bool isRel = (sec->type == SHT_REL || sec->type == SHT_RELA);
- if (!isAlloc && !isLinkOrder && !isRel && !sec->nextInSectionGroup)
+ if (!isAlloc && !isLinkOrder && !isRel && !sec->nextInSectionGroup) {
sec->markLive();
+ for (InputSection *isec : sec->dependentSections)
+ isec->markLive();
+ }
}
// Follow the graph to mark all live sections.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89841.299532.patch
Type: text/x-patch
Size: 975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201021/8d7e6d27/attachment.bin>
More information about the llvm-commits
mailing list