1include mk/cleanvars.mk 2 3# Set current submodule (used for module specific flags compile result etc) 4sm := ldelf 5sm-$(sm) := y 6 7link-out-dir$(sm) := $(out-dir)/$(sm) 8 9cppflags$(sm) := $(core-platform-cppflags) 10cflags$(sm) := $(core-platform-cflags) -fpie -fvisibility=hidden 11aflags$(sm) := $(core-platform-aflags) 12 13# ldelf is compiled for the same arch or register width as core 14ifeq ($(CFG_ARM64_core),y) 15CFG_ARM64_$(sm) := y 16endif 17ifeq ($(CFG_ARM32_core),y) 18CFG_ARM32_$(sm) := y 19endif 20ifeq ($(CFG_RV64_core),y) 21CFG_RV64_$(sm) := y 22endif 23ifeq ($(CFG_RV32_core),y) 24CFG_RV32_$(sm) := y 25endif 26arch-bits-$(sm) := $(arch-bits-core) 27 28cppflags$(sm) += -include $(conf-file) 29cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL) 30cppflags$(sm) += -D__LDELF__ 31 32ifeq ($(CFG_CORE_SANITIZE_UNDEFINED),y) 33cflags$(sm) += -fsanitize=undefined 34endif 35ifeq ($(CFG_CORE_SANITIZE_KADDRESS),y) 36ifeq ($(CFG_USER_ASAN_SHADOW_OFFSET),) 37$(error error: CFG_USER_ASAN_SHADOW_OFFSET was not set) 38endif 39cflags$(sm) += -fsanitize=kernel-address \ 40 -fasan-shadow-offset=$(CFG_USER_ASAN_SHADOW_OFFSET) \ 41 --param=asan-globals=1 \ 42 --param=asan-instrumentation-with-call-threshold=0 \ 43 --param=asan-stack=1 44endif 45 46# Use same compiler as for core 47CROSS_COMPILE_$(sm) := $(CROSS_COMPILE_core) 48COMPILER_$(sm) := $(COMPILER_core) 49include mk/$(COMPILER_$(sm)).mk 50 51base-prefix := $(sm)- 52 53libname = utils 54libdir = lib/libutils 55include mk/lib.mk 56 57libname = utee 58libdir = lib/libutee 59include mk/lib.mk 60 61libname = unw 62libdir = lib/libunw 63include mk/lib.mk 64 65base-prefix := 66 67subdirs = ldelf 68include mk/subdir.mk 69 70include mk/compile.mk 71 72include ldelf/link.mk 73