diff --git a/base-linux/lib/import/import-lx_hybrid.mk b/base-linux/lib/import/import-lx_hybrid.mk index 71a1af5705..2005f33d4f 100644 --- a/base-linux/lib/import/import-lx_hybrid.mk +++ b/base-linux/lib/import/import-lx_hybrid.mk @@ -77,10 +77,17 @@ endif # # Use the host's startup codes, linker script, and dynamic linker # +ifneq ($(filter hardening_tool_chain, $(SPECS)),) +EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=Scrt1.o) +EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crti.o) +EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crtbeginS.o) +EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crtendS.o) +else 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 cc $(CC_MARCH) -print-file-name=crtbegin.o) EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crtend.o) +endif EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crtn.o) EXT_OBJECTS += -lgcc -lgcc_s -lsupc++ -lc EXT_OBJECTS += -lpthread diff --git a/base-linux/mk/spec-linux.mk b/base-linux/mk/spec-linux.mk index 8c04c855b7..fe6e06151b 100644 --- a/base-linux/mk/spec-linux.mk +++ b/base-linux/mk/spec-linux.mk @@ -15,3 +15,7 @@ LD_SCRIPT_STATIC = $(call select_from_repositories,src/platform/genode.ld) \ else LD_SCRIPT_STATIC = endif + +ifneq ($(filter hardening_tool_chain, $(SPECS)),) +CC_OPT += -fPIC +endif diff --git a/base/lib/import/import-stdcxx.mk b/base/lib/import/import-stdcxx.mk index 0e343f69f6..14c96db2ef 100644 --- a/base/lib/import/import-stdcxx.mk +++ b/base/lib/import/import-stdcxx.mk @@ -18,4 +18,8 @@ INC_DIR += $(shell echo "int main() {return 0;}" |\ # # Link libstdc++ that comes with the tool chain # +ifneq ($(filter hardening_tool_chain, $(SPECS)),) +EXT_OBJECTS += $(shell $(CUSTOM_CXX_LIB) $(CC_MARCH) -print-file-name=libstdc++.so) +else EXT_OBJECTS += $(shell $(CUSTOM_CXX_LIB) $(CC_MARCH) -print-file-name=libstdc++.a) +endif