From ba8980f492d39040ef13c78acf64410e47a9881d Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 21 Jun 2020 02:03:46 +0200 Subject: [PATCH] limit gnu_inline hack to macos some linux programs (kernel) really want to have 'extern inline' functions be visible from other units, i.e. not be static, but also mark them as always_inline. That's -fgnu89-inline semantics, so it's fine, but we don't (yet) implement this, so we can't make them static just so. But we do need this hack on MacOS due to some uses in system headers (see commit f18f8651). So, for now conditionalize the hack on Mach-O. --- tccgen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tccgen.c b/tccgen.c index e49407dd..8fa59581 100644 --- a/tccgen.c +++ b/tccgen.c @@ -8229,6 +8229,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) sym = type.ref; if (sym->f.func_type == FUNC_OLD && l == VT_CONST) decl0(VT_CMP, 0, sym); +#ifdef TCC_TARGET_MACHO if (sym->f.func_alwinl && ((type.t & (VT_EXTERN | VT_INLINE)) == (VT_EXTERN | VT_INLINE))) { @@ -8239,6 +8240,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) type.t &= ~VT_EXTERN; type.t |= VT_STATIC; } +#endif /* always compile 'extern inline' */ if (type.t & VT_EXTERN) type.t &= ~VT_INLINE;