Skip to content

Commit

Permalink
binutils: backport patch for msys2/MSYS2-packages#454
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Feb 22, 2017
1 parent 1e31fe6 commit d333206
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From ec8f76882145c71bef81a9cadf0bf51ff9fa5b35 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
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

54 changes: 0 additions & 54 deletions mingw-w64-binutils/0200-try-fix-isue-with-embedded-manifest.patch

This file was deleted.

8 changes: 4 additions & 4 deletions mingw-w64-binutils/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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'
Expand All @@ -48,7 +48,7 @@ sha256sums=('369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88'
'6b336f218443a95e141d231e4fab726c85d27de7c60ad1ce9fb1a1687943a1ce'
'0f145655d4f2aae3383e0c0269d0c47b8a7176144bf0595425fc38b7ebf53153'
'2d44aff41789cbac293a09901385341309153c8b3c155587e620047c4fe52033'
'3372fb5bbc717691cfbe0f2a7a3ff46a2bbb82c21f774b70f55ef36bcd58141d')
'8e7eccaf77bf99a67c436891b43f9f54d3ab5254daff9275a89faa9e61e2a6d9')
validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93')

prepare() {
Expand All @@ -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() {
Expand Down

0 comments on commit d333206

Please sign in to comment.