tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] [PATCH] Added LD before running intermediary executables


From: Brian Mayer
Subject: [Tinycc-devel] [PATCH] Added LD before running intermediary executables
Date: Sat, 23 Mar 2024 13:59:55 -0300

Building on buildroot normally requires different interpreters for running c2str
and tcc, that are compiled on the build process. This is troublesome
because they
are invoked by simply ./c2str and ../tcc which do not work, since on
cross compilation
they are built to the target system, but ran on the host.

This patch adds a LD variable to call the correct interpreter, which needs to be
informed like:

   make LD=<PATH_TO_TARGET_LD>

I'm not sure if this is the correct approach, but it works on buildroot. Also,
I'm not sure if I followed the help correctly to compile, I used:

  ./configure --cross-prefix=<PATH_TO_BUILT_TOOLCHAIN>- ...

I hope this helps. Thanks
---
 Makefile     | 4 ++--
 lib/Makefile | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2b247ea7..6758aab8 100644
--- a/Makefile
+++ b/Makefile
@@ -275,7 +275,7 @@ endif

 # convert "include/tccdefs.h" to "tccdefs_.h"
 %_.h : include/%.h conftest.c
-       $S$(CC) -DC2STR $(filter %.c,$^) -o c2str.exe && ./c2str.exe $< $@
+       $S$(CC) -DC2STR $(filter %.c,$^) -o c2str.exe && $(LD) ./c2str.exe $< $@

 # target specific object rule
 $(X)%.o : %.c $(LIBTCC_INC)
@@ -332,7 +332,7 @@ libtcc.dll : DEFINES += -DLIBTCC_AS_DLL

 # import file for windows libtcc.dll
 libtcc.def : libtcc.dll tcc$(EXESUF)
-       $S$(XTCC) -impdef $< -o $@
+       $S$(LD) $(XTCC) -impdef $< -o $@
 XTCC ?= ./tcc$(EXESUF)

 # TinyCC runtime libraries
diff --git a/lib/Makefile b/lib/Makefile
index c95a3e30..3ccd987c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -8,7 +8,7 @@ VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib
 T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
 X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)

-XTCC ?= $(TOP)/$(X)tcc$(EXESUF)
+XTCC ?= $(LD) $(TOP)/$(X)tcc$(EXESUF)
 XCC = $(XTCC)
 XAR = $(XTCC) -ar
 XFLAGS-unx = -B$(TOPSRC)
--
2.44.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]