This is the mail archive of the binutils@sources.redhat.com 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]

Fix relocation bug


This bugfix feels wrong, so I would like some feedback on why it is
necessary and perhaps a better way to fix it.

The problem was that R_X86_64_PC32 relocations were calculated
wrong. Replacing the bfd_elf_generic_reloc with zeros in the howto table
solved it, but it is probably not correct to do this for all entries.

I'll investigate some of the specialized implementations of this entry,
but I would appreciate it if someone could shed some light on the possible
problem here.

2001-02-28  Bo Thorsen  <bo@suse.de>

	* elf64-x86-64.c (x86_64_elf_howto_table): Replace
	bfd_elf_generic_reloc with zero. Fixes a bug in relocations.

Index: elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.9
diff -u -r1.9 elf64-x86-64.c
--- elf64-x86-64.c	2001/02/26 07:50:22	1.9
+++ elf64-x86-64.c	2001/02/28 09:53:47
@@ -37,37 +37,37 @@
 static reloc_howto_type x86_64_elf_howto_table[] =
 {
   HOWTO(R_X86_64_NONE, 0, 0, 0, false, 0, complain_overflow_dont,
-	bfd_elf_generic_reloc, "R_X86_64_NONE",	false, 0x00000000, 0x00000000, false),
+	0, "R_X86_64_NONE", false, 0x00000000, 0x00000000, false),
   HOWTO(R_X86_64_64, 0, 4, 64, false, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_64", false, MINUS_ONE, MINUS_ONE, false),
+	0, "R_X86_64_64", false, MINUS_ONE, MINUS_ONE, false),
   HOWTO(R_X86_64_PC32, 0, 4, 32, true, 0, complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_PC32", false, 0xffffffff, 0xffffffff, true),
+	0, "R_X86_64_PC32", false, 0xffffffff, 0xffffffff, true),
   HOWTO(R_X86_64_GOT32, 0, 4, 32, false, 0, complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_GOT32", false, 0xffffffff, 0xffffffff, false),
+	0, "R_X86_64_GOT32", false, 0xffffffff, 0xffffffff, false),
   HOWTO(R_X86_64_PLT32, 0, 4, 32, true, 0, complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_PLT32", false, 0xffffffff, 0xffffffff, true),
+	0, "R_X86_64_PLT32", false, 0xffffffff, 0xffffffff, true),
   HOWTO(R_X86_64_COPY, 0, 4, 32, false, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_COPY", false, 0xffffffff, 0xffffffff, false),
+	0, "R_X86_64_COPY", false, 0xffffffff, 0xffffffff, false),
   HOWTO(R_X86_64_GLOB_DAT, 0, 4, 64, false, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_GLOB_DAT", false, MINUS_ONE, MINUS_ONE, false),
+	0, "R_X86_64_GLOB_DAT", false, MINUS_ONE, MINUS_ONE, false),
   HOWTO(R_X86_64_JUMP_SLOT, 0, 4, 64, false, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_JUMP_SLOT", false, MINUS_ONE, MINUS_ONE, false),
+	0, "R_X86_64_JUMP_SLOT", false, MINUS_ONE, MINUS_ONE, false),
   HOWTO(R_X86_64_RELATIVE, 0, 4, 64, false, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_RELATIVE", false, MINUS_ONE, MINUS_ONE, false),
+	0, "R_X86_64_RELATIVE", false, MINUS_ONE, MINUS_ONE, false),
   HOWTO(R_X86_64_GOTPCREL, 0, 4, 32, true,0 , complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_GOTPCREL", false, 0xffffffff, 0xffffffff, true),
+	0, "R_X86_64_GOTPCREL", false, 0xffffffff, 0xffffffff, true),
   HOWTO(R_X86_64_32, 0, 4, 32, false, 0, complain_overflow_unsigned,
-	bfd_elf_generic_reloc, "R_X86_64_32", false, 0xffffffff, 0xffffffff, false),
+	0, "R_X86_64_32", false, 0xffffffff, 0xffffffff, false),
   HOWTO(R_X86_64_32S, 0, 4, 32, false, 0, complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_32S", false, 0xffffffff, 0xffffffff, false),
+	0, "R_X86_64_32S", false, 0xffffffff, 0xffffffff, false),
   HOWTO(R_X86_64_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_16", false, 0xffff, 0xffff, false),
+	0, "R_X86_64_16", false, 0xffff, 0xffff, false),
   HOWTO(R_X86_64_PC16,0, 1, 16, true, 0, complain_overflow_bitfield,
-	bfd_elf_generic_reloc, "R_X86_64_PC16", false, 0xffff, 0xffff, true),
+	0, "R_X86_64_PC16", false, 0xffff, 0xffff, true),
   HOWTO(R_X86_64_8, 0, 0, 8, false, 0, complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_8", false, 0xff, 0xff, false),
+	0, "R_X86_64_8", false, 0xff, 0xff, false),
   HOWTO(R_X86_64_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
-	bfd_elf_generic_reloc, "R_X86_64_PC8", false, 0xff, 0xff, true)
+	0, "R_X86_64_PC8", false, 0xff, 0xff, true)
 };
 
 /* Map BFD relocs to the x86_64 elf relocs.  */

Bo.

-- 

     Bo Thorsen                 |   Lahnsgade 31, st.
     Free software developer    |   5000 Odense C
     SuSE Labs                  |   Denmark


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