* [PATCH] gcc: configure: Fix the optimization flags cleanup
[not found] <CGME20240202160322eucas1p25517fc683bc772879cde2b2229d4b116@eucas1p2.samsung.com>
@ 2024-02-02 16:02 ` Slava Barinov
0 siblings, 0 replies; only message in thread
From: Slava Barinov @ 2024-02-02 16:02 UTC (permalink / raw)
To: gcc-patches; +Cc: dongkyun.s, Slava Barinov
Currently sed command in flag cleanup removes all the -O[0-9] flags, ignoring
the context. This leads to issues when the optimization flags is passed to
linker:
CFLAGS="-Os -Wl,-O1 -Wl,--hash-style=gnu"
is converted into
CFLAGS="-Os -Wl,-Wl,--hash-style=gnu"
Which leads to configure failure with ld: unrecognized option '-Wl,-Wl'.
gcc/
* configure.ac: Only remove -O[0-9] if not preceded with comma
* configure: Regenerated
---
gcc/configure | 4 ++--
gcc/configure.ac | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/configure b/gcc/configure
index c83e09beea9..fd72034cbc1 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -5472,8 +5472,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# optimizations to be activated explicitly by the toplevel.
case "$CC" in
*/prev-gcc/xgcc*) ;;
- *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/-O[0-9]*[ ]//" `
- CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/-O[0-9]*[ ]//" ` ;;
+ *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/[^,]-O[0-9]*[ ]//" `
+ CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/[^,]-O[0-9]*[ ]//" ` ;;
esac
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 239856a4e20..d62d630d9b7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -467,8 +467,8 @@ AC_LANG(C++)
# optimizations to be activated explicitly by the toplevel.
case "$CC" in
*/prev-gcc/xgcc*) ;;
- *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" `
- CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;;
+ *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/[[^,]]-O[[0-9]]*[[ ]]//" `
+ CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/[[^,]]-O[[0-9]]*[[ ]]//" ` ;;
esac
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-02 16:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20240202160322eucas1p25517fc683bc772879cde2b2229d4b116@eucas1p2.samsung.com>
2024-02-02 16:02 ` [PATCH] gcc: configure: Fix the optimization flags cleanup Slava Barinov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).