build: Check for objcopy options
authorMatthias Clasen <mclasen@redhat.com>
Fri, 28 Jul 2023 06:05:03 +0000 (09:05 +0300)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 28 Jul 2023 06:06:14 +0000 (09:06 +0300)
Check that objcopy understands the --set-section-alignment
option that we are now using.

meson.build

index ee75e706c7ffe64613183bbc1c61cd03fd0bd84c..4e9d7ca1fa81d8ea7fbf71dd59424e4ed9b36176 100644 (file)
@@ -742,9 +742,11 @@ build_gir = gir.found() and (get_option('introspection').enabled() or
 glib_compile_resources = find_program('glib-compile-resources')
 
 objcopy_supports_add_symbol = false
+objcopy_supports_section_alignment = false
 objcopy = find_program('objcopy', required : false)
 if objcopy.found()
   objcopy_supports_add_symbol = run_command(objcopy, '--help', check: false).stdout().contains('--add-symbol')
+  objcopy_supports_section_alignment = run_command(objcopy, '--help', check: false).stdout().contains('--set-section-alignment')
 endif
 
 ld_is_bfd = false
@@ -753,7 +755,7 @@ if ld.found()
   ld_is_bfd = run_command(ld, '--version', check: false).stdout().contains('GNU ld')
 endif
 
-if not meson.is_cross_build() and build_machine.cpu_family() == 'x86_64' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found() and ld_is_bfd
+if not meson.is_cross_build() and build_machine.cpu_family() == 'x86_64' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and objcopy_supports_section_alignment and ld.found() and ld_is_bfd
   can_use_objcopy_for_resources = true
 else
   can_use_objcopy_for_resources = false