[lld] r249193 - [elf2] Add STB_GNU_UNIQUE support.
Michael J. Spencer via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 14:57:52 PDT 2015
Author: mspencer
Date: Fri Oct 2 16:57:52 2015
New Revision: 249193
URL: http://llvm.org/viewvc/llvm-project?rev=249193&view=rev
Log:
[elf2] Add STB_GNU_UNIQUE support.
Added:
lld/trunk/test/elf2/gnu-unique.s
Modified:
lld/trunk/ELF/InputFiles.cpp
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=249193&r1=249192&r2=249193&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Fri Oct 2 16:57:52 2015
@@ -181,6 +181,7 @@ SymbolBody *elf2::ObjectFile<ELFT>::crea
error("unexpected binding");
case STB_GLOBAL:
case STB_WEAK:
+ case STB_GNU_UNIQUE:
return new (Alloc) DefinedRegular<ELFT>(Name, *Sym, *Sections[SecIndex]);
}
}
Added: lld/trunk/test/elf2/gnu-unique.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/gnu-unique.s?rev=249193&view=auto
==============================================================================
--- lld/trunk/test/elf2/gnu-unique.s (added)
+++ lld/trunk/test/elf2/gnu-unique.s Fri Oct 2 16:57:52 2015
@@ -0,0 +1,24 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
+// RUN: lld -flavor gnu2 %t -shared -o %tout.so
+// RUN: llvm-readobj -t -dyn-symbols %tout.so | FileCheck %s
+// REQUIRES: x86
+
+// Check that STB_GNU_UNIQUE is treated as a global and ends up in the dynamic
+// symbol table as STB_GNU_UNIQUE.
+
+.global _start
+.text
+_start:
+
+.data
+.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: }
More information about the llvm-commits
mailing list