mirror of
https://github.com/frida/tinycc
synced 2024-12-24 05:56:49 +03:00
configure: pass CONFIG_xxxDIR/PATH options via commandline
- except for CONFIG_SYSROOT and CONFIG_TCCDIR Strictly neccessary it is only for CONFIG_MULTIARCHDIR because otherwise if it's in config.h it is impossible to leave it undefined. But it is also nicer not to use these definitions for cross-compilers. - Also: lib/Makefile : include ../Makefile for CFLAGS lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
This commit is contained in:
parent
99b801dafc
commit
762a43877b
6
Makefile
6
Makefile
@ -42,13 +42,13 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
NATIVE_DEFINES=-DTCC_TARGET_I386
|
||||
NATIVE_DEFINES+=-DTCC_TARGET_I386
|
||||
else ifeq ($(ARCH),x86-64)
|
||||
NATIVE_DEFINES=-DTCC_TARGET_X86_64
|
||||
NATIVE_DEFINES+=-DTCC_TARGET_X86_64
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),arm)
|
||||
NATIVE_DEFINES=-DTCC_TARGET_ARM
|
||||
NATIVE_DEFINES+=-DTCC_TARGET_ARM
|
||||
NATIVE_DEFINES+=-DWITHOUT_LIBTCC
|
||||
ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3))
|
||||
NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
|
||||
|
48
configure
vendored
48
configure
vendored
@ -304,15 +304,6 @@ if test -z "$cross_prefix" ; then
|
||||
tcc_lddir="lib64"
|
||||
fi
|
||||
|
||||
# gr: FIXME
|
||||
# ldd $CONFTEST gives (ubuntu 8)
|
||||
# linux-gate.so.1 => (0xb7fc3000)
|
||||
# libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e37000)
|
||||
# /lib/ld-linux.so.2 (0xb7fa9000)
|
||||
# result is crap:
|
||||
# CONFIG_LDDIR="lib/tls/i686/cmov"
|
||||
# CONFIG_MUADIR="tls/i686/cmov"
|
||||
#
|
||||
# multiarch_triplet=${libc_dir#*/}
|
||||
# multiarch_triplet=${multiarch_triplet%/}
|
||||
# tcc_lddir="${libc_dir%%/*}"
|
||||
@ -321,8 +312,8 @@ if test -z "$cross_prefix" ; then
|
||||
# fi
|
||||
|
||||
# gr: maybe for after the release:
|
||||
# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
|
||||
# #echo "elfinterp $tcc_elfinterp"
|
||||
# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
|
||||
# echo "elfinterp $tcc_elfinterp"
|
||||
|
||||
fi
|
||||
fi
|
||||
@ -333,18 +324,6 @@ else
|
||||
esac
|
||||
fi
|
||||
|
||||
# gr: maybe for after the release:
|
||||
# run compiler to see if it supports FLAG, if yes add to CFLAGS
|
||||
#cc_option() {
|
||||
# if $cc $CFLAGS $1 -S -o /dev/null -xc conftest.c >/dev/null 2>&1; then
|
||||
# CFLAGS="$CFLAGS $1"; else if test -n "$2"; then
|
||||
# CFLAGS="$CFLAGS $2"; fi; fi
|
||||
#}
|
||||
#cc_option -fno-strict-aliasing
|
||||
#cc_option -Wno-pointer-sign
|
||||
#cc_option -Wno-sign-compare
|
||||
#cc_option -Wno-unused-result -D_FORTIFY_SOURCE=0
|
||||
|
||||
cat <<EOF
|
||||
Binary directory $bindir
|
||||
TinyCC directory $tccdir
|
||||
@ -389,24 +368,29 @@ LIBSUF=$LIBSUF
|
||||
EXESUF=$EXESUF
|
||||
EOF
|
||||
|
||||
print_def() {
|
||||
print_inc() {
|
||||
if test -n "$2"; then
|
||||
echo "#ifndef $1" >> $TMPH
|
||||
echo "# define $1 \"$2\"" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
fi
|
||||
}
|
||||
print_mak() {
|
||||
if test -n "$2"; then
|
||||
echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak
|
||||
fi
|
||||
}
|
||||
|
||||
echo "/* Automatically generated by configure - do not modify */" > $TMPH
|
||||
|
||||
print_def CONFIG_SYSROOT "$sysroot"
|
||||
print_def CONFIG_TCCDIR "$tccdir"
|
||||
print_def CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
|
||||
print_def CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
||||
print_def CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
|
||||
print_def CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
|
||||
print_def CONFIG_MULTIARCHDIR "$multiarch_triplet"
|
||||
print_def CONFIG_LDDIR "$tcc_lddir"
|
||||
print_inc CONFIG_SYSROOT "$sysroot"
|
||||
print_inc CONFIG_TCCDIR "$tccdir"
|
||||
print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
|
||||
print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
||||
print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
|
||||
print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
|
||||
print_mak CONFIG_LDDIR "$tcc_lddir"
|
||||
print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet"
|
||||
|
||||
echo "#define GCC_MAJOR $gcc_major" >> $TMPH
|
||||
echo "#define GCC_MINOR $gcc_minor" >> $TMPH
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
TOP = ..
|
||||
include $(TOP)/config.mak
|
||||
include $(TOP)/Makefile
|
||||
VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib
|
||||
|
||||
ifndef TARGET
|
||||
@ -91,7 +91,7 @@ $(DIR)/%.o : %.c
|
||||
$(DIR)/%.o : %.S
|
||||
$(XCC) -c $< -o $@ $(XFLAGS)
|
||||
$(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c
|
||||
$(CC) -Os -s -o $@ $< $(XFLAGS) $(LDFLAGS)
|
||||
$(CC) -o $@ $< $(XFLAGS) $(LDFLAGS)
|
||||
|
||||
$(OBJ) $(XAR) : $(DIR)/exists
|
||||
$(DIR)/exists :
|
||||
|
@ -609,8 +609,11 @@ unsigned long long __fixunsxfdi (long double a1)
|
||||
|
||||
/* helper functions for stdarg.h */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef __TINYC__
|
||||
/* gives "incompatible types for redefinition of __va_arg" below */
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
enum __va_arg_type {
|
||||
__va_gen_reg, __va_float_reg, __va_stack
|
||||
@ -665,7 +668,9 @@ void *__va_arg(struct __va_list_struct *ap,
|
||||
return ap->overflow_arg_area - size;
|
||||
|
||||
default:
|
||||
#ifndef __TINYC__
|
||||
fprintf(stderr, "unknown ABI type for __va_arg\n");
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
1
tcc.c
1
tcc.c
@ -223,6 +223,7 @@ static void display_info(TCCState *s, int what)
|
||||
print_paths("crt", s->crt_paths, s->nb_crt_paths);
|
||||
print_paths("libraries", s->library_paths, s->nb_library_paths);
|
||||
print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths);
|
||||
printf("elfinterp:\n %s\n", CONFIG_TCC_ELFINTERP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
2
tcc.h
2
tcc.h
@ -214,6 +214,8 @@
|
||||
# define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2"
|
||||
# elif defined(TCC_UCLIBC)
|
||||
# define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0"
|
||||
# elif defined(TCC_TARGET_PE)
|
||||
# define CONFIG_TCC_ELFINTERP "-"
|
||||
# else
|
||||
# define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2"
|
||||
# endif
|
||||
|
Loading…
Reference in New Issue
Block a user