diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-10-12 04:55:24 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-10-12 04:57:16 -0700 |
commit | 4373f8af3ddbc301227e883d5cbed8302c107e59 (patch) | |
tree | 8f393f237c1b03f93a1bb47cc5ab07e89aef71d4 | |
parent | ede77e6963d1fa748fed1515d58f26e842a2cccb (diff) | |
download | gdb-4373f8af3ddbc301227e883d5cbed8302c107e59.zip gdb-4373f8af3ddbc301227e883d5cbed8302c107e59.tar.gz gdb-4373f8af3ddbc301227e883d5cbed8302c107e59.tar.bz2 |
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.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr19073.map | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr19073.rd | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr19073.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 6 |
7 files changed, 47 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ce1089b..abcddc9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-10-12 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/19073 + * elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned + definition after the default version. + 2015-10-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com> PR ld/19083 diff --git a/bfd/elflink.c b/bfd/elflink.c index 94bb710..839cebb 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 95a58b8..ef4631b 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-10-12 H.J. Lu <hongjiu.lu@intel.com> + + 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 <claziss@synopsys.com> * 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 0000000..e9adf09 --- /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 0000000..7785d9f --- /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 0000000..f60df4f --- /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 0076740..731eef3 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 |