Skip to content

Commit

Permalink
binutils: Proposed patch for issue msys2/MSYS2-packages#454
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexpux committed Feb 21, 2017
1 parent ac5d89b commit 0e79e62
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
54 changes: 54 additions & 0 deletions mingw-w64-binutils/0200-try-fix-isue-with-embedded-manifest.patch
@@ -0,0 +1,54 @@
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;
10 changes: 7 additions & 3 deletions mingw-w64-binutils/PKGBUILD
Expand Up @@ -5,7 +5,7 @@ _realname=binutils
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.27
pkgrel=3
pkgrel=4
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 @@ -30,7 +30,8 @@ source=(https://ftp.gnu.org/gnu/binutils/${_realname}-${pkgver}.tar.bz2{,.sig}
0015-dont-link-ld-to-libiberty.mingw.patch
0017-fix-iconv-linking.all.patch
0110-binutils-mingw-gnu-print.patch
0018-binutils-PC64-PCRQUAD-relocation-fix.mingw32.patch)
0018-binutils-PC64-PCRQUAD-relocation-fix.mingw32.patch
0200-try-fix-isue-with-embedded-manifest.patch)
sha256sums=('369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88'
'SKIP'
'93296b909e1a4f9d8a4bbe2437aafa17ca565ef6642a9812b0360c05be228c9d'
Expand All @@ -46,7 +47,8 @@ sha256sums=('369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88'
'376931c0c2f8f5d655458016ac496f93e75c00bf5538e445c29984920a2f5415'
'6b336f218443a95e141d231e4fab726c85d27de7c60ad1ce9fb1a1687943a1ce'
'0f145655d4f2aae3383e0c0269d0c47b8a7176144bf0595425fc38b7ebf53153'
'2d44aff41789cbac293a09901385341309153c8b3c155587e620047c4fe52033')
'2d44aff41789cbac293a09901385341309153c8b3c155587e620047c4fe52033'
'3372fb5bbc717691cfbe0f2a7a3ff46a2bbb82c21f774b70f55ef36bcd58141d')
validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93')

prepare() {
Expand All @@ -67,6 +69,8 @@ prepare() {
patch -p1 -i "${srcdir}"/0018-binutils-PC64-PCRQUAD-relocation-fix.mingw32.patch

# Upstream patches
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69880
patch -p1 -i "${srcdir}"/0200-try-fix-isue-with-embedded-manifest.patch
}

build() {
Expand Down

0 comments on commit 0e79e62

Please sign in to comment.