Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -276,6 +276,9 @@ if (Config->Pie) error("-r and -pie may not be used together"); } + + if (Args.hasArg(OPT_version_script) && Args.hasArg(OPT_dynamic_list)) + error("--version-script and --dynamic-list may not be used together"); } static int getInteger(opt::InputArgList &Args, unsigned Key, int Default) { Index: test/ELF/version-script.s =================================================================== --- test/ELF/version-script.s +++ test/ELF/version-script.s @@ -38,9 +38,11 @@ # RUN: FileCheck -check-prefix=WARN2 %s # WARN2: duplicate symbol 'foo1' in version script +## --dynamic-list and --version-script may not be used together. # RUN: echo "{ foo1; foo2; };" > %t.list -# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2 -# RUN: llvm-readobj %t2 > /dev/null +# RUN: not ld.lld --version-script %t.script --dynamic-list %t.list %t.o \ +# RUN: %t2.so -o %t2 2>&1 | FileCheck -check-prefix=ERR3 %s +# ERR3: --version-script and --dynamic-list may not be used together # DSO: DynamicSymbols [ # DSO-NEXT: Symbol {