diff --git a/tccelf.c b/tccelf.c index c5dc023e..12bdc8d0 100644 --- a/tccelf.c +++ b/tccelf.c @@ -956,10 +956,6 @@ static void tcc_add_runtime(TCCState *s1) { char buf[1024]; - if (!s1->nostdlib) { - snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.a"); - tcc_add_file(s1, buf); - } #ifdef CONFIG_TCC_BCHECK if (do_bounds_check) { unsigned long *ptr; @@ -993,6 +989,9 @@ static void tcc_add_runtime(TCCState *s1) /* add libc */ if (!s1->nostdlib) { tcc_add_library(s1, "c"); + + snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.a"); + tcc_add_file(s1, buf); } /* add crt end if not memory output */ if (s1->output_type != TCC_OUTPUT_MEMORY && !s1->nostdlib) {