* [PATCH] ELF: Make section symbol PROTECTED only in shared library
@ 2020-06-10 12:52 H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2020-06-10 12:52 UTC (permalink / raw)
To: binutils
PROTECTED symbol in executable serves no purpose since definitions in
executable aren't preemptible.
bfd/
PR ld/26105
* elflink.c (bfd_elf_define_start_stop): Make symbol PROTECTED
only in shared library.
ld/
PR ld/26105
* testsuite/ld-elf/pr26094-1b.rd: Updated.
* testsuite/ld-gc/pr20022.d: Likewise.
---
bfd/elflink.c | 3 ++-
ld/testsuite/ld-elf/pr26094-1b.rd | 2 +-
ld/testsuite/ld-gc/pr20022.d | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 3e56a297f6..ac20f2f0cb 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -14828,7 +14828,8 @@ bfd_elf_define_start_stop (struct bfd_link_info *info,
}
else
{
- if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ if ((bfd_link_dll (info))
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED;
if (was_dynamic)
bfd_elf_link_record_dynamic_symbol (info, h);
diff --git a/ld/testsuite/ld-elf/pr26094-1b.rd b/ld/testsuite/ld-elf/pr26094-1b.rd
index ec0c13d83c..36bbb45592 100644
--- a/ld/testsuite/ld-elf/pr26094-1b.rd
+++ b/ld/testsuite/ld-elf/pr26094-1b.rd
@@ -4,5 +4,5 @@
#xfail: ![check_shared_lib_support]
#...
- +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +OBJECT +GLOBAL +PROTECTED +[0-9]+ +___?start_FOO@@SOME_VERSION_NAME
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +OBJECT +GLOBAL +DEFAULT +[0-9]+ +___?start_FOO@@SOME_VERSION_NAME
#pass
diff --git a/ld/testsuite/ld-gc/pr20022.d b/ld/testsuite/ld-gc/pr20022.d
index 7623041c41..5e4449cf72 100644
--- a/ld/testsuite/ld-gc/pr20022.d
+++ b/ld/testsuite/ld-gc/pr20022.d
@@ -6,5 +6,5 @@
#...
\[[ 0-9]+\] _foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+[ \t]+.*
#...
- +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +__start__foo
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +__start__foo
#pass
--
2.26.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-10 12:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 12:52 [PATCH] ELF: Make section symbol PROTECTED only in shared library H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).