From 6a15f15093c71db597d3a9ed117def40b17bf520 Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Fri, 26 Jun 2020 11:36:41 +0200 Subject: [PATCH] Fix coredump on linux when boostrapping tcc with -std=c11 --- tests/libtcc_test_mt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/libtcc_test_mt.c b/tests/libtcc_test_mt.c index 520d3a23..2b6cb384 100644 --- a/tests/libtcc_test_mt.c +++ b/tests/libtcc_test_mt.c @@ -105,6 +105,15 @@ void parse_args(TCCState *s) else if (a[1] == 'L') tcc_add_library_path(s, a+2); else if (a[1] == 'D') { +#if defined(__linux__) \ + && defined(__STDC_VERSION__) \ + && (__STDC_VERSION__ >= 201112L) + /* + * gcc -std=c11 no longer declare strdup which fails with + * coredump (at least on Linux x64). + */ + extern char* strdup(const char*); +#endif char *dup = strdup(a); char *eq = strchr(dup+2, '='); if (eq) { -- 2.11.4.GIT