forked from OSchip/llvm-project
Add --no-gnu-unique and --no-undefined-version for completeness.
Differential Revision: https://reviews.llvm.org/D42865 llvm-svn: 324145
This commit is contained in:
parent
a767ee5af0
commit
aad2e328b9
|
@ -124,6 +124,7 @@ struct Configuration {
|
|||
bool GcSections;
|
||||
bool GdbIndex;
|
||||
bool GnuHash = false;
|
||||
bool GnuUnique;
|
||||
bool HasDynamicList = false;
|
||||
bool HasDynSymTab;
|
||||
bool ICF;
|
||||
|
@ -131,8 +132,6 @@ struct Configuration {
|
|||
bool IgnoreFunctionAddressEquality;
|
||||
bool MergeArmExidx;
|
||||
bool MipsN32Abi = false;
|
||||
bool NoGnuUnique;
|
||||
bool NoUndefinedVersion;
|
||||
bool NoinhibitExec;
|
||||
bool Nostdlib;
|
||||
bool OFormatBinary;
|
||||
|
@ -149,6 +148,7 @@ struct Configuration {
|
|||
bool SysvHash = false;
|
||||
bool Target1Rel;
|
||||
bool Trace;
|
||||
bool UndefinedVersion;
|
||||
bool Verbose;
|
||||
bool WarnCommon;
|
||||
bool WarnMissingEntry;
|
||||
|
|
|
@ -621,6 +621,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
|
|||
Config->Fini = Args.getLastArgValue(OPT_fini, "_fini");
|
||||
Config->FixCortexA53Errata843419 = Args.hasArg(OPT_fix_cortex_a53_843419);
|
||||
Config->GcSections = Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false);
|
||||
Config->GnuUnique = Args.hasFlag(OPT_gnu_unique, OPT_no_gnu_unique, true);
|
||||
Config->GdbIndex = Args.hasFlag(OPT_gdb_index, OPT_no_gdb_index, false);
|
||||
Config->ICF = Args.hasFlag(OPT_icf_all, OPT_icf_none, false);
|
||||
Config->IgnoreDataAddressEquality =
|
||||
|
@ -633,10 +634,8 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
|
|||
Config->LTOO = args::getInteger(Args, OPT_lto_O, 2);
|
||||
Config->LTOPartitions = args::getInteger(Args, OPT_lto_partitions, 1);
|
||||
Config->MapFile = Args.getLastArgValue(OPT_Map);
|
||||
Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique);
|
||||
Config->MergeArmExidx =
|
||||
Args.hasFlag(OPT_merge_exidx_entries, OPT_no_merge_exidx_entries, true);
|
||||
Config->NoUndefinedVersion = Args.hasArg(OPT_no_undefined_version);
|
||||
Config->NoinhibitExec = Args.hasArg(OPT_noinhibit_exec);
|
||||
Config->Nostdlib = Args.hasArg(OPT_nostdlib);
|
||||
Config->OFormatBinary = isOutputFormatBinary(Args);
|
||||
|
@ -672,6 +671,8 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
|
|||
ThreadsEnabled = Args.hasFlag(OPT_threads, OPT_no_threads, true);
|
||||
Config->Trace = Args.hasArg(OPT_trace);
|
||||
Config->Undefined = args::getStrings(Args, OPT_undefined);
|
||||
Config->UndefinedVersion =
|
||||
Args.hasFlag(OPT_undefined_version, OPT_no_undefined_version, true);
|
||||
Config->UnresolvedSymbols = getUnresolvedSymbolPolicy(Args);
|
||||
Config->Verbose = Args.hasArg(OPT_verbose);
|
||||
errorHandler().Verbose = Config->Verbose;
|
||||
|
|
|
@ -150,6 +150,10 @@ defm gdb_index: B<"gdb-index",
|
|||
"Generate .gdb_index section",
|
||||
"Do not generate .gdb_index section">;
|
||||
|
||||
defm gnu_unique: B<"gnu-unique",
|
||||
"Enable STB_GNU_UNIQUE symbol binding",
|
||||
"Disable STB_GNU_UNIQUE symbol binding">;
|
||||
|
||||
defm hash_style: Eq<"hash-style">,
|
||||
HelpText<"Specify hash style (sysv, gnu or both)">;
|
||||
|
||||
|
@ -193,9 +197,6 @@ def no_color_diagnostics: F<"no-color-diagnostics">,
|
|||
def no_dynamic_linker: F<"no-dynamic-linker">,
|
||||
HelpText<"Inhibit output of .interp section">;
|
||||
|
||||
def no_gnu_unique: F<"no-gnu-unique">,
|
||||
HelpText<"Disable STB_GNU_UNIQUE symbol binding">;
|
||||
|
||||
def noinhibit_exec: F<"noinhibit-exec">,
|
||||
HelpText<"Retain the executable output file whenever it is still usable">;
|
||||
|
||||
|
@ -208,9 +209,6 @@ def no_rosegment: F<"no-rosegment">,
|
|||
def no_undefined: F<"no-undefined">,
|
||||
HelpText<"Report unresolved symbols even if the linker is creating a shared library">;
|
||||
|
||||
def no_undefined_version: F<"no-undefined-version">,
|
||||
HelpText<"Report version scripts that refer undefined symbols">;
|
||||
|
||||
def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
|
||||
HelpText<"Path to file to write output">;
|
||||
|
||||
|
@ -298,6 +296,10 @@ defm undefined: Eq<"undefined">,
|
|||
defm unresolved_symbols: Eq<"unresolved-symbols">,
|
||||
HelpText<"Determine how to handle unresolved symbols">;
|
||||
|
||||
defm undefined_version: B<"undefined-version",
|
||||
"Allow unused version in version script",
|
||||
"Report version scripts that refer undefined symbols">;
|
||||
|
||||
defm rsp_quoting: Eq<"rsp-quoting">,
|
||||
HelpText<"Quoting style for response files. Values supported: windows|posix">;
|
||||
|
||||
|
|
|
@ -700,7 +700,7 @@ void SymbolTable::assignExactVersion(SymbolVersion Ver, uint16_t VersionId,
|
|||
// Get a list of symbols which we need to assign the version to.
|
||||
std::vector<Symbol *> Syms = findByVersion(Ver);
|
||||
if (Syms.empty()) {
|
||||
if (Config->NoUndefinedVersion)
|
||||
if (!Config->UndefinedVersion)
|
||||
error("version script assignment of '" + VersionName + "' to symbol '" +
|
||||
Ver.Name + "' failed: symbol not defined");
|
||||
return;
|
||||
|
|
|
@ -241,7 +241,7 @@ uint8_t Symbol::computeBinding() const {
|
|||
return STB_LOCAL;
|
||||
if (VersionId == VER_NDX_LOCAL && isDefined())
|
||||
return STB_LOCAL;
|
||||
if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE)
|
||||
if (!Config->GnuUnique && Binding == STB_GNU_UNIQUE)
|
||||
return STB_GLOBAL;
|
||||
return Binding;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
//
|
||||
// RUN: ld.lld %t -shared -o %tout.so
|
||||
// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck -check-prefix=GNU %s
|
||||
// RUN: ld.lld %t -shared -o %tout.so --gnu-unique
|
||||
// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck -check-prefix=GNU %s
|
||||
//
|
||||
// RUN: ld.lld %t -shared -o %tout.so --no-gnu-unique
|
||||
// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck -check-prefix=NO %s
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
# RUN: echo "VERSION_1.0 { global: bar; };" > %t.script
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
||||
# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
|
||||
# RUN: ld.lld --version-script %t.script -shared --undefined-version %t.o -o %t.so
|
||||
# RUN: not ld.lld --version-script %t.script -shared --no-undefined-version \
|
||||
# RUN: %t.o -o %t.so 2>&1 | FileCheck -check-prefix=ERR1 %s
|
||||
# ERR1: version script assignment of 'VERSION_1.0' to symbol 'bar' failed: symbol not defined
|
||||
|
|
Loading…
Reference in New Issue