- 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
Unified · Split
| @@ -42,13 +42,13 @@ endif · 41 unmodified lines | |||
| 42 | endif | 42 | endif |
| 43 | 43 | ||
| 44 | ifeq ($(ARCH),i386) | 44 | ifeq ($(ARCH),i386) |
| 45 | NATIVE_DEFINES=-DTCC_TARGET_I386 | 45 | NATIVE_DEFINES+=-DTCC_TARGET_I386 |
| 46 | else ifeq ($(ARCH),x86-64) | 46 | else ifeq ($(ARCH),x86-64) |
| 47 | NATIVE_DEFINES=-DTCC_TARGET_X86_64 | 47 | NATIVE_DEFINES+=-DTCC_TARGET_X86_64 |
| 48 | endif | 48 | endif |
| 49 | 49 | ||
| 50 | ifeq ($(ARCH),arm) | 50 | ifeq ($(ARCH),arm) |
| 51 | NATIVE_DEFINES=-DTCC_TARGET_ARM | 51 | NATIVE_DEFINES+=-DTCC_TARGET_ARM |
| 52 | NATIVE_DEFINES+=-DWITHOUT_LIBTCC | 52 | NATIVE_DEFINES+=-DWITHOUT_LIBTCC |
| 53 | ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3)) | 53 | ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3)) |
| 54 | NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT | 54 | NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT |
| @@ -304,15 +304,6 @@ if test -z "$cross_prefix" ; then · 303 unmodified lines | |||
| 304 | tcc_lddir="lib64" | 304 | tcc_lddir="lib64" |
| 305 | fi | 305 | fi |
| 306 | 306 | ||
| 307 | # gr: FIXME | ||
| 308 | # ldd $CONFTEST gives (ubuntu 8) | ||
| 309 | # linux-gate.so.1 => (0xb7fc3000) | ||
| 310 | # libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e37000) | ||
| 311 | # /lib/ld-linux.so.2 (0xb7fa9000) | ||
| 312 | # result is crap: | ||
| 313 | # CONFIG_LDDIR="lib/tls/i686/cmov" | ||
| 314 | # CONFIG_MUADIR="tls/i686/cmov" | ||
| 315 | # | ||
| 316 | # multiarch_triplet=${libc_dir#*/} | 307 | # multiarch_triplet=${libc_dir#*/} |
| 317 | # multiarch_triplet=${multiarch_triplet%/} | 308 | # multiarch_triplet=${multiarch_triplet%/} |
| 318 | # tcc_lddir="${libc_dir%%/*}" | 309 | # tcc_lddir="${libc_dir%%/*}" |
| @@ -321,8 +312,8 @@ if test -z "$cross_prefix" ; then · 2 unmodified lines | |||
| 321 | # fi | 312 | # fi |
| 322 | 313 | ||
| 323 | # gr: maybe for after the release: | 314 | # gr: maybe for after the release: |
| 324 | # tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')" | 315 | # tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')" |
| 325 | # #echo "elfinterp $tcc_elfinterp" | 316 | # echo "elfinterp $tcc_elfinterp" |
| 326 | 317 | ||
| 327 | fi | 318 | fi |
| 328 | fi | 319 | fi |
| @@ -333,18 +324,6 @@ else · 4 unmodified lines | |||
| 333 | esac | 324 | esac |
| 334 | fi | 325 | fi |
| 335 | 326 | ||
| 336 | # gr: maybe for after the release: | ||
| 337 | # run compiler to see if it supports FLAG, if yes add to CFLAGS | ||
| 338 | #cc_option() { | ||
| 339 | # if $cc $CFLAGS $1 -S -o /dev/null -xc conftest.c >/dev/null 2>&1; then | ||
| 340 | # CFLAGS="$CFLAGS $1"; else if test -n "$2"; then | ||
| 341 | # CFLAGS="$CFLAGS $2"; fi; fi | ||
| 342 | #} | ||
| 343 | #cc_option -fno-strict-aliasing | ||
| 344 | #cc_option -Wno-pointer-sign | ||
| 345 | #cc_option -Wno-sign-compare | ||
| 346 | #cc_option -Wno-unused-result -D_FORTIFY_SOURCE=0 | ||
| 347 | |||
| 348 | cat <<EOF | 327 | cat <<EOF |
| 349 | Binary directory $bindir | 328 | Binary directory $bindir |
| 350 | TinyCC directory $tccdir | 329 | TinyCC directory $tccdir |
| @@ -389,24 +368,29 @@ LIBSUF=$LIBSUF · 38 unmodified lines | |||
| 389 | EXESUF=$EXESUF | 368 | EXESUF=$EXESUF |
| 390 | EOF | 369 | EOF |
| 391 | 370 | ||
| 392 | print_def() { | 371 | print_inc() { |
| 393 | if test -n "$2"; then | 372 | if test -n "$2"; then |
| 394 | echo "#ifndef $1" >> $TMPH | 373 | echo "#ifndef $1" >> $TMPH |
| 395 | echo "# define $1 \"$2\"" >> $TMPH | 374 | echo "# define $1 \"$2\"" >> $TMPH |
| 396 | echo "#endif" >> $TMPH | 375 | echo "#endif" >> $TMPH |
| 397 | fi | 376 | fi |
| 398 | } | 377 | } |
| 378 | print_mak() { | ||
| 379 | if test -n "$2"; then | ||
| 380 | echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak | ||
| 381 | fi | ||
| 382 | } | ||
| 399 | 383 | ||
| 400 | echo "/* Automatically generated by configure - do not modify */" > $TMPH | 384 | echo "/* Automatically generated by configure - do not modify */" > $TMPH |
| 401 | 385 | ||
| 402 | print_def CONFIG_SYSROOT "$sysroot" | 386 | print_inc CONFIG_SYSROOT "$sysroot" |
| 403 | print_def CONFIG_TCCDIR "$tccdir" | 387 | print_inc CONFIG_TCCDIR "$tccdir" |
| 404 | print_def CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" | 388 | print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" |
| 405 | print_def CONFIG_TCC_LIBPATHS "$tcc_libpaths" | 389 | print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths" |
| 406 | print_def CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" | 390 | print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" |
| 407 | print_def CONFIG_TCC_ELFINTERP "$tcc_elfinterp" | 391 | print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp" |
| 408 | print_def CONFIG_MULTIARCHDIR "$multiarch_triplet" | 392 | print_mak CONFIG_LDDIR "$tcc_lddir" |
| 409 | print_def CONFIG_LDDIR "$tcc_lddir" | 393 | print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet" |
| 410 | 394 | ||
| 411 | echo "#define GCC_MAJOR $gcc_major" >> $TMPH | 395 | echo "#define GCC_MAJOR $gcc_major" >> $TMPH |
| 412 | echo "#define GCC_MINOR $gcc_minor" >> $TMPH | 396 | echo "#define GCC_MINOR $gcc_minor" >> $TMPH |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | TOP = .. | 5 | TOP = .. |
| 6 | include $(TOP)/config.mak | 6 | include $(TOP)/Makefile |
| 7 | VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib | 7 | VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib |
| 8 | 8 | ||
| 9 | ifndef TARGET | 9 | ifndef TARGET |
| @@ -91,7 +91,7 @@ $(DIR)/%.o : %.c · 81 unmodified lines | |||
| 91 | $(DIR)/%.o : %.S | 91 | $(DIR)/%.o : %.S |
| 92 | $(XCC) -c $< -o $@ $(XFLAGS) | 92 | $(XCC) -c $< -o $@ $(XFLAGS) |
| 93 | $(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c | 93 | $(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c |
| 94 | $(CC) -Os -s -o $@ $< $(XFLAGS) $(LDFLAGS) | 94 | $(CC) -o $@ $< $(XFLAGS) $(LDFLAGS) |
| 95 | 95 | ||
| 96 | $(OBJ) $(XAR) : $(DIR)/exists | 96 | $(OBJ) $(XAR) : $(DIR)/exists |
| 97 | $(DIR)/exists : | 97 | $(DIR)/exists : |
| @@ -609,8 +609,11 @@ unsigned long long __fixunsxfdi (long double a1) · 608 unmodified lines | |||
| 609 | 609 | ||
| 610 | /* helper functions for stdarg.h */ | 610 | /* helper functions for stdarg.h */ |
| 611 | 611 | ||
| 612 | #include <stdio.h> | ||
| 613 | #include <stdlib.h> | 612 | #include <stdlib.h> |
| 613 | #ifndef __TINYC__ | ||
| 614 | /* gives "incompatible types for redefinition of __va_arg" below */ | ||
| 615 | #include <stdio.h> | ||
| 616 | #endif | ||
| 614 | 617 | ||
| 615 | enum __va_arg_type { | 618 | enum __va_arg_type { |
| 616 | __va_gen_reg, __va_float_reg, __va_stack | 619 | __va_gen_reg, __va_float_reg, __va_stack |
| @@ -665,7 +668,9 @@ void *__va_arg(struct __va_list_struct *ap, · 48 unmodified lines | |||
| 665 | return ap->overflow_arg_area - size; | 668 | return ap->overflow_arg_area - size; |
| 666 | 669 | ||
| 667 | default: | 670 | default: |
| 671 | #ifndef __TINYC__ | ||
| 668 | fprintf(stderr, "unknown ABI type for __va_arg\n"); | 672 | fprintf(stderr, "unknown ABI type for __va_arg\n"); |
| 673 | #endif | ||
| 669 | abort(); | 674 | abort(); |
| 670 | } | 675 | } |
| 671 | } | 676 | } |
| @@ -223,6 +223,7 @@ static void display_info(TCCState *s, int what) · 222 unmodified lines | |||
| 223 | print_paths("crt", s->crt_paths, s->nb_crt_paths); | 223 | print_paths("crt", s->crt_paths, s->nb_crt_paths); |
| 224 | print_paths("libraries", s->library_paths, s->nb_library_paths); | 224 | print_paths("libraries", s->library_paths, s->nb_library_paths); |
| 225 | print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths); | 225 | print_paths("include", s->sysinclude_paths, s->nb_sysinclude_paths); |
| 226 | printf("elfinterp:\n %s\n", CONFIG_TCC_ELFINTERP); | ||
| 226 | break; | 227 | break; |
| 227 | } | 228 | } |
| 228 | } | 229 | } |
| @@ -214,6 +214,8 @@ · 213 unmodified lines | |||
| 214 | # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" | 214 | # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" |
| 215 | # elif defined(TCC_UCLIBC) | 215 | # elif defined(TCC_UCLIBC) |
| 216 | # define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0" | 216 | # define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0" |
| 217 | # elif defined(TCC_TARGET_PE) | ||
| 218 | # define CONFIG_TCC_ELFINTERP "-" | ||
| 217 | # else | 219 | # else |
| 218 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" | 220 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" |
| 219 | # endif | 221 | # endif |