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.
This commit is contained in:
H.J. Lu
2015-10-12 04:55:24 -07:00
parent ede77e6963
commit 4373f8af3d
7 changed files with 47 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -0,0 +1,6 @@
VERS.1 {
global:
foo;
local:
*;
};

View File

@ -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
#...

View File

@ -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

View File

@ -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