Index: lld/trunk/ELF/Driver.cpp =================================================================== --- lld/trunk/ELF/Driver.cpp +++ lld/trunk/ELF/Driver.cpp @@ -596,7 +596,9 @@ // Initializes Config members by the command line options. void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->AllowMultipleDefinition = - Args.hasArg(OPT_allow_multiple_definition) || hasZOption(Args, "muldefs"); + Args.hasFlag(OPT_allow_multiple_definition, + OPT_no_allow_multiple_definition, false) || + hasZOption(Args, "muldefs"); Config->AuxiliaryList = args::getStrings(Args, OPT_auxiliary); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); @@ -678,7 +680,7 @@ Config->UnresolvedSymbols = getUnresolvedSymbolPolicy(Args); Config->Verbose = Args.hasArg(OPT_verbose); errorHandler().Verbose = Config->Verbose; - Config->WarnCommon = Args.hasArg(OPT_warn_common); + Config->WarnCommon = Args.hasFlag(OPT_warn_common, OPT_no_warn_common, false); Config->ZCombreloc = !hasZOption(Args, "nocombreloc"); Config->ZExecstack = hasZOption(Args, "execstack"); Config->ZNocopyreloc = hasZOption(Args, "nocopyreloc"); Index: lld/trunk/ELF/Options.td =================================================================== --- lld/trunk/ELF/Options.td +++ lld/trunk/ELF/Options.td @@ -54,8 +54,9 @@ defm Ttext: Eq<"Ttext">, HelpText<"Same as --section-start with .text as the sectionname">; -def allow_multiple_definition: F<"allow-multiple-definition">, - HelpText<"Allow multiple definitions">; +defm allow_multiple_definition: B<"allow-multiple-definition", + "Allow multiple definitions", + "Do not allow multiple definitions">; defm apply_dynamic_relocs: B<"apply-dynamic-relocs", "Apply dynamic relocations to place", @@ -319,8 +320,9 @@ defm version_script: Eq<"version-script">, HelpText<"Read a version script">; -def warn_common: F<"warn-common">, - HelpText<"Warn about duplicate common symbols">; +defm warn_common: B<"warn-common", + "Warn about duplicate common symbols", + "Do not warn about duplicate common symbols">; def warn_unresolved_symbols: F<"warn-unresolved-symbols">, HelpText<"Report unresolved symbols as warnings">; @@ -354,6 +356,7 @@ def alias_format_b: S<"b">, Alias; def alias_library: JoinedOrSeparate<["-"], "l">, Alias; def alias_library_path: JoinedOrSeparate<["-"], "L">, Alias; +def alias_no_pie_pic_executable: F<"no-pic-executable">, Alias; def alias_omagic: Flag<["-"], "N">, Alias; def alias_o_output: Joined<["--"], "output=">, Alias; def alias_o_output2 : Separate<["--"], "output">, Alias; @@ -424,7 +427,6 @@ def no_ctors_in_init_array: F<"no-ctors-in-init-array">; def no_keep_memory: F<"no-keep-memory">; def no_mmap_output_file: F<"no-mmap-output-file">; -def no_warn_common: F<"no-warn-common">; def no_warn_mismatch: F<"no-warn-mismatch">; def rpath_link: S<"rpath-link">; def rpath_link_eq: J<"rpath-link=">; Index: lld/trunk/test/ELF/allow-multiple-definition.s =================================================================== --- lld/trunk/test/ELF/allow-multiple-definition.s +++ lld/trunk/test/ELF/allow-multiple-definition.s @@ -3,6 +3,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/allow-multiple-definition.s -o %t2 # RUN: not ld.lld %t1 %t2 -o %t3 +# RUN: not ld.lld --allow-multiple-definition --no-allow-multiple-definition %t1 %t2 -o %t3 # RUN: ld.lld --allow-multiple-definition %t1 %t2 -o %t3 # RUN: ld.lld --allow-multiple-definition %t2 %t1 -o %t4 # RUN: llvm-objdump -d %t3 | FileCheck %s Index: lld/trunk/test/ELF/pie.s =================================================================== --- lld/trunk/test/ELF/pie.s +++ lld/trunk/test/ELF/pie.s @@ -50,6 +50,8 @@ ## Check -nopie # RUN: ld.lld -no-pie %t1.o -o %t2 # RUN: llvm-readobj -file-headers -r %t2 | FileCheck %s --check-prefix=NOPIE +# RUN: ld.lld -no-pic-executable %t1.o -o %t2 +# RUN: llvm-readobj -file-headers -r %t2 | FileCheck %s --check-prefix=NOPIE # NOPIE-NOT: Type: SharedObject .globl _start Index: lld/trunk/test/ELF/warn-common.s =================================================================== --- lld/trunk/test/ELF/warn-common.s +++ lld/trunk/test/ELF/warn-common.s @@ -7,9 +7,7 @@ # RUN: ld.lld --warn-common %t1.o %t2.o -o %t.out 2>&1 | FileCheck %s --check-prefix=WARN # WARN: multiple common of arr -## no-warn-common is ignored -# RUN: ld.lld --no-warn-common %t1.o %t2.o -o %t.out -# RUN: llvm-readobj %t.out > /dev/null +# RUN: ld.lld --fatal-warnings --warn-common --no-warn-common %t1.o %t2.o -o %t.out ## Report if common is overridden # RUN: ld.lld --warn-common %t1.o %t3.o -o %t.out 2>&1 | FileCheck %s --check-prefix=OVER