[binutils-gdb] objcopy: also check --file-alignment option argument
Jan Beulich
jbeulich@sourceware.org
Fri Apr 4 08:27:26 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4fa9476ad23d5868c2bc4c02dc1a73acaefbcbc2
commit 4fa9476ad23d5868c2bc4c02dc1a73acaefbcbc2
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Apr 4 10:25:31 2025 +0200
objcopy: also check --file-alignment option argument
... to be a power of two, just like --section-alignment does.
Diff:
---
binutils/objcopy.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 5048648de0f..31933e13b7a 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -5943,6 +5943,11 @@ copy_main (int argc, char *argv[])
case OPTION_FILE_ALIGNMENT:
pe_file_alignment = parse_vma (optarg, "--file-alignment");
+ if (power_of_two (pe_file_alignment) == -1)
+ {
+ non_fatal (_("--file-alignment argument is not a power of two: %s - ignoring"), optarg);
+ pe_file_alignment = (bfd_vma) -1;
+ }
break;
case OPTION_HEAP:
More information about the Binutils-cvs
mailing list