From: H.J. Lu Date: Mon, 12 Oct 2015 11:55:24 +0000 (-0700) Subject: Skip the unversioned definition after the default version X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4373f8af3ddbc301227e883d5cbed8302c107e59;p=binutils-gdb.git Skip the unversioned definition after the default version We may see an unversioned definition after the default version. We should skip the unversioned definition in this case. bfd/ PR ld/19073 * elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned definition after the default version. ld/testsuite/ PR ld/19073 * ld-elf/pr19073.map: New file. * ld-elf/pr19073.rd: Likewise. * ld-elf/pr19073.s: Likewise. * ld-elf/shared.exp (build_tests): Add tests for PR ld/19073. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ce1089b6a3a..abcddc93157 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-10-12 H.J. Lu + + PR ld/19073 + * elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned + definition after the default version. + 2015-10-12 Andreas Krebbel PR ld/19083 diff --git a/bfd/elflink.c b/bfd/elflink.c index 94bb7109151..839cebb16ef 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1715,6 +1715,13 @@ _bfd_elf_add_default_symbol (bfd *abfd, h->versioned = versioned; } } + else + { + /* PR ld/19073: We may see an unversioned definition after the + default version. */ + if (p == NULL) + return TRUE; + } bed = get_elf_backend_data (abfd); collect = bed->collect; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 95a58b8d4bb..ef4631b14e5 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-10-12 H.J. Lu + + PR ld/19073 + * ld-elf/pr19073.map: New file. + * ld-elf/pr19073.rd: Likewise. + * ld-elf/pr19073.s: Likewise. + * ld-elf/shared.exp (build_tests): Add tests for PR ld/19073. + 2015-10-07 Claudiu Zissulescu * ld-elf/linkonce1.d: Skip extra relocs before .debug_frame. diff --git a/ld/testsuite/ld-elf/pr19073.map b/ld/testsuite/ld-elf/pr19073.map new file mode 100644 index 00000000000..e9adf097e0e --- /dev/null +++ b/ld/testsuite/ld-elf/pr19073.map @@ -0,0 +1,6 @@ +VERS.1 { +global: + foo; +local: + *; +}; diff --git a/ld/testsuite/ld-elf/pr19073.rd b/ld/testsuite/ld-elf/pr19073.rd new file mode 100644 index 00000000000..7785d9f4b10 --- /dev/null +++ b/ld/testsuite/ld-elf/pr19073.rd @@ -0,0 +1,5 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +foo@@VERS.1 +#... diff --git a/ld/testsuite/ld-elf/pr19073.s b/ld/testsuite/ld-elf/pr19073.s new file mode 100644 index 00000000000..f60df4fc7e0 --- /dev/null +++ b/ld/testsuite/ld-elf/pr19073.s @@ -0,0 +1,9 @@ + .text + .globl __foo + .type __foo, %function +__foo: + .byte 0 + .globl foo + .weak foo + .set foo, __foo + .symver __foo,foo@@VERS.1 diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 007674043ed..731eef30911 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -273,6 +273,12 @@ set build_tests { {"Build libpr18458b.so" "-shared -Wl,-z,now tmpdir/libpr18458a.so" "-fPIC" {pr18458b.c} {} "libpr18458b.so"} + {"Build pr19073a.o" + "-r -nostdlib" "" + {pr19073.s} {} "pr19073a.o"} + {"Build libpr19073.so" + "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC" + {dummy.c} {{readelf {--dyn-syms --wide} pr19073.rd}} "libpr19073.so"} } run_cc_link_tests $build_tests