PATCH: PR ld/11933: Differnt linker behavior with incompatible input files

H.J. Lu hjl.tools@gmail.com
Sun Aug 22 07:51:00 GMT 2010


On Sat, Aug 21, 2010 at 11:50 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> The linker behavior with incompatible input files is changed from
>
> /export/home/hjl/bugs/binutils/merge-3/bz623687/ld: i386 architecture of input file `libtiff.a(tif_close.o)' is incompatible with i386:x86-64 output
>
> to
>
> libtiff.a: could not read symbols: File in wrong format
>
> The new message isn't as clear as the old one. This patch restores the
> old message.  OK to install?
>
> Thanks.
>
>
> H.J.
> ---
> bfd/
>
> 2010-08-21  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/11933
>        * elflink.c (elf_link_add_object_symbols): Don't check relocation
>        if input ELF object ID doesn't match output.
>
> ld/testsuite/
>
> 2010-08-21  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/11933
>        * ld-x86-64/mixed1a.s: New.
>        * ld-x86-64/mixed1b.s: Likewise.
>        * ld-x86-64/mixed2a.s: Likewise.
>        * ld-x86-64/mixed2b.s: Likewise.
>
>        * ld-x86-64/x86-64.exp: Text mixed x86_64 and i386 inputs.
>
> diff --git a/bfd/elflink.c b/bfd/elflink.c
> index 074229f..2f67c47 100644
> --- a/bfd/elflink.c
> +++ b/bfd/elflink.c
> @@ -4791,6 +4791,7 @@ error_free_dyn:
>   if (! dynamic
>       && is_elf_hash_table (htab)
>       && bed->check_relocs != NULL
> +      && elf_object_id (abfd) == elf_hash_table_id (htab)
>       && (*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
>     {

Can we replace relocs_compatible with checking elf_object_id?

-- 
H.J.



More information about the Binutils mailing list