From: Willy Tarreau Date: Wed, 24 May 2023 19:37:06 +0000 (+0200) Subject: BUILD: compiler: systematically set USE_OBSOLETE_LINKER with TCC X-Git-Tag: v2.8-dev13~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b298882acccc73a6d803d54da3dda484cbb35c02;p=thirdparty%2Fhaproxy.git BUILD: compiler: systematically set USE_OBSOLETE_LINKER with TCC TCC silently ignores the weak and section attributes, which ruins the initcalls. Technically we're exactly in the same situation as with an obsolete linker. Let's just automatically set the flag if TCC is detected, this avoids surprises where the program compiles but does not start. No backport is needed. --- diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h index 86d4ddf5a7..ff93df780b 100644 --- a/include/haproxy/compiler.h +++ b/include/haproxy/compiler.h @@ -127,6 +127,13 @@ #define __maybe_unused __attribute__((unused)) #endif +/* TCC doesn't support weak attribute, sections etc and needs the more portable + * obsolete linker model instead. + */ +#if defined(__TINYC__) && !defined(USE_OBSOLETE_LINKER) +#define USE_OBSOLETE_LINKER 1 +#endif + /* These macros are used to declare a section name for a variable. * WARNING: keep section names short, as MacOS limits them to 16 characters. * The _START and _STOP attributes have to be placed after the start and stop