[PATCH] handle clang's option "-meabi gnu"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>

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@xxxxxxxxxxxxxx
Reported-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 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




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux