Accept option "-Os" and define "__OPTIMIZE_SIZE__"

Some headers and source code change macros and
implementation, when __OPTIMIZE_SIZE__ is defined.

This does not change our generated code.

Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
This commit is contained in:
Detlef Riekenberg 2022-04-10 17:32:38 +02:00
parent b3bebdb20a
commit 3ce7bc6efc
2 changed files with 7 additions and 1 deletions

View file

@ -1997,7 +1997,11 @@ reparse:
s->filetype = x | (s->filetype & ~AFF_TYPE_MASK);
break;
case TCC_OPTION_O:
s->optimize = atoi(optarg);
/* Use "-O" as alias for "-O1". */
/* Other common used values: "-O0", "-O1", "-O2", "-O3" and "-Os" */
/* no failure with unsupported options */
x = *optarg;
s->optimize = isnum(x) ? atoi(optarg) : (x) ? x : 1;
break;
case TCC_OPTION_print_search_dirs:
x = OPT_PRINT_DIRS;

View file

@ -3733,6 +3733,8 @@ static void tcc_predefs(TCCState *s1, CString *cs, int is_asm)
putdef(cs, "__CHAR_UNSIGNED__");
if (s1->optimize > 0)
putdef(cs, "__OPTIMIZE__");
if (s1->optimize == 's')
putdef(cs, "__OPTIMIZE_SIZE__");
if (s1->option_pthread)
putdef(cs, "_REENTRANT");
if (s1->leading_underscore)