linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <lucvoo@kernel.org>
To: linux-sparse@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH] handle clang's option "-meabi gnu"
Date: Sun, 22 May 2022 11:08:24 +0200	[thread overview]
Message-ID: <20220522090824.11678-1-lucvoo@kernel.org> (raw)
In-Reply-To: <CAHk-=wit1MGUeFOycVt_qrk8TKBAAHf-9=ekqC=t0snMNpo29g@mail.gmail.com>

From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Clang has an option "-meabi <arg>" which is used by the kernel for ARMv7.
This kind of option, taking a argument without a separating '=', can't
be ignored like most other options and must this be special-cased.

So, add the special case for this option and consume the argument if it's
one of the valid one.

Link: https://lore.kernel.org/r/20220331110118.vr4miyyytqlssjoi@pengutronix.de
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 options.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/options.c b/options.c
index 6704fc8d2c8d..0224c290d322 100644
--- a/options.c
+++ b/options.c
@@ -685,6 +685,19 @@ static const struct flag mflags[] = {
 
 static char **handle_switch_m(char *arg, char **next)
 {
+	if (!strcmp(arg, "meabi") && next[1] && next[1][0] != '-') {
+		// clang has such an option with syntax: -meabi <arg>
+		// It's used by the kernel for armv7.
+		// GCC has the same opion but with no argument.
+		// Parse it here to consume the possible argument.
+		static const char *valid[] = { "gnu", "4", "5", "default", NULL };
+		int i;
+		for (i = 0; valid[i]; i++) {
+			if (!strcmp(next[1], valid[i]))
+				return ++next;
+		}
+	}
+
 	if (!strcmp(arg, "multiarch-dir")) {
 		return handle_multiarch_dir(arg, next);
 	} else {
-- 
2.36.1


  reply	other threads:[~2022-05-22  9:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 11:01 building Linux for ARMv7 with llvm breaks sparse Marc Kleine-Budde
2022-03-31 19:17 ` Linus Torvalds
2022-03-31 19:22   ` Linus Torvalds
2022-03-31 19:31     ` Marc Kleine-Budde
2022-03-31 19:57       ` Linus Torvalds
2022-05-22  9:08         ` Luc Van Oostenryck [this message]
2022-05-23  9:17           ` [PATCH] handle clang's option "-meabi gnu" Marc Kleine-Budde

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=20220522090824.11678-1-lucvoo@kernel.org \
    --to=lucvoo@kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mkl@pengutronix.de \
    --cc=torvalds@linux-foundation.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).