From 15e0dc08a67003f72c59a1f06d762245824d2ae6 Mon Sep 17 00:00:00 2001 From: Daniel Glöckner Date: Fri, 5 Sep 2008 21:08:37 +0200 Subject: Allow to use libgcc instead of libtcc1 This patch adds a switch --with-libgcc to configure. When passed it prevents libtcc1.a from being built and links to /lib/libgcc_s.so.1 instead of PREFIX/lib/tcc/libtcc1.a. It will work on ARM when using libgcc from GCC >= 4.2.0. Prior versions don't have the __floatun[sd]i[sdx]f functions. It won't work on i386 because of two missing symbols emitted when floats are cast to integers, but users can provide those symbols (global short constants) in their code if needed. Daniel --- tccelf.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tccelf.c') diff --git a/tccelf.c b/tccelf.c index 7de8a48..aa2df9b 100644 --- a/tccelf.c +++ b/tccelf.c @@ -992,7 +992,9 @@ static void add_init_array_defines(TCCState *s1, const char *section_name) /* add tcc runtime libraries */ static void tcc_add_runtime(TCCState *s1) { +#if defined(CONFIG_TCC_BCHECK) || !defined(CONFIG_USE_LIBGCC) char buf[1024]; +#endif #ifdef CONFIG_TCC_BCHECK if (do_bounds_check) { @@ -1028,8 +1030,12 @@ static void tcc_add_runtime(TCCState *s1) if (!s1->nostdlib) { tcc_add_library(s1, "c"); +#ifdef CONFIG_USE_LIBGCC + tcc_add_file(s1, CONFIG_SYSROOT "/lib/libgcc_s.so.1"); +#else snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.a"); tcc_add_file(s1, buf); +#endif } /* add crt end if not memory output */ if (s1->output_type != TCC_OUTPUT_MEMORY && !s1->nostdlib) { -- cgit v1.3.1