From: noneofyourbusiness <noneofyourbusin...@danwin1210.de> simply using --extra-ldflags=-static regressed in da0d43903b2b31b935188847d6739306ab998e13
Signed-off-by: noneofyourbusiness <noneofyourbusin...@danwin1210.de> --- Makefile | 4 ++++ configure | 3 +++ tccrun.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 13260d07..4a28a810 100644 --- a/Makefile +++ b/Makefile @@ -274,6 +274,10 @@ CFLAGS += -g LDFLAGS += -g endif +ifeq ($(CONFIG_static-tcc),yes) +CFLAGS += -DSTATIC_TCC +endif + # convert "include/tccdefs.h" to "tccdefs_.h" %_.h : include/%.h conftest.c $S$(CC) -DC2STR $(filter %.c,$^) -o c2str.exe && ./c2str.exe $< $@ diff --git a/configure b/configure index e7735a4e..483bb0b1 100755 --- a/configure +++ b/configure @@ -123,6 +123,8 @@ for opt do ;; --enable-static) confvars="$confvars static" ;; + --enable-static-tcc) confvars="$confvars static-tcc" + ;; --disable-rpath) confvars="$confvars rpath=no" ;; --debug) confvars="$confvars debug" @@ -174,6 +176,7 @@ Advanced options (experts only): --debug include debug info with resulting binaries --disable-static make libtcc.so instead of libtcc.a --enable-static make libtcc.a instead of libtcc.dll (win32) + --enable-static-tcc create a statically linked tcc --disable-rpath disable use of -rpath with libtcc.so --with-libgcc use libgcc_s.so.1 instead of libtcc1.a --with-selinux use mmap for executable memory (tcc -run) diff --git a/tccrun.c b/tccrun.c index b0cb4dba..593cb9db 100644 --- a/tccrun.c +++ b/tccrun.c @@ -213,6 +213,11 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) char **envp = environ; #endif +#ifdef STATIC_TCC + /* dlopen() won't work */ + s1->static_link = 1; +#endif + /* tcc -dt -run ... nothing to do if no main() */ if ((s1->dflag & 16) && (addr_t)-1 == get_sym_addr(s1, "main", 0, 1)) return 0; -- 2.46.0 _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel