Don't check shared/export_dynamic/ref_dynamic for type mismatch

There is nothing linker can do when a type mismatched default definition
are made dynamic by info->shared, info->export_dynamic or h->ref_dynamic.
But we do want to avoid exporting it when building PIE.  Let's remove
those checks.

bfd/

	PR ld/2404
	* elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
	info->export_dynamic, nor !h->ref_dynamic for type mismatch when
	adding the default version.

ld/testsuite/

	PR ld/2404
	* ld-elf/shared.exp: Add a PIE test for PR ld/2404.
This commit is contained in:
H.J. Lu 2014-01-21 05:33:48 -08:00
parent 48ded086b6
commit 22ef172a21
4 changed files with 38 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2404
* elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
info->export_dynamic nor h->ref_dynamic for type mismatch when
adding the default version.
2014-01-16 Alan Modra <amodra@gmail.com>
* elfxx-mips.c (mips_elf_record_got_page_entry): Pass in a

View file

@ -1090,9 +1090,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
the type of existing regular definition mismatch. We only do it
if the existing regular definition won't be dynamic. */
if (pold_alignment == NULL
&& !info->shared
&& !info->export_dynamic
&& !h->ref_dynamic
&& newdyn
&& newdef
&& !olddyn

View file

@ -1,3 +1,8 @@
2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2404
* ld-elf/shared.exp: Add a PIE test for PR ld/2404.
2014-01-20 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2404

View file

@ -453,3 +453,29 @@ set run_cxx_tests {
run_cc_link_tests $build_cxx_tests
run_ld_link_exec_tests [] $run_cxx_tests
if { [istarget *-*-linux*]
|| [istarget *-*-nacl*]
|| [istarget *-*-gnu*] } {
run_cc_link_tests [list \
[list \
"Build libpr2404b.a with PIE" \
"" \
"-fPIE" \
{ pr2404b.c } \
{} \
"libpr2404b.a" \
] \
]
run_ld_link_exec_tests [] [list \
[list \
"Run pr2404 with PIE" \
"-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
"" \
{ dummy.c } \
"pr2404pie" \
"pr2404.out" \
"-fPIE" \
] \
]
}