Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -1449,6 +1449,9 @@ } else if (Tok == "ASSERT") { Cmd->Commands.emplace_back(new AssertCommand(readAssert())); expect(";"); + } else if (Tok == "CONSTRUCTORS") { + if (Config->Verbose) + elf::log(getCurrentLocation() + ": CONSTRUCTORS ignored for ELF"); } else if (Tok == "FILL") { Cmd->Filler = readFill(); } else if (Tok == "SORT") { Index: test/ELF/linkerscript/constructor.s =================================================================== --- test/ELF/linkerscript/constructor.s +++ test/ELF/linkerscript/constructor.s @@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "SECTIONS { foo : { *(.foo) CONSTRUCTORS } }" > %t.script +# RUN: ld.lld --script %t.script %t.o -o %t1 --verbose | FileCheck %s +# CHECK: {{.*}}.script:1: CONSTRUCTORS ignored for ELF + +# RUN: llvm-objdump -section-headers %t1 | FileCheck %s --check-prefix=SIZE +# SIZE: Sections: +# SIZE-NEXT: Idx Name Size +# SIZE-NEXT: 0 00000000 +# SIZE-NEXT: 1 foo 00000001 + +.section foo, "a" +.byte 0