From 4fa9476ad23d5868c2bc4c02dc1a73acaefbcbc2 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 4 Apr 2025 10:25:31 +0200 Subject: [PATCH] objcopy: also check --file-alignment option argument ... to be a power of two, just like --section-alignment does. --- 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: -- 2.47.2