History

Revert "build c2str.exe with the host compiler; default it to gcc if cross prefix given"

This reverts commit 41fa74fc8485be8e7f6eb92de93997d8e3b0a7f7. Reasons for the revert: 1. The commit message is lacking and the use case is not obvious. At the very least a concrete example of use case should be given (likely cross-building tcc on platform X for running on platform Y), followed by an issue description in such use case, and fix descr. (e.g. "On platform X, when running ./configure ... && make ..., the build fails because whatever. this commit does Y and fixes it"). 2. assign_opt is used incorrectly: 1st arg must be --OPTNAME=VALUE but it's not. The only thing it does is unconditional host_cc=gcc if --cross-prefix=... is used - no need for "assign_opt" at all. 3. cross-building tcc currently has several triggers: build/target cpu differ, or build/target OS differ, or --cross-prefix=... is used, but that commit only covers the --cross-prefix=... case. It's possible that it's intentional to only cover one case, but if so then it's not explained why. 4. The var name host_cc is likely incorrect and probably meant to be "native_cc", judging by the assigned value "gcc". 5. "gcc" is used unconditionally in such case, without any way to use a different native compiler (assuming that's indeed the goal). A better approach is likely supporting --native-cc=... option which defaults to $cc (which already defaults to "gcc") _before_ $cross_prefix is added in-front.

Avi Halachmi (:avih) committed 10 months ago

Commit 4fccaf61 parent 41fa74f2 files · +2 −5Browse files

Unified · Split

2 files
  1. Makefile +1 −1
  2. configure +1 −4
Makefile+1−1
@@ -256,7 +256,7 @@ endif · 255 unmodified lines
256 $S./c2str.exe $< $@256 $S./c2str.exe $< $@
257 257
258c2str.exe : conftest.c258c2str.exe : conftest.c
259 $S$(HOST_CC) -DC2STR $< -o $@259 $S$(CC) -DC2STR $< -o $@
260 260
261# target specific object rule261# target specific object rule
262$(X)%.o : %.c $(LIBTCC_INC)262$(X)%.o : %.c $(LIBTCC_INC)
configure+1−4
@@ -58,8 +58,6 @@ build_cross= · 57 unmodified lines
58test -n "$CC" && cc="$CC"58test -n "$CC" && cc="$CC"
59test -n "$AR" && ar="$AR"59test -n "$AR" && ar="$AR"
60 60
61host_cc="$CC"
62
63# set default CFLAGS if unset in environment61# set default CFLAGS if unset in environment
64test -z "$CFLAGS" && CFLAGS="-Wall -O2"62test -z "$CFLAGS" && CFLAGS="-Wall -O2"
65 63
@@ -124,7 +122,7 @@ for opt do · 58 unmodified lines
124 ;;122 ;;
125 --source-path=*) assign_opt "$opt" source_path123 --source-path=*) assign_opt "$opt" source_path
126 ;;124 ;;
127 --cross-prefix=*) assign_opt "$opt" cross_prefix; assign_opt "gcc" host_cc125 --cross-prefix=*) assign_opt "$opt" cross_prefix
128 ;;126 ;;
129 --os-release=*) assign_opt "$opt" os_release127 --os-release=*) assign_opt "$opt" os_release
130 ;;128 ;;
@@ -586,7 +584,6 @@ mandir=\$(DESTDIR)$mandir · 455 unmodified lines
586infodir=\$(DESTDIR)$infodir584infodir=\$(DESTDIR)$infodir
587docdir=\$(DESTDIR)$docdir585docdir=\$(DESTDIR)$docdir
588CC=$cc586CC=$cc
589HOST_CC=$host_cc
590CC_NAME=$cc_name587CC_NAME=$cc_name
591GCC_MAJOR=$gcc_major588GCC_MAJOR=$gcc_major
592GCC_MINOR=$gcc_minor589GCC_MINOR=$gcc_minor

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