forked from OSchip/llvm-project
Add -no-allow-multiple-definition, -no-pic-executable and -no-warn-common.
GNU gold has these options. Differential Revision: https://reviews.llvm.org/D42929 llvm-svn: 324300
This commit is contained in:
parent
791c98e4c8
commit
bb8d15e4d7
|
@ -596,7 +596,9 @@ static int parseInt(StringRef S, opt::Arg *Arg) {
|
|||
// 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 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
|
|||
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");
|
||||
|
|
|
@ -54,8 +54,9 @@ defm Tdata: Eq<"Tdata">,
|
|||
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 @@ def version: F<"version">, HelpText<"Display the version number and exit">;
|
|||
|
||||
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_filter: Separate<["-"], "F">, Alias<filter>;
|
|||
def alias_format_b: S<"b">, Alias<format>;
|
||||
def alias_library: JoinedOrSeparate<["-"], "l">, Alias<library>;
|
||||
def alias_library_path: JoinedOrSeparate<["-"], "L">, Alias<library_path>;
|
||||
def alias_no_pie_pic_executable: F<"no-pic-executable">, Alias<no_pie>;
|
||||
def alias_omagic: Flag<["-"], "N">, Alias<omagic>;
|
||||
def alias_o_output: Joined<["--"], "output=">, Alias<o>;
|
||||
def alias_o_output2 : Separate<["--"], "output">, Alias<o>;
|
||||
|
@ -424,7 +427,6 @@ def no_copy_dt_needed_entries: F<"no-copy-dt-needed-entries">;
|
|||
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=">;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue