mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
base-linux: configurable host toolchain
This commit uses CUSTOM_HOST_CC/CUSTOM_HOST_CXX instead of hardcoded commands and introduces HOST_DEV_PREFIX. Original patch by Roman Iten and Pirmin Duss. Issue #3466
This commit is contained in:
parent
cebc963396
commit
23ed5d3936
@ -7,7 +7,7 @@ include $(call select_from_repositories,lib/import/import-syscall-linux.mk)
|
||||
# Manually supply all library search paths of the host compiler to our tool
|
||||
# chain.
|
||||
#
|
||||
HOST_LIB_SEARCH_DIRS = $(shell cc $(CC_MARCH) -print-search-dirs | grep libraries |\
|
||||
HOST_LIB_SEARCH_DIRS = $(shell $(CUSTOM_HOST_CC) $(CC_MARCH) -print-search-dirs | grep libraries |\
|
||||
sed "s/.*=//" | sed "s/:/ /g" |\
|
||||
sed "s/\/ / /g" | sed "s/\/\$$//")
|
||||
#
|
||||
@ -18,7 +18,7 @@ HOST_LIB_SEARCH_DIRS = $(shell cc $(CC_MARCH) -print-search-dirs | grep librarie
|
||||
# is appended to the include directory list.
|
||||
#
|
||||
HOST_INC_DIR += $(shell echo "int main() {return 0;}" |\
|
||||
LANG=C $(CXX) -x c++ -v -E - 2>&1 |\
|
||||
LANG=C $(CXX) -x $(CUSTOM_HOST_CXX) -v -E - 2>&1 |\
|
||||
sed '/^\#include <\.\.\.> search starts here:/,/^End of search list/!d' |\
|
||||
grep "include-fixed")
|
||||
|
||||
@ -68,11 +68,11 @@ endif
|
||||
LD_TEXT_ADDR ?=
|
||||
LD_SCRIPT_STATIC ?=
|
||||
|
||||
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crt1.o)
|
||||
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crti.o)
|
||||
EXT_OBJECTS += $(shell $(CUSTOM_HOST_CC) $(CC_MARCH) -print-file-name=crt1.o)
|
||||
EXT_OBJECTS += $(shell $(CUSTOM_HOST_CC) $(CC_MARCH) -print-file-name=crti.o)
|
||||
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtbegin.o)
|
||||
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtend.o)
|
||||
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crtn.o)
|
||||
EXT_OBJECTS += $(shell $(CUSTOM_HOST_CC) $(CC_MARCH) -print-file-name=crtn.o)
|
||||
|
||||
LX_LIBS_OPT += -lgcc -lgcc_s -lsupc++ -lc -lpthread
|
||||
|
||||
@ -105,7 +105,7 @@ endif
|
||||
LD_LIBGCC = $(LX_LIBS_OPT)
|
||||
|
||||
# use the host c++ for linking to find shared libraries in DT_RPATH library paths
|
||||
LD_CMD = c++
|
||||
LD_CMD = $(CUSTOM_HOST_CXX)
|
||||
|
||||
# disable format-string security checks, which prevent non-literal format strings
|
||||
CC_OPT += -Wno-format-security
|
||||
@ -115,7 +115,7 @@ CC_OPT += -Wno-format-security
|
||||
# Ubuntu 16.10 or newer)
|
||||
#
|
||||
CXX_LINK_OPT_NO_PIE := $(shell \
|
||||
(echo "int main(){}" | $(LD_CMD) -no-pie -x c++ - -o /dev/null >& /dev/null \
|
||||
(echo "int main(){}" | $(LD_CMD) -no-pie -x $(CUSTOM_HOST_CXX) - -o /dev/null >& /dev/null \
|
||||
&& echo "-no-pie") || true)
|
||||
CXX_LINK_OPT += $(CXX_LINK_OPT_NO_PIE)
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
HOST_INC_DIR += $(dir $(call select_from_repositories,src/lib/syscall/linux_syscalls.h))
|
||||
HOST_INC_DIR += $(dir $(CUSTOM_HOST_CC))/../$(shell $(CUSTOM_HOST_CC) -dumpmachine)/libc/usr/include
|
||||
HOST_INC_DIR += /usr/include
|
||||
|
||||
# needed for Ubuntu >= 11.04
|
||||
HOST_INC_DIR += /usr/include/$(shell gcc -dumpmachine)
|
||||
HOST_INC_DIR += /usr/include/$(shell $(CUSTOM_HOST_CC) -dumpmachine)
|
||||
|
||||
#
|
||||
# Explicitly add some well-known paths as the dumpmachine magic above does not
|
||||
|
@ -8,4 +8,4 @@ SRC_CC += cpu/arm/cache.cc
|
||||
|
||||
LIBS += timeout-arm
|
||||
|
||||
include $(REP_DIR)/lib/mk/base.mk
|
||||
include $(REP_DIR)/lib/mk/base-linux.mk
|
||||
|
@ -23,7 +23,8 @@ CUSTOM_OBJCOPY ?= $(CROSS_DEV_PREFIX)objcopy
|
||||
CUSTOM_RANLIB ?= $(CROSS_DEV_PREFIX)ranlib
|
||||
CUSTOM_STRIP ?= $(CROSS_DEV_PREFIX)strip
|
||||
CUSTOM_GNATBIND ?= $(CROSS_DEV_PREFIX)gnatbind
|
||||
CUSTOM_HOST_CC ?= gcc
|
||||
CUSTOM_HOST_CC ?= $(HOST_DEV_PREFIX)gcc
|
||||
CUSTOM_HOST_CXX ?= $(HOST_DEV_PREFIX)g++
|
||||
CUSTOM_ADA_CC ?= $(CUSTOM_CC)
|
||||
CUSTOM_ALI2DEP ?= $(CROSS_DEV_PREFIX)ali2dep
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user