From: Fangrui Song <maskray@google.com>
To: Daniel Kiper <daniel.kiper@oracle.com>
Cc: grub-devel@gnu.org,
Alex Burmashev <alexander.burmashev@oracle.com>,
Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Subject: Re: [PATCH 2/2] configure: Check -falign-jumps=1 -falign-functions=1 beside -falign-loops=1
Date: Wed, 25 Aug 2021 09:34:41 -0700 [thread overview]
Message-ID: <20210825163441.vfzgujarnnq2rs4l@google.com> (raw)
In-Reply-To: <20210825132408.owyrc2gm72zgg5s6@tomti.i.net-space.pl>
[-- 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
next prev parent reply other threads:[~2021-08-25 16:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-08-26 14:13 ` Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210825163441.vfzgujarnnq2rs4l@google.com \
--to=maskray@google.com \
--cc=alexander.burmashev@oracle.com \
--cc=daniel.kiper@oracle.com \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.