This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: x86_64-pc-mingw32 needs pc relative instead of relative relocations
- From: Kai Tietz <Kai dot Tietz at onevision dot com>
- To: binutils at sourceware dot org
- Date: Wed, 7 Mar 2007 14:29:05 +0100
- Subject: PATCH: x86_64-pc-mingw32 needs pc relative instead of relative relocations
Hallo,
I noticed, that for x86_64-pc-mingw32 target the indirect jump for import
libraries is PC-relative. Therefore I want to sent this patch for
approval.
Regards,
i.A. Kai Tietz
ChangeLog:
* binutils/dlltool.c: () Use pc-relative relocation instead of
relative relocation for x86_64-pc-mingw32 target
* ld/pe-dll.c: () Ditto
Patch:
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.74
diff -b -u -r1.74 dlltool.c
--- binutils/dlltool.c 17 Feb 2007 13:33:54 -0000 1.74
+++ binutils/dlltool.c 7 Mar 2007 13:27:31 -0000
@@ -2412,6 +2412,11 @@
BFD_RELOC_16_GOTOFF);
rel->sym_ptr_ptr = iname_pp;
}
+ else if (machine == MX86)
+ {
+ rel->howto = bfd_reloc_type_lookup
(abfd,BFD_RELOC_32_PCRE
+ rel->sym_ptr_ptr = iname_pp;
+ }
else
{
rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
Index: ld/pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.95
diff -b -u -r1.95 pe-dll.c
--- ld/pe-dll.c 19 Jan 2007 15:40:54 -0000 1.95
+++ ld/pe-dll.c 7 Mar 2007 13:28:04 -0000
@@ -1975,7 +1975,11 @@
switch (pe_details->pe_arch)
{
case PE_ARCH_i386:
+#ifdef pe_use_x86_64
+ quick_reloc (abfd, 2, BFD_RELOC_32_PCREL, 2);
+#else
quick_reloc (abfd, 2, BFD_RELOC_32, 2);
+#endif
break;
case PE_ARCH_sh:
quick_reloc (abfd, 8, BFD_RELOC_32, 2);