Skip to contentSkip to conversation

configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1

PATCH Superseded Fangrui Song 2 participants 4 messages Aug 16, 2021 – Aug 24, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1

Clang 14.0.0 has implemented -falign-loops=1 but -falign-jumps=1 is still unsupported. The check should test all flags which may be added into CFLAGS.

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -2
index bee28dbeb..b2fd0c3e4 100644
@@ -799,14 +799,14 @@ 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"
+    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"
+    CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1 -Werror"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
         [grub_cv_cc_malign_loop=yes],
 	[grub_cv_cc_malign_loop=no])
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
#1 lore raw

Ping.

This is needed to allow Clang 14.0.0 to build grub.

Quoted 34 lines · Fangrui Song

Clang 14.0.0 has implemented -falign-loops=1 but -falign-jumps=1 is still unsupported. The check should test all flags which may be added into CFLAGS.

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -3
index bee28dbeb..b2fd0c3e4 100644
@@ -799,14 +799,14 @@ 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"
+    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"
+    CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1 -Werror"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
         [grub_cv_cc_malign_loop=yes],
        [grub_cv_cc_malign_loop=no])
--

2.33.0.rc1.237.g0d66db33f3-goog

Signature · 1 line
宋方睿
#2 lore raw
In reply to Fangrui Song

Dear Fangrui,

Am 16.08.21 um 21:06 schrieb Fangrui Song via Grub-devel:

Quoted 2 lines

Clang 14.0.0 has implemented -falign-loops=1 but -falign-jumps=1 is still unsupported. The check should test all flags which may be added

“alignment” flags?

Quoted 12 lines

into CFLAGS.

---
  configure.ac | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +0 -0
index bee28dbeb..b2fd0c3e4 100644

configure.ac fi · line 802

Quoted 5 lines
configure.ac +1 -1
@@ -799,14 +799,14 @@ 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"
+    CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Werror"

I guess the AC_CACHE_CHECK description needs to be updated too?

Please mention in the commit message, why a separate check for each switch is not useful.

configure.ac fi · line 812

Quoted 12 lines
configure.ac +1 -1
      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"
+    CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1 -Werror"
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
          [grub_cv_cc_malign_loop=yes],
  	[grub_cv_cc_malign_loop=no])

When you sent the v2, please include the maintainers listed in MAINTAINERS in the recipient list.

Kind regards,

Paul

#3 lore raw

Hi Paul,

Thank you for your suggestions. I just sent v2
https://lists.gnu.org/archive/html/grub-devel/2021-08/msg00091.html
with a further cleanup.

Quoted 8 lines · Paul Menzel

Dear Fangrui,

Am 16.08.21 um 21:06 schrieb Fangrui Song via Grub-devel:

Quoted 2 lines

Clang 14.0.0 has implemented -falign-loops=1 but -falign-jumps=1 is still unsupported. The check should test all flags which may be added

“alignment” flags?

Done.

Quoted 20 lines
Quoted 12 lines

into CFLAGS.

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +0 -0
index bee28dbeb..b2fd0c3e4 100644

configure.ac fi · line 802

Quoted 5 lines
configure.ac +1 -1
@@ -799,14 +799,14 @@ 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"
+    CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Werror"

I guess the AC_CACHE_CHECK description needs to be updated too?

Quoted 1 line

Please mention in the commit message, why a separate check for each switch is not useful.

Done

Quoted 12 lines

configure.ac fi

Quoted 11 lines
configure.ac +1 -1
     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"
+    CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1 -Werror"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
         [grub_cv_cc_malign_loop=yes],
 	[grub_cv_cc_malign_loop=no])
 
Quoted 1 line

When you sent the v2, please include the maintainers listed in MAINTAINERS in the recipient list.

Done.

Quoted 4 lines

Kind regards,

Paul