History

tcc android-enabled (armeabi-v7a)

On an armeabi-v7a device (phone) in the termux app with clang & make installed this passes all the tests. Can be used as a cross compiler to create "native apps" as well. Example 'config-extra.mak' for the cross arm-eabi-tcc: SYSROOT = <path_to_android_ndk...>/sysroot/usr TRIPLET = arm-linux-androideabi ANDRVER = 32 ROOT-arm-eabi = $(SYSROOT) CRT-arm-eabi = {R}/lib/$(TRIPLET)/$(ANDRVER) LIB-arm-eabi = {B};{R}/lib/$(TRIPLET)/$(ANDRVER);{R}/lib/$(TRIPLET) INC-arm-eabi = {B}/lib/include;{R}/include/$(TRIPLET);{R}/include DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI DEF-arm-eabi += -DTARGETOS_ANDROID -DCONFIG_TCC_PIE -DCONFIG_NEW_DTAGS DEF-arm-eabi += -DCONFIG_TCC_ELFINTERP=\"/system/bin/linker\" # on unix replace ';' by ':'. $ ./configure && make cross-arm-eabi && make install

grischka committed 4 years ago

Commit 09808f31 parent 8e8607014 files · +109 −49Browse files

Unified · Split

14 files
  1. Makefile +2 −0
  2. configure +29 −12
  3. conftest.c +11 −3
  4. include/tccdefs.h +7 −0
  5. lib/bcheck.c +3 −2
  6. libtcc.c +10 −1
  7. tcc.c +3 −0
  8. tccelf.c +12 −14
  9. tccgen.c +1 −1
  10. tccpp.c +13 −5
  11. tccrun.c +1 −1
  12. tests/Makefile +5 −3
  13. tests/tcctest.c +10 −5
  14. tests/tests2/Makefile +2 −2
Makefile+2−0
@@ -90,8 +90,10 @@ NATIVE_DEFINES_$(CONFIG_arm_vfp) += -DTCC_ARM_VFP · 89 unmodified lines
90NATIVE_DEFINES_$(CONFIG_arm64) += -DTCC_TARGET_ARM6490NATIVE_DEFINES_$(CONFIG_arm64) += -DTCC_TARGET_ARM64
91NATIVE_DEFINES_$(CONFIG_riscv64) += -DTCC_TARGET_RISCV6491NATIVE_DEFINES_$(CONFIG_riscv64) += -DTCC_TARGET_RISCV64
92NATIVE_DEFINES_$(CONFIG_BSD) += -DTARGETOS_$(TARGETOS)92NATIVE_DEFINES_$(CONFIG_BSD) += -DTARGETOS_$(TARGETOS)
93NATIVE_DEFINES_$(CONFIG_Android) += -DTARGETOS_ANDROID
93NATIVE_DEFINES_$(CONFIG_pie) += -DCONFIG_TCC_PIE94NATIVE_DEFINES_$(CONFIG_pie) += -DCONFIG_TCC_PIE
94NATIVE_DEFINES_$(CONFIG_pic) += -DCONFIG_TCC_PIC95NATIVE_DEFINES_$(CONFIG_pic) += -DCONFIG_TCC_PIC
96NATIVE_DEFINES_$(CONFIG_new-dtags) += -DCONFIG_NEW_DTAGS
95NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=097NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0
96NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=098NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=0
97NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no)99NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no)
configure+29−12
@@ -27,8 +27,7 @@ mandir="" · 26 unmodified lines
27infodir=""27infodir=""
28sysroot=""28sysroot=""
29cross_prefix=""29cross_prefix=""
30test -z "$CC" && CC="gcc"30cc="gcc"
31test -z "$cc" && cc="$CC"
32ar="ar"31ar="ar"
33bigendian="no"32bigendian="no"
34mingw32="no"33mingw32="no"
@@ -46,16 +45,20 @@ confvars= · 11 unmodified lines
46suggest="yes"45suggest="yes"
47gcc_major=046gcc_major=0
48gcc_minor=047gcc_minor=0
49cc_name="$cc"48cc_name="gcc"
50ar_set=49ar_set=
51darwin=50darwin=
52cpu=
53cpuver=51cpuver=
54dwarf=52dwarf=
55 53
54# use CC from environment when set
55test -n "$CC" && cc="$CC"
56
56# OS specific57# OS specific
57cpu_sys=`uname -m`58cpu=`uname -m`
59cpu_sys="$cpu"
58targetos=`uname`60targetos=`uname`
61test "$(uname -o)" = "Android" && targetos=Android
59 62
60case $targetos in63case $targetos in
61 Darwin)64 Darwin)
@@ -73,6 +76,20 @@ case $targetos in · 11 unmodified lines
73 DragonFly|OpenBSD|FreeBSD|NetBSD)76 DragonFly|OpenBSD|FreeBSD|NetBSD)
74 confvars="$confvars BSD ldl=no"77 confvars="$confvars BSD ldl=no"
75 ;;78 ;;
79 Android)
80 confvars="$confvars Android pie new-dtags"
81 if test -n "$TERMUX_VERSION"; then
82 prefix="$PREFIX" # "/data/data/com.termux/files/usr"
83 sysroot="$PREFIX"
84 test "$cpu" = "aarch64" -o "$cpu" = "x86_64" && S="64" || S=""
85 tcc_sysincludepaths="{B}/include:{R}/include/\\\"CONFIG_TRIPLET\\\":{R}/include"
86 tcc_libpaths="{B}:{R}/lib:/system/lib${S}"
87 tcc_crtprefix="{R}/lib"
88 tcc_elfinterp="/system/bin/linker${S}"
89 use_triplet="yes"
90 tcc_switches="-Wl,-rpath=$sysroot/lib,-section-alignment=0x1000"
91 fi
92 ;;
76 *)93 *)
77 ;;94 ;;
78esac95esac
@@ -153,6 +170,8 @@ for opt do · 74 unmodified lines
153 ;;170 ;;
154 --with-selinux) confvars="$confvars selinux"171 --with-selinux) confvars="$confvars selinux"
155 ;;172 ;;
173 --tcc-switches=*) tcc_switches=`echo $opt | cut -d '=' -f 2-`
174 ;;
156 --config-mingw32*) mingw32=$(echo "$opt=yes" | cut -d '=' -f 2)175 --config-mingw32*) mingw32=$(echo "$opt=yes" | cut -d '=' -f 2)
157 ;;176 ;;
158 --config-*) confvars="$confvars ${opt#--config-}"; suggest="no"177 --config-*) confvars="$confvars ${opt#--config-}"; suggest="no"
@@ -176,9 +195,6 @@ if test "$darwin" = "yes" -a "$cpu" = "x86_64" -a "$cpu_sys" = "arm64"; then · 17 unmodified lines
176 LDFLAGS="$LDFLAGS -arch $cpu"195 LDFLAGS="$LDFLAGS -arch $cpu"
177fi196fi
178 197
179# checking for cpu
180test -z "$cpu" && cpu="$cpu_sys"
181
182case "$cpu" in198case "$cpu" in
183 x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)199 x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
184 cpu="i386"200 cpu="i386"
@@ -325,6 +341,7 @@ Advanced options (experts only): · 140 unmodified lines
325 --crtprefix=... specify locations of crt?.o, colon separated341 --crtprefix=... specify locations of crt?.o, colon separated
326 --elfinterp=... specify elf interpreter342 --elfinterp=... specify elf interpreter
327 --triplet=... specify system library/include directory triplet343 --triplet=... specify system library/include directory triplet
344 --tcc-switches=... specify implicit switches passed to tcc
328 345
329 --config-uClibc,-musl enable system specific configurations346 --config-uClibc,-musl enable system specific configurations
330 --config-mingw32 build on windows using msys, busybox, etc.347 --config-mingw32 build on windows using msys, busybox, etc.
@@ -349,8 +366,8 @@ if test -z "$cross_prefix" ; then · 18 unmodified lines
349 fi366 fi
350 if test "$mingw32" = "no" ; then367 if test "$mingw32" = "no" ; then
351 368
352 if test -z "$triplet"; then369 if test -z "$triplet" -a -n "$_triplet"; then
353 if test -n "$_triplet" -a -f "/usr/lib/$_triplet/crti.o" ; then370 if test -f "/usr/lib/$_triplet/crti.o" -o -n "$use_triplet" ; then
354 triplet="$_triplet"371 triplet="$_triplet"
355 fi372 fi
356 fi373 fi
@@ -372,8 +389,7 @@ if test -z "$cross_prefix" ; then · 15 unmodified lines
372 confvars="$confvars arm_eabihf arm_vfp"389 confvars="$confvars arm_eabihf arm_vfp"
373 elif test "${_triplet%eabi}" != "$_triplet" ; then390 elif test "${_triplet%eabi}" != "$_triplet" ; then
374 confvars="$confvars arm_eabi arm_vfp"391 confvars="$confvars arm_eabi arm_vfp"
375 fi392 elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
376 if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
377 confvars="$confvars arm_vfp"393 confvars="$confvars arm_vfp"
378 fi394 fi
379 fi395 fi
@@ -496,6 +512,7 @@ print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" · 116 unmodified lines
496print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"512print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
497print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"513print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
498print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"514print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
515print_mak CONFIG_TCC_SWITCHES "$tcc_switches"
499print_mak CONFIG_LDDIR "$tcc_lddir"516print_mak CONFIG_LDDIR "$tcc_lddir"
500print_mak CONFIG_TRIPLET "$triplet"517print_mak CONFIG_TRIPLET "$triplet"
501print_mak TCC_CPU_VERSION "$cpuver" num518print_mak TCC_CPU_VERSION "$cpuver" num
conftest.c+11−3
@@ -21,6 +21,8 @@ const char *platform_macros[] = { · 20 unmodified lines
21 "__OpenBSD__", "TARGETOS_OpenBSD",21 "__OpenBSD__", "TARGETOS_OpenBSD",
22 "__NetBSD__", "TARGETOS_NetBSD",22 "__NetBSD__", "TARGETOS_NetBSD",
23 "__linux__", "TARGETOS_Linux",23 "__linux__", "TARGETOS_Linux",
24 "__ANDROID__", "TARGETOS_ANDROID",
25
24 "__SIZEOF_POINTER__", "PTR_SIZE",26 "__SIZEOF_POINTER__", "PTR_SIZE",
25 "__SIZEOF_LONG__", "LONG_SIZE",27 "__SIZEOF_LONG__", "LONG_SIZE",
26 028 0
@@ -206,15 +208,21 @@ int main(int argc, char **argv) · 179 unmodified lines
206# define TRIPLET_OS "unknown"208# define TRIPLET_OS "unknown"
207#endif209#endif
208 210
211#if defined __ANDROID__
212# define ABI_PREFIX "android"
213#else
214# define ABI_PREFIX "gnu"
215#endif
216
209/* Define calling convention and ABI */217/* Define calling convention and ABI */
210#if defined (__ARM_EABI__)218#if defined (__ARM_EABI__)
211# if defined (__ARM_PCS_VFP)219# if defined (__ARM_PCS_VFP)
212# define TRIPLET_ABI "gnueabihf"220# define TRIPLET_ABI ABI_PREFIX"eabihf"
213# else221# else
214# define TRIPLET_ABI "gnueabi"222# define TRIPLET_ABI ABI_PREFIX"eabi"
215# endif223# endif
216#else224#else
217# define TRIPLET_ABI "gnu"225# define TRIPLET_ABI ABI_PREFIX
218#endif226#endif
219 227
220#if defined _WIN32228#if defined _WIN32
include/tccdefs.h+7−0
@@ -125,6 +125,13 @@ · 124 unmodified lines
125 #define __FINITE_MATH_ONLY__ 1125 #define __FINITE_MATH_ONLY__ 1
126 #define _FORTIFY_SOURCE 0126 #define _FORTIFY_SOURCE 0
127 127
128#elif defined __ANDROID__
129 #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD
130 #define __PRETTY_FUNCTION__ __FUNCTION__
131 #define __has_builtin(x) 0
132 #define _Nonnull
133 #define _Nullable
134
128#else135#else
129 /* Linux */136 /* Linux */
130 137
lib/bcheck.c+3−2
@@ -161,7 +161,7 @@ static pthread_spinlock_t bounds_spin; · 160 unmodified lines
161#define HAVE_TLS_FUNC (1)161#define HAVE_TLS_FUNC (1)
162#define HAVE_TLS_VAR (0)162#define HAVE_TLS_VAR (0)
163#endif163#endif
164#ifdef TCC_MUSL164#if defined TCC_MUSL || defined __ANDROID__
165# undef HAVE_CTYPE165# undef HAVE_CTYPE
166#endif166#endif
167#endif167#endif
@@ -1174,7 +1174,8 @@ void __attribute__((destructor)) __bound_exit(void) · 1006 unmodified lines
1174 1174
1175 if (inited) {1175 if (inited) {
1176#if !defined(_WIN32) && !defined(__APPLE__) && !defined TCC_MUSL && \1176#if !defined(_WIN32) && !defined(__APPLE__) && !defined TCC_MUSL && \
1177 !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)1177 !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
1178 !defined(__ANDROID__)
1178 if (print_heap) {1179 if (print_heap) {
1179 extern void __libc_freeres (void);1180 extern void __libc_freeres (void);
1180 __libc_freeres ();1181 __libc_freeres ();
libtcc.c+10−1
@@ -496,6 +496,8 @@ static void tcc_split_path(TCCState *s, void *p_ary, int *p_nb_ary, const char * · 495 unmodified lines
496 c = p[1], p += 2;496 c = p[1], p += 2;
497 if (c == 'B')497 if (c == 'B')
498 cstr_cat(&str, s->tcc_lib_path, -1);498 cstr_cat(&str, s->tcc_lib_path, -1);
499 if (c == 'R')
500 cstr_cat(&str, CONFIG_SYSROOT, -1);
499 if (c == 'f' && file) {501 if (c == 'f' && file) {
500 /* substitute current file's dir */502 /* substitute current file's dir */
501 const char *f = file->true_filename;503 const char *f = file->true_filename;
@@ -810,7 +812,9 @@ LIBTCCAPI TCCState *tcc_new(void) · 308 unmodified lines
810#ifdef TCC_TARGET_ARM812#ifdef TCC_TARGET_ARM
811 s->float_abi = ARM_FLOAT_ABI;813 s->float_abi = ARM_FLOAT_ABI;
812#endif814#endif
813 815#ifdef CONFIG_NEW_DTAGS
816 s->enable_new_dtags = 1;
817#endif
814 s->ppfp = stdout;818 s->ppfp = stdout;
815 /* might be used in error() before preprocess_start() */819 /* might be used in error() before preprocess_start() */
816 s->include_stack_ptr = s->include_stack;820 s->include_stack_ptr = s->include_stack;
@@ -943,6 +947,11 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 126 unmodified lines
943 tcc_add_crt(s, "crtbeginS.o");947 tcc_add_crt(s, "crtbeginS.o");
944 else948 else
945 tcc_add_crt(s, "crtbegin.o");949 tcc_add_crt(s, "crtbegin.o");
950#elif defined TARGETOS_ANDROID
951 if (output_type != TCC_OUTPUT_DLL)
952 tcc_add_crt(s, "crtbegin_dynamic.o");
953 else
954 tcc_add_crt(s, "crtbegin_so.o");
946#else955#else
947 if (output_type != TCC_OUTPUT_DLL)956 if (output_type != TCC_OUTPUT_DLL)
948 tcc_add_crt(s, "crt1.o");957 tcc_add_crt(s, "crt1.o");
tcc.c+3−0
@@ -281,6 +281,9 @@ int main(int argc0, char **argv0) · 280 unmodified lines
281redo:281redo:
282 argc = argc0, argv = argv0;282 argc = argc0, argv = argv0;
283 s = s1 = tcc_new();283 s = s1 = tcc_new();
284#ifdef CONFIG_TCC_SWITCHES
285 tcc_set_options(s, CONFIG_TCC_SWITCHES);
286#endif
284 opt = tcc_parse_args(s, &argc, &argv, 1);287 opt = tcc_parse_args(s, &argc, &argv, 1);
285 288
286 if (n == 0) {289 if (n == 0) {
tccelf.c+12−14
@@ -857,7 +857,7 @@ ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve) · 856 unmodified lines
857#if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE857#if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE
858 /* dlsym() needs the undecorated name. */858 /* dlsym() needs the undecorated name. */
859 void *addr = dlsym(RTLD_DEFAULT, &name[s1->leading_underscore]);859 void *addr = dlsym(RTLD_DEFAULT, &name[s1->leading_underscore]);
860#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD860#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD || TARGETOS_ANDROID
861 if (addr == NULL) {861 if (addr == NULL) {
862 int i;862 int i;
863 for (i = 0; i < s1->nb_loaded_dlls; i++)863 for (i = 0; i < s1->nb_loaded_dlls; i++)
@@ -1526,6 +1526,11 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) · 662 unmodified lines
1526# if !TARGETOS_OpenBSD1526# if !TARGETOS_OpenBSD
1527 tcc_add_crt(s1, "crtn.o");1527 tcc_add_crt(s1, "crtn.o");
1528# endif1528# endif
1529#elif TARGETOS_ANDROID
1530 if (s1->output_type == TCC_OUTPUT_DLL)
1531 tcc_add_crt(s1, "crtend_so.o");
1532 else
1533 tcc_add_crt(s1, "crtend_android.o");
1529#else1534#else
1530 tcc_add_crt(s1, "crtn.o");1535 tcc_add_crt(s1, "crtn.o");
1531#endif1536#endif
@@ -2272,22 +2277,15 @@ static void tcc_output_elf(TCCState *s1, FILE *f, int phnum, ElfW(Phdr) *phdr, · 740 unmodified lines
2272 ehdr.e_ident[4] = ELFCLASSW;2277 ehdr.e_ident[4] = ELFCLASSW;
2273 ehdr.e_ident[5] = ELFDATA2LSB;2278 ehdr.e_ident[5] = ELFDATA2LSB;
2274 ehdr.e_ident[6] = EV_CURRENT;2279 ehdr.e_ident[6] = EV_CURRENT;
2280
2275#if TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel2281#if TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel
2276 ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;2282 ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
2277#endif2283#elif defined TCC_TARGET_ARM && defined TCC_ARM_EABI
2278#ifdef TCC_TARGET_ARM2284 ehdr.e_flags = EF_ARM_EABI_VER5;
2279#ifdef TCC_ARM_EABI2285 ehdr.e_flags |= s1->float_abi == ARM_HARD_FLOAT
2280 ehdr.e_ident[EI_OSABI] = 0;2286 ? EF_ARM_VFP_FLOAT : EF_ARM_SOFT_FLOAT;
2281 ehdr.e_flags = EF_ARM_EABI_VER4;2287#elif defined TCC_TARGET_ARM
2282 if (file_type & (TCC_OUTPUT_EXE | TCC_OUTPUT_DLL))
2283 ehdr.e_flags |= EF_ARM_HASENTRY;
2284 if (s1->float_abi == ARM_HARD_FLOAT)
2285 ehdr.e_flags |= EF_ARM_VFP_FLOAT;
2286 else
2287 ehdr.e_flags |= EF_ARM_SOFT_FLOAT;
2288#else
2289 ehdr.e_ident[EI_OSABI] = ELFOSABI_ARM;2288 ehdr.e_ident[EI_OSABI] = ELFOSABI_ARM;
2290#endif
2291#elif defined TCC_TARGET_RISCV642289#elif defined TCC_TARGET_RISCV64
2292 ehdr.e_flags = EF_RISCV_FLOAT_ABI_DOUBLE;2290 ehdr.e_flags = EF_RISCV_FLOAT_ABI_DOUBLE;
2293#endif2291#endif
tccgen.c+1−1
@@ -8266,7 +8266,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) · 8265 unmodified lines
8266 sym = type.ref;8266 sym = type.ref;
8267 if (sym->f.func_type == FUNC_OLD && l == VT_CONST)8267 if (sym->f.func_type == FUNC_OLD && l == VT_CONST)
8268 decl0(VT_CMP, 0, sym);8268 decl0(VT_CMP, 0, sym);
8269#ifdef TCC_TARGET_MACHO8269#if defined TCC_TARGET_MACHO || defined TARGETOS_ANDROID
8270 if (sym->f.func_alwinl8270 if (sym->f.func_alwinl
8271 && ((type.t & (VT_EXTERN | VT_INLINE))8271 && ((type.t & (VT_EXTERN | VT_INLINE))
8272 == (VT_EXTERN | VT_INLINE))) {8272 == (VT_EXTERN | VT_INLINE))) {
tccpp.c+13−5
@@ -3713,6 +3713,9 @@ static const char * const target_os_defs = · 3712 unmodified lines
3713# else3713# else
3714 "__linux__\0"3714 "__linux__\0"
3715 "__linux\0"3715 "__linux\0"
3716# if TARGETOS_ANDROID
3717 "__ANDROID__\0"
3718# endif
3716# endif3719# endif
3717 "__unix__\0"3720 "__unix__\0"
3718 "__unix\0"3721 "__unix\0"
@@ -3724,17 +3727,22 @@ static void putdef(CString *cs, const char *p) · 5 unmodified lines
3724 cstr_printf(cs, "#define %s%s\n", p, &" 1"[!!strchr(p, ' ')*2]);3727 cstr_printf(cs, "#define %s%s\n", p, &" 1"[!!strchr(p, ' ')*2]);
3725}3728}
3726 3729
3730static void putdefs(CString *cs, const char *p)
3731{
3732 while (*p)
3733 putdef(cs, p), p = strchr(p, 0) + 1;
3734}
3735
3727static void tcc_predefs(TCCState *s1, CString *cs, int is_asm)3736static void tcc_predefs(TCCState *s1, CString *cs, int is_asm)
3728{3737{
3729 int a, b, c;3738 int a, b, c;
3730 const char *defs[] = { target_machine_defs, target_os_defs, NULL };
3731 const char *p;
3732 3739
3733 sscanf(TCC_VERSION, "%d.%d.%d", &a, &b, &c);3740 sscanf(TCC_VERSION, "%d.%d.%d", &a, &b, &c);
3734 cstr_printf(cs, "#define __TINYC__ %d\n", a*10000 + b*100 + c);3741 cstr_printf(cs, "#define __TINYC__ %d\n", a*10000 + b*100 + c);
3735 for (a = 0; defs[a]; ++a)3742
3736 for (p = defs[a]; *p; p = strchr(p, 0) + 1)3743 putdefs(cs, target_machine_defs);
3737 putdef(cs, p);3744 putdefs(cs, target_os_defs);
3745
3738#ifdef TCC_TARGET_ARM3746#ifdef TCC_TARGET_ARM
3739 if (s1->float_abi == ARM_HARD_FLOAT)3747 if (s1->float_abi == ARM_HARD_FLOAT)
3740 putdef(cs, "__ARM_PCS_VFP");3748 putdef(cs, "__ARM_PCS_VFP");
tccrun.c+1−1
@@ -390,7 +390,7 @@ static void set_pages_executable(TCCState *s1, int mode, void *ptr, unsigned lon · 389 unmodified lines
390 tcc_error("mprotect failed: did you mean to configure --with-selinux?");390 tcc_error("mprotect failed: did you mean to configure --with-selinux?");
391 391
392/* XXX: BSD sometimes dump core with bad system call */392/* XXX: BSD sometimes dump core with bad system call */
393# if (TCC_TARGET_ARM && !TARGETOS_BSD) || TCC_TARGET_ARM64393# if (defined TCC_TARGET_ARM && !TARGETOS_BSD) || defined TCC_TARGET_ARM64
394 if (mode == 0 || mode == 3) {394 if (mode == 0 || mode == 3) {
395 void __clear_cache(void *beginning, void *end);395 void __clear_cache(void *beginning, void *end);
396 __clear_cache(ptr, (char *)ptr + length);396 __clear_cache(ptr, (char *)ptr + length);
tests/Makefile+5−3
@@ -35,8 +35,8 @@ endif · 34 unmodified lines
35ifeq (,$(filter arm64 i386 x86_64,$(ARCH)))35ifeq (,$(filter arm64 i386 x86_64,$(ARCH)))
36 TESTS := $(filter-out vla_test-run,$(TESTS))36 TESTS := $(filter-out vla_test-run,$(TESTS))
37endif37endif
38ifeq ($(CONFIG_arm_eabi),yes)38ifeq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--)
39 TESTS := $(filter-out test3,$(TESTS))39 TESTS := $(filter-out test3 test1b,$(TESTS))
40endif40endif
41ifeq (,$(filter i386 x86_64,$(ARCH)))41ifeq (,$(filter i386 x86_64,$(ARCH)))
42 TESTS := $(filter-out asm-c-connect-test,$(TESTS))42 TESTS := $(filter-out asm-c-connect-test,$(TESTS))
@@ -250,7 +250,7 @@ abitest-% : abitest-%.exe · 207 unmodified lines
250 ./$< $(TCCFLAGS)250 ./$< $(TCCFLAGS)
251 251
252abitest: abitest-cc252abitest: abitest-cc
253ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float253ifneq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--)
254abitest: abitest-tcc254abitest: abitest-tcc
255endif255endif
256 256
@@ -261,6 +261,8 @@ vla_test-run: vla_test$(EXESUF) · 4 unmodified lines
261 @echo ------------ $@ ------------261 @echo ------------ $@ ------------
262 ./vla_test$(EXESUF)262 ./vla_test$(EXESUF)
263 263
264.PHONY: abitest vla_test
265
264asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c266asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c
265 $(TCC) -o $@ $^267 $(TCC) -o $@ $^
266 268
tests/tcctest.c+10−5
@@ -21,14 +21,19 @@ · 20 unmodified lines
21typedef __SIZE_TYPE__ uintptr_t;21typedef __SIZE_TYPE__ uintptr_t;
22#endif22#endif
23 23
24#if defined(_WIN32) || \24#if defined(_WIN32) \
25 (defined(__arm__) && \25 || (defined(__arm__) \
26 (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)))26 && (defined(__FreeBSD__) \
27 || defined(__OpenBSD__) \
28 || defined(__NetBSD__) \
29 || defined __ANDROID__))
27#define LONG_LONG_FORMAT "%lld"30#define LONG_LONG_FORMAT "%lld"
28#define ULONG_LONG_FORMAT "%llu"31#define ULONG_LONG_FORMAT "%llu"
32#define XLONG_LONG_FORMAT "%llx"
29#else33#else
30#define LONG_LONG_FORMAT "%Ld"34#define LONG_LONG_FORMAT "%Ld"
31#define ULONG_LONG_FORMAT "%Lu"35#define ULONG_LONG_FORMAT "%Lu"
36#define XLONG_LONG_FORMAT "%Lx"
32#endif37#endif
33 38
34// MinGW has 80-bit rather than 64-bit long double which isn't compatible with TCC or MSVC39// MinGW has 80-bit rather than 64-bit long double which isn't compatible with TCC or MSVC
@@ -2265,7 +2270,7 @@ double ftab1[3] = { 1.2, 3.4, -5.6 }; · 2230 unmodified lines
2265 2270
2266void float_test(void)2271void float_test(void)
2267{2272{
2268#if !defined(__arm__) || defined(__ARM_PCS_VFP)2273#if !defined(__arm__) || defined(__ARM_PCS_VFP) || defined __ANDROID__
2269 volatile float fa, fb;2274 volatile float fa, fb;
2270 volatile double da, db;2275 volatile double da, db;
2271 int a;2276 int a;
@@ -2531,7 +2536,7 @@ void longlong_test(void) · 259 unmodified lines
2531 b = 0x12345678;2536 b = 0x12345678;
2532 a = -1;2537 a = -1;
2533 c = a + b;2538 c = a + b;
2534 printf("%Lx\n", c);2539 printf(XLONG_LONG_FORMAT"\n", c);
2535#endif2540#endif
2536 2541
2537 /* long long reg spill test */2542 /* long long reg spill test */
tests/tests2/Makefile+2−2
@@ -9,7 +9,7 @@ TESTS = $(patsubst %.c,%.test,\ · 8 unmodified lines
9 9
10# some tests do not pass on all platforms, remove them for now10# some tests do not pass on all platforms, remove them for now
11SKIP = 34_array_assignment.test # array assignment is not in C standard11SKIP = 34_array_assignment.test # array assignment is not in C standard
12ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float12ifeq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--)
13 SKIP += 22_floating_point.test13 SKIP += 22_floating_point.test
14endif14endif
15ifdef CONFIG_OSX15ifdef CONFIG_OSX
@@ -27,12 +27,12 @@ ifeq (,$(filter i386 x86_64,$(ARCH))) · 11 unmodified lines
27 SKIP += 125_atomic_misc.test # currently only x86 supported27 SKIP += 125_atomic_misc.test # currently only x86 supported
28endif28endif
29ifeq ($(CONFIG_backtrace),no)29ifeq ($(CONFIG_backtrace),no)
30 SKIP += 112_backtrace.test
31 SKIP += 113_btdll.test30 SKIP += 113_btdll.test
32 CONFIG_bcheck = no31 CONFIG_bcheck = no
33# no bcheck without backtrace32# no bcheck without backtrace
34endif33endif
35ifeq ($(CONFIG_bcheck),no)34ifeq ($(CONFIG_bcheck),no)
35 SKIP += 112_backtrace.test
36 SKIP += 114_bound_signal.test36 SKIP += 114_bound_signal.test
37 SKIP += 115_bound_setjmp.test37 SKIP += 115_bound_setjmp.test
38 SKIP += 116_bound_setjmp2.test38 SKIP += 116_bound_setjmp2.test

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t