This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Problems generating shared library for MIPS using binutils-2.13...
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: "Steven J. Hill" <sjhill at realitydiluted dot com>
- Cc: linux-mips at linux-mips dot org, binutils at sources dot redhat dot com
- Date: 05 Nov 2002 15:19:04 +0000
- Subject: Re: Problems generating shared library for MIPS using binutils-2.13...
- References: <Pine.GSO.3.96.1021025185639.1121A-100000@delta.ds2.pg.gda.pl><3DC68907.30708@realitydiluted.com>
"Steven J. Hill" <sjhill@realitydiluted.com> writes:
> In the '_bfd_mips_elf_final_write_processing' function in 'bfd/elfxx-mips.c'
> If I print out the EF_MIPS_ARCH flags for the input BFD descriptor. It
> is properly set to 'MIPS2', but when the case statement in
> '_bfd_mips_elf_final_write_processing' is traversed, it
> uses the R3000/default case which means that the target CPU architecture
> didn't get put into the BFD descriptor.
Is it related to this?
<http://sources.redhat.com/ml/binutils/2002-10/msg00248.html>
(In the message body, I accidentally copied the code after
the patch rather than before. Sorry about that.)
Anyway, that patch won't solve your problem, but the issue
seems to be the same: _bfd_mips_elf_merge_private_bfd_data()
merges the EF_MIPS_ARCH and EF_MIPS_MACH bits, but
_bfd_mips_elf_final_write_processing() overwrites them
based on the BFD mach.
Personally, I think _bfd_mips_elf_final_write_processing()
is doing the right thing. Surely we ought to be able to
set EF_MIPS_ARCH and EF_MIPS_MACH based on the value of
bfd_get_mach?
I wonder whether _bfd_mips_elf_merge_private_bfd_data() should
be checking for compatibility based on the BFD machs rather
than the header flags. It seems a bit odd that we check the
ISA level and "machine" separately.
In other words, replace:
/* Compare the ISA's. */
if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))
!= (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)))
{
...
}
with code that checks bfd_get_mach (ibfd) against bfd_get_mach (obfd).
If ibfd's architecture is an extension of obfd's, copy it to obfd.
Richard