aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorDaniel Glöckner <daniel-gl@gmx.net>2008-09-05 21:08:37 +0200
committergrischka <grischka>2008-09-12 22:22:58 +0200
commit15e0dc08a67003f72c59a1f06d762245824d2ae6 (patch)
tree3082b92909e6b7b9f99e6a8bcd6c684f511781e2 /tccelf.c
parent256f6e6200be1a73cbf663938213778624436cad (diff)
downloadtinycc-15e0dc08a67003f72c59a1f06d762245824d2ae6.tar.gz
tinycc-15e0dc08a67003f72c59a1f06d762245824d2ae6.tar.bz2
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
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c6
1 files changed, 6 insertions, 0 deletions
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) {