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
Unified · Split
| @@ -90,8 +90,10 @@ NATIVE_DEFINES_$(CONFIG_arm_vfp) += -DTCC_ARM_VFP · 89 unmodified lines | ||
| 90 | 90 | NATIVE_DEFINES_$(CONFIG_arm64) += -DTCC_TARGET_ARM64 |
| 91 | 91 | NATIVE_DEFINES_$(CONFIG_riscv64) += -DTCC_TARGET_RISCV64 |
| 92 | 92 | NATIVE_DEFINES_$(CONFIG_BSD) += -DTARGETOS_$(TARGETOS) |
| 93 | +NATIVE_DEFINES_$(CONFIG_Android) += -DTARGETOS_ANDROID | |
| 93 | 94 | NATIVE_DEFINES_$(CONFIG_pie) += -DCONFIG_TCC_PIE |
| 94 | 95 | NATIVE_DEFINES_$(CONFIG_pic) += -DCONFIG_TCC_PIC |
| 96 | +NATIVE_DEFINES_$(CONFIG_new-dtags) += -DCONFIG_NEW_DTAGS | |
| 95 | 97 | NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0 |
| 96 | 98 | NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=0 |
| 97 | 99 | NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no) |
| @@ -27,8 +27,7 @@ mandir="" · 26 unmodified lines | ||
| 27 | 27 | infodir="" |
| 28 | 28 | sysroot="" |
| 29 | 29 | cross_prefix="" |
| 30 | −test -z "$CC" && CC="gcc" | |
| 31 | −test -z "$cc" && cc="$CC" | |
| 30 | +cc="gcc" | |
| 32 | 31 | ar="ar" |
| 33 | 32 | bigendian="no" |
| 34 | 33 | mingw32="no" |
| @@ -46,16 +45,20 @@ confvars= · 11 unmodified lines | ||
| 46 | 45 | suggest="yes" |
| 47 | 46 | gcc_major=0 |
| 48 | 47 | gcc_minor=0 |
| 49 | −cc_name="$cc" | |
| 48 | +cc_name="gcc" | |
| 50 | 49 | ar_set= |
| 51 | 50 | darwin= |
| 52 | −cpu= | |
| 53 | 51 | cpuver= |
| 54 | 52 | dwarf= |
| 55 | 53 | |
| 54 | +# use CC from environment when set | |
| 55 | +test -n "$CC" && cc="$CC" | |
| 56 | + | |
| 56 | 57 | # OS specific |
| 57 | −cpu_sys=`uname -m` | |
| 58 | +cpu=`uname -m` | |
| 59 | +cpu_sys="$cpu" | |
| 58 | 60 | targetos=`uname` |
| 61 | +test "$(uname -o)" = "Android" && targetos=Android | |
| 59 | 62 | |
| 60 | 63 | case $targetos in |
| 61 | 64 | Darwin) |
| @@ -73,6 +76,20 @@ case $targetos in · 11 unmodified lines | ||
| 73 | 76 | DragonFly|OpenBSD|FreeBSD|NetBSD) |
| 74 | 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 | ;; |
| 78 | 95 | esac |
| @@ -153,6 +170,8 @@ for opt do · 74 unmodified lines | ||
| 153 | 170 | ;; |
| 154 | 171 | --with-selinux) confvars="$confvars selinux" |
| 155 | 172 | ;; |
| 173 | + --tcc-switches=*) tcc_switches=`echo $opt | cut -d '=' -f 2-` | |
| 174 | + ;; | |
| 156 | 175 | --config-mingw32*) mingw32=$(echo "$opt=yes" | cut -d '=' -f 2) |
| 157 | 176 | ;; |
| 158 | 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 | 195 | LDFLAGS="$LDFLAGS -arch $cpu" |
| 177 | 196 | fi |
| 178 | 197 | |
| 179 | −# checking for cpu | |
| 180 | −test -z "$cpu" && cpu="$cpu_sys" | |
| 181 | − | |
| 182 | 198 | case "$cpu" in |
| 183 | 199 | x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386) |
| 184 | 200 | cpu="i386" |
| @@ -325,6 +341,7 @@ Advanced options (experts only): · 140 unmodified lines | ||
| 325 | 341 | --crtprefix=... specify locations of crt?.o, colon separated |
| 326 | 342 | --elfinterp=... specify elf interpreter |
| 327 | 343 | --triplet=... specify system library/include directory triplet |
| 344 | + --tcc-switches=... specify implicit switches passed to tcc | |
| 328 | 345 | |
| 329 | 346 | --config-uClibc,-musl enable system specific configurations |
| 330 | 347 | --config-mingw32 build on windows using msys, busybox, etc. |
| @@ -349,8 +366,8 @@ if test -z "$cross_prefix" ; then · 18 unmodified lines | ||
| 349 | 366 | fi |
| 350 | 367 | if test "$mingw32" = "no" ; then |
| 351 | 368 | |
| 352 | − if test -z "$triplet"; then | |
| 353 | − if test -n "$_triplet" -a -f "/usr/lib/$_triplet/crti.o" ; then | |
| 369 | + if test -z "$triplet" -a -n "$_triplet"; then | |
| 370 | + if test -f "/usr/lib/$_triplet/crti.o" -o -n "$use_triplet" ; then | |
| 354 | 371 | triplet="$_triplet" |
| 355 | 372 | fi |
| 356 | 373 | fi |
| @@ -372,8 +389,7 @@ if test -z "$cross_prefix" ; then · 15 unmodified lines | ||
| 372 | 389 | confvars="$confvars arm_eabihf arm_vfp" |
| 373 | 390 | elif test "${_triplet%eabi}" != "$_triplet" ; then |
| 374 | 391 | confvars="$confvars arm_eabi arm_vfp" |
| 375 | − fi | |
| 376 | − if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then | |
| 392 | + elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then | |
| 377 | 393 | confvars="$confvars arm_vfp" |
| 378 | 394 | fi |
| 379 | 395 | fi |
| @@ -496,6 +512,7 @@ print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" · 116 unmodified lines | ||
| 496 | 512 | print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths" |
| 497 | 513 | print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" |
| 498 | 514 | print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp" |
| 515 | +print_mak CONFIG_TCC_SWITCHES "$tcc_switches" | |
| 499 | 516 | print_mak CONFIG_LDDIR "$tcc_lddir" |
| 500 | 517 | print_mak CONFIG_TRIPLET "$triplet" |
| 501 | 518 | print_mak TCC_CPU_VERSION "$cpuver" num |
| @@ -21,6 +21,8 @@ const char *platform_macros[] = { · 20 unmodified lines | ||
| 21 | 21 | "__OpenBSD__", "TARGETOS_OpenBSD", |
| 22 | 22 | "__NetBSD__", "TARGETOS_NetBSD", |
| 23 | 23 | "__linux__", "TARGETOS_Linux", |
| 24 | + "__ANDROID__", "TARGETOS_ANDROID", | |
| 25 | + | |
| 24 | 26 | "__SIZEOF_POINTER__", "PTR_SIZE", |
| 25 | 27 | "__SIZEOF_LONG__", "LONG_SIZE", |
| 26 | 28 | 0 |
| @@ -206,15 +208,21 @@ int main(int argc, char **argv) · 179 unmodified lines | ||
| 206 | 208 | # define TRIPLET_OS "unknown" |
| 207 | 209 | #endif |
| 208 | 210 | |
| 211 | +#if defined __ANDROID__ | |
| 212 | +# define ABI_PREFIX "android" | |
| 213 | +#else | |
| 214 | +# define ABI_PREFIX "gnu" | |
| 215 | +#endif | |
| 216 | + | |
| 209 | 217 | /* Define calling convention and ABI */ |
| 210 | 218 | #if defined (__ARM_EABI__) |
| 211 | 219 | # if defined (__ARM_PCS_VFP) |
| 212 | −# define TRIPLET_ABI "gnueabihf" | |
| 220 | +# define TRIPLET_ABI ABI_PREFIX"eabihf" | |
| 213 | 221 | # else |
| 214 | −# define TRIPLET_ABI "gnueabi" | |
| 222 | +# define TRIPLET_ABI ABI_PREFIX"eabi" | |
| 215 | 223 | # endif |
| 216 | 224 | #else |
| 217 | −# define TRIPLET_ABI "gnu" | |
| 225 | +# define TRIPLET_ABI ABI_PREFIX | |
| 218 | 226 | #endif |
| 219 | 227 | |
| 220 | 228 | #if defined _WIN32 |
| @@ -125,6 +125,13 @@ · 124 unmodified lines | ||
| 125 | 125 | #define __FINITE_MATH_ONLY__ 1 |
| 126 | 126 | #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 | 135 | #else |
| 129 | 136 | /* Linux */ |
| 130 | 137 | |
| @@ -161,7 +161,7 @@ static pthread_spinlock_t bounds_spin; · 160 unmodified lines | ||
| 161 | 161 | #define HAVE_TLS_FUNC (1) |
| 162 | 162 | #define HAVE_TLS_VAR (0) |
| 163 | 163 | #endif |
| 164 | −#ifdef TCC_MUSL | |
| 164 | +#if defined TCC_MUSL || defined __ANDROID__ | |
| 165 | 165 | # undef HAVE_CTYPE |
| 166 | 166 | #endif |
| 167 | 167 | #endif |
| @@ -1174,7 +1174,8 @@ void __attribute__((destructor)) __bound_exit(void) · 1006 unmodified lines | ||
| 1174 | 1174 | |
| 1175 | 1175 | if (inited) { |
| 1176 | 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 | 1179 | if (print_heap) { |
| 1179 | 1180 | extern void __libc_freeres (void); |
| 1180 | 1181 | __libc_freeres (); |
| @@ -496,6 +496,8 @@ static void tcc_split_path(TCCState *s, void *p_ary, int *p_nb_ary, const char * · 495 unmodified lines | ||
| 496 | 496 | c = p[1], p += 2; |
| 497 | 497 | if (c == 'B') |
| 498 | 498 | cstr_cat(&str, s->tcc_lib_path, -1); |
| 499 | + if (c == 'R') | |
| 500 | + cstr_cat(&str, CONFIG_SYSROOT, -1); | |
| 499 | 501 | if (c == 'f' && file) { |
| 500 | 502 | /* substitute current file's dir */ |
| 501 | 503 | const char *f = file->true_filename; |
| @@ -810,7 +812,9 @@ LIBTCCAPI TCCState *tcc_new(void) · 308 unmodified lines | ||
| 810 | 812 | #ifdef TCC_TARGET_ARM |
| 811 | 813 | s->float_abi = ARM_FLOAT_ABI; |
| 812 | 814 | #endif |
| 813 | − | |
| 815 | +#ifdef CONFIG_NEW_DTAGS | |
| 816 | + s->enable_new_dtags = 1; | |
| 817 | +#endif | |
| 814 | 818 | s->ppfp = stdout; |
| 815 | 819 | /* might be used in error() before preprocess_start() */ |
| 816 | 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 | 947 | tcc_add_crt(s, "crtbeginS.o"); |
| 944 | 948 | else |
| 945 | 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 | 955 | #else |
| 947 | 956 | if (output_type != TCC_OUTPUT_DLL) |
| 948 | 957 | tcc_add_crt(s, "crt1.o"); |
| @@ -281,6 +281,9 @@ int main(int argc0, char **argv0) · 280 unmodified lines | ||
| 281 | 281 | redo: |
| 282 | 282 | argc = argc0, argv = argv0; |
| 283 | 283 | s = s1 = tcc_new(); |
| 284 | +#ifdef CONFIG_TCC_SWITCHES | |
| 285 | + tcc_set_options(s, CONFIG_TCC_SWITCHES); | |
| 286 | +#endif | |
| 284 | 287 | opt = tcc_parse_args(s, &argc, &argv, 1); |
| 285 | 288 | |
| 286 | 289 | if (n == 0) { |
| @@ -857,7 +857,7 @@ ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve) · 856 unmodified lines | ||
| 857 | 857 | #if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE |
| 858 | 858 | /* dlsym() needs the undecorated name. */ |
| 859 | 859 | void *addr = dlsym(RTLD_DEFAULT, &name[s1->leading_underscore]); |
| 860 | −#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD | |
| 860 | +#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD || TARGETOS_ANDROID | |
| 861 | 861 | if (addr == NULL) { |
| 862 | 862 | int i; |
| 863 | 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 | 1526 | # if !TARGETOS_OpenBSD |
| 1527 | 1527 | tcc_add_crt(s1, "crtn.o"); |
| 1528 | 1528 | # 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 | 1534 | #else |
| 1530 | 1535 | tcc_add_crt(s1, "crtn.o"); |
| 1531 | 1536 | #endif |
| @@ -2272,22 +2277,15 @@ static void tcc_output_elf(TCCState *s1, FILE *f, int phnum, ElfW(Phdr) *phdr, · 740 unmodified lines | ||
| 2272 | 2277 | ehdr.e_ident[4] = ELFCLASSW; |
| 2273 | 2278 | ehdr.e_ident[5] = ELFDATA2LSB; |
| 2274 | 2279 | ehdr.e_ident[6] = EV_CURRENT; |
| 2280 | + | |
| 2275 | 2281 | #if TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel |
| 2276 | 2282 | ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; |
| 2277 | −#endif | |
| 2278 | −#ifdef TCC_TARGET_ARM | |
| 2279 | −#ifdef TCC_ARM_EABI | |
| 2280 | − ehdr.e_ident[EI_OSABI] = 0; | |
| 2281 | − ehdr.e_flags = EF_ARM_EABI_VER4; | |
| 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 | |
| 2283 | +#elif defined TCC_TARGET_ARM && defined TCC_ARM_EABI | |
| 2284 | + ehdr.e_flags = EF_ARM_EABI_VER5; | |
| 2285 | + ehdr.e_flags |= s1->float_abi == ARM_HARD_FLOAT | |
| 2286 | + ? EF_ARM_VFP_FLOAT : EF_ARM_SOFT_FLOAT; | |
| 2287 | +#elif defined TCC_TARGET_ARM | |
| 2289 | 2288 | ehdr.e_ident[EI_OSABI] = ELFOSABI_ARM; |
| 2290 | −#endif | |
| 2291 | 2289 | #elif defined TCC_TARGET_RISCV64 |
| 2292 | 2290 | ehdr.e_flags = EF_RISCV_FLOAT_ABI_DOUBLE; |
| 2293 | 2291 | #endif |
| @@ -8266,7 +8266,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) · 8265 unmodified lines | ||
| 8266 | 8266 | sym = type.ref; |
| 8267 | 8267 | if (sym->f.func_type == FUNC_OLD && l == VT_CONST) |
| 8268 | 8268 | decl0(VT_CMP, 0, sym); |
| 8269 | −#ifdef TCC_TARGET_MACHO | |
| 8269 | +#if defined TCC_TARGET_MACHO || defined TARGETOS_ANDROID | |
| 8270 | 8270 | if (sym->f.func_alwinl |
| 8271 | 8271 | && ((type.t & (VT_EXTERN | VT_INLINE)) |
| 8272 | 8272 | == (VT_EXTERN | VT_INLINE))) { |
| @@ -3713,6 +3713,9 @@ static const char * const target_os_defs = · 3712 unmodified lines | ||
| 3713 | 3713 | # else |
| 3714 | 3714 | "__linux__\0" |
| 3715 | 3715 | "__linux\0" |
| 3716 | +# if TARGETOS_ANDROID | |
| 3717 | + "__ANDROID__\0" | |
| 3718 | +# endif | |
| 3716 | 3719 | # endif |
| 3717 | 3720 | "__unix__\0" |
| 3718 | 3721 | "__unix\0" |
| @@ -3724,17 +3727,22 @@ static void putdef(CString *cs, const char *p) · 5 unmodified lines | ||
| 3724 | 3727 | cstr_printf(cs, "#define %s%s\n", p, &" 1"[!!strchr(p, ' ')*2]); |
| 3725 | 3728 | } |
| 3726 | 3729 | |
| 3730 | +static void putdefs(CString *cs, const char *p) | |
| 3731 | +{ | |
| 3732 | + while (*p) | |
| 3733 | + putdef(cs, p), p = strchr(p, 0) + 1; | |
| 3734 | +} | |
| 3735 | + | |
| 3727 | 3736 | static void tcc_predefs(TCCState *s1, CString *cs, int is_asm) |
| 3728 | 3737 | { |
| 3729 | 3738 | int a, b, c; |
| 3730 | − const char *defs[] = { target_machine_defs, target_os_defs, NULL }; | |
| 3731 | − const char *p; | |
| 3732 | 3739 | |
| 3733 | 3740 | sscanf(TCC_VERSION, "%d.%d.%d", &a, &b, &c); |
| 3734 | 3741 | cstr_printf(cs, "#define __TINYC__ %d\n", a*10000 + b*100 + c); |
| 3735 | − for (a = 0; defs[a]; ++a) | |
| 3736 | − for (p = defs[a]; *p; p = strchr(p, 0) + 1) | |
| 3737 | − putdef(cs, p); | |
| 3742 | + | |
| 3743 | + putdefs(cs, target_machine_defs); | |
| 3744 | + putdefs(cs, target_os_defs); | |
| 3745 | + | |
| 3738 | 3746 | #ifdef TCC_TARGET_ARM |
| 3739 | 3747 | if (s1->float_abi == ARM_HARD_FLOAT) |
| 3740 | 3748 | putdef(cs, "__ARM_PCS_VFP"); |
| @@ -390,7 +390,7 @@ static void set_pages_executable(TCCState *s1, int mode, void *ptr, unsigned lon · 389 unmodified lines | ||
| 390 | 390 | tcc_error("mprotect failed: did you mean to configure --with-selinux?"); |
| 391 | 391 | |
| 392 | 392 | /* XXX: BSD sometimes dump core with bad system call */ |
| 393 | −# if (TCC_TARGET_ARM && !TARGETOS_BSD) || TCC_TARGET_ARM64 | |
| 393 | +# if (defined TCC_TARGET_ARM && !TARGETOS_BSD) || defined TCC_TARGET_ARM64 | |
| 394 | 394 | if (mode == 0 || mode == 3) { |
| 395 | 395 | void __clear_cache(void *beginning, void *end); |
| 396 | 396 | __clear_cache(ptr, (char *)ptr + length); |
| @@ -35,8 +35,8 @@ endif · 34 unmodified lines | ||
| 35 | 35 | ifeq (,$(filter arm64 i386 x86_64,$(ARCH))) |
| 36 | 36 | TESTS := $(filter-out vla_test-run,$(TESTS)) |
| 37 | 37 | endif |
| 38 | −ifeq ($(CONFIG_arm_eabi),yes) | |
| 39 | − TESTS := $(filter-out test3,$(TESTS)) | |
| 38 | +ifeq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--) | |
| 39 | + TESTS := $(filter-out test3 test1b,$(TESTS)) | |
| 40 | 40 | endif |
| 41 | 41 | ifeq (,$(filter i386 x86_64,$(ARCH))) |
| 42 | 42 | TESTS := $(filter-out asm-c-connect-test,$(TESTS)) |
| @@ -250,7 +250,7 @@ abitest-% : abitest-%.exe · 207 unmodified lines | ||
| 250 | 250 | ./$< $(TCCFLAGS) |
| 251 | 251 | |
| 252 | 252 | abitest: abitest-cc |
| 253 | −ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float | |
| 253 | +ifneq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--) | |
| 254 | 254 | abitest: abitest-tcc |
| 255 | 255 | endif |
| 256 | 256 | |
| @@ -261,6 +261,8 @@ vla_test-run: vla_test$(EXESUF) · 4 unmodified lines | ||
| 261 | 261 | @echo ------------ $@ ------------ |
| 262 | 262 | ./vla_test$(EXESUF) |
| 263 | 263 | |
| 264 | +.PHONY: abitest vla_test | |
| 265 | + | |
| 264 | 266 | asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c |
| 265 | 267 | $(TCC) -o $@ $^ |
| 266 | 268 | |
| @@ -21,14 +21,19 @@ · 20 unmodified lines | ||
| 21 | 21 | typedef __SIZE_TYPE__ uintptr_t; |
| 22 | 22 | #endif |
| 23 | 23 | |
| 24 | −#if defined(_WIN32) || \ | |
| 25 | − (defined(__arm__) && \ | |
| 26 | − (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__))) | |
| 24 | +#if defined(_WIN32) \ | |
| 25 | + || (defined(__arm__) \ | |
| 26 | + && (defined(__FreeBSD__) \ | |
| 27 | + || defined(__OpenBSD__) \ | |
| 28 | + || defined(__NetBSD__) \ | |
| 29 | + || defined __ANDROID__)) | |
| 27 | 30 | #define LONG_LONG_FORMAT "%lld" |
| 28 | 31 | #define ULONG_LONG_FORMAT "%llu" |
| 32 | +#define XLONG_LONG_FORMAT "%llx" | |
| 29 | 33 | #else |
| 30 | 34 | #define LONG_LONG_FORMAT "%Ld" |
| 31 | 35 | #define ULONG_LONG_FORMAT "%Lu" |
| 36 | +#define XLONG_LONG_FORMAT "%Lx" | |
| 32 | 37 | #endif |
| 33 | 38 | |
| 34 | 39 | // 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 | |
| 2266 | 2271 | void float_test(void) |
| 2267 | 2272 | { |
| 2268 | −#if !defined(__arm__) || defined(__ARM_PCS_VFP) | |
| 2273 | +#if !defined(__arm__) || defined(__ARM_PCS_VFP) || defined __ANDROID__ | |
| 2269 | 2274 | volatile float fa, fb; |
| 2270 | 2275 | volatile double da, db; |
| 2271 | 2276 | int a; |
| @@ -2531,7 +2536,7 @@ void longlong_test(void) · 259 unmodified lines | ||
| 2531 | 2536 | b = 0x12345678; |
| 2532 | 2537 | a = -1; |
| 2533 | 2538 | c = a + b; |
| 2534 | − printf("%Lx\n", c); | |
| 2539 | + printf(XLONG_LONG_FORMAT"\n", c); | |
| 2535 | 2540 | #endif |
| 2536 | 2541 | |
| 2537 | 2542 | /* long long reg spill test */ |
| @@ -9,7 +9,7 @@ TESTS = $(patsubst %.c,%.test,\ · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | # some tests do not pass on all platforms, remove them for now |
| 11 | 11 | SKIP = 34_array_assignment.test # array assignment is not in C standard |
| 12 | −ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float | |
| 12 | +ifeq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--) | |
| 13 | 13 | SKIP += 22_floating_point.test |
| 14 | 14 | endif |
| 15 | 15 | ifdef CONFIG_OSX |
| @@ -27,12 +27,12 @@ ifeq (,$(filter i386 x86_64,$(ARCH))) · 11 unmodified lines | ||
| 27 | 27 | SKIP += 125_atomic_misc.test # currently only x86 supported |
| 28 | 28 | endif |
| 29 | 29 | ifeq ($(CONFIG_backtrace),no) |
| 30 | − SKIP += 112_backtrace.test | |
| 31 | 30 | SKIP += 113_btdll.test |
| 32 | 31 | CONFIG_bcheck = no |
| 33 | 32 | # no bcheck without backtrace |
| 34 | 33 | endif |
| 35 | 34 | ifeq ($(CONFIG_bcheck),no) |
| 35 | + SKIP += 112_backtrace.test | |
| 36 | 36 | SKIP += 114_bound_signal.test |
| 37 | 37 | SKIP += 115_bound_setjmp.test |
| 38 | 38 | SKIP += 116_bound_setjmp2.test |