diff --git a/mingw-w64-cross-binutils/27aaeda.diff b/mingw-w64-cross-binutils/27aaeda.diff new file mode 100644 index 00000000..29ca87ee --- /dev/null +++ b/mingw-w64-cross-binutils/27aaeda.diff @@ -0,0 +1,36 @@ +From 27aaeda0cdf9f69625b96e3abdb25c8fdbbb3435 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 18 Mar 2015 16:19:59 +0000 +Subject: [PATCH] Fixes a problem generating relocs for import libraries + created by Microsoft tools for the x86_64 architecture. + + PR ld/16598 + * peicode.h (pe_ILF_build_a_bfd): Add support for creating relocs + suitable for the AMD64. +--- + bfd/peicode.h | 9 +++++++++ + 1 files changed, 9 insertions(+) + +diff --git a/bfd/peicode.h b/bfd/peicode.h +index e36568a..200ef5e 100644 +--- a/bfd/peicode.h ++++ b/bfd/peicode.h +@@ -973,6 +973,15 @@ pe_ILF_build_a_bfd (bfd * abfd, + } + else + #endif ++#ifdef AMD64MAGIC ++ if (magic == AMD64MAGIC) ++ { ++ pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset, ++ BFD_RELOC_32_PCREL, (asymbol **) imp_sym, ++ imp_index); ++ } ++ else ++#endif + pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset, + BFD_RELOC_32, (asymbol **) imp_sym, + imp_index); +-- +2.4.0 + diff --git a/mingw-w64-cross-binutils/9ac47a4.diff b/mingw-w64-cross-binutils/9ac47a4.diff new file mode 100644 index 00000000..91687bb5 --- /dev/null +++ b/mingw-w64-cross-binutils/9ac47a4.diff @@ -0,0 +1,30 @@ +From 9ac47a43ffc8e3c73867b9953145a8e7a227132d Mon Sep 17 00:00:00 2001 +From: Toni Spets +Date: Wed, 6 May 2015 14:18:34 +0100 +Subject: [PATCH] Skip discarded resource sections when building a PE resource + table. + + PR ld/18372 + * peXXigen.c (rsrc_process_section): Skip discarded resource + sections. +--- + bfd/peXXigen.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c +index 6aa18ca..c897c64 100644 +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -4160,7 +4160,8 @@ rsrc_process_section (bfd * abfd, + { + asection * rsrc_sec = bfd_get_section_by_name (input, ".rsrc"); + +- if (rsrc_sec != NULL) ++ /* PR 18372 - skip discarded .rsrc sections. */ ++ if (rsrc_sec != NULL && !discarded_section (rsrc_sec)) + { + if (num_input_rsrc == max_num_input_rsrc) + { +-- +2.4.0 + diff --git a/mingw-w64-cross-binutils/PKGBUILD b/mingw-w64-cross-binutils/PKGBUILD index 9b125ebc..4c25c0e2 100644 --- a/mingw-w64-cross-binutils/PKGBUILD +++ b/mingw-w64-cross-binutils/PKGBUILD @@ -6,7 +6,7 @@ pkgname=("${_mingw_suff}-${_realname}") #_basever=2.24.51 #pkgver=${_basever}.20131119 pkgver=2.25 -pkgrel=1 +pkgrel=2 pkgdesc="A set of programs to assemble and manipulate binary and object files" arch=('i686' 'x86_64') url="http://www.gnu.org/software/binutils/" @@ -24,7 +24,10 @@ source=(#"ftp://mirrors.kernel.org/sources.redhat.com/binutils/snapshots/binutil 0008-fix-libiberty-makefile.mingw.patch 0009-fix-libiberty-configure.mingw.patch 0110-binutils-mingw-gnu-print.patch - 0900-binutils-trunk-msys2.patch) + 0900-binutils-trunk-msys2.patch + 27aaeda.diff + a93d5cb.diff + 9ac47a4.diff) md5sums=('d9f3303f802a5b6b0bb73a335ab89d66' 'SKIP' 'f3be04ed70b9d352a2c0e2a80b0706b2' @@ -32,7 +35,10 @@ md5sums=('d9f3303f802a5b6b0bb73a335ab89d66' 'df13a2462c24d14376a09ec1d1609519' '9cd71d49b765932a9701b66dfde00775' '1c34f5ee0ee5d5008a617e1638362d43' - '81d65b787c8979e7a94d232222bb9bc1') + '81d65b787c8979e7a94d232222bb9bc1' + '83e26439fa877c6407fe3b84cdb01e76' + 'c0eaa32bbc4239ebb9bdd95c129ca56a' + 'ac0c62e2653558f7aab8c32ffa23dd4a') _targets="i686-w64-mingw32 x86_64-w64-mingw32" prepare() { @@ -50,7 +56,10 @@ prepare() { # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS" sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure - mkdir ${srcdir}/binutils-build + # Upstream patches + patch -p1 -i "${srcdir}"/27aaeda.diff + patch -p1 -i "${srcdir}"/a93d5cb.diff + patch -p1 -i "${srcdir}"/9ac47a4.diff } build() { diff --git a/mingw-w64-cross-binutils/a93d5cb.diff b/mingw-w64-cross-binutils/a93d5cb.diff new file mode 100644 index 00000000..4fb35268 --- /dev/null +++ b/mingw-w64-cross-binutils/a93d5cb.diff @@ -0,0 +1,33 @@ +From a93d5cb1976818c8d34133fd8798b3df76269f80 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 29 Apr 2015 12:26:46 +0100 +Subject: [PATCH] Add support for absolute PE/x86 relocations. + + PR 17099 + * coff-i386.c (coff_i386_rtype_to_howto): Allow absolute PCRLONG + relocs. +--- + bfd/coff-i386.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c +index 20d2402..b185b81 100644 +--- a/bfd/coff-i386.c ++++ b/bfd/coff-i386.c +@@ -509,7 +509,12 @@ coff_i386_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; + } + +- BFD_ASSERT (sym != NULL); ++ /* PR 17099 - Absolute R_PCRLONG relocations do not need a symbol. */ ++ if (rel->r_type == R_PCRLONG && sym == NULL) ++ *addendp -= rel->r_vaddr; ++ else ++ BFD_ASSERT (sym != NULL); ++ + if (rel->r_type == R_SECREL32 && sym != NULL) + { + bfd_vma osect_vma; +-- +2.4.0 +