From 427620f60137a52c75fcb5850018d7c3705147be Mon Sep 17 00:00:00 2001 From: Kooda Date: Fri, 14 Feb 2020 15:51:03 +0100 Subject: [PATCH] Make CHICKEN build with TCC --- Makefile.linux | 12 ++++++------ chicken.h | 2 ++ csc.scm | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile.linux b/Makefile.linux index cfa8c2c5..78c6b20b 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -34,7 +34,7 @@ ARCH ?= $(shell sh $(SRCDIR)/config-arch.sh) C_COMPILER_OPTIONS ?= -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H ifdef DEBUGBUILD -C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused +C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused -Wunsupported else ifdef OPTIMIZE_FOR_SPEED C_COMPILER_OPTIMIZATION_OPTIONS ?= -O3 -fomit-frame-pointer @@ -42,11 +42,11 @@ else C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer endif endif -LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared -LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-R"$(RUNTIME_LINKER_PATH)" -LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)" -LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION) -LIBRARIES = -lm -ldl +LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared -rdynamic +LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -L/usr/local/lib -shared -rdynamic -Wl,-rpath="$(RUNTIME_LINKER_PATH)" +LINKER_LINK_SHARED_PROGRAM_OPTIONS = -L/usr/local/lib -Wl,-rpath="$(RUNTIME_LINKER_PATH)" +LIBCHICKEN_SO_LINKER_OPTIONS = -L/usr/local/lib -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION) +LIBRARIES = -lm -ldl -g NEEDS_RELINKING = yes USES_SONAME = yes diff --git a/chicken.h b/chicken.h index 376b0a26..9816cfc9 100644 --- a/chicken.h +++ b/chicken.h @@ -1017,6 +1017,8 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret; # else # define C_stack_pointer ((C_word *)C_alloca(1)) # endif +#elif defined (__TINYC__) +# define C_stack_pointer ((C_word *)C_alloca(1)) #else # define C_stack_pointer ((C_word *)C_alloca(0)) #endif diff --git a/csc.scm b/csc.scm index a3a89aa3..f78a1b81 100644 --- a/csc.scm +++ b/csc.scm @@ -262,14 +262,14 @@ (cond (elf (list (conc "-L" library-dir) - (conc "-Wl,-R" + (conc "-Wl,-rpath=" (if deployed "$ORIGIN" (if host-mode host-libdir TARGET_RUN_LIB_HOME))))) (aix - (list (conc "-Wl,-R\"" library-dir "\""))) + (list (conc "-Wl,-rpath\"" library-dir "\""))) (else (list (conc "-L" library-dir)))) (if (and deployed (memq (software-version) '(freebsd openbsd netbsd))) @@ -776,7 +776,7 @@ EOF (set! rpath (car rest)) (when (and (memq (build-platform) '(gnu clang)) (not mingw) (not osx)) - (set! link-options (append link-options (list (string-append "-Wl,-R" rpath)))) ) + (set! link-options (append link-options (list (string-append "-Wl,-rpath=" rpath)))) ) (set! rest (cdr rest)) ] [(-host) #f] ((-oi) -- 2.25.0