All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] configure: Remove -malign-* and fix Clang 14 breakage
@ 2021-08-24  6:18 Fangrui Song
  2021-08-24  6:18 ` [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions} Fangrui Song
  2021-08-24  6:18 ` [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1 Fangrui Song
  0 siblings, 2 replies; 9+ messages in thread
From: Fangrui Song @ 2021-08-24  6:18 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko
  Cc: Fangrui Song

This replaces
https://lists.gnu.org/archive/html/grub-devel/2021-08/threads.html
("[PATCH v2] configure: Check -falign-jumps=1 -falign-functions=1 beside -")

Fangrui Song (2):
  configure: Remove obsoleted -malign-{jumps,loops,functions}
  configure: Check -falign-jumps=1 -falign-functions=1 beside
    -falign-loops=1

 configure.ac | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

-- 
2.33.0.rc2.250.ged5fa647cd-goog



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions}
  2021-08-24  6:18 [PATCH 0/2] configure: Remove -malign-* and fix Clang 14 breakage Fangrui Song
@ 2021-08-24  6:18 ` Fangrui Song
  2021-08-24  6:24   ` Paul Menzel
  2021-08-24  6:18 ` [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1 Fangrui Song
  1 sibling, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2021-08-24  6:18 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko
  Cc: Fangrui Song

GCC warns `cc1: warning: ‘-malign-loops’ is obsolete, use ‘-falign-loops’`.
Clang silently ignores -malign-{jumps,loops,functions}.

The preferred -falign-* forms have been supported since GCC 3.2, so just
remove -malign-{jumps,loops,functions}.

Signed-off-by: Fangrui Song <maskray@google.com>
---
 configure.ac | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index bee28dbeb..9a12151bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -805,17 +805,8 @@ if test "x$target_cpu" = xi386; then
 	[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
 
-- 
2.33.0.rc2.250.ged5fa647cd-goog



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
  2021-08-24  6:18 [PATCH 0/2] configure: Remove -malign-* and fix Clang 14 breakage Fangrui Song
  2021-08-24  6:18 ` [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions} Fangrui Song
@ 2021-08-24  6:18 ` Fangrui Song
  2021-08-24  6:25   ` Paul Menzel
  2021-08-25 13:24   ` Daniel Kiper
  1 sibling, 2 replies; 9+ messages in thread
From: Fangrui Song @ 2021-08-24  6:18 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko
  Cc: Fangrui Song

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.

Signed-off-by: Fangrui Song <maskray@google.com>
---
 configure.ac | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9a12151bd..8625e6776 100644
--- a/configure.ac
+++ b/configure.ac
@@ -798,8 +798,9 @@ 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])
-- 
2.33.0.rc2.250.ged5fa647cd-goog



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions}
  2021-08-24  6:18 ` [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions} Fangrui Song
@ 2021-08-24  6:24   ` Paul Menzel
  2021-08-25 13:19     ` Daniel Kiper
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Menzel @ 2021-08-24  6:24 UTC (permalink / raw)
  To: Fāng-ruì Sòng
  Cc: grub-devel, Daniel Kiper, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko

Dear Fāng-ruì,


Am 24.08.21 um 08:18 schrieb Fangrui Song via Grub-devel:
> GCC warns `cc1: warning: ‘-malign-loops’ is obsolete, use ‘-falign-loops’`.
> Clang silently ignores -malign-{jumps,loops,functions}.
> 
> The preferred -falign-* forms have been supported since GCC 3.2, so just
> remove -malign-{jumps,loops,functions}.

In `INSTALL` under *The Requirements* at least GCC 5.1 is required.

> * GCC 5.1.0 or later
>   Experimental support for clang 3.8.0 or later (results in much bigger binaries)
>   for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64

So, this works.

> Signed-off-by: Fangrui Song <maskray@google.com>
> ---
>   configure.ac | 9 ---------
>   1 file changed, 9 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index bee28dbeb..9a12151bd 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -805,17 +805,8 @@ if test "x$target_cpu" = xi386; then
>   	[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
>   

Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
  2021-08-24  6:18 ` [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1 Fangrui Song
@ 2021-08-24  6:25   ` Paul Menzel
  2021-08-25 13:24   ` Daniel Kiper
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Menzel @ 2021-08-24  6:25 UTC (permalink / raw)
  To: Fāng-ruì Sòng
  Cc: grub-devel, Daniel Kiper, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko

Dear Fāng-ruì,


Am 24.08.21 um 08:18 schrieb Fangrui Song via Grub-devel:
> 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.
> 
> Signed-off-by: Fangrui Song <maskray@google.com>
> ---
>   configure.ac | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9a12151bd..8625e6776 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -798,8 +798,9 @@ 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])
> 

Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions}
  2021-08-24  6:24   ` Paul Menzel
@ 2021-08-25 13:19     ` Daniel Kiper
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Kiper @ 2021-08-25 13:19 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Fāng-ruì Sòng, grub-devel, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko

On Tue, Aug 24, 2021 at 08:24:14AM +0200, Paul Menzel wrote:
> Dear Fāng-ruì,
>
> Am 24.08.21 um 08:18 schrieb Fangrui Song via Grub-devel:
> > GCC warns `cc1: warning: ‘-malign-loops’ is obsolete, use ‘-falign-loops’`.
> > Clang silently ignores -malign-{jumps,loops,functions}.
> >
> > The preferred -falign-* forms have been supported since GCC 3.2, so just
> > remove -malign-{jumps,loops,functions}.
>
> In `INSTALL` under *The Requirements* at least GCC 5.1 is required.
>
> > * GCC 5.1.0 or later
> >   Experimental support for clang 3.8.0 or later (results in much bigger binaries)
> >   for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
>
> So, this works.
>
> > Signed-off-by: Fangrui Song <maskray@google.com>
> > ---
> >   configure.ac | 9 ---------
> >   1 file changed, 9 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index bee28dbeb..9a12151bd 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -805,17 +805,8 @@ if test "x$target_cpu" = xi386; then
> >   	[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
>
> Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
  2021-08-24  6:18 ` [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1 Fangrui Song
  2021-08-24  6:25   ` Paul Menzel
@ 2021-08-25 13:24   ` Daniel Kiper
  2021-08-25 16:34     ` Fangrui Song
  1 sibling, 1 reply; 9+ messages in thread
From: Daniel Kiper @ 2021-08-25 13:24 UTC (permalink / raw)
  To: Fangrui Song
  Cc: grub-devel, Alex Burmashev, Vladimir 'phcoder' Serbinenko

On Mon, Aug 23, 2021 at 11:18:38PM -0700, Fangrui Song wrote:
> 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.
>
> Signed-off-by: Fangrui Song <maskray@google.com>
> ---
>  configure.ac | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9a12151bd..8625e6776 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -798,8 +798,9 @@ 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"

I would prefer if you add a separate check for every -falign-* option.

Daniel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
  2021-08-25 13:24   ` Daniel Kiper
@ 2021-08-25 16:34     ` Fangrui Song
  2021-08-26 14:13       ` Daniel Kiper
  0 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2021-08-25 16:34 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: grub-devel, Alex Burmashev, Vladimir 'phcoder' Serbinenko

[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

On 2021-08-25, Daniel Kiper wrote:
>On Mon, Aug 23, 2021 at 11:18:38PM -0700, Fangrui Song wrote:
>> 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.
>>
>> Signed-off-by: Fangrui Song <maskray@google.com>
>> ---
>>  configure.ac | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 9a12151bd..8625e6776 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -798,8 +798,9 @@ 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"
>
>I would prefer if you add a separate check for every -falign-* option.
>
>Daniel

The attached patch checks both -falign-jumps=1 and -falign-loops=1

[-- Attachment #2: 0001-configure-Check-falign-jumps-1-beside-falign-loops-1.patch --]
[-- Type: text/x-diff, Size: 1916 bytes --]

From fbef8198d26babeb402b480d333a4a5212069afb Mon Sep 17 00:00:00 2001
From: Fangrui Song <maskray@google.com>
Date: Wed, 25 Aug 2021 09:28:46 -0700
Subject: [PATCH] configure: Check -falign-jumps=1 beside -falign-loops=1

Clang does not support -falign-jumps and only recently gained support
for -falign-loops. -falign-jumps=1 should be tested beside
-fliang-loops=1 to avoid passing unrecognized options to Clang:

    clang-14: error: optimization flag '-falign-jumps=1' is not supported [-Werror,-Wignored-optimization-argument]

-falign-functions=1 is supported by GCC 5.1.0/Clang 3.8.0, so just add
the option unconditionally.

Signed-off-by: Fangrui Song <maskray@google.com>
---
 configure.ac | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 9a12151bd..91a6ef128 100644
--- a/configure.ac
+++ b/configure.ac
@@ -798,6 +798,8 @@ fi
 
 # Force no alignment to save space on i386.
 if test "x$target_cpu" = xi386; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -falign-functions=1"
+
   AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
     CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
@@ -806,7 +808,18 @@ if test "x$target_cpu" = xi386; then
   ])
 
   if test "x$grub_cv_cc_falign_loop" = xyes; then
-    TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
+    TARGET_CFLAGS="$TARGET_CFLAGS -falign-loops=1"
+  fi
+
+  AC_CACHE_CHECK([whether -falign-jumps works], [grub_cv_cc_falign_jumps], [
+    CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -Werror"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+        [grub_cv_cc_falign_jumps=yes],
+	[grub_cv_cc_falign_jumps=no])
+  ])
+
+  if test "x$grub_cv_cc_falign_jumps" = xyes; then
+    TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1"
   fi
 fi
 
-- 
2.33.0.rc2.250.ged5fa647cd-goog


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
  2021-08-25 16:34     ` Fangrui Song
@ 2021-08-26 14:13       ` Daniel Kiper
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Kiper @ 2021-08-26 14:13 UTC (permalink / raw)
  To: Fangrui Song
  Cc: grub-devel, Alex Burmashev, Vladimir 'phcoder' Serbinenko

On Wed, Aug 25, 2021 at 09:34:41AM -0700, Fangrui Song wrote:
> On 2021-08-25, Daniel Kiper wrote:
> > On Mon, Aug 23, 2021 at 11:18:38PM -0700, Fangrui Song wrote:
> > > 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.
> > >
> > > Signed-off-by: Fangrui Song <maskray@google.com>
> > > ---
> > >  configure.ac | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/configure.ac b/configure.ac
> > > index 9a12151bd..8625e6776 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -798,8 +798,9 @@ 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"
> >
> > I would prefer if you add a separate check for every -falign-* option.
> >
> > Daniel
>
> The attached patch checks both -falign-jumps=1 and -falign-loops=1

> From fbef8198d26babeb402b480d333a4a5212069afb Mon Sep 17 00:00:00 2001
> From: Fangrui Song <maskray@google.com>
> Date: Wed, 25 Aug 2021 09:28:46 -0700
> Subject: [PATCH] configure: Check -falign-jumps=1 beside -falign-loops=1
>
> Clang does not support -falign-jumps and only recently gained support
> for -falign-loops. -falign-jumps=1 should be tested beside
> -fliang-loops=1 to avoid passing unrecognized options to Clang:
>
>     clang-14: error: optimization flag '-falign-jumps=1' is not supported [-Werror,-Wignored-optimization-argument]
>
> -falign-functions=1 is supported by GCC 5.1.0/Clang 3.8.0, so just add
> the option unconditionally.
>
> Signed-off-by: Fangrui Song <maskray@google.com>
> ---
>  configure.ac | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9a12151bd..91a6ef128 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -798,6 +798,8 @@ fi
>
>  # Force no alignment to save space on i386.
>  if test "x$target_cpu" = xi386; then
> +  TARGET_CFLAGS="$TARGET_CFLAGS -falign-functions=1"
> +
>    AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
>      CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
>      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> @@ -806,7 +808,18 @@ if test "x$target_cpu" = xi386; then
>    ])
>
>    if test "x$grub_cv_cc_falign_loop" = xyes; then
> -    TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
> +    TARGET_CFLAGS="$TARGET_CFLAGS -falign-loops=1"
> +  fi
> +
> +  AC_CACHE_CHECK([whether -falign-jumps works], [grub_cv_cc_falign_jumps], [
> +    CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -Werror"
> +    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> +        [grub_cv_cc_falign_jumps=yes],
> +	[grub_cv_cc_falign_jumps=no])

It seems to me formatting is broken somehow here. It should be the same
like for -falign-loops detection.

Otherwise LGTM...

Please repost both patches using "git send-email" as v3.

You can add Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> and
Paul's Acked-by to the patches before posting. If there are no
objections I will merge them and other reviewed patches next week...

Daniel


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-26 14:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  6:18 [PATCH 0/2] configure: Remove -malign-* and fix Clang 14 breakage Fangrui Song
2021-08-24  6:18 ` [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, functions} Fangrui Song
2021-08-24  6:24   ` Paul Menzel
2021-08-25 13:19     ` Daniel Kiper
2021-08-24  6:18 ` [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1 Fangrui Song
2021-08-24  6:25   ` Paul Menzel
2021-08-25 13:24   ` Daniel Kiper
2021-08-25 16:34     ` Fangrui Song
2021-08-26 14:13       ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.