linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, Jessica Yu <jeyu@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>
Cc: letux-kernel@openphoenux.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pyra-handheld.com,
	"H. Nikolaus Schaller" <hns@goldelico.com>
Subject: [PATCH 2/2] arch: mips: Fix non-POSIX regexp
Date: Thu,  8 Jul 2021 10:57:10 +0200	[thread overview]
Message-ID: <f1be72eb0fd589df5a535792a3f21949bd46da50.1625734629.git.hns@goldelico.com> (raw)
In-Reply-To: <cover.1625734629.git.hns@goldelico.com>

When cross compiling a MIPS kernel on a BSD based HOSTCC leads
to errors like

  SYNC    include/config/auto.conf.cmd - due to: .config
egrep: empty (sub)expression
  UPD     include/config/kernel.release
  HOSTCC  scripts/dtc/dtc.o - due to target missing

It turns out that egrep uses this egrep pattern:

		(|MINOR_|PATCHLEVEL_)

This is not valid syntax or gives undefined results according
to POSIX 9.5.3 ERE Grammar

	https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html

It seems to be silently accepted by the Linux egrep implementation
while a BSD host complains.

Such patterns can be replaced by a transformation like

	"(|p1|p2)" -> "(p1|p2)?"

Fixes: 48c35b2d245f ("[MIPS] There is no __GNUC_MAJOR__")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 arch/mips/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 258234c35a096..674f68d16a73f 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -321,7 +321,7 @@ KBUILD_LDFLAGS		+= -m $(ld-emul)
 
 ifdef CONFIG_MIPS
 CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
-	egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
+	egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
 	sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
 endif
 
-- 
2.31.1


  parent reply	other threads:[~2021-07-08  8:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08  8:57 [PATCH 0/2] Regex fixes for mips and x86 cross-compile H. Nikolaus Schaller
2021-07-08  8:57 ` [PATCH 1/2] x86/tools/relocs: Fix non-POSIX regexp H. Nikolaus Schaller
2021-08-05 11:52   ` Masahiro Yamada
2021-07-08  8:57 ` H. Nikolaus Schaller [this message]
2021-08-05 11:53   ` [PATCH 2/2] arch: mips: " Masahiro Yamada
2021-07-19 19:04 ` [PATCH 0/2] Regex fixes for mips and x86 cross-compile H. Nikolaus Schaller
2021-07-19 20:37   ` Nick Desaulniers
2021-08-03 15:58     ` H. Nikolaus Schaller
2021-08-05 11:54       ` Masahiro Yamada

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=f1be72eb0fd589df5a535792a3f21949bd46da50.1625734629.git.hns@goldelico.com \
    --to=hns@goldelico.com \
    --cc=bp@alien8.de \
    --cc=emil.l.velikov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jeyu@kernel.org \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@redhat.com \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=x86@kernel.org \
    /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 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 NNTP newsgroup(s).