diff options
-rw-r--r-- | lld/ELF/Writer.cpp | 4 | ||||
-rw-r--r-- | lld/test/ELF/startstop-shared.s | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 4bbd812dec7..a28d910f2ad 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1261,11 +1261,11 @@ void Writer<ELFT>::addStartStopSymbols(OutputSectionBase<ELFT> *Sec) { 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) { diff --git a/lld/test/ELF/startstop-shared.s b/lld/test/ELF/startstop-shared.s index 9c18d36b02b..0e52bac2621 100644 --- a/lld/test/ELF/startstop-shared.s +++ b/lld/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 |