[PATCH] elf: Treat undefined version as hidden
H.J. Lu
hjl.tools@gmail.com
Sun Aug 1 14:31:04 GMT 2021
Since undefined version can't be used to resolve any references, treat
it as hidden.
bfd/
PR binutils/28158
* elf.c (_bfd_elf_get_symbol_version_string): Treat undefined
version as hidden.
ld/
PR binutils/28158
* testsuite/ld-elfvers/vers2.dsym: Updated.
* testsuite/ld-elfvers/vers3.dsym: Likewise.
* testsuite/ld-elfvers/vers6.dsym: Likewise.
* testsuite/ld-elfvers/vers19.dsym: Likewise.
* testsuite/ld-elfvers/vers22.dsym: Likewise.
* testsuite/ld-elfvers/vers28c.dsym: Likewise.
---
bfd/elf.c | 1 +
ld/testsuite/ld-elfvers/vers19.dsym | 2 +-
ld/testsuite/ld-elfvers/vers2.dsym | 2 +-
ld/testsuite/ld-elfvers/vers22.dsym | 2 +-
ld/testsuite/ld-elfvers/vers28c.dsym | 2 +-
ld/testsuite/ld-elfvers/vers3.dsym | 2 +-
ld/testsuite/ld-elfvers/vers6.dsym | 6 +++---
7 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index d0898855de8..5941eeb010b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1944,6 +1944,7 @@ _bfd_elf_get_symbol_version_string (bfd *abfd, asymbol *symbol,
{
if (a->vna_other == vernum)
{
+ *hidden = true;
version_string = a->vna_nodename;
break;
}
diff --git a/ld/testsuite/ld-elfvers/vers19.dsym b/ld/testsuite/ld-elfvers/vers19.dsym
index a77f9490127..798466fb8bd 100644
--- a/ld/testsuite/ld-elfvers/vers19.dsym
+++ b/ld/testsuite/ld-elfvers/vers19.dsym
@@ -1 +1 @@
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS_2\.0\) +(0x[0-9a-f]+ )?_?show_foo
diff --git a/ld/testsuite/ld-elfvers/vers2.dsym b/ld/testsuite/ld-elfvers/vers2.dsym
index 30ba91b82b4..f820fdc9717 100644
--- a/ld/testsuite/ld-elfvers/vers2.dsym
+++ b/ld/testsuite/ld-elfvers/vers2.dsym
@@ -1,3 +1,3 @@
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS_2\.0\) +(0x[0-9a-f]+ )?_?show_foo
0+ g +DO \*ABS\* 0+ +VERS_XXX_1\.1 VERS_XXX_1\.1
[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_XXX_1\.1 (0x[0-9a-f]+ )?_?show_xyzzy
diff --git a/ld/testsuite/ld-elfvers/vers22.dsym b/ld/testsuite/ld-elfvers/vers22.dsym
index db2aeec4bc3..65a183345a2 100644
--- a/ld/testsuite/ld-elfvers/vers22.dsym
+++ b/ld/testsuite/ld-elfvers/vers22.dsym
@@ -1 +1 @@
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?_?bar
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS\.0\) +(0x[0-9a-f]+ )?_?bar
diff --git a/ld/testsuite/ld-elfvers/vers28c.dsym b/ld/testsuite/ld-elfvers/vers28c.dsym
index 7ad56789eea..a575eff0d2c 100644
--- a/ld/testsuite/ld-elfvers/vers28c.dsym
+++ b/ld/testsuite/ld-elfvers/vers28c.dsym
@@ -1 +1 @@
-[0-9a-f]+[ ]+DF[ ]+\*UND\*[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo
+[0-9a-f]+[ ]+DF[ ]+\*UND\*[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?_?foo
diff --git a/ld/testsuite/ld-elfvers/vers3.dsym b/ld/testsuite/ld-elfvers/vers3.dsym
index a77f9490127..798466fb8bd 100644
--- a/ld/testsuite/ld-elfvers/vers3.dsym
+++ b/ld/testsuite/ld-elfvers/vers3.dsym
@@ -1 +1 @@
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS_2\.0\) +(0x[0-9a-f]+ )?_?show_foo
diff --git a/ld/testsuite/ld-elfvers/vers6.dsym b/ld/testsuite/ld-elfvers/vers6.dsym
index a5a805377ca..6d073127648 100644
--- a/ld/testsuite/ld-elfvers/vers6.dsym
+++ b/ld/testsuite/ld-elfvers/vers6.dsym
@@ -1,4 +1,4 @@
[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +Base +(0x[0-9a-f]+ )?_?show_foo
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2.0 +(0x[0-9a-f]+ )?_?show_foo
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.2 +(0x[0-9a-f]+ )?_?show_foo
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.1 +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS_2.0\) +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS_1.2\) +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +\(VERS_1.1\) +(0x[0-9a-f]+ )?_?show_foo
--
2.31.1
More information about the Binutils
mailing list