Message ID | 20220522090824.11678-1-lucvoo@kernel.org (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | handle clang's option "-meabi gnu" | expand |
On 22.05.2022 11:08:24, Luc Van Oostenryck wrote: > 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> Tested-by: Marc Kleine-Budde <mkl@pengutronix.de> regards, Marc
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 {