Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -175,6 +175,8 @@ unsigned I = -1; const ELFFile &Obj = this->ELFObj; for (const Elf_Shdr &Sec : Obj.sections()) { + if (HasError) + return; ++I; if (Sections[I] == InputSection::Discarded) continue; @@ -245,6 +247,10 @@ if (Name == ".note.GNU-stack") return InputSection::Discarded; + // .note.GNU-split-stack is a marker we don't support currently. + if (Name == ".note.GNU-split-stack") + error("Objects using splitstacks are not supported"); + // A MIPS object file has a special section that contains register // usage info, which needs to be handled by the linker specially. if (Config->EMachine == EM_MIPS && Name == ".reginfo") { Index: test/ELF/splitstacks.s =================================================================== --- test/ELF/splitstacks.s +++ test/ELF/splitstacks.s @@ -0,0 +1,13 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o + +## Check that splitstacks objects are not allowed. +# RUN: not ld.lld %t1.o -o %t 2>&1 | \ +# RUN: FileCheck --check-prefix=ERR %s +# ERR: Objects using splitstacks are not supported + +.globl _start +_start: + nop + +.section .note.GNU-split-stack,"",@progbits