]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
objcopy: also check --file-alignment option argument
authorJan Beulich <jbeulich@suse.com>
Fri, 4 Apr 2025 08:25:31 +0000 (10:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 4 Apr 2025 08:25:31 +0000 (10:25 +0200)
... to be a power of two, just like --section-alignment does.

binutils/objcopy.c

index 5048648de0f71dcd82cbe262f47cc1285b6de307..31933e13b7af74617cb9f1de15e0d6d15624b18e 100644 (file)
@@ -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: