build: Check for objcopy options

Check that objcopy understands the --set-section-alignment
option that we are now using.
This commit is contained in:
Matthias Clasen
2023-07-28 09:05:03 +03:00
parent 96145ae8ed
commit c61313cbfe

View 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