bool GnuHash = false;
bool ICF;
bool Mips64EL = false;
+ bool NoGnuUnique;
bool NoUndefined;
bool NoinhibitExec;
bool Pic;
Config->ExportDynamic = Args.hasArg(OPT_export_dynamic);
Config->GcSections = Args.hasArg(OPT_gc_sections);
Config->ICF = Args.hasArg(OPT_icf);
+ Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique);
Config->NoUndefined = Args.hasArg(OPT_no_undefined);
Config->NoinhibitExec = Args.hasArg(OPT_noinhibit_exec);
Config->Pie = Args.hasArg(OPT_pie);
def no_demangle: Flag<["--"], "no-demangle">,
HelpText<"Do not demangle symbol names">;
+def no_gnu_unique : Flag<["--"], "no-gnu-unique">,
+ HelpText<"Disable STB_GNU_UNIQUE symbol binding">;
+
def no_whole_archive : Flag<["--", "-"], "no-whole-archive">,
HelpText<"Restores the default behavior of loading archive members">;
uint8_t Visibility = Body->getVisibility();
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
return STB_LOCAL;
+ if (Config->NoGnuUnique && Body->Binding == STB_GNU_UNIQUE)
+ return STB_GLOBAL;
return Body->Binding;
}
+// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
+//
// RUN: ld.lld %t -shared -o %tout.so
-// RUN: llvm-readobj -dyn-symbols %tout.so | FileCheck %s
-// REQUIRES: x86
+// 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
// Check that STB_GNU_UNIQUE is treated as a global and ends up in the dynamic
// symbol table as STB_GNU_UNIQUE.
.type symb, @gnu_unique_object
symb:
-# CHECK: Name: symb@
-# CHECK-NEXT: Value:
-# CHECK-NEXT: Size: 0
-# CHECK-NEXT: Binding: Unique
-# CHECK-NEXT: Type: Object
-# CHECK-NEXT: Other: 0
-# CHECK-NEXT: Section: .data
-# CHECK-NEXT: }
+# GNU: Name: symb@
+# GNU-NEXT: Value:
+# GNU-NEXT: Size: 0
+# GNU-NEXT: Binding: Unique
+# GNU-NEXT: Type: Object
+# GNU-NEXT: Other: 0
+# GNU-NEXT: Section: .data
+# GNU-NEXT: }
+
+# NO: Name: symb@
+# NO-NEXT: Value:
+# NO-NEXT: Size: 0
+# NO-NEXT: Binding: Global
+# NO-NEXT: Type: Object
+# NO-NEXT: Other: 0
+# NO-NEXT: Section: .data
+# NO-NEXT: }