1ifeq (,$(shlibuuid)) 2$(error SHLIBUUID not set) 3endif 4link-out-dir = $(out-dir) 5 6SIGN ?= $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py 7TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem 8 9all: $(link-out-dir)/$(shlibname).so $(link-out-dir)/$(shlibname).dmp \ 10 $(link-out-dir)/$(shlibname).stripped.so \ 11 $(link-out-dir)/$(shlibuuid).elf \ 12 $(link-out-dir)/$(shlibuuid).ta 13 14cleanfiles += $(link-out-dir)/$(shlibname).so 15cleanfiles += $(link-out-dir)/$(shlibname).dmp 16cleanfiles += $(link-out-dir)/$(shlibname).stripped.so 17cleanfiles += $(link-out-dir)/$(shlibuuid).elf 18cleanfiles += $(link-out-dir)/$(shlibuuid).ta 19 20shlink-ldflags = $(LDFLAGS) 21shlink-ldflags += -shared -z max-page-size=4096 22shlink-ldflags += $(call ld-option,-z separate-loadable-segments) 23ifeq ($(sm)-$(CFG_TA_BTI),ta_arm64-y) 24shlink-ldflags += $(call ld-option,-z force-bti) --fatal-warnings 25endif 26shlink-ldflags += --as-needed # Do not add dependency on unused shlib 27 28shlink-ldadd = $(LDADD) 29shlink-ldadd += $(addprefix -L,$(libdirs)) 30shlink-ldadd += --start-group $(addprefix -l,$(libnames)) --end-group 31ldargs-$(shlibname).so := $(shlink-ldflags) $(objs) $(shlink-ldadd) $(libgcc$(sm)) 32 33 34$(link-out-dir)/$(shlibname).so: $(objs) $(libdeps) 35 @$(cmd-echo-silent) ' LD $@' 36 $(q)$(LD$(sm)) $(ldargs-$(shlibname).so) --soname=$(shlibuuid) -o $@ 37 38$(link-out-dir)/$(shlibname).dmp: $(link-out-dir)/$(shlibname).so 39 @$(cmd-echo-silent) ' OBJDUMP $@' 40 $(q)$(OBJDUMP$(sm)) -l -x -d $< > $@ 41 42$(link-out-dir)/$(shlibname).stripped.so: $(link-out-dir)/$(shlibname).so 43 @$(cmd-echo-silent) ' OBJCOPY $@' 44 $(q)$(OBJCOPY$(sm)) --strip-unneeded $< $@ 45 46$(link-out-dir)/$(shlibuuid).elf: $(link-out-dir)/$(shlibname).so 47 @$(cmd-echo-silent) ' LN $@' 48 $(q)ln -sf $(<F) $@ 49 50$(link-out-dir)/$(shlibuuid).ta: $(link-out-dir)/$(shlibname).stripped.so \ 51 $(TA_SIGN_KEY) $(TA_SUBKEY_DEPS) 52 @$(cmd-echo-silent) ' SIGN $@' 53 $(q)$(PYTHON3) $(SIGN) --key $(TA_SIGN_KEY) $(TA_SUBKEY_ARGS) \ 54 --uuid $(shlibuuid) --in $< --out $@ 55