From 8dccddc72b9377d256e54bf969e13d0c11072950 Mon Sep 17 00:00:00 2001 From: Leon Chen Date: Wed, 23 Mar 2022 18:51:48 +0800 Subject: [PATCH] build(makefile): add extra makefile variable for extension Introduce EXTRA_LINKERFILE for GCC linker options. GCC linker can realize multiple linker scripts, and vendors can extend ro or text sections by inserting sections among the original sections specified by blx.ld.S. Vendors can assign compiled object files by assigning MODULE_OBJS with their own built path. Signed-off-by: Leon Chen Change-Id: I1bd2e0383a52204723816131da4b7948def4c4e9 --- make_helpers/build_macros.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index 12aaee684..a58caf565 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -489,6 +489,10 @@ ifeq ($(USE_ROMLIB),1) $(ELF): romlib.bin endif +# MODULE_OBJS can be assigned by vendors with different compiled +# object file path, and prebuilt object file path. +$(eval OBJS += $(MODULE_OBJS)) + $(ELF): $(OBJS) $(LINKERFILE) | $(1)_dirs libraries $(BL_LIBS) $$(ECHO) " LD $$@" ifdef MAKE_BUILD_STRINGS @@ -507,7 +511,7 @@ ifneq ($(findstring armlink,$(notdir $(LD))),) $(BUILD_DIR)/build_message.o $(OBJS) else ifneq ($(findstring gcc,$(notdir $(LD))),) $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) -Wl,-Map=$(MAPFILE) \ - -Wl,-T$(LINKERFILE) $(BUILD_DIR)/build_message.o \ + -Wl,-dT $(LINKERFILE) $(EXTRA_LINKERFILE) $(BUILD_DIR)/build_message.o \ $(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) else $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) -Map=$(MAPFILE) \