This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Prevent problems with section alignment by not shrinking the .rsrc section.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ec8f76882145c71bef81a9cadf0bf51ff9fa5b35

commit ec8f76882145c71bef81a9cadf0bf51ff9fa5b35
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Nov 25 09:47:31 2016 +0000

    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.

Diff:
---
 bfd/ChangeLog  |  6 ++++++
 bfd/peXXigen.c | 22 ++--------------------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a680896..0d79764 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-11-25  Jon Turney  <jon.turney@dronecode.org.uk>
+
+	PR ld/20193
+	* peXXigen.c (rsrc_process_section): Do not shrink the merged
+	.rsrc section.
+
 2016-11-24  Jiong Wang  <jiong.wang@arm.com>
 
 	PR target/20737
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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]