This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
incorrect use of bfd_arch_bits_per_address in elf32-mips.c
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 07 Apr 2003 17:25:04 -0300
- Subject: incorrect use of bfd_arch_bits_per_address in elf32-mips.c
- Organization: GCC Team, Red Hat
It doesn't seem right to infer bfd_arch_mips_per_address when trying
to figure out whether the ABI uses 32- or 64-bit addresses. Back when
we rejected inter-linking of code for 32-bit and 64-bit ISAs, we'd
probably always get it right, but this is now allowed, so this could
possibly break o32 (and perhaps other 32-bit arches). I unfortunately
have no idea of how to trigger this particular code chunk (defining a
function with attribute constructor didn't do it), so this hasn't got
much testing. Ok to install anyway?
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva at redhat dot com>
* elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor)
pointer size from ABI, not arch_bits_per_address.
Index: bfd/elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.163
diff -u -p -r1.163 elf32-mips.c
--- bfd/elf32-mips.c 12 Mar 2003 23:05:50 -0000 1.163
+++ bfd/elf32-mips.c 7 Apr 2003 20:21:10 -0000
@@ -1440,11 +1440,12 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, c
case BFD_RELOC_CTOR:
/* We need to handle BFD_RELOC_CTOR specially.
Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the
- size of addresses on this architecture. */
- if (bfd_arch_bits_per_address (abfd) == 32)
- return &howto_table[(int) R_MIPS_32];
- else
+ size of addresses of the ABI. */
+ if ((elf_elfheader (abfd)->e_flags & (E_MIPS_ABI_O64
+ | E_MIPS_ABI_EABI64)) != 0)
return &elf_mips_ctor64_howto;
+ else
+ return &howto_table[(int) R_MIPS_32];
case BFD_RELOC_MIPS16_JMP:
return &elf_mips16_jump_howto;
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer