[PATCH] D19024: ELF: Give automatically generated __start_* and __stop_* symbols hidden visibility.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 12 13:47:22 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL266121: ELF: Give automatically generated __start_* and __stop_* symbols hidden… (authored by pcc).
Changed prior to commit:
http://reviews.llvm.org/D19024?vs=53433&id=53456#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19024
Files:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/startstop-shared.s
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -1261,11 +1261,11 @@
StringRef Stop = Saver.save("__stop_" + S);
if (SymbolBody *B = Symtab.find(Start))
if (B->isUndefined())
- Symtab.addSynthetic(Start, *Sec, 0, STV_DEFAULT);
+ Symtab.addSynthetic(Start, *Sec, 0, STV_HIDDEN);
if (SymbolBody *B = Symtab.find(Stop))
if (B->isUndefined())
Symtab.addSynthetic(Stop, *Sec, DefinedSynthetic<ELFT>::SectionEnd,
- STV_DEFAULT);
+ STV_HIDDEN);
}
template <class ELFT> static bool needsPtLoad(OutputSectionBase<ELFT> *Sec) {
Index: lld/trunk/test/ELF/startstop-shared.s
===================================================================
--- lld/trunk/test/ELF/startstop-shared.s
+++ lld/trunk/test/ELF/startstop-shared.s
@@ -5,21 +5,21 @@
.quad __start_foo
.section foo,"a"
-// By default the symbol is visible and we need a dynamic reloc.
-// CHECK: R_X86_64_64 __start_foo 0x0
+// By default the symbol is hidden.
+// CHECK: R_X86_64_RELATIVE - 0x[[ADDR1:.*]]
.hidden __start_bar
.quad __start_bar
.section bar,"a"
-// Test that we are able to hide the symbol.
-// CHECK: R_X86_64_RELATIVE - 0x[[ADDR:.*]]
+// References do not affect the visibility.
+// CHECK: R_X86_64_RELATIVE - 0x[[ADDR2:.*]]
// CHECK: Name: __start_bar
-// CHECK-NEXT: Value: 0x[[ADDR]]
+// CHECK-NEXT: Value: 0x[[ADDR2]]
// CHECK-NEXT: Size:
// CHECK-NEXT: Binding: Local
// CHECK: Name: __start_foo
-// CHECK-NEXT: Value:
+// CHECK-NEXT: Value: 0x[[ADDR1]]
// CHECK-NEXT: Size:
-// CHECK-NEXT: Binding: Global
+// CHECK-NEXT: Binding: Local
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19024.53456.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/74785e35/attachment.bin>
More information about the llvm-commits
mailing list