forked from OSchip/llvm-project
[ELF] Filter out non InputSection members from InputSections
InputSections may contain MergeInputSection members which trigger a segmentation fault when trying to cast them to InputSection. Differential Revision: https://reviews.llvm.org/D33628 llvm-svn: 304189
This commit is contained in:
parent
d7b94d3840
commit
08dfd53269
|
@ -291,6 +291,9 @@ LinkerScript::computeInputSections(const InputSectionDescription *Cmd) {
|
|||
size_t SizeBefore = Ret.size();
|
||||
|
||||
for (InputSectionBase *Sec : InputSections) {
|
||||
if (!isa<InputSection>(Sec))
|
||||
continue;
|
||||
|
||||
if (Sec->Assigned)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -31,6 +31,16 @@
|
|||
# 0x19E = begin + sizeof(.foo) = 0x190 + 0xE
|
||||
# CHECK-NEXT: Value: 0x19E
|
||||
|
||||
# Check that we don't crash with --gc-sections
|
||||
# RUN: ld.lld --gc-sections -o %t2 --script %t.script %t -shared
|
||||
# RUN: llvm-readobj -s -t %t2 | FileCheck %s --check-prefix=GC
|
||||
|
||||
# GC: Name: .foo
|
||||
# GC-NEXT: Type: SHT_PROGBITS
|
||||
# GC-NEXT: Flags [
|
||||
# GC-NEXT: SHF_ALLOC
|
||||
# GC-NEXT: ]
|
||||
|
||||
.section .foo.1a,"aMS",@progbits,1
|
||||
.asciz "foo"
|
||||
|
||||
|
|
Loading…
Reference in New Issue