diff options
author | Jan Beulich <jbeulich@suse.com> | 2025-03-21 08:33:58 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2025-03-21 08:33:58 +0100 |
commit | daf53ffeaa968694f783d4ad6ee0531b9f2bd9a6 (patch) | |
tree | c8563f8e649521cfc87d6e54c3c94e4fbd8c5077 /binutils | |
parent | 37a1bbe9d56e0fc6093a687c55023db7d465da86 (diff) | |
download | binutils-daf53ffeaa968694f783d4ad6ee0531b9f2bd9a6.zip binutils-daf53ffeaa968694f783d4ad6ee0531b9f2bd9a6.tar.gz binutils-daf53ffeaa968694f783d4ad6ee0531b9f2bd9a6.tar.bz2 |
strip: don't corrupt PE binary's section/file alignment
Section and file alignment are supposed to remain unaltered when PE
binaries are stripped. While this is the case when they're strip-ed
individually, passing multiple such files to strip would reset the
two values to their defaults in all but the first of those binaries.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/objcopy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index e2e6bd7..572f22c 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2832,7 +2832,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) if (pe_file_alignment != (bfd_vma) -1) pe->pe_opthdr.FileAlignment = pe_file_alignment; - else + else if (!is_strip) pe_file_alignment = PE_DEF_FILE_ALIGNMENT; if (pe_heap_commit != (bfd_vma) -1) @@ -2846,7 +2846,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) if (pe_section_alignment != (bfd_vma) -1) pe->pe_opthdr.SectionAlignment = pe_section_alignment; - else + else if (!is_strip) pe_section_alignment = PE_DEF_SECTION_ALIGNMENT; if (pe_stack_commit != (bfd_vma) -1) |