diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-09-18 09:12:27 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-09-19 07:19:39 -0700 |
commit | e4675a5810fc3d0a7d0b1c744f0a1837ccc0507e (patch) | |
tree | 0b4614c66e6c46feb1d0bf3b7252d0c771139724 /ld | |
parent | 034ce7b42a1da639979fd743d8b9b1fb86c22d1c (diff) | |
download | binutils-e4675a5810fc3d0a7d0b1c744f0a1837ccc0507e.zip binutils-e4675a5810fc3d0a7d0b1c744f0a1837ccc0507e.tar.gz binutils-e4675a5810fc3d0a7d0b1c744f0a1837ccc0507e.tar.bz2 |
elf: Don't set version info on unversioned symbols
Don't set version info on unversioned symbols when seeing a hidden
versioned symbol after an unversioned definition and the default
versioned symbol.
bfd/
PR ld/28348
* elflink.c (elf_link_add_object_symbols): Don't set version info
on unversioned symbols.
ld/
PR ld/28348
* testsuite/ld-elf/pr28348.rd: New file.
* testsuite/ld-elf/pr28348.t: Likewise.
* testsuite/ld-elf/pr28348a.c: Likewise.
* testsuite/ld-elf/pr28348b.c: Likewise.
* testsuite/ld-elf/pr28348c.c: Likewise.
* testsuite/ld-elf/shared.exp: Run PR ld/28348 tests.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-elf/pr28348.rd | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr28348.t | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr28348a.c | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr28348b.c | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr28348c.c | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 39 |
6 files changed, 71 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/pr28348.rd b/ld/testsuite/ld-elf/pr28348.rd new file mode 100644 index 0000000..6e6ac04 --- /dev/null +++ b/ld/testsuite/ld-elf/pr28348.rd @@ -0,0 +1,8 @@ +#ld: -shared +#readelf: --dyn-syms --wide +#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi +#xfail: ![check_shared_lib_support] + +#... + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +WEAK +DEFAULT (\[NOPV\]|) +[0-9]+ +_?foo +#pass diff --git a/ld/testsuite/ld-elf/pr28348.t b/ld/testsuite/ld-elf/pr28348.t new file mode 100644 index 0000000..89ea6ef --- /dev/null +++ b/ld/testsuite/ld-elf/pr28348.t @@ -0,0 +1,6 @@ +VERS_2.0 { +global: + foo; bar; +local: + *; +}; diff --git a/ld/testsuite/ld-elf/pr28348a.c b/ld/testsuite/ld-elf/pr28348a.c new file mode 100644 index 0000000..3d54205 --- /dev/null +++ b/ld/testsuite/ld-elf/pr28348a.c @@ -0,0 +1,5 @@ +__attribute__ ((weak)) +void +foo (void) +{ +} diff --git a/ld/testsuite/ld-elf/pr28348b.c b/ld/testsuite/ld-elf/pr28348b.c new file mode 100644 index 0000000..b4aab59 --- /dev/null +++ b/ld/testsuite/ld-elf/pr28348b.c @@ -0,0 +1,5 @@ +void +foo (void) +{ +} +asm (".symver foo,foo@VERS_2.0"); diff --git a/ld/testsuite/ld-elf/pr28348c.c b/ld/testsuite/ld-elf/pr28348c.c new file mode 100644 index 0000000..cbb9d56 --- /dev/null +++ b/ld/testsuite/ld-elf/pr28348c.c @@ -0,0 +1,8 @@ +extern void foo (void); + +int +main () +{ + foo (); + return 0; +} diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 9224782..19a8e49 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -868,6 +868,45 @@ run_cc_link_tests [list \ {} \ "pr26590" \ ] \ + [list \ + "Build libpr28348a.so" \ + "-shared -Wl,--version-script=pr28348.t" \ + "-fPIC" \ + {pr28348a.c} \ + {} \ + "libpr28348a.so" \ + ] \ + [list \ + "Build pr28348b.o" \ + "" \ + "-fPIC" \ + {pr28348b.c} \ + ] \ + [list \ + "Build pr28348c.o" \ + "" \ + "" \ + {pr28348c.c} \ + ] \ + [list \ + "Build libpr28348b.so" \ + "-shared -Wl,--version-script=pr28348.t \ + -Wl,--no-as-needed tmpdir/pr28348b.o tmpdir/libpr28348a.so" \ + "-fPIC" \ + {dummy.c} \ + {} \ + "libpr28348b.so" \ + ] \ + [list \ + "Build pr28348" \ + "-Wl,--no-as-needed tmpdir/pr28348c.o \ + tmpdir/pr28348a.o tmpdir/libpr28348a.so tmpdir/libpr28348b.so \ + tmpdir/libpr28348a.so" \ + "" \ + {dummy.c} \ + {{readelf {--dyn-syms --wide} pr28348.rd}} \ + "pr28348" \ + ] \ ] # pr19073.s uses .set, which has a different meaning on alpha. |