configure: - remove CONFIG_USE_LIBGCC, --with-libgcc - remove CONFIG_LDDIR - remove CONFIG_USR_INCLUDE - add -q switch for quiet (=no) output tcc.h: - remove /usr/local/include&lib search paths arm-gen.c: - remove default_elfinterp() function tccelf.c: - setup the ELF-interp in tccelf_new()
Unified · Split
| @@ -158,10 +158,27 @@ all : cross · 157 unmodified lines | |||
| 158 | endif | 158 | endif |
| 159 | 159 | ||
| 160 | # -------------------------------------------- | 160 | # -------------------------------------------- |
| 161 | 161 | T = $(or $(CROSS_TARGET),$(NATIVE_TARGET)) | |
| 162 | T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown) | ||
| 163 | X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-) | 162 | X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-) |
| 164 | 163 | ||
| 164 | ifneq ($(T),$(NATIVE_TARGET)) | ||
| 165 | $(if $(DEF-$T),,$(error error: unknown target: '$T')) | ||
| 166 | ifneq ($(CONFIG_WIN32),yes) | ||
| 167 | DEF-win = -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" | ||
| 168 | endif | ||
| 169 | # some default config for cross compilers | ||
| 170 | TRIPLET-i386 = i686-linux-gnu | ||
| 171 | TRIPLET-x86_64 = x86_64-linux-gnu | ||
| 172 | TRIPLET-arm = arm-linux-gnueabihf | ||
| 173 | TRIPLET-arm64 = aarch64-linux-gnu | ||
| 174 | TRIPLET-riscv64 = riscv64-linux-gnu | ||
| 175 | ifneq ($(TRIPLET-$T),) | ||
| 176 | # assume support files in "/usr/<triplet>" | ||
| 177 | ROOT-$T = /usr/$(TRIPLET-$T) | ||
| 178 | INC-$T = {B}/include:{R}/include | ||
| 179 | LIB-$T = {R}/lib:{B} | ||
| 180 | CRT-$T = {R}/lib | ||
| 181 | endif | ||
| 165 | DEFINES += $(DEF-$T) | 182 | DEFINES += $(DEF-$T) |
| 166 | DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"") | 183 | DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"") |
| 167 | DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"") | 184 | DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"") |
| @@ -169,36 +186,17 @@ DEFINES += $(if $(LIB-$T),-DCONFIG_TCC_LIBPATHS="\"$(LIB-$T)\"") · 1 unmodified line | |||
| 169 | DEFINES += $(if $(INC-$T),-DCONFIG_TCC_SYSINCLUDEPATHS="\"$(INC-$T)\"") | 186 | DEFINES += $(if $(INC-$T),-DCONFIG_TCC_SYSINCLUDEPATHS="\"$(INC-$T)\"") |
| 170 | DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"") | 187 | DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"") |
| 171 | DEFINES += $(DEF-$(or $(findstring win,$T),unx)) | 188 | DEFINES += $(DEF-$(or $(findstring win,$T),unx)) |
| 172 | 189 | DEFINES += -DCONFIG_TCC_CROSSPREFIX="\"$X\"" | |
| 173 | ifneq ($(X),) | ||
| 174 | $(if $(DEF-$T),,$(error error: unknown target: '$T')) | ||
| 175 | DEF-$(NATIVE_TARGET) = | ||
| 176 | DEF-$T += -DCONFIG_TCC_CROSSPREFIX="\"$X\"" | ||
| 177 | ifneq ($(CONFIG_WIN32),yes) | ||
| 178 | DEF-win += -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" | ||
| 179 | endif | ||
| 180 | else | ||
| 181 | # using values from config.h | ||
| 182 | DEF-$(NATIVE_TARGET) = | ||
| 183 | endif | 190 | endif |
| 184 | 191 | ||
| 185 | # include custom configuration (see make help) | 192 | # include custom configuration (see make help) |
| 186 | -include config-extra.mak | 193 | -include config-extra.mak |
| 187 | 194 | ||
| 188 | ifneq ($(T),$(NATIVE_TARGET)) | 195 | # so one can use: make EXTRA-DEFS=... |
| 189 | # assume support files for cross-targets in "/usr/<triplet>" by default | 196 | DEFINES += $(EXTRA-DEFS) |
| 190 | TRIPLET-i386 ?= i686-linux-gnu | 197 | |
| 191 | TRIPLET-x86_64 ?= x86_64-linux-gnu | 198 | # find config.h with 'out of tree' builds |
| 192 | TRIPLET-arm ?= arm-linux-gnueabi | 199 | DEFINES += -I$(TOP) |
| 193 | TRIPLET-arm64 ?= aarch64-linux-gnu | ||
| 194 | TRIPLET-riscv64 ?= riscv64-linux-gnu | ||
| 195 | MARCH-i386 ?= i386-linux-gnu | ||
| 196 | MARCH-$T ?= $(TRIPLET-$T) | ||
| 197 | TR = $(if $(TRIPLET-$T),$T,ignored) | ||
| 198 | CRT-$(TR) ?= /usr/$(TRIPLET-$T)/lib | ||
| 199 | LIB-$(TR) ?= {B}:/usr/$(TRIPLET-$T)/lib:/usr/lib/$(MARCH-$T) | ||
| 200 | INC-$(TR) ?= {B}/include:/usr/$(TRIPLET-$T)/include:/usr/include | ||
| 201 | endif | ||
| 202 | 200 | ||
| 203 | CORE_FILES = tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c | 201 | CORE_FILES = tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c |
| 204 | CORE_FILES += tcc.h config.h libtcc.h tcctok.h | 202 | CORE_FILES += tcc.h config.h libtcc.h tcctok.h |
| @@ -209,7 +207,6 @@ x86_64-win32_FILES = $(x86_64_FILES) tccpe.c · 4 unmodified lines | |||
| 209 | x86_64-osx_FILES = $(x86_64_FILES) tccmacho.c | 207 | x86_64-osx_FILES = $(x86_64_FILES) tccmacho.c |
| 210 | arm_FILES = $(CORE_FILES) arm-gen.c arm-link.c arm-asm.c arm-tok.h | 208 | arm_FILES = $(CORE_FILES) arm-gen.c arm-link.c arm-asm.c arm-tok.h |
| 211 | arm-wince_FILES = $(arm_FILES) tccpe.c | 209 | arm-wince_FILES = $(arm_FILES) tccpe.c |
| 212 | arm-eabihf_FILES = $(arm_FILES) | ||
| 213 | arm-fpa_FILES = $(arm_FILES) | 210 | arm-fpa_FILES = $(arm_FILES) |
| 214 | arm-fpa-ld_FILES = $(arm_FILES) | 211 | arm-fpa-ld_FILES = $(arm_FILES) |
| 215 | arm-vfp_FILES = $(arm_FILES) | 212 | arm-vfp_FILES = $(arm_FILES) |
| @@ -241,7 +238,6 @@ $(CROSS_TARGET)-tcc.o : DEFINES += -DONE_SOURCE=0 · 25 unmodified lines | |||
| 241 | endif | 238 | endif |
| 242 | # native tcc always made from tcc.o and libtcc.[so|a] | 239 | # native tcc always made from tcc.o and libtcc.[so|a] |
| 243 | tcc.o : DEFINES += -DONE_SOURCE=0 | 240 | tcc.o : DEFINES += -DONE_SOURCE=0 |
| 244 | DEFINES += -I$(TOP) | ||
| 245 | 241 | ||
| 246 | GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no) | 242 | GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no) |
| 247 | ifneq ($(GITHASH),no) | 243 | ifneq ($(GITHASH),no) |
| @@ -340,7 +336,7 @@ FORCE: · 92 unmodified lines | |||
| 340 | # some versions of gnu-make do not recognize 'command' as a shell builtin | 336 | # some versions of gnu-make do not recognize 'command' as a shell builtin |
| 341 | WHICH = sh -c 'command -v $1' | 337 | WHICH = sh -c 'command -v $1' |
| 342 | 338 | ||
| 343 | run-if = $(if $(shell $(call WHICH,$1)),$S $1 $2) | 339 | run-if = $(if $(shell $(call WHICH,$1)),$S $1 $2,@echo "(skipping $@ - no $1)") |
| 344 | S = $(if $(findstring yes,$(SILENT)),@$(info * $@)) | 340 | S = $(if $(findstring yes,$(SILENT)),@$(info * $@)) |
| 345 | 341 | ||
| 346 | # -------------------------------------------------------------------------- | 342 | # -------------------------------------------------------------------------- |
| @@ -501,14 +497,14 @@ distclean: clean · 154 unmodified lines | |||
| 501 | help: | 497 | help: |
| 502 | @echo "make" | 498 | @echo "make" |
| 503 | @echo " build native compiler (from separate objects)" | 499 | @echo " build native compiler (from separate objects)" |
| 504 | @echo "make cross" | ||
| 505 | @echo " build cross compilers (from one source)" | ||
| 506 | @echo "make ONE_SOURCE=no/yes SILENT=no/yes" | 500 | @echo "make ONE_SOURCE=no/yes SILENT=no/yes" |
| 507 | @echo " force building from separate/one object(s), less/more silently" | 501 | @echo " force building from separate/one object(s), less/more silently" |
| 508 | @echo "make cross-TARGET" | 502 | @echo "make cross-TARGET" |
| 509 | @echo " build one specific cross compiler for 'TARGET'. Currently supported:" | 503 | @echo " build one specific cross compiler for 'TARGET'. Currently supported:" |
| 510 | @echo " $(wordlist 1,8,$(TCC_X))" | 504 | @echo " $(wordlist 1,8,$(TCC_X))" |
| 511 | @echo " $(wordlist 9,99,$(TCC_X))" | 505 | @echo " $(wordlist 9,99,$(TCC_X))" |
| 506 | @echo "make cross" | ||
| 507 | @echo " build all cross compilers" | ||
| 512 | @echo "make test" | 508 | @echo "make test" |
| 513 | @echo " run all tests" | 509 | @echo " run all tests" |
| 514 | @echo "make tests2.all / make tests2.37 / make tests2.37+" | 510 | @echo "make tests2.all / make tests2.37 / make tests2.37+" |
| @@ -133,11 +133,8 @@ enum { · 132 unmodified lines | |||
| 133 | 133 | ||
| 134 | #define CHAR_IS_UNSIGNED | 134 | #define CHAR_IS_UNSIGNED |
| 135 | 135 | ||
| 136 | #ifdef TCC_ARM_HARDFLOAT | 136 | #define ARM_SOFTFP_FLOAT 0 |
| 137 | # define ARM_FLOAT_ABI ARM_HARD_FLOAT | 137 | #define ARM_HARD_FLOAT 1 |
| 138 | #else | ||
| 139 | # define ARM_FLOAT_ABI ARM_SOFTFP_FLOAT | ||
| 140 | #endif | ||
| 141 | 138 | ||
| 142 | /******************************************************/ | 139 | /******************************************************/ |
| 143 | #else /* ! TARGET_DEFS_ONLY */ | 140 | #else /* ! TARGET_DEFS_ONLY */ |
| @@ -160,8 +157,6 @@ ST_DATA const char * const target_machine_defs = · 16 unmodified lines | |||
| 160 | #endif | 157 | #endif |
| 161 | ; | 158 | ; |
| 162 | 159 | ||
| 163 | enum float_abi float_abi; | ||
| 164 | |||
| 165 | ST_DATA const int reg_classes[NB_REGS] = { | 160 | ST_DATA const int reg_classes[NB_REGS] = { |
| 166 | /* r0 */ RC_INT | RC_R0, | 161 | /* r0 */ RC_INT | RC_R0, |
| 167 | /* r1 */ RC_INT | RC_R1, | 162 | /* r1 */ RC_INT | RC_R1, |
| @@ -180,6 +175,7 @@ ST_DATA const int reg_classes[NB_REGS] = { · 12 unmodified lines | |||
| 180 | #endif | 175 | #endif |
| 181 | }; | 176 | }; |
| 182 | 177 | ||
| 178 | static int float_abi; | ||
| 183 | static int func_sub_sp_offset, last_itod_magic; | 179 | static int func_sub_sp_offset, last_itod_magic; |
| 184 | static int leaffunc; | 180 | static int leaffunc; |
| 185 | 181 | ||
| @@ -241,16 +237,6 @@ static int regmask(int r) { · 55 unmodified lines | |||
| 241 | 237 | ||
| 242 | /******************************************************/ | 238 | /******************************************************/ |
| 243 | 239 | ||
| 244 | #if defined(TCC_ARM_EABI) && !defined(CONFIG_TCC_ELFINTERP) | ||
| 245 | const char *default_elfinterp(struct TCCState *s) | ||
| 246 | { | ||
| 247 | if (s->float_abi == ARM_HARD_FLOAT) | ||
| 248 | return "/lib/ld-linux-armhf.so.3"; | ||
| 249 | else | ||
| 250 | return "/lib/ld-linux.so.3"; | ||
| 251 | } | ||
| 252 | #endif | ||
| 253 | |||
| 254 | void o(uint32_t i) | 240 | void o(uint32_t i) |
| 255 | { | 241 | { |
| 256 | /* this is a good place to start adding big-endian support*/ | 242 | /* this is a good place to start adding big-endian support*/ |
| @@ -18,11 +18,6 @@ · 17 unmodified lines | |||
| 18 | #define PCRELATIVE_DLLPLT 1 | 18 | #define PCRELATIVE_DLLPLT 1 |
| 19 | #define RELOCATE_DLLPLT 1 | 19 | #define RELOCATE_DLLPLT 1 |
| 20 | 20 | ||
| 21 | enum float_abi { | ||
| 22 | ARM_SOFTFP_FLOAT, | ||
| 23 | ARM_HARD_FLOAT, | ||
| 24 | }; | ||
| 25 | |||
| 26 | #else /* !TARGET_DEFS_ONLY */ | 21 | #else /* !TARGET_DEFS_ONLY */ |
| 27 | 22 | ||
| 28 | #include "tcc.h" | 23 | #include "tcc.h" |
| @@ -35,13 +35,11 @@ mingw32="no" · 34 unmodified lines | |||
| 35 | LIBSUF=".a" | 35 | LIBSUF=".a" |
| 36 | EXESUF="" | 36 | EXESUF="" |
| 37 | DLLSUF=".so" | 37 | DLLSUF=".so" |
| 38 | tcc_usrinclude="" | ||
| 39 | tcc_sysincludepaths="" | 38 | tcc_sysincludepaths="" |
| 40 | tcc_libpaths="" | 39 | tcc_libpaths="" |
| 41 | tcc_crtprefix="" | 40 | tcc_crtprefix="" |
| 42 | tcc_elfinterp="" | 41 | tcc_elfinterp="" |
| 43 | triplet= | 42 | triplet= |
| 44 | tcc_lddir= | ||
| 45 | confvars= | 43 | confvars= |
| 46 | suggest="yes" | 44 | suggest="yes" |
| 47 | gcc_major=0 | 45 | gcc_major=0 |
| @@ -53,6 +51,7 @@ cpuver= · 5 unmodified lines | |||
| 53 | dwarf= | 51 | dwarf= |
| 54 | targetos= | 52 | targetos= |
| 55 | build_cross= | 53 | build_cross= |
| 54 | quiet= | ||
| 56 | 55 | ||
| 57 | # use CC/AR from environment when set | 56 | # use CC/AR from environment when set |
| 58 | test -n "$CC" && cc="$CC" | 57 | test -n "$CC" && cc="$CC" |
| @@ -160,8 +159,6 @@ for opt do · 101 unmodified lines | |||
| 160 | ;; | 159 | ;; |
| 161 | --debug) confvars_set debug | 160 | --debug) confvars_set debug |
| 162 | ;; | 161 | ;; |
| 163 | --with-libgcc) confvars_set libgcc | ||
| 164 | ;; | ||
| 165 | --with-selinux) confvars_set selinux | 162 | --with-selinux) confvars_set selinux |
| 166 | ;; | 163 | ;; |
| 167 | --tcc-switches=*) assign_opt "$opt" tcc_switches | 164 | --tcc-switches=*) assign_opt "$opt" tcc_switches |
| @@ -174,6 +171,8 @@ for opt do · 6 unmodified lines | |||
| 174 | ;; | 171 | ;; |
| 175 | --help|-h) show_help="yes" | 172 | --help|-h) show_help="yes" |
| 176 | ;; | 173 | ;; |
| 174 | -q) quiet=yes | ||
| 175 | ;; | ||
| 177 | *) echo "configure: WARNING: unrecognized option $opt" | 176 | *) echo "configure: WARNING: unrecognized option $opt" |
| 178 | ;; | 177 | ;; |
| 179 | esac | 178 | esac |
| @@ -197,6 +196,7 @@ Standard options: · 17 unmodified lines | |||
| 197 | --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc] | 196 | --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc] |
| 198 | --mandir=DIR man documentation in DIR [SHAREDIR/man] | 197 | --mandir=DIR man documentation in DIR [SHAREDIR/man] |
| 199 | --infodir=DIR info documentation in DIR [SHAREDIR/info] | 198 | --infodir=DIR info documentation in DIR [SHAREDIR/info] |
| 199 | -q be quiet | ||
| 200 | 200 | ||
| 201 | Advanced options (experts only): | 201 | Advanced options (experts only): |
| 202 | --source-path=PATH path of source code [$source_path] | 202 | --source-path=PATH path of source code [$source_path] |
| @@ -210,9 +210,8 @@ Advanced options (experts only): · 7 unmodified lines | |||
| 210 | --disable-static make libtcc.so instead of libtcc.a | 210 | --disable-static make libtcc.so instead of libtcc.a |
| 211 | --enable-static make libtcc.a instead of libtcc.dll (win32) | 211 | --enable-static make libtcc.a instead of libtcc.dll (win32) |
| 212 | --disable-rpath disable use of -rpath with libtcc.so | 212 | --disable-rpath disable use of -rpath with libtcc.so |
| 213 | --with-libgcc use libgcc_s.so.1 instead of libtcc1.a | ||
| 214 | --with-selinux use mmap for executable memory (tcc -run) | 213 | --with-selinux use mmap for executable memory (tcc -run) |
| 215 | --enable-cross build cross compilers (see also 'make help') | 214 | --enable-cross build all cross compilers (see also 'make help') |
| 216 | 215 | ||
| 217 | --sysincludepaths=... specify system include paths, colon separated | 216 | --sysincludepaths=... specify system include paths, colon separated |
| 218 | --libpaths=... specify system library paths, colon separated | 217 | --libpaths=... specify system library paths, colon separated |
| @@ -367,6 +366,7 @@ case $targetos in · 148 unmodified lines | |||
| 367 | cc=`command -v cc` | 366 | cc=`command -v cc` |
| 368 | cc=`readlink $cc || echo clang` | 367 | cc=`readlink $cc || echo clang` |
| 369 | tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" | 368 | tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" |
| 369 | default tcc_sysincludepaths "{B}/include:$tcc_usrinclude" | ||
| 370 | if test "${confvars%new_macho*}" = "${confvars}"; then | 370 | if test "${confvars%new_macho*}" = "${confvars}"; then |
| 371 | # if new_macho was not specified and (known) ver <= 10, use old (=no) | 371 | # if new_macho was not specified and (known) ver <= 10, use old (=no) |
| 372 | osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z | 372 | osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z |
| @@ -478,7 +478,8 @@ if test -z "$build_cross"; then · 105 unmodified lines | |||
| 478 | if test -z "$triplet"; then | 478 | if test -z "$triplet"; then |
| 479 | case $cpu in x86_64|arm64|riscv64) | 479 | case $cpu in x86_64|arm64|riscv64) |
| 480 | if test -f "/usr/lib64/crti.o" ; then | 480 | if test -f "/usr/lib64/crti.o" ; then |
| 481 | tcc_lddir="lib64" | 481 | default tcc_libpaths "{B}:/usr/lib64" |
| 482 | default tcc_crtprefix "/usr/lib64" | ||
| 482 | fi | 483 | fi |
| 483 | esac | 484 | esac |
| 484 | fi | 485 | fi |
| @@ -552,6 +553,7 @@ fi · 67 unmodified lines | |||
| 552 | 553 | ||
| 553 | fcho() { if test -n "$2"; then echo "$1$2"; fi } | 554 | fcho() { if test -n "$2"; then echo "$1$2"; fi } |
| 554 | 555 | ||
| 556 | if test -z "$quiet"; then | ||
| 555 | fcho "Binary directory " "$bindir" | 557 | fcho "Binary directory " "$bindir" |
| 556 | fcho "TinyCC directory " "$tccdir" | 558 | fcho "TinyCC directory " "$tccdir" |
| 557 | fcho "Library directory " "$libdir" | 559 | fcho "Library directory " "$libdir" |
| @@ -560,7 +562,6 @@ fcho "Manual directory " "$mandir" · 2 unmodified lines | |||
| 560 | fcho "Info directory " "$infodir" | 562 | fcho "Info directory " "$infodir" |
| 561 | fcho "Doc directory " "$docdir" | 563 | fcho "Doc directory " "$docdir" |
| 562 | fcho "Target root prefix " "$sysroot" | 564 | fcho "Target root prefix " "$sysroot" |
| 563 | fcho "/usr/include dir " "$tcc_usrinclude" | ||
| 564 | echo "Source path $source_path" | 565 | echo "Source path $source_path" |
| 565 | echo "Build OS $(uname -m -s)" | 566 | echo "Build OS $(uname -m -s)" |
| 566 | echo "C compiler $cc ($gcc_major.$gcc_minor)" | 567 | echo "C compiler $cc ($gcc_major.$gcc_minor)" |
| @@ -574,6 +575,7 @@ fcho "Elfinterp " "$tcc_elfinterp" · 7 unmodified lines | |||
| 574 | fcho "Switches " "$tcc_switches" | 575 | fcho "Switches " "$tcc_switches" |
| 575 | fcho "Config " "${confvars# }" | 576 | fcho "Config " "${confvars# }" |
| 576 | echo "Creating config.mak and config.h" | 577 | echo "Creating config.mak and config.h" |
| 578 | fi | ||
| 577 | 579 | ||
| 578 | version=$(head "$source_path/VERSION") | 580 | version=$(head "$source_path/VERSION") |
| 579 | 581 | ||
| @@ -691,7 +693,6 @@ for v in $cpu $confvars ; do · 111 unmodified lines | |||
| 691 | esac | 693 | esac |
| 692 | ;; | 694 | ;; |
| 693 | # other | 695 | # other |
| 694 | CONFIG_libgcc=yes) print_num CONFIG_USE_LIBGCC 1 ;; | ||
| 695 | CONFIG_selinux=yes) print_num CONFIG_SELINUX 1 ;; | 696 | CONFIG_selinux=yes) print_num CONFIG_SELINUX 1 ;; |
| 696 | CONFIG_pie=yes) print_num CONFIG_TCC_PIE 1 ;; | 697 | CONFIG_pie=yes) print_num CONFIG_TCC_PIE 1 ;; |
| 697 | CONFIG_pic=yes) print_num CONFIG_TCC_PIC 1 ;; | 698 | CONFIG_pic=yes) print_num CONFIG_TCC_PIC 1 ;; |
| @@ -706,13 +707,11 @@ for v in $cpu $confvars ; do · 8 unmodified lines | |||
| 706 | esac | 707 | esac |
| 707 | done | 708 | done |
| 708 | 709 | ||
| 709 | print_str CONFIG_USR_INCLUDE "$tcc_usrinclude" | ||
| 710 | print_str CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" | 710 | print_str CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" |
| 711 | print_str CONFIG_TCC_LIBPATHS "$tcc_libpaths" | 711 | print_str CONFIG_TCC_LIBPATHS "$tcc_libpaths" |
| 712 | print_str CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" | 712 | print_str CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" |
| 713 | print_str CONFIG_TCC_ELFINTERP "$tcc_elfinterp" | 713 | print_str CONFIG_TCC_ELFINTERP "$tcc_elfinterp" |
| 714 | print_str CONFIG_TCC_SWITCHES "$tcc_switches" | 714 | print_str CONFIG_TCC_SWITCHES "$tcc_switches" |
| 715 | print_str CONFIG_LDDIR "$tcc_lddir" | ||
| 716 | print_str CONFIG_TRIPLET "$triplet" | 715 | print_str CONFIG_TRIPLET "$triplet" |
| 717 | print_str CONFIG_OS_RELEASE "$os_release" | 716 | print_str CONFIG_OS_RELEASE "$os_release" |
| 718 | echo "#endif" >> $TMPH && echo >> $TMPH | 717 | echo "#endif" >> $TMPH && echo >> $TMPH |
| @@ -724,7 +723,7 @@ print_num CONFIG_TCC_PREDEFS "$predefs" · 5 unmodified lines | |||
| 724 | diff $TMPH config.h >/dev/null 2>&1 | 723 | diff $TMPH config.h >/dev/null 2>&1 |
| 725 | if test $? -ne 0 ; then | 724 | if test $? -ne 0 ; then |
| 726 | mv -f $TMPH config.h | 725 | mv -f $TMPH config.h |
| 727 | else | 726 | elif test -z "$quiet"; then |
| 728 | echo "config.h is unchanged" | 727 | echo "config.h is unchanged" |
| 729 | fi | 728 | fi |
| 730 | 729 | ||
| @@ -896,8 +896,8 @@ LIBTCCAPI TCCState *tcc_new(void) · 895 unmodified lines | |||
| 896 | #if defined TCC_TARGET_MACHO /* || defined TCC_TARGET_PE */ | 896 | #if defined TCC_TARGET_MACHO /* || defined TCC_TARGET_PE */ |
| 897 | s->leading_underscore = 1; | 897 | s->leading_underscore = 1; |
| 898 | #endif | 898 | #endif |
| 899 | #ifdef TCC_TARGET_ARM | 899 | #ifdef TCC_ARM_HARDFLOAT |
| 900 | s->float_abi = ARM_FLOAT_ABI; | 900 | s->float_abi = ARM_HARD_FLOAT; |
| 901 | #endif | 901 | #endif |
| 902 | #ifdef CONFIG_NEW_DTAGS | 902 | #ifdef CONFIG_NEW_DTAGS |
| 903 | s->enable_new_dtags = 1; | 903 | s->enable_new_dtags = 1; |
| @@ -995,10 +995,12 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 91 unmodified lines | |||
| 995 | /* allow linking with system dll's directly */ | 995 | /* allow linking with system dll's directly */ |
| 996 | tcc_add_systemdir(s); | 996 | tcc_add_systemdir(s); |
| 997 | # endif | 997 | # endif |
| 998 | |||
| 998 | #elif defined TCC_TARGET_MACHO | 999 | #elif defined TCC_TARGET_MACHO |
| 999 | # ifdef TCC_IS_NATIVE | 1000 | # ifdef TCC_IS_NATIVE |
| 1000 | tcc_add_macos_sdkpath(s); | 1001 | tcc_add_macos_sdkpath(s); |
| 1001 | # endif | 1002 | # endif |
| 1003 | |||
| 1002 | #else | 1004 | #else |
| 1003 | /* paths for crt objects */ | 1005 | /* paths for crt objects */ |
| 1004 | tcc_split_path(s, &s->crt_paths, &s->nb_crt_paths, CONFIG_TCC_CRTPREFIX); | 1006 | tcc_split_path(s, &s->crt_paths, &s->nb_crt_paths, CONFIG_TCC_CRTPREFIX); |
| @@ -1362,10 +1364,11 @@ struct lopt { · 357 unmodified lines | |||
| 1362 | /* match linker option */ | 1364 | /* match linker option */ |
| 1363 | static int link_option(struct lopt *o, const char *q) | 1365 | static int link_option(struct lopt *o, const char *q) |
| 1364 | { | 1366 | { |
| 1365 | const char *p = o->opt; | 1367 | const char *p; |
| 1366 | int c; | 1368 | int c; |
| 1367 | 1369 | redo: | |
| 1368 | /* there should be 1 or 2 dashes */ | 1370 | /* there should be 1 or 2 dashes */ |
| 1371 | p = o->opt; | ||
| 1369 | if (*p++ != '-') | 1372 | if (*p++ != '-') |
| 1370 | return 0; | 1373 | return 0; |
| 1371 | if (*p == '-') | 1374 | if (*p == '-') |
| @@ -1378,16 +1381,22 @@ static int link_option(struct lopt *o, const char *q) · 6 unmodified lines | |||
| 1378 | goto succ; /* -Wl,-opt=arg */ | 1381 | goto succ; /* -Wl,-opt=arg */ |
| 1379 | ++q; | 1382 | ++q; |
| 1380 | } | 1383 | } |
| 1381 | if (c == '=' || c == ':') { | 1384 | if (*p == '\0') { |
| 1382 | if (*p == '\0') { | 1385 | if (c == '|') |
| 1386 | goto succ; | ||
| 1387 | if (c == '=' || c == ':') { | ||
| 1383 | if (o->s->link_optind + 1 < o->s->link_argc) { | 1388 | if (o->s->link_optind + 1 < o->s->link_argc) { |
| 1384 | p = o->s->link_argv[++o->s->link_optind]; | 1389 | p = o->s->link_argv[++o->s->link_optind]; |
| 1385 | goto succ; /* -Wl,-opt,arg */ | 1390 | goto succ; /* -Wl,-opt,arg */ |
| 1386 | } | 1391 | } |
| 1387 | o->match = 1; /* -Wl,-opt -Wl,arg */ | 1392 | o->match = 1; /* -Wl,-opt -Wl,arg */ |
| 1388 | } else if (c == ':') | 1393 | return 0; |
| 1389 | goto succ; /* -Wl,-Iarg */ | 1394 | } |
| 1390 | } | 1395 | } else if (c == ':') |
| 1396 | goto succ; /* -Wl,-Iarg */ | ||
| 1397 | while (*q) | ||
| 1398 | if (*q++ == '|') | ||
| 1399 | goto redo; | ||
| 1391 | return 0; | 1400 | return 0; |
| 1392 | succ: | 1401 | succ: |
| 1393 | o->arg = p; | 1402 | o->arg = p; |
| @@ -1415,9 +1424,9 @@ static int tcc_set_linker(TCCState *s, const char *optarg) · 21 unmodified lines | |||
| 1415 | s->symbolic = 1; | 1424 | s->symbolic = 1; |
| 1416 | } else if (link_option(&o, "nostdlib")) { | 1425 | } else if (link_option(&o, "nostdlib")) { |
| 1417 | s->nostdlib_paths = 1; | 1426 | s->nostdlib_paths = 1; |
| 1418 | } else if (link_option(&o, "e=") || link_option(&o, "entry=")) { | 1427 | } else if (link_option(&o, "e=|entry=")) { |
| 1419 | tcc_set_str(&s->elf_entryname, o.arg); | 1428 | tcc_set_str(&s->elf_entryname, o.arg); |
| 1420 | } else if (link_option(&o, "image-base=") || link_option(&o, "Ttext=")) { | 1429 | } else if (link_option(&o, "image-base=|Ttext=")) { |
| 1421 | s->text_addr = strtoull(o.arg, &end, 16); | 1430 | s->text_addr = strtoull(o.arg, &end, 16); |
| 1422 | s->has_text_addr = 1; | 1431 | s->has_text_addr = 1; |
| 1423 | } else if (link_option(&o, "init=")) { | 1432 | } else if (link_option(&o, "init=")) { |
| @@ -1446,18 +1455,17 @@ static int tcc_set_linker(TCCState *s, const char *optarg) · 22 unmodified lines | |||
| 1446 | #endif | 1455 | #endif |
| 1447 | else | 1456 | else |
| 1448 | goto err; | 1457 | goto err; |
| 1449 | } else if (link_option(&o, "export-all-symbols") | 1458 | } else if (link_option(&o, "export-all-symbols|export-dynamic|E")) { |
| 1450 | || link_option(&o, "export-dynamic")) { | ||
| 1451 | s->rdynamic = 1; | 1459 | s->rdynamic = 1; |
| 1452 | } else if (link_option(&o, "rpath=")) { | 1460 | } else if (link_option(&o, "rpath=")) { |
| 1453 | tcc_concat_str(&s->rpath, o.arg, ':'); | 1461 | tcc_concat_str(&s->rpath, o.arg, ':'); |
| 1454 | } else if (link_option(&o, "dynamic-linker=") || link_option(&o, "I:")) { | 1462 | } else if (link_option(&o, "dynamic-linker=|I:")) { |
| 1455 | tcc_set_str(&s->elfint, o.arg); | 1463 | tcc_set_str(&s->elfint, o.arg); |
| 1456 | } else if (link_option(&o, "enable-new-dtags")) { | 1464 | } else if (link_option(&o, "enable-new-dtags")) { |
| 1457 | s->enable_new_dtags = 1; | 1465 | s->enable_new_dtags = 1; |
| 1458 | } else if (link_option(&o, "section-alignment=")) { | 1466 | } else if (link_option(&o, "section-alignment=")) { |
| 1459 | s->section_align = strtoul(o.arg, &end, 16); | 1467 | s->section_align = strtoul(o.arg, &end, 16); |
| 1460 | } else if (link_option(&o, "soname=") || link_option(&o, "install_name=")) { | 1468 | } else if (link_option(&o, "soname=|install_name=")) { |
| 1461 | tcc_set_str(&s->soname, o.arg); | 1469 | tcc_set_str(&s->soname, o.arg); |
| 1462 | } else if (link_option(&o, "whole-archive")) { | 1470 | } else if (link_option(&o, "whole-archive")) { |
| 1463 | s->filetype |= AFF_WHOLE_ARCHIVE; | 1471 | s->filetype |= AFF_WHOLE_ARCHIVE; |
| @@ -2024,7 +2032,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv) · 560 unmodified lines | |||
| 2024 | s->float_abi = ARM_HARD_FLOAT; | 2032 | s->float_abi = ARM_HARD_FLOAT; |
| 2025 | else | 2033 | else |
| 2026 | return tcc_error_noabort("unsupported float abi '%s'", optarg); | 2034 | return tcc_error_noabort("unsupported float abi '%s'", optarg); |
| 2027 | break; | 2035 | continue; |
| 2028 | #endif | 2036 | #endif |
| 2029 | case TCC_OPTION_m: | 2037 | case TCC_OPTION_m: |
| 2030 | if (set_flag(s, options_m, optarg) < 0) { | 2038 | if (set_flag(s, options_m, optarg) < 0) { |
| @@ -226,7 +226,7 @@ static void print_search_dirs(TCCState *s) · 225 unmodified lines | |||
| 226 | printf("libtcc1:\n %s/%s\n", s->library_paths[0], CONFIG_TCC_CROSSPREFIX TCC_LIBTCC1); | 226 | printf("libtcc1:\n %s/%s\n", s->library_paths[0], CONFIG_TCC_CROSSPREFIX TCC_LIBTCC1); |
| 227 | #ifdef TCC_TARGET_UNIX | 227 | #ifdef TCC_TARGET_UNIX |
| 228 | print_dirs("crt", s->crt_paths, s->nb_crt_paths); | 228 | print_dirs("crt", s->crt_paths, s->nb_crt_paths); |
| 229 | printf("elfinterp:\n %s\n", DEFAULT_ELFINTERP(s)); | 229 | printf("elfinterp:\n %s\n", s->elfint); |
| 230 | #endif | 230 | #endif |
| 231 | } | 231 | } |
| 232 | 232 | ||
| @@ -252,15 +252,14 @@ extern long double strtold (const char *__nptr, char **__endptr); · 251 unmodified lines | |||
| 252 | #ifndef CONFIG_SYSROOT | 252 | #ifndef CONFIG_SYSROOT |
| 253 | # define CONFIG_SYSROOT "" | 253 | # define CONFIG_SYSROOT "" |
| 254 | #endif | 254 | #endif |
| 255 | |||
| 255 | #if !defined CONFIG_TCCDIR && !defined _WIN32 | 256 | #if !defined CONFIG_TCCDIR && !defined _WIN32 |
| 256 | # define CONFIG_TCCDIR "/usr/local/lib/tcc" | 257 | # define CONFIG_TCCDIR "/usr/local/lib/tcc" |
| 257 | #endif | 258 | #endif |
| 258 | #ifndef CONFIG_LDDIR | 259 | |
| 259 | # define CONFIG_LDDIR "lib" | ||
| 260 | #endif | ||
| 261 | #ifdef CONFIG_TRIPLET | 260 | #ifdef CONFIG_TRIPLET |
| 262 | # define USE_TRIPLET(s) s "/" CONFIG_TRIPLET | 261 | # define USE_TRIPLET(s) s "/" CONFIG_TRIPLET |
| 263 | # define ALSO_TRIPLET(s) USE_TRIPLET(s) ":" s | 262 | # define ALSO_TRIPLET(s) USE_TRIPLET(s) PATHSEP s |
| 264 | #else | 263 | #else |
| 265 | # define USE_TRIPLET(s) s | 264 | # define USE_TRIPLET(s) s |
| 266 | # define ALSO_TRIPLET(s) s | 265 | # define ALSO_TRIPLET(s) s |
| @@ -268,11 +267,8 @@ extern long double strtold (const char *__nptr, char **__endptr); · 1 unmodified line | |||
| 268 | 267 | ||
| 269 | /* path to find crt1.o, crti.o and crtn.o */ | 268 | /* path to find crt1.o, crti.o and crtn.o */ |
| 270 | #ifndef CONFIG_TCC_CRTPREFIX | 269 | #ifndef CONFIG_TCC_CRTPREFIX |
| 271 | # define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) | 270 | # define CONFIG_TCC_CRTPREFIX \ |
| 272 | #endif | 271 | USE_TRIPLET(CONFIG_SYSROOT "/usr/lib") |
| 273 | |||
| 274 | #ifndef CONFIG_USR_INCLUDE | ||
| 275 | # define CONFIG_USR_INCLUDE "/usr/include" | ||
| 276 | #endif | 272 | #endif |
| 277 | 273 | ||
| 278 | /* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */ | 274 | /* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */ |
| @@ -280,25 +276,22 @@ extern long double strtold (const char *__nptr, char **__endptr); · 1 unmodified line | |||
| 280 | /* system include paths */ | 276 | /* system include paths */ |
| 281 | #ifndef CONFIG_TCC_SYSINCLUDEPATHS | 277 | #ifndef CONFIG_TCC_SYSINCLUDEPATHS |
| 282 | # if defined TCC_TARGET_PE || defined _WIN32 | 278 | # if defined TCC_TARGET_PE || defined _WIN32 |
| 283 | # define CONFIG_TCC_SYSINCLUDEPATHS "{B}/include"PATHSEP"{B}/include/winapi" | 279 | # define CONFIG_TCC_SYSINCLUDEPATHS \ |
| 280 | "{B}/include" PATHSEP "{B}/include/winapi" | ||
| 284 | # else | 281 | # else |
| 285 | # define CONFIG_TCC_SYSINCLUDEPATHS \ | 282 | # define CONFIG_TCC_SYSINCLUDEPATHS \ |
| 286 | "{B}/include" \ | 283 | "{B}/include" PATHSEP ALSO_TRIPLET(CONFIG_SYSROOT "/usr/include") |
| 287 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \ | ||
| 288 | ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE) | ||
| 289 | # endif | 284 | # endif |
| 290 | #endif | 285 | #endif |
| 291 | 286 | ||
| 292 | /* library search paths */ | 287 | /* library search paths */ |
| 293 | #ifndef CONFIG_TCC_LIBPATHS | 288 | #ifndef CONFIG_TCC_LIBPATHS |
| 294 | # if defined TCC_TARGET_PE || defined _WIN32 | 289 | # if defined TCC_TARGET_PE || defined _WIN32 |
| 295 | # define CONFIG_TCC_LIBPATHS "{B}/lib" | 290 | # define CONFIG_TCC_LIBPATHS \ |
| 291 | "{B}/lib" | ||
| 296 | # else | 292 | # else |
| 297 | # define CONFIG_TCC_LIBPATHS \ | 293 | # define CONFIG_TCC_LIBPATHS \ |
| 298 | "{B}" \ | 294 | "{B}" PATHSEP ALSO_TRIPLET(CONFIG_SYSROOT "/usr/lib") |
| 299 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \ | ||
| 300 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \ | ||
| 301 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR) | ||
| 302 | # endif | 295 | # endif |
| 303 | #endif | 296 | #endif |
| 304 | 297 | ||
| @@ -314,28 +307,19 @@ extern long double strtold (const char *__nptr, char **__endptr); · 9 unmodified lines | |||
| 314 | # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" | 307 | # define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" |
| 315 | # elif defined(TCC_TARGET_RISCV64) | 308 | # elif defined(TCC_TARGET_RISCV64) |
| 316 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux-riscv64-lp64d.so.1" | 309 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux-riscv64-lp64d.so.1" |
| 317 | # elif defined(TCC_ARM_EABI) | 310 | # elif defined(TCC_TARGET_ARM) |
| 318 | # define DEFAULT_ELFINTERP(s) default_elfinterp(s) | 311 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.3" |
| 312 | # define CONFIG_TCC_ELFINTERP_ARMHF "/lib/ld-linux-armhf.so.3" | ||
| 319 | # else | 313 | # else |
| 320 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" | 314 | # define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" |
| 321 | # endif | 315 | # endif |
| 322 | #endif | 316 | #endif |
| 323 | 317 | ||
| 324 | /* var elf_interp dans *-gen.c */ | ||
| 325 | #ifndef DEFAULT_ELFINTERP | ||
| 326 | # define DEFAULT_ELFINTERP(s) CONFIG_TCC_ELFINTERP | ||
| 327 | #endif | ||
| 328 | |||
| 329 | /* (target specific) libtcc1.a */ | 318 | /* (target specific) libtcc1.a */ |
| 330 | #ifndef TCC_LIBTCC1 | 319 | #ifndef TCC_LIBTCC1 |
| 331 | # define TCC_LIBTCC1 "libtcc1.a" | 320 | # define TCC_LIBTCC1 "libtcc1.a" |
| 332 | #endif | 321 | #endif |
| 333 | 322 | ||
| 334 | /* library to use with CONFIG_USE_LIBGCC instead of libtcc1.a */ | ||
| 335 | #if defined CONFIG_USE_LIBGCC && !defined TCC_LIBGCC | ||
| 336 | #define TCC_LIBGCC USE_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) "/libgcc_s.so.1" | ||
| 337 | #endif | ||
| 338 | |||
| 339 | /* <cross-prefix-to->libtcc1.a */ | 323 | /* <cross-prefix-to->libtcc1.a */ |
| 340 | #ifndef CONFIG_TCC_CROSSPREFIX | 324 | #ifndef CONFIG_TCC_CROSSPREFIX |
| 341 | # define CONFIG_TCC_CROSSPREFIX "" | 325 | # define CONFIG_TCC_CROSSPREFIX "" |
| @@ -110,6 +110,21 @@ ST_FUNC void tccelf_new(TCCState *s) · 109 unmodified lines | |||
| 110 | if (s->elf_entryname) | 110 | if (s->elf_entryname) |
| 111 | set_global_sym(s, s->elf_entryname, NULL, 0); /* SHN_UNDEF */ | 111 | set_global_sym(s, s->elf_entryname, NULL, 0); /* SHN_UNDEF */ |
| 112 | #endif | 112 | #endif |
| 113 | |||
| 114 | #ifndef ELF_OBJ_ONLY | ||
| 115 | if (NULL == s->elfint && s1->output_type != TCC_OUTPUT_OBJ) { | ||
| 116 | const char *p = CONFIG_TCC_ELFINTERP; | ||
| 117 | #ifdef TCC_TARGET_ARM | ||
| 118 | if (s->float_abi == ARM_HARD_FLOAT) | ||
| 119 | p = CONFIG_TCC_ELFINTERP_ARMHF; | ||
| 120 | #endif | ||
| 121 | #if defined TCC_IS_NATIVE && defined TARGETOS_BSD | ||
| 122 | /* see commit 55cb2170cd5ce77a7d76dcaf462fad2707281605 */ | ||
| 123 | { const char *e = getenv("LD_SO"); if (e) p = e; } | ||
| 124 | #endif | ||
| 125 | s->elfint = tcc_strdup(p); | ||
| 126 | } | ||
| 127 | #endif /* ndef ELF_OBJ_ONLY */ | ||
| 113 | } | 128 | } |
| 114 | 129 | ||
| 115 | ST_FUNC void free_section(Section *s) | 130 | ST_FUNC void free_section(Section *s) |
| @@ -2939,18 +2954,10 @@ static int elf_output_file(TCCState *s1, const char *filename) · 2823 unmodified lines | |||
| 2939 | 2954 | ||
| 2940 | if (!s1->static_link) { | 2955 | if (!s1->static_link) { |
| 2941 | if (file_type & TCC_OUTPUT_EXE) { | 2956 | if (file_type & TCC_OUTPUT_EXE) { |
| 2942 | char *ptr; | ||
| 2943 | /* allow override the dynamic loader */ | ||
| 2944 | const char *elfint = s1->elfint; | ||
| 2945 | if (elfint == NULL) | ||
| 2946 | elfint = getenv("LD_SO"); | ||
| 2947 | if (elfint == NULL) | ||
| 2948 | elfint = DEFAULT_ELFINTERP(s1); | ||
| 2949 | /* add interpreter section only if executable */ | 2957 | /* add interpreter section only if executable */ |
| 2950 | interp = new_section(s1, ".interp", SHT_PROGBITS, SHF_ALLOC); | 2958 | interp = new_section(s1, ".interp", SHT_PROGBITS, SHF_ALLOC); |
| 2951 | interp->sh_addralign = 1; | 2959 | interp->sh_addralign = 1; |
| 2952 | ptr = section_ptr_add(interp, 1 + strlen(elfint)); | 2960 | put_elf_str(interp, s1->elfint); |
| 2953 | strcpy(ptr, elfint); | ||
| 2954 | dyninf.interp = interp; | 2961 | dyninf.interp = interp; |
| 2955 | } | 2962 | } |
| 2956 | 2963 | ||