* Patch to fix merging of EF_MIPS_MACH flags
@ 2002-10-11 8:56 Richard Sandiford
0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2002-10-11 8:56 UTC (permalink / raw)
To: binutils; +Cc: echristo
This code in _bfd_mips_elf_merge_private_bfd_data:
/* Do we need to update the mach field? */
if (_bfd_mips_elf_mach_extends_p (old_mach, new_mach))
{
elf_elfheader (obfd)->e_flags &= ~EF_MIPS_MACH;
elf_elfheader (obfd)->e_flags |= new_mach;
bfd_set_arch_info (obfd, bfd_get_arch_info (ibfd));
}
didn't have the desired effect because the EF_MIPS_MACH bits are
overwritten by _bfd_mips_elf_final_write_processing. Is the
patch below the right fix? (Based on the h8300 port.)
Tested on mips64-elf, no regressions.
Richard
bfd/
* elfxx-mips.c (_bfd_mips_elf_mach_extends_p): Be more strict.
(_bfd_mips_elf_merge_private_bfd_data): When changing the
EF_MIPS_MACH flag, change the bfd arch_info as well.
ld/testsuite
* ld-mips-elf/vr4120-1.d: New test.
* ld-mips-elf/mips-elf.exp: Run it.
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.26
diff -c -d -p -r1.26 elfxx-mips.c
*** bfd/elfxx-mips.c 11 Oct 2002 08:33:11 -0000 1.26
--- bfd/elfxx-mips.c 11 Oct 2002 15:49:46 -0000
*************** _bfd_mips_elf_mach_extends_p (base, exte
*** 7663,7669 ****
and vr5500 code to be merged anyway, since many libraries will
just use the core ISA. Perhaps we could add some sort of ASE
flag if this ever proves a problem. */
! return (base == 0
|| (base == E_MIPS_MACH_5400 && extension == E_MIPS_MACH_5500)
|| (base == E_MIPS_MACH_4100 && extension == E_MIPS_MACH_4111)
|| (base == E_MIPS_MACH_4100 && extension == E_MIPS_MACH_4120));
--- 7663,7669 ----
and vr5500 code to be merged anyway, since many libraries will
just use the core ISA. Perhaps we could add some sort of ASE
flag if this ever proves a problem. */
! return ((base == 0 && extension != 0)
|| (base == E_MIPS_MACH_5400 && extension == E_MIPS_MACH_5500)
|| (base == E_MIPS_MACH_4100 && extension == E_MIPS_MACH_4111)
|| (base == E_MIPS_MACH_4100 && extension == E_MIPS_MACH_4120));
*************** _bfd_mips_elf_merge_private_bfd_data (ib
*** 7798,7803 ****
--- 7798,7804 ----
{
elf_elfheader (obfd)->e_flags &= ~EF_MIPS_MACH;
elf_elfheader (obfd)->e_flags |= new_mach;
+ bfd_set_arch_info (obfd, bfd_get_arch_info (ibfd));
}
/* Do we need to update the ISA field? */
Index: ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf.exp,v
retrieving revision 1.6
diff -c -d -p -r1.6 mips-elf.exp
*** ld/testsuite/ld-mips-elf/mips-elf.exp 3 Oct 2002 23:56:24 -0000 1.6
--- ld/testsuite/ld-mips-elf/mips-elf.exp 11 Oct 2002 15:49:46 -0000
*************** if { [istarget mips*-*-*] } then {
*** 30,35 ****
--- 30,37 ----
# MIPS branch offset final link checking.
run_dump_test "branch-misc-1"
run_dump_test "branch-misc-2"
+
+ run_dump_test "vr4120-1"
}
if { $embedded_elf } {
*** /dev/null Tue Nov 14 21:44:43 2000
--- ld/testsuite/ld-mips-elf/vr4120-1.d Fri Oct 11 16:17:25 2002
***************
*** 0 ****
--- 1,7 ----
+ #source: mips16-1a.s -march=vr4100
+ #source: mips16-1b.s -march=vr4120
+ #ld: -r
+ #readelf: --header
+ #...
+ Flags:.* 4120.*
+ #pass
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-11 15:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-11 8:56 Patch to fix merging of EF_MIPS_MACH flags Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).