diff --git a/mingw-w64-binutils/0200-prevent-problems-with-section-alignment.patch b/mingw-w64-binutils/0200-prevent-problems-with-section-alignment.patch new file mode 100644 index 0000000000000..237c573b7510e --- /dev/null +++ b/mingw-w64-binutils/0200-prevent-problems-with-section-alignment.patch @@ -0,0 +1,49 @@ +From ec8f76882145c71bef81a9cadf0bf51ff9fa5b35 Mon Sep 17 00:00:00 2001 +From: Jon Turney +Date: Fri, 25 Nov 2016 09:47:31 +0000 +Subject: [PATCH] Prevent problems with section alignment by not shrinking the + .rsrc section. + + PR ld/20193 + * peXXigen.c (rsrc_process_section): Do not shrink the merged + .rsrc section. +--- + bfd/peXXigen.c | 22 ++-------------------- + 1 file changed, 2 insertions(+), 20 deletions(-) + +diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c +index 0bbd200..3a16ef0 100644 +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -4319,26 +4319,8 @@ rsrc_process_section (bfd * abfd, + rsrc_write_directory (& write_data, & new_table); + + /* Step five: Replace the old contents with the new. +- We recompute the size as we may have lost entries due to mergeing. */ +- size = ((write_data.next_data - new_data) + 3) & ~ 3; +- +- { +- int page_size; +- +- if (coff_data (abfd)->link_info) +- { +- page_size = pe_data (abfd)->pe_opthdr.FileAlignment; +- +- /* If no file alignment has been set, default to one. +- This repairs 'ld -r' for arm-wince-pe target. */ +- if (page_size == 0) +- page_size = 1; +- } +- else +- page_size = PE_DEF_FILE_ALIGNMENT; +- size = (size + page_size - 1) & - page_size; +- } +- ++ We don't recompute the size as it's too late here to shrink section. ++ See PR ld/20193 for more details. */ + bfd_set_section_contents (pfinfo->output_bfd, sec, new_data, 0, size); + sec->size = sec->rawsize = size; + +-- +2.9.3 + diff --git a/mingw-w64-binutils/0200-try-fix-isue-with-embedded-manifest.patch b/mingw-w64-binutils/0200-try-fix-isue-with-embedded-manifest.patch deleted file mode 100644 index feef6408d41d3..0000000000000 --- a/mingw-w64-binutils/0200-try-fix-isue-with-embedded-manifest.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c -index c09779a..a51b384 100644 ---- a/bfd/peXXigen.c -+++ b/bfd/peXXigen.c -@@ -4097,6 +4097,8 @@ rsrc_process_section (bfd * abfd, - unsigned int num_input_rsrc = 0; - unsigned int max_num_input_rsrc = 4; - ptrdiff_t * rsrc_sizes = NULL; -+ unsigned long page_size; -+ - - new_table.names.num_entries = 0; - new_table.ids.num_entries = 0; -@@ -4274,22 +4277,25 @@ rsrc_process_section (bfd * abfd, - We recompute the size as we may have lost entries due to mergeing. */ - size = ((write_data.next_data - new_data) + 3) & ~ 3; - -- { -- int page_size; -- -- if (coff_data (abfd)->link_info) -- { -- page_size = pe_data (abfd)->pe_opthdr.FileAlignment; -+ if (coff_data (abfd)->link_info) -+ { -+ page_size = pe_data (abfd)->pe_opthdr.FileAlignment; - -- /* If no file alignment has been set, default to one. -- This repairs 'ld -r' for arm-wince-pe target. */ -- if (page_size == 0) -- page_size = 1; -- } -- else -- page_size = PE_DEF_FILE_ALIGNMENT; -- size = (size + page_size - 1) & - page_size; -- } -+ /* If no file alignment has been set, default to one. -+ This repairs 'ld -r' for arm-wince-pe target. */ -+ if (page_size == 0) -+ page_size = 1; -+ } -+ else -+ page_size = PE_DEF_FILE_ALIGNMENT; -+ -+ size = (size + page_size - 1) & - page_size; -+ /* PR gcc/69880: We must ensure that there are no gaps between the end -+ of the .rsrc section and whichever section comes next in the file. -+ This does mean that we can end up with a lot of unused space at -+ the end of the .rsrc section, but at least this way works. */ -+ if (sec->next && sec->next->filepos > (file_ptr)(sec->filepos + size)) -+ size = sec->next->filepos - sec->filepos; - - bfd_set_section_contents (pfinfo->output_bfd, sec, new_data, 0, size); - sec->size = sec->rawsize = size; diff --git a/mingw-w64-binutils/PKGBUILD b/mingw-w64-binutils/PKGBUILD index 8615d37a38cfb..dcf26eea740db 100644 --- a/mingw-w64-binutils/PKGBUILD +++ b/mingw-w64-binutils/PKGBUILD @@ -5,7 +5,7 @@ _realname=binutils pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgver=2.27 -pkgrel=4 +pkgrel=5 pkgdesc="A set of programs to assemble and manipulate binary and object files (mingw-w64)" arch=('any') url="http://www.gnu.org/software/binutils/" @@ -31,7 +31,7 @@ source=(https://ftp.gnu.org/gnu/binutils/${_realname}-${pkgver}.tar.bz2{,.sig} 0017-fix-iconv-linking.all.patch 0110-binutils-mingw-gnu-print.patch 0018-binutils-PC64-PCRQUAD-relocation-fix.mingw32.patch - 0200-try-fix-isue-with-embedded-manifest.patch) + 0200-prevent-problems-with-section-alignment.patch) sha256sums=('369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88' 'SKIP' '93296b909e1a4f9d8a4bbe2437aafa17ca565ef6642a9812b0360c05be228c9d' @@ -48,7 +48,7 @@ sha256sums=('369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88' '6b336f218443a95e141d231e4fab726c85d27de7c60ad1ce9fb1a1687943a1ce' '0f145655d4f2aae3383e0c0269d0c47b8a7176144bf0595425fc38b7ebf53153' '2d44aff41789cbac293a09901385341309153c8b3c155587e620047c4fe52033' - '3372fb5bbc717691cfbe0f2a7a3ff46a2bbb82c21f774b70f55ef36bcd58141d') + '8e7eccaf77bf99a67c436891b43f9f54d3ab5254daff9275a89faa9e61e2a6d9') validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93') prepare() { @@ -70,7 +70,7 @@ prepare() { # Upstream patches # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69880 - patch -p1 -i "${srcdir}"/0200-try-fix-isue-with-embedded-manifest.patch + patch -p1 -i "${srcdir}"/0200-prevent-problems-with-section-alignment.patch } build() {