This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix ELF{32,64}_R_SYM choice in elf-eh-frame.c

elf-eh-frame.c assumes that elf_backend_eh_frame_address_size == 8
iff we're using ELF64 and elf_backend_eh_frame_address_size == 4
iff we're using ELF32.  Unfortunately, MIPS EABI64 uses 8-byte
pointers with ELF32 (don't ask), so we misinterpret the r_info
field and bail out.

This has been silently broken for a long time, but the recent
warning about .eh_frame_hdr has brought it to the fore.

Tested on mipsisa64-elf and x86_64-linux-gnu.  OK to install?


	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Use the
	ELF header to choose between 32-bit and 64-bit relocation structures.

Index: bfd/elf-eh-frame.c
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.62
diff -u -p -r1.62 elf-eh-frame.c
--- bfd/elf-eh-frame.c	12 Jul 2007 07:16:41 -0000	1.62
+++ bfd/elf-eh-frame.c	29 Nov 2007 19:50:00 -0000
@@ -683,7 +683,8 @@ _bfd_elf_discard_section_eh_frame
 			  unsigned long r_symndx;
 #ifdef BFD64
-			  if (ptr_size == 8)
+			  if (elf_elfheader (abfd)->e_ident[EI_CLASS]
+			      == ELFCLASS64)
 			    r_symndx = ELF64_R_SYM (cookie->rel->r_info);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]