From ad723a419fd956d984a0956713566453ba8f6a12 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 3 Oct 2016 05:20:21 +0200 Subject: x86_64: Add -mno-sse option This disables generation of any SSE instructions (in particular in stdarg function prologues). Necessary for kernel compiles. --- libtcc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index 76ee11c..58dddb9 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1303,6 +1303,16 @@ static int tcc_set_flag(TCCState *s, const char *flag_name, int value) flag_name, value); } +static const FlagDef m_defs[] = { +#ifdef TCC_TARGET_X86_64 + { offsetof(TCCState, nosse), FD_INVERT, "sse" }, +#endif + { 0, 0, " no flag" }, +}; +static int tcc_set_m_flag(TCCState *s, const char *flag_name, int value) +{ + return set_flag(s, m_defs, countof(m_defs), flag_name, value); +} static int strstart(const char *val, const char **str) { @@ -1778,9 +1788,10 @@ reparse: s->soname = tcc_strdup(optarg); break; case TCC_OPTION_m: - if (strcmp(optarg, "32") && strcmp(optarg, "64")) + if (!strcmp(optarg, "32") || !strcmp(optarg, "64")) + s->option_m = tcc_strdup(optarg); + else if (tcc_set_m_flag(s, optarg, 1) < 0) goto unsupported_option; - s->option_m = tcc_strdup(optarg); break; case TCC_OPTION_o: if (s->outfile) { -- cgit v1.3.1