configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
PATCH v2 1/1 configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
Clang does not support -falign-jumps and only recently gained support for -falign-loops. Test all the alignment options to avoid passing unrecognized options to Clang:
clang-14: error: optimization flag '-falign-jumps=1' is not supported [-Werror,-Wignored-optimization-argument]
When compiled with older Clang, the alignment options are not added, so just avoid the complexity for each option.
While here, remove checks for the obsoleted -malign-* forms. GCC has supported the preferred -falign-* forms since 3.2.
--- configure.ac | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
configure.ac +3 -11
@@ -798,24 +798,16 @@ fi # Force no alignment to save space on i386. if test "x$target_cpu" = xi386; then - AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ - CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror" + AC_CACHE_CHECK([whether -falign-jumps=1 -falign-loops=1 -falign-functions=1 works], + [grub_cv_cc_falign_loop], [ + CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Werror" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [grub_cv_cc_falign_loop=yes], [grub_cv_cc_falign_loop=no]) ]) - AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [ - CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_malign_loop=yes], - [grub_cv_cc_malign_loop=no]) - ]) - if test "x$grub_cv_cc_falign_loop" = xyes; then TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" - elif test "x$grub_cv_cc_malign_loop" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" fi fi
Signature · 1 line
2.33.0.rc2.250.ged5fa647cd-goog
Dear Fāng-ruì,
Am 24.08.21 um 07:53 schrieb Fangrui Song via Grub-devel:
Quoted 11 lines
Clang does not support -falign-jumps and only recently gained support for -falign-loops. Test all the alignment options to avoid passing unrecognized options to Clang:
clang-14: error: optimization flag '-falign-jumps=1' is not supported [-Werror,-Wignored-optimization-argument]
When compiled with older Clang, the alignment options are not added, so just avoid the complexity for each option.
While here, remove checks for the obsoleted -malign-* forms. GCC has supported the preferred -falign-* forms since 3.2.
Thank you for the cleanup. Could you put this in a separate commit please (and maybe order it first)?
Quoted 4 lines
Signed-off-by Fangrui Song <[email protected]>--- configure.ac | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
[…]
Kind regards,
Paul