[PATCH] D23514: [ELF] - Do not change binding of symbols when creating relocatable output.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 01:39:04 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279220: [ELF] - Do not change binding of symbols when creating relocatable output. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D23514?vs=68490&id=68657#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23514
Files:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/test/ELF/relocatable-visibility.s
Index: lld/trunk/ELF/OutputSections.cpp
===================================================================
--- lld/trunk/ELF/OutputSections.cpp
+++ lld/trunk/ELF/OutputSections.cpp
@@ -1316,6 +1316,8 @@
static uint8_t getSymbolBinding(SymbolBody *Body) {
Symbol *S = Body->symbol();
+ if (Config->Relocatable)
+ return S->Binding;
uint8_t Visibility = S->Visibility;
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
return STB_LOCAL;
Index: lld/trunk/test/ELF/relocatable-visibility.s
===================================================================
--- lld/trunk/test/ELF/relocatable-visibility.s
+++ lld/trunk/test/ELF/relocatable-visibility.s
@@ -0,0 +1,19 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: ld.lld -r %t.o -o %t1
+# RUN: llvm-readobj -t %t1 | FileCheck --check-prefix=RELOCATABLE %s
+
+# RELOCATABLE: Name: foo
+# RELOCATABLE-NEXT: Value: 0x0
+# RELOCATABLE-NEXT: Size: 0
+# RELOCATABLE-NEXT: Binding: Global
+# RELOCATABLE-NEXT: Type: None
+# RELOCATABLE-NEXT: Other [
+# RELOCATABLE-NEXT: STV_HIDDEN
+# RELOCATABLE-NEXT: ]
+# RELOCATABLE-NEXT: Section: Undefined
+
+.global _start
+_start:
+ callq foo
+ .hidden foo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23514.68657.patch
Type: text/x-patch
Size: 1230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/e2c43fd4/attachment.bin>
More information about the llvm-commits
mailing list