forked from msys2/MINGW-packages
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
binutils: Proposed patch for issue msys2/MSYS2-packages#454
- Loading branch information
Showing
2 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
mingw-w64-binutils/0200-try-fix-isue-with-embedded-manifest.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters