aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xconfigure121
-rw-r--r--libtcc.c8
-rw-r--r--tcc.h2
-rw-r--r--tccpe.c2
-rw-r--r--x86_64-gen.c2
6 files changed, 70 insertions, 67 deletions
diff --git a/Makefile b/Makefile
index f6401f4..5fa9659 100644
--- a/Makefile
+++ b/Makefile
@@ -157,7 +157,7 @@ $(WIN32_CROSS) : DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \
$(WIN64_CROSS) : DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
-DCONFIG_TCC_LIBPATHS="\"{B}/lib/64;{B}/lib\""
-$(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE
+$(WINCE_CROSS): DEFINES = -DTCC_TARGET_ARM -DTCC_TARGET_PE
$(C67_CROSS): DEFINES = -DTCC_TARGET_C67 -w # disable warnigs
$(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM
$(ARM_FPA_LD_CROSS)$(EXESUF): DEFINES = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
diff --git a/configure b/configure
index c2668a5..7c5d438 100755
--- a/configure
+++ b/configure
@@ -69,58 +69,6 @@ if test -z "$source_path" -o "$source_path" = "." ; then
source_path_used="no"
fi
-cpu=`uname -m`
-if test $mingw32=yes; then
- if test "$PROCESSOR_ARCHITEW6432" = "AMD64" \
- -o "$PROCESSOR_ARCHITECTURE" = "AMD64"; then
- cpu="x86_64"
- fi
-fi
-
-case "$cpu" in
-x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
- cpu="x86"
- ;;
- x86_64|amd64)
- cpu="x86-64"
- ;;
- arm*)
- case "$cpu" in
- arm|armv4l)
- cpuver=4
- ;;
- armv5tel|armv5tejl)
- cpuver=5
- ;;
- armv6j|armv6l)
- cpuver=6
- ;;
- armv7a|armv7l)
- cpuver=7
- ;;
- esac
- cpu="armv4l"
- ;;
- aarch64)
- cpu="aarch64"
- ;;
- alpha)
- cpu="alpha"
- ;;
- "Power Macintosh"|ppc|ppc64)
- cpu="powerpc"
- ;;
- mips)
- cpu="mips"
- ;;
- s390)
- cpu="s390"
- ;;
- *)
- cpu="unknown"
- ;;
-esac
-
for opt do
eval opt=\"$opt\"
case "$opt" in
@@ -195,12 +143,61 @@ for opt do
esac
done
+if test -z "$cpu" ; then
+ if test -n "$ARCH" ; then
+ cpu="$ARCH"
+ else
+ cpu=`uname -m`
+ fi
+fi
+
+case "$cpu" in
+ x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
+ cpu="x86"
+ ;;
+ x86_64|amd64)
+ cpu="x86-64"
+ ;;
+ arm*)
+ case "$cpu" in
+ arm|armv4l)
+ cpuver=4
+ ;;
+ armv5tel|armv5tejl)
+ cpuver=5
+ ;;
+ armv6j|armv6l)
+ cpuver=6
+ ;;
+ armv7a|armv7l)
+ cpuver=7
+ ;;
+ esac
+ cpu="armv4l"
+ ;;
+ aarch64)
+ cpu="aarch64"
+ ;;
+ alpha)
+ cpu="alpha"
+ ;;
+ "Power Macintosh"|ppc|ppc64)
+ cpu="powerpc"
+ ;;
+ mips)
+ cpu="mips"
+ ;;
+ s390)
+ cpu="s390"
+ ;;
+ *)
+ cpu="unknown"
+ ;;
+esac
+
# Checking for CFLAGS
if test -z "$CFLAGS"; then
CFLAGS="-Wall -g -O2"
- if test "$mingw32" = "yes" -a "$cpu" = "x86-64"; then
- CFLAGS="-m64 $CFLAGS"
- fi
fi
if test "$mingw32" = "yes" ; then
@@ -238,11 +235,8 @@ else
if test x"$bindir" = x""; then
bindir="${execprefix}/bin"
fi
- if test x"$tccdir" = x""; then
- tccdir="tcc"
- fi
if test x"$docdir" = x""; then
- docdir="${sharedir}/doc/${tccdir}"
+ docdir="${sharedir}/doc"
fi
if test x"$mandir" = x""; then
mandir="${sharedir}/man"
@@ -250,7 +244,9 @@ else
if test x"$infodir" = x""; then
infodir="${sharedir}/info"
fi
- tccdir="${libdir}/${tccdir}"
+ if test x"$tccdir" = x""; then
+ tccdir="${libdir}/tcc"
+ fi
fi # mingw32
if test x"$includedir" = x""; then
@@ -284,6 +280,7 @@ Advanced options (experts only):
--ar=AR create archives using AR [$ar]
--extra-cflags= specify compiler flags [$CFLAGS]
--extra-ldflags= specify linker options []
+ --cpu=CPU CPU [$cpu]
--strip-binaries strip symbol tables from resulting binaries
--disable-static make libtcc.so instead of libtcc.a
--disable-rpath disable use of -rpath with the above
@@ -317,9 +314,9 @@ if test -z "$cross_prefix" ; then
if test "$mingw32" = "no" ; then
triplet="$($CONFTEST triplet)"
if test -f "/usr/lib/$triplet/crti.o" ; then
- tcc_lddir="lib/$triplet"
+ tcc_lddir="lib"
multiarch_triplet="$triplet"
- elif test -f "/usr/lib64/crti.o" ; then
+ elif test "$cpu" != "x86" -a -f "/usr/lib64/crti.o" ; then
tcc_lddir="lib64"
fi
diff --git a/libtcc.c b/libtcc.c
index 0f7e476..7cfd054 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -116,7 +116,7 @@ static void tcc_add_systemdir(TCCState *s)
}
#endif
-#ifndef CONFIG_TCC_STATIC
+#if defined TCC_IS_NATIVE && !defined CONFIG_TCC_STATIC
static void dlclose(void *p)
{
FreeLibrary((HMODULE)p);
@@ -481,8 +481,10 @@ static void tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char
cstr_ccat(&str, c);
}
}
- cstr_ccat(&str, '\0');
- dynarray_add(p_ary, p_nb_ary, tcc_strdup(str.data));
+ if (str.size) {
+ cstr_ccat(&str, '\0');
+ dynarray_add(p_ary, p_nb_ary, tcc_strdup(str.data));
+ }
cstr_free(&str);
in = p+1;
} while (*p);
diff --git a/tcc.h b/tcc.h
index 0090ce4..c25ab01 100644
--- a/tcc.h
+++ b/tcc.h
@@ -1535,7 +1535,9 @@ ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str);
ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd);
ST_FUNC int pe_output_file(TCCState * s1, const char *filename);
ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value);
+#ifndef TCC_TARGET_ARM
ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2);
+#endif
#ifdef TCC_TARGET_X86_64
ST_FUNC void pe_add_unwind_data(unsigned start, unsigned end, unsigned stack);
#endif
diff --git a/tccpe.c b/tccpe.c
index 0e88fa9..04a63ea 100644
--- a/tccpe.c
+++ b/tccpe.c
@@ -1447,6 +1447,7 @@ static void pe_print_sections(TCCState *s1, const char *fname)
/* ------------------------------------------------------------- */
/* helper function for load/store to insert one more indirection */
+#ifndef TCC_TARGET_ARM
ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2)
{
Sym *sym;
@@ -1486,6 +1487,7 @@ ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2)
v2->r |= sv->r & VT_LVAL;
return v2;
}
+#endif
ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value)
{
diff --git a/x86_64-gen.c b/x86_64-gen.c
index 921813b..fa2460c 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -1069,8 +1069,8 @@ static X86_64_Mode classify_x86_64_inner(CType *ty)
return mode;
}
-
assert(0);
+ return 0;
}
static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *palign, int *reg_count)