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
This commit is contained in:
Daniel Glöckner
2008-09-05 21:08:37 +02:00
committed by grischka
parent 256f6e6200
commit 15e0dc08a6
3 changed files with 28 additions and 4 deletions

View File

@ -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) {