The port is functional. Bound checking is not supported yet.
Unified · Split
| @@ -73,6 +73,7 @@ NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386 · 72 unmodified lines | |||
| 73 | NATIVE_DEFINES_$(CONFIG_x86_64) += -DTCC_TARGET_X86_64 | 73 | NATIVE_DEFINES_$(CONFIG_x86_64) += -DTCC_TARGET_X86_64 |
| 74 | NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE | 74 | NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE |
| 75 | NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC | 75 | NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC |
| 76 | NATIVE_DEFINES_$(CONFIG_musl) += -DTCC_MUSL | ||
| 76 | NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM | 77 | NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM |
| 77 | NATIVE_DEFINES_$(CONFIG_arm_eabihf) += -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT | 78 | NATIVE_DEFINES_$(CONFIG_arm_eabihf) += -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT |
| 78 | NATIVE_DEFINES_$(CONFIG_arm_eabi) += -DTCC_ARM_EABI | 79 | NATIVE_DEFINES_$(CONFIG_arm_eabi) += -DTCC_ARM_EABI |
| @@ -352,6 +352,8 @@ if test -z "$cross_prefix" ; then · 351 unmodified lines | |||
| 352 | 352 | ||
| 353 | if test -f "/lib/ld-uClibc.so.0" ; then | 353 | if test -f "/lib/ld-uClibc.so.0" ; then |
| 354 | confvars="$confvars uClibc" | 354 | confvars="$confvars uClibc" |
| 355 | elif test -f "/lib/ld-musl-$cpu.so.1"; then | ||
| 356 | confvars="$confvars musl" | ||
| 355 | fi | 357 | fi |
| 356 | fi | 358 | fi |
| 357 | else | 359 | else |
| @@ -16,7 +16,11 @@ typedef struct { · 15 unmodified lines | |||
| 16 | char *reg_save_area; | 16 | char *reg_save_area; |
| 17 | } __va_list_struct; | 17 | } __va_list_struct; |
| 18 | 18 | ||
| 19 | /* Avoid conflicting definition for va_list on musl libc */ | ||
| 20 | #ifndef __DEFINED_va_list | ||
| 19 | typedef __va_list_struct va_list[1]; | 21 | typedef __va_list_struct va_list[1]; |
| 22 | #define __DEFINED_va_list | ||
| 23 | #endif | ||
| 20 | 24 | ||
| 21 | void __va_start(__va_list_struct *ap, void *fp); | 25 | void __va_start(__va_list_struct *ap, void *fp); |
| 22 | void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); | 26 | void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); |
| @@ -30,6 +30,10 @@ ifeq ($(TARGETOS),Darwin) · 29 unmodified lines | |||
| 30 | BCHECK_O = | 30 | BCHECK_O = |
| 31 | endif | 31 | endif |
| 32 | 32 | ||
| 33 | ifeq ($(CONFIG_musl),yes) | ||
| 34 | BCHECK_O = | ||
| 35 | endif | ||
| 36 | |||
| 33 | I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O) | 37 | I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O) |
| 34 | X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o $(BCHECK_O) | 38 | X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o $(BCHECK_O) |
| 35 | ARM_O = libtcc1.o armeabi.o alloca-arm.o | 39 | ARM_O = libtcc1.o armeabi.o alloca-arm.o |
| @@ -48,7 +48,7 @@ · 47 unmodified lines | |||
| 48 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ | 48 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ |
| 49 | || defined(__DragonFly__) || defined(__dietlibc__) \ | 49 | || defined(__DragonFly__) || defined(__dietlibc__) \ |
| 50 | || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \ | 50 | || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \ |
| 51 | || defined(_WIN32) || defined(TCC_UCLIBC) | 51 | || defined(_WIN32) || defined(TCC_UCLIBC) || defined(TCC_MUSL) |
| 52 | //#warning Bound checking does not support malloc (etc.) in this environment. | 52 | //#warning Bound checking does not support malloc (etc.) in this environment. |
| 53 | #undef CONFIG_TCC_MALLOC_HOOKS | 53 | #undef CONFIG_TCC_MALLOC_HOOKS |
| 54 | #undef HAVE_MEMALIGN | 54 | #undef HAVE_MEMALIGN |
| @@ -851,6 +851,10 @@ LIBTCCAPI TCCState *tcc_new(void) · 850 unmodified lines | |||
| 851 | tcc_define_symbol(s, "__ILP32__", NULL); | 851 | tcc_define_symbol(s, "__ILP32__", NULL); |
| 852 | #endif | 852 | #endif |
| 853 | 853 | ||
| 854 | #if defined(TCC_MUSL) | ||
| 855 | tcc_define_symbol(s, "__builtin_va_list", "void *"); | ||
| 856 | #endif /* TCC_MUSL */ | ||
| 857 | |||
| 854 | #ifdef TCC_TARGET_PE | 858 | #ifdef TCC_TARGET_PE |
| 855 | tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short"); | 859 | tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short"); |
| 856 | tcc_define_symbol(s, "__WINT_TYPE__", "unsigned short"); | 860 | tcc_define_symbol(s, "__WINT_TYPE__", "unsigned short"); |
| @@ -136,7 +136,7 @@ · 135 unmodified lines | |||
| 136 | 136 | ||
| 137 | #if !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \ | 137 | #if !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \ |
| 138 | !defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_C67) && \ | 138 | !defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_C67) && \ |
| 139 | !defined(CONFIG_USE_LIBGCC) | 139 | !defined(CONFIG_USE_LIBGCC) && !defined(TCC_MUSL) |
| 140 | #define CONFIG_TCC_BCHECK /* enable bound checking code */ | 140 | #define CONFIG_TCC_BCHECK /* enable bound checking code */ |
| 141 | #endif | 141 | #endif |
| 142 | 142 | ||
| @@ -239,11 +239,23 @@ · 96 unmodified lines | |||
| 239 | # elif defined(TCC_UCLIBC) | 239 | # elif defined(TCC_UCLIBC) |
| 240 | # define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0" /* is there a uClibc for x86_64 ? */ | 240 | # define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0" /* is there a uClibc for x86_64 ? */ |
| 241 | # elif defined TCC_TARGET_ARM64 | 241 | # elif defined TCC_TARGET_ARM64 |
| 242 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux-aarch64.so.1" | 242 | # if defined(TCC_MUSL) |
| 243 | # define CONFIG_TCC_ELFINTERP "/lib/ld-musl-aarch64.so.1" | ||
| 244 | # else | ||
| 245 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux-aarch64.so.1" | ||
| 246 | # endif | ||
| 243 | # elif defined(TCC_TARGET_X86_64) | 247 | # elif defined(TCC_TARGET_X86_64) |
| 244 | # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" | 248 | # if defined(TCC_MUSL) |
| 249 | # define CONFIG_TCC_ELFINTERP "/lib/ld-musl-x86_64.so.1" | ||
| 250 | # else | ||
| 251 | # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" | ||
| 252 | # endif | ||
| 245 | # elif !defined(TCC_ARM_EABI) | 253 | # elif !defined(TCC_ARM_EABI) |
| 246 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" | 254 | # if defined(TCC_MUSL) |
| 255 | # define CONFIG_TCC_ELFINTERP "/lib/ld-musl-arm.so.1" | ||
| 256 | # else | ||
| 257 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" | ||
| 258 | # endif | ||
| 247 | # endif | 259 | # endif |
| 248 | #endif | 260 | #endif |
| 249 | 261 | ||
| @@ -1718,7 +1718,7 @@ static int final_sections_reloc(TCCState *s1) · 1717 unmodified lines | |||
| 1718 | /* XXX: ignore sections with allocated relocations ? */ | 1718 | /* XXX: ignore sections with allocated relocations ? */ |
| 1719 | for(i = 1; i < s1->nb_sections; i++) { | 1719 | for(i = 1; i < s1->nb_sections; i++) { |
| 1720 | s = s1->sections[i]; | 1720 | s = s1->sections[i]; |
| 1721 | #ifdef TCC_TARGET_I386 | 1721 | #if defined(TCC_TARGET_I386) || defined(TCC_MUSL) |
| 1722 | if (s->reloc && s != s1->got && (s->sh_flags & SHF_ALLOC)) //gr | 1722 | if (s->reloc && s != s1->got && (s->sh_flags & SHF_ALLOC)) //gr |
| 1723 | /* On X86 gdb 7.3 works in any case but gdb 6.6 will crash if SHF_ALLOC | 1723 | /* On X86 gdb 7.3 works in any case but gdb 6.6 will crash if SHF_ALLOC |
| 1724 | checking is removed */ | 1724 | checking is removed */ |