diff --git a/Makefile b/Makefile index 7440f30fb..1fffc1853 100644 --- a/Makefile +++ b/Makefile @@ -98,28 +98,6 @@ endif export Q ECHO -################################################################################ -# Toolchain -################################################################################ - -HOSTCC := gcc -export HOSTCC - -CC := ${CROSS_COMPILE}gcc -CPP := ${CROSS_COMPILE}gcc -E -AS := ${CROSS_COMPILE}gcc -AR := ${CROSS_COMPILE}gcc-ar -LINKER := ${CROSS_COMPILE}ld -OC := ${CROSS_COMPILE}objcopy -OD := ${CROSS_COMPILE}objdump -DTC := dtc - -# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). -ifneq ($(strip $(wildcard ${LD}.bfd) \ - $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),) -LINKER := ${LINKER}.bfd -endif - ################################################################################ # Auxiliary tools (fiptool, cert_create, etc) ################################################################################ @@ -166,35 +144,22 @@ endif #(ARM_ARCH_MAJOR) ################################################################################ arch-features = ${ARM_ARCH_FEATURE} -ifneq ($(findstring clang,$(notdir $(CC))),) - ifneq ($(findstring armclang,$(notdir $(CC))),) +ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) + ifneq ($(findstring armclang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch32 := -target arm-arm-none-eabi TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi - LD := $(LINKER) else TF_CFLAGS_aarch32 = $(target32-directive) TF_CFLAGS_aarch64 := -target aarch64-elf - LD := $(shell $(CC) --print-prog-name ld.lld) - - AR := $(shell $(CC) --print-prog-name llvm-ar) - OD := $(shell $(CC) --print-prog-name llvm-objdump) - OC := $(shell $(CC) --print-prog-name llvm-objcopy) endif - CPP := $(CC) -E $(TF_CFLAGS_$(ARCH)) - AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) -else ifneq ($(findstring gcc,$(notdir $(CC))),) +else ifneq ($(findstring gcc,$(notdir $($(ARCH)-cc))),) ifeq ($(ENABLE_LTO),1) # Enable LTO only for aarch64 ifeq (${ARCH},aarch64) LTO_CFLAGS = -flto - # Use gcc as a wrapper for the ld, recommended for LTO - LINKER := ${CROSS_COMPILE}gcc endif endif - LD = $(LINKER) -else - LD = $(LINKER) endif #(clang) # Process Debug flag @@ -291,7 +256,7 @@ else ifeq (${W},3) endif #(W) # Compiler specific warnings -ifeq ($(findstring clang,$(notdir $(CC))),) +ifeq ($(findstring clang,$(notdir $($(ARCH)-cc))),) # not using clang WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \ -Wpacked-bitfield-compat -Wshift-overflow=2 \ @@ -335,18 +300,18 @@ ifeq (${SANITIZE_UB},trap) -fsanitize-undefined-trap-on-error endif #(${SANITIZE_UB},trap) -GCC_V_OUTPUT := $(shell $(CC) -v 2>&1) +GCC_V_OUTPUT := $(shell $($(ARCH)-cc) -v 2>&1) TF_LDFLAGS += -z noexecstack # LD = armlink -ifneq ($(findstring armlink,$(notdir $(LD))),) +ifneq ($(findstring armlink,$(notdir $($(ARCH)-ld))),) TF_LDFLAGS += --diag_error=warning --lto_level=O1 TF_LDFLAGS += --remove --info=unused,unusedsymbols TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) # LD = gcc (used when GCC LTO is enabled) -else ifneq ($(findstring gcc,$(notdir $(LD))),) +else ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) # Pass ld options with Wl or Xlinker switches TF_LDFLAGS += $(call ld_option,-Xlinker --no-warn-rwx-segments) TF_LDFLAGS += -Wl,--fatal-warnings -O1 @@ -388,7 +353,7 @@ else # therefore don't add those in that case. # ld.lld reports section type mismatch warnings, # therefore don't add --fatal-warnings to it. - ifeq ($(findstring ld.lld,$(notdir $(LD))),) + ifeq ($(findstring ld.lld,$(notdir $($(ARCH)-ld))),) TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) --fatal-warnings endif @@ -420,7 +385,7 @@ BL_COMMON_SOURCES += common/bl_common.c \ plat/common/${ARCH}/platform_helpers.S \ ${COMPILER_RT_SRCS} -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S endif @@ -601,14 +566,14 @@ include ${MAKE_HELPERS_DIRECTORY}arch_features.mk ifeq (${SUPPORT_STACK_MEMTAG},yes) ifdef mem_tag_arch_support # Check for armclang and clang compilers - ifneq ( ,$(filter $(notdir $(CC)),armclang clang)) + ifneq ( ,$(filter $(notdir $($(ARCH)-cc)),armclang clang)) # Add "memtag" architecture feature modifier if not specified ifeq ( ,$(findstring memtag,$(arch-features))) arch-features := $(arch-features)+memtag endif # memtag - ifeq ($(notdir $(CC)),armclang) + ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS += -mmemtag-stack - else ifeq ($(notdir $(CC)),clang) + else ifeq ($(notdir $($(ARCH)-cc)),clang) TF_CFLAGS += -fsanitize=memtag endif # armclang endif @@ -722,12 +687,12 @@ endif PIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT}) ifneq ($(PIE_FOUND),) TF_CFLAGS += -fno-PIE -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) TF_LDFLAGS += -no-pie endif endif #(PIE_FOUND) -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker else PIE_LDFLAGS += -pie --no-dynamic-linker @@ -1452,7 +1417,7 @@ ifeq (${DYN_DISABLE_AUTH},1) $(eval $(call add_define,DYN_DISABLE_AUTH)) endif -ifneq ($(findstring armlink,$(notdir $(LD))),) +ifneq ($(findstring armlink,$(notdir $($(ARCH)-ld))),) $(eval $(call add_define,USE_ARM_LINK)) endif @@ -1484,7 +1449,7 @@ msg_start: ifeq (${ERROR_DEPRECATED},0) # Check if deprecated declarations and cpp warnings should be treated as error or not. -ifneq ($(findstring clang,$(notdir $(CC))),) +ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) CPPFLAGS += -Wno-error=deprecated-declarations else CPPFLAGS += -Wno-error=deprecated-declarations -Wno-error=cpp diff --git a/bl1/bl1.mk b/bl1/bl1.mk index 53946ab8d..d11831793 100644 --- a/bl1/bl1.mk +++ b/bl1/bl1.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -29,9 +29,9 @@ ifeq (${ENABLE_PMF},1) BL1_SOURCES += lib/pmf/pmf_main.c endif -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) BL1_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) BL1_LDFLAGS += --sort-section=alignment endif diff --git a/bl2/bl2.mk b/bl2/bl2.mk index b70a3fbed..0a0a8b9ce 100644 --- a/bl2/bl2.mk +++ b/bl2/bl2.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -15,9 +15,9 @@ ifeq (${ARCH},aarch64) BL2_SOURCES += common/aarch64/early_exceptions.S endif -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) BL2_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) BL2_LDFLAGS += --sort-section=alignment endif diff --git a/bl2u/bl2u.mk b/bl2u/bl2u.mk index 9fe20f50f..d7601bb70 100644 --- a/bl2u/bl2u.mk +++ b/bl2u/bl2u.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -14,8 +14,8 @@ endif BL2U_DEFAULT_LINKER_SCRIPT_SOURCE := bl2u/bl2u.ld.S -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) BL2U_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) BL2U_LDFLAGS += --sort-section=alignment endif diff --git a/bl31/bl31.mk b/bl31/bl31.mk index 9959a3ef5..fa6f058c9 100644 --- a/bl31/bl31.mk +++ b/bl31/bl31.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -167,9 +167,9 @@ endif BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) BL31_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) BL31_LDFLAGS += --sort-section=alignment endif diff --git a/bl32/sp_min/sp_min.mk b/bl32/sp_min/sp_min.mk index 065468c58..baf68cbe6 100644 --- a/bl32/sp_min/sp_min.mk +++ b/bl32/sp_min/sp_min.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -57,9 +57,9 @@ endif BL32_DEFAULT_LINKER_SCRIPT_SOURCE := bl32/sp_min/sp_min.ld.S -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) BL32_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) BL32_LDFLAGS += --sort-section=alignment endif diff --git a/bl32/tsp/tsp.mk b/bl32/tsp/tsp.mk index 4c1813118..06efe84af 100644 --- a/bl32/tsp/tsp.mk +++ b/bl32/tsp/tsp.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -24,9 +24,9 @@ BL32_SOURCES += bl32/tsp/aarch64/tsp_entrypoint.S \ BL32_DEFAULT_LINKER_SCRIPT_SOURCE := bl32/tsp/tsp.ld.S -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) BL32_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) BL32_LDFLAGS += --sort-section=alignment endif diff --git a/lib/romlib/Makefile b/lib/romlib/Makefile index 1ae90959d..f11e5779e 100644 --- a/lib/romlib/Makefile +++ b/lib/romlib/Makefile @@ -8,11 +8,6 @@ toolchains := aarch64 include ../../make_helpers/toolchain.mk -AS = $(CROSS_COMPILE)gcc -AR = $(CROSS_COMPILE)gcc-ar -LD = $(CROSS_COMPILE)ld -OC = $(CROSS_COMPILE)objcopy -CPP = $(CROSS_COMPILE)gcc -E ROMLIB_GEN = ./romlib_generator.py BUILD_DIR = $(BUILD_PLAT)/romlib LIB_DIR = $(BUILD_PLAT)/lib @@ -52,23 +47,23 @@ all: $(BUILD_DIR)/romlib.bin $(LIB_DIR)/libwrappers.a %.o: %.s @echo " AS $@" - $(Q)$(AS) -c $(ASFLAGS) -o $@ $< + $(Q)$(aarch64-as) -c $(ASFLAGS) -o $@ $< $(BUILD_DIR)/%.o: %.s @echo " AS $@" - $(Q)$(AS) -c $(ASFLAGS) -o $@ $< + $(Q)$(aarch64-as) -c $(ASFLAGS) -o $@ $< $(BUILD_DIR)/romlib.ld: romlib.ld.S @echo " PP $@" - $(Q)$(CPP) $(PPFLAGS) -o $@ romlib.ld.S + $(Q)$(aarch64-cpp) -E $(PPFLAGS) -o $@ romlib.ld.S $(BUILD_DIR)/romlib.elf: $(OBJS) $(BUILD_DIR)/romlib.ld @echo " LD $@" - $(Q)$(LD) -T $(BUILD_DIR)/romlib.ld -L$(LIB_DIR) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + $(Q)$(aarch64-ld) -T $(BUILD_DIR)/romlib.ld -L$(LIB_DIR) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(BUILD_DIR)/romlib.bin: $(BUILD_DIR)/romlib.elf @echo " BIN $@" - $(Q)$(OC) -O binary $(BUILD_DIR)/romlib.elf $@ + $(Q)$(aarch64-oc) -O binary $(BUILD_DIR)/romlib.elf $@ $(WRAPPER_DIR)/jmpvar.s: $(BUILD_DIR)/romlib.elf @echo " VAR $@" @@ -76,7 +71,7 @@ $(WRAPPER_DIR)/jmpvar.s: $(BUILD_DIR)/romlib.elf $(LIB_DIR)/libwrappers.a: $(WRAPPER_DIR)/jmpvar.o $(WRAPPER_OBJS) @echo " AR $@" - $(Q)$(AR) -rc $@ $(WRAPPER_DIR)/jmpvar.o $(WRAPPER_OBJS) + $(Q)$(aarch64-ar) -rc $@ $(WRAPPER_DIR)/jmpvar.o $(WRAPPER_OBJS) $(BUILD_DIR)/jmptbl.i: ../../$(PLAT_DIR)/jmptbl.i @echo " PRE $@" diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index 6edc2d635..7a780f883 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -113,12 +113,12 @@ endef # Convenience function to check for a given linker option. An call to # $(call ld_option, --no-XYZ) will return --no-XYZ if supported by the linker -ld_option = $(shell $(LD) $(1) -Wl,--version >/dev/null 2>&1 || $(LD) $(1) -v >/dev/null 2>&1 && echo $(1)) +ld_option = $(shell $($(ARCH)-ld) $(1) -Wl,--version >/dev/null 2>&1 || $($(ARCH)-ld) $(1) -v >/dev/null 2>&1 && echo $(1)) # Convenience function to check for a given compiler option. A call to # $(call cc_option, --no-XYZ) will return --no-XYZ if supported by the compiler define cc_option - $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi ) + $(shell if $($(ARCH)-cc) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi ) endef # CREATE_SEQ is a recursive function to create sequence of numbers from 1 to @@ -312,7 +312,7 @@ $(eval LIB := $(call uppercase, $(notdir $(1)))) $(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | lib$(3)_dirs $$(ECHO) " CC $$<" - $$(Q)$$(CC) $$($(LIB)_CFLAGS) $$(TF_CFLAGS) $$(CFLAGS) $(MAKE_DEP) -c $$< -o $$@ + $$(Q)$($(ARCH)-cc) $$($(LIB)_CFLAGS) $$(TF_CFLAGS) $$(CFLAGS) $(MAKE_DEP) -c $$< -o $$@ -include $(DEP) @@ -328,7 +328,7 @@ $(eval DEP := $(patsubst %.o,%.d,$(OBJ))) $(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | lib$(3)_dirs $$(ECHO) " AS $$<" - $$(Q)$$(AS) $$(ASFLAGS) $(MAKE_DEP) -c $$< -o $$@ + $$(Q)$($(ARCH)-as) -x assembler-with-cpp $$(TF_CFLAGS_$(ARCH)) $$(ASFLAGS) $(MAKE_DEP) -c $$< -o $$@ -include $(DEP) @@ -351,7 +351,7 @@ $(eval BL_CFLAGS := $($(call uppercase,$(3))_CFLAGS) $(PLAT_BL_COMMON_CFLAGS)) $(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $(3)_dirs $$(ECHO) " CC $$<" - $$(Q)$$(CC) $$(LTO_CFLAGS) $$(TF_CFLAGS) $$(CFLAGS) $(BL_CPPFLAGS) $(BL_CFLAGS) $(MAKE_DEP) -c $$< -o $$@ + $$(Q)$($(ARCH)-cc) $$(LTO_CFLAGS) $$(TF_CFLAGS) $$(CFLAGS) $(BL_CPPFLAGS) $(BL_CFLAGS) $(MAKE_DEP) -c $$< -o $$@ -include $(DEP) @@ -374,7 +374,7 @@ $(eval BL_ASFLAGS := $($(call uppercase,$(3))_ASFLAGS) $(PLAT_BL_COMMON_ASFLAGS) $(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $(3)_dirs $$(ECHO) " AS $$<" - $$(Q)$$(AS) $$(ASFLAGS) $(BL_CPPFLAGS) $(BL_ASFLAGS) $(MAKE_DEP) -c $$< -o $$@ + $$(Q)$($(ARCH)-as) -x assembler-with-cpp $$(TF_CFLAGS_$(ARCH)) $$(ASFLAGS) $(BL_CPPFLAGS) $(BL_ASFLAGS) $(MAKE_DEP) -c $$< -o $$@ -include $(DEP) @@ -395,7 +395,7 @@ $(eval BL_CPPFLAGS := $($(call uppercase,$(3))_CPPFLAGS) $(addprefix -D,$(BL_DEF $(1): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $(3)_dirs $$(ECHO) " PP $$<" - $$(Q)$$(CPP) $$(CPPFLAGS) $(BL_CPPFLAGS) $(TF_CFLAGS_$(ARCH)) -P -x assembler-with-cpp -D__LINKER__ $(MAKE_DEP) -o $$@ $$< + $$(Q)$($(ARCH)-cpp) -E $$(CPPFLAGS) $(BL_CPPFLAGS) $(TF_CFLAGS_$(ARCH)) -P -x assembler-with-cpp -D__LINKER__ $(MAKE_DEP) -o $$@ $$< -include $(DEP) @@ -493,7 +493,7 @@ all: ${LIB_DIR}/lib$(1).a ${LIB_DIR}/lib$(1).a: $(OBJS) $$(ECHO) " AR $$@" - $$(Q)$$(AR) cr $$@ $$? + $$(Q)$($(ARCH)-ar) cr $$@ $$? endef # Generate the path to one or more preprocessed linker scripts given the paths @@ -573,22 +573,22 @@ else @echo 'const char build_message[] = "Built : "$(BUILD_MESSAGE_TIMESTAMP); \ const char version_string[] = "${VERSION_STRING}"; \ const char version[] = "${VERSION}";' | \ - $$(CC) $$(TF_CFLAGS) $$(CFLAGS) -xc -c - -o $(BUILD_DIR)/build_message.o + $($(ARCH)-cc) $$(TF_CFLAGS) $$(CFLAGS) -xc -c - -o $(BUILD_DIR)/build_message.o endif ifneq ($(findstring armlink,$(notdir $(LD))),) - $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) --entry=${1}_entrypoint \ + $$(Q)$($(ARCH)-ld) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) --entry=${1}_entrypoint \ --predefine="-D__LINKER__=$(__LINKER__)" \ --predefine="-DTF_CFLAGS=$(TF_CFLAGS)" \ --map --list="$(MAPFILE)" --scatter=${PLAT_DIR}/scat/${1}.scat \ $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) \ $(BUILD_DIR)/build_message.o $(OBJS) else ifneq ($(findstring gcc,$(notdir $(LD))),) - $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) -Wl,-Map=$(MAPFILE) \ + $$(Q)$($(ARCH)-ld) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) -Wl,-Map=$(MAPFILE) \ $(addprefix -Wl$(comma)--script$(comma),$(LINKER_SCRIPTS)) -Wl,--script,$(DEFAULT_LINKER_SCRIPT) \ $(BUILD_DIR)/build_message.o \ $(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) else - $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) -Map=$(MAPFILE) \ + $$(Q)$($(ARCH)-ld) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) -Map=$(MAPFILE) \ $(addprefix -T ,$(LINKER_SCRIPTS)) --script $(DEFAULT_LINKER_SCRIPT) \ $(BUILD_DIR)/build_message.o \ $(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) @@ -601,11 +601,11 @@ endif $(DUMP): $(ELF) $${ECHO} " OD $$@" - $${Q}$${OD} -dx $$< > $$@ + $${Q}$($(ARCH)-od) -dx $$< > $$@ $(BIN): $(ELF) $${ECHO} " BIN $$@" - $$(Q)$$(OC) -O binary $$< $$@ + $$(Q)$($(ARCH)-oc) -O binary $$< $$@ @${ECHO_BLANK_LINE} @echo "Built $$@ successfully" @${ECHO_BLANK_LINE} @@ -668,9 +668,9 @@ $(eval DTBDEP := $(patsubst %.dtb,%.d,$(DOBJ))) $(DOBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | fdt_dirs $${ECHO} " CPP $$<" $(eval DTBS := $(addprefix $(1)/,$(call SOURCES_TO_DTBS,$(2)))) - $$(Q)$$(CPP) $$(DTC_CPPFLAGS) -MT $(DTBS) -MMD -MF $(DTSDEP) -o $(DPRE) $$< + $$(Q)$($(ARCH)-cpp) -E $$(TF_CFLAGS_$(ARCH)) $$(DTC_CPPFLAGS) -MT $(DTBS) -MMD -MF $(DTSDEP) -o $(DPRE) $$< $${ECHO} " DTC $$<" - $$(Q)$$(DTC) $$(DTC_FLAGS) -d $(DTBDEP) -o $$@ $(DPRE) + $$(Q)$($(ARCH)-dtc) $$(DTC_FLAGS) -d $(DTBDEP) -o $$@ $(DPRE) -include $(DTBDEP) -include $(DTSDEP) diff --git a/make_helpers/march.mk b/make_helpers/march.mk index 1b73969a8..9c42ae686 100644 --- a/make_helpers/march.mk +++ b/make_helpers/march.mk @@ -21,7 +21,7 @@ # armv8.6-a armv8.7-a armv8.8-a armv8-r armv9-a # [...] # -GCC_MARCH_OUTPUT := $(shell $(CC) -march=foo -Q --help=target -v 2>&1) +GCC_MARCH_OUTPUT := $(shell $($(ARCH)-cc) -march=foo -Q --help=target -v 2>&1) # This function is used to find the best march value supported by the given compiler. # We try to use `GCC_MARCH_OUTPUT` which has verbose message with supported march values we filter that @@ -54,7 +54,7 @@ else provided-march = armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a endif -ifeq ($(findstring clang,$(notdir $(CC))),) +ifeq ($(findstring clang,$(notdir $($(ARCH)-cc))),) # We expect from Platform to provide a correct Major/Minor value but expecting something # from compiler with unsupported march means we shouldn't fail without trying anything, diff --git a/make_helpers/windows.mk b/make_helpers/windows.mk index 980abf095..7ed8e84ce 100644 --- a/make_helpers/windows.mk +++ b/make_helpers/windows.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -88,8 +88,7 @@ VERSION_MESSAGE = const char version[] = "${VERSION}"; define MAKE_BUILD_STRINGS $$(file >$1.in,$$(TF_CFLAGS) $$(CFLAGS)) @echo $$(BUILT_TIME_DATE_STRING) $$(VERSION_STRING_MESSAGE) $$(VERSION_MESSAGE) | \ - $$(CC) @$1.in -x c -c - -o $1 + $($(ARCH)-cc) @$1.in -x c -c - -o $1 endef MSVC_NMAKE := nmake.exe - diff --git a/plat/amlogic/axg/platform.mk b/plat/amlogic/axg/platform.mk index 3560b0cd1..e6a9b041c 100644 --- a/plat/amlogic/axg/platform.mk +++ b/plat/amlogic/axg/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -41,9 +41,9 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${GIC_SOURCES} # Tune compiler for Cortex-A53 -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 -else ifneq ($(findstring clang,$(notdir $(CC))),) +else ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 else TF_CFLAGS_aarch64 += -mtune=cortex-a53 @@ -92,4 +92,3 @@ ${DOIMAGETOOL}: ${BUILD_PLAT}/bl31.img: ${BUILD_PLAT}/bl31.bin ${DOIMAGETOOL} ${DOIMAGETOOL} ${BUILD_PLAT}/bl31.bin ${BUILD_PLAT}/bl31.img - diff --git a/plat/amlogic/g12a/platform.mk b/plat/amlogic/g12a/platform.mk index b0c91b063..58ca7324c 100644 --- a/plat/amlogic/g12a/platform.mk +++ b/plat/amlogic/g12a/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2019-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -41,9 +41,9 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${GIC_SOURCES} # Tune compiler for Cortex-A53 -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 -else ifneq ($(findstring clang,$(notdir $(CC))),) +else ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 else TF_CFLAGS_aarch64 += -mtune=cortex-a53 @@ -88,4 +88,3 @@ ${DOIMAGETOOL}: ${BUILD_PLAT}/bl31.img: ${BUILD_PLAT}/bl31.bin ${DOIMAGETOOL} ${DOIMAGETOOL} ${BUILD_PLAT}/bl31.bin ${BUILD_PLAT}/bl31.img - diff --git a/plat/amlogic/gxbb/platform.mk b/plat/amlogic/gxbb/platform.mk index 62384d2aa..f1c1a9ffe 100644 --- a/plat/amlogic/gxbb/platform.mk +++ b/plat/amlogic/gxbb/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -37,9 +37,9 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${GIC_SOURCES} # Tune compiler for Cortex-A53 -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 -else ifneq ($(findstring clang,$(notdir $(CC))),) +else ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 else TF_CFLAGS_aarch64 += -mtune=cortex-a53 diff --git a/plat/amlogic/gxl/platform.mk b/plat/amlogic/gxl/platform.mk index 641d177bc..e8871cd62 100644 --- a/plat/amlogic/gxl/platform.mk +++ b/plat/amlogic/gxl/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -41,9 +41,9 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${GIC_SOURCES} # Tune compiler for Cortex-A53 -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 -else ifneq ($(findstring clang,$(notdir $(CC))),) +else ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 else TF_CFLAGS_aarch64 += -mtune=cortex-a53 @@ -88,4 +88,3 @@ ${DOIMAGETOOL}: ${BUILD_PLAT}/bl31.img: ${BUILD_PLAT}/bl31.bin ${DOIMAGETOOL} ${DOIMAGETOOL} ${BUILD_PLAT}/bl31.bin ${BUILD_PLAT}/bl31.img - diff --git a/plat/arm/board/arm_fpga/platform.mk b/plat/arm/board/arm_fpga/platform.mk index f44b37d4a..c9c248fff 100644 --- a/plat/arm/board/arm_fpga/platform.mk +++ b/plat/arm/board/arm_fpga/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2023, Arm Limited. All rights reserved. +# Copyright (c) 2021-2024, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -129,6 +129,6 @@ $(eval $(call MAKE_LD,$(BUILD_PLAT)/build_axf.ld,plat/arm/board/arm_fpga/build_a bl31.axf: bl31 dtbs ${BUILD_PLAT}/rom_trampoline.o ${BUILD_PLAT}/kernel_trampoline.o ${BUILD_PLAT}/build_axf.ld $(ECHO) " LD $@" - $(Q)$(LD) -T ${BUILD_PLAT}/build_axf.ld -L ${BUILD_PLAT} --strip-debug -s -n -o ${BUILD_PLAT}/bl31.axf + $(Q)$($(ARCH)-ld) -T ${BUILD_PLAT}/build_axf.ld -L ${BUILD_PLAT} --strip-debug -s -n -o ${BUILD_PLAT}/bl31.axf all: bl31.axf diff --git a/plat/nvidia/tegra/platform.mk b/plat/nvidia/tegra/platform.mk index 236556499..0221b5ec8 100644 --- a/plat/nvidia/tegra/platform.mk +++ b/plat/nvidia/tegra/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. # Copyright (c) 2020, NVIDIA Corporation. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause @@ -82,7 +82,7 @@ override LIBC_SRCS := $(addprefix lib/libc/, \ INCLUDES += -Iinclude/lib/libc \ -Iinclude/lib/libc/$(ARCH) \ -ifneq ($(findstring armlink,$(notdir $(LD))),) +ifneq ($(findstring armlink,$(notdir $($(ARCH)-ld))),) # o suppress warnings for section mismatches, undefined symbols # o use only those libraries that are specified in the input file # list to resolve references diff --git a/plat/renesas/rcar/platform.mk b/plat/renesas/rcar/platform.mk index c95590d5e..5718478b2 100644 --- a/plat/renesas/rcar/platform.mk +++ b/plat/renesas/rcar/platform.mk @@ -371,7 +371,6 @@ clean_srecord: .PHONY: rcar_srecord rcar_srecord: $(BL2_ELF_SRC) $(BL31_ELF_SRC) @echo "generating srec: ${SREC_PATH}/bl2.srec" - $(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec + $(Q)$($(ARCH)-oc) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec @echo "generating srec: ${SREC_PATH}/bl31.srec" - $(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec - + $(Q)$($(ARCH)-oc) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec diff --git a/plat/renesas/rzg/platform.mk b/plat/renesas/rzg/platform.mk index f37d7d0cc..89ca22780 100644 --- a/plat/renesas/rzg/platform.mk +++ b/plat/renesas/rzg/platform.mk @@ -269,6 +269,6 @@ clean_srecord: .PHONY: rzg_srecord rzg_srecord: $(BL2_ELF_SRC) $(BL31_ELF_SRC) @echo "generating srec: ${SREC_PATH}/bl2.srec" - $(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec + $(Q)$($(ARCH)-oc) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec @echo "generating srec: ${SREC_PATH}/bl31.srec" - $(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec + $(Q)$($(ARCH)-oc) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec diff --git a/plat/rockchip/rk3399/drivers/m0/Makefile b/plat/rockchip/rk3399/drivers/m0/Makefile index 55f0a829a..2abcc18ba 100644 --- a/plat/rockchip/rk3399/drivers/m0/Makefile +++ b/plat/rockchip/rk3399/drivers/m0/Makefile @@ -42,13 +42,6 @@ CFLAGS := -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-common ASFLAGS := -Wa,--gdwarf-2 LDFLAGS := -Wl,--gc-sections -Wl,--build-id=none -# Cross tool -CC := ${M0_CROSS_COMPILE}gcc -CPP := ${M0_CROSS_COMPILE}gcc -E -AR := ${M0_CROSS_COMPILE}gcc-ar -OC := ${M0_CROSS_COMPILE}objcopy -OD := ${M0_CROSS_COMPILE}objdump - # NOTE: The line continuation '\' is required in the next define otherwise we # end up with a line-feed characer at the end of the last c filename. # Also bare this issue in mind if extending the list of supported filetypes. @@ -79,7 +72,7 @@ $(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2)))) $(OBJ) : $(2) @echo " CC $$<" - $$(Q)$$(CC) $$(COMMON_FLAGS) $$(CFLAGS) $$(INCLUDES) -MMD -MT $$@ -c $$< -o $$@ + $$(Q)$(rk3399-m0-cc) $$(COMMON_FLAGS) $$(CFLAGS) $$(INCLUDES) -MMD -MT $$@ -c $$< -o $$@ endef define MAKE_S @@ -87,7 +80,7 @@ $(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2)))) $(OBJ) : $(2) @echo " AS $$<" - $$(Q)$$(CC) -x assembler-with-cpp $$(COMMON_FLAGS) $$(ASFLAGS) -c $$< -o $$@ + $$(Q)$(rk3399-m0-cc) -x assembler-with-cpp $$(COMMON_FLAGS) $$(ASFLAGS) -c $$< -o $$@ endef define MAKE_OBJS @@ -108,20 +101,20 @@ all: $(BIN) $(BIN_PMU) .DEFAULT_GOAL := all $(LINKERFILE): $(LINKERFILE_SRC) - $(CC) $(COMMON_FLAGS) $(INCLUDES) -P -E -D__LINKER__ -MMD -MF $@.d -MT $@ -o $@ $< + $(rk3399-m0-cc) $(COMMON_FLAGS) $(INCLUDES) -P -E -D__LINKER__ -MMD -MF $@.d -MT $@ -o $@ $< -include $(LINKERFILE).d $(ELF) : $(OBJS) $(OBJS_COMMON) $(LINKERFILE) @echo " LD $@" - $(Q)$(CC) -o $@ $(COMMON_FLAGS) $(LDFLAGS) -Wl,-Map=$(MAPFILE) -Wl,-T$(LINKERFILE) $(OBJS) $(OBJS_COMMON) + $(Q)$(rk3399-m0-cc) -o $@ $(COMMON_FLAGS) $(LDFLAGS) -Wl,-Map=$(MAPFILE) -Wl,-T$(LINKERFILE) $(OBJS) $(OBJS_COMMON) %.bin : %.elf @echo " BIN $@" - $(Q)$(OC) -O binary $< $@ + $(Q)$(rk3399-m0-oc) -O binary $< $@ $(ELF_PMU) : $(OBJS_COMMON) $(OBJS_PMU) $(LINKERFILE) @echo " LD $@" - $(Q)$(CC) -o $@ $(COMMON_FLAGS) $(LDFLAGS) -Wl,-Map=$(MAPFILE_PMU) -Wl,-T$(LINKERFILE) $(OBJS_PMU) $(OBJS_COMMON) + $(Q)$(rk3399-m0-cc) -o $@ $(COMMON_FLAGS) $(LDFLAGS) -Wl,-Map=$(MAPFILE_PMU) -Wl,-T$(LINKERFILE) $(OBJS_PMU) $(OBJS_COMMON) $(eval $(call MAKE_OBJS,$(BUILD),$(SOURCES_COMMON),$(1))) $(eval $(call MAKE_OBJS,$(BUILD),$(SOURCES),$(1))) diff --git a/plat/rpi/rpi3/platform.mk b/plat/rpi/rpi3/platform.mk index 06393e40b..3af177cf5 100644 --- a/plat/rpi/rpi3/platform.mk +++ b/plat/rpi/rpi3/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -52,9 +52,9 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${LIBFDT_SRCS} # Tune compiler for Cortex-A53 -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 -else ifneq ($(findstring clang,$(notdir $(CC))),) +else ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch64 += -mcpu=cortex-a53 else TF_CFLAGS_aarch64 += -mtune=cortex-a53 diff --git a/plat/rpi/rpi4/platform.mk b/plat/rpi/rpi4/platform.mk index 528eb1d2e..0b5fef792 100644 --- a/plat/rpi/rpi4/platform.mk +++ b/plat/rpi/rpi4/platform.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2021, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -39,9 +39,9 @@ RESET_TO_BL31 := 1 COLD_BOOT_SINGLE_CPU := 0 # Tune compiler for Cortex-A72 -ifeq ($(notdir $(CC)),armclang) +ifeq ($(notdir $($(ARCH)-cc)),armclang) TF_CFLAGS_aarch64 += -mcpu=cortex-a72 -else ifneq ($(findstring clang,$(notdir $(CC))),) +else ifneq ($(findstring clang,$(notdir $($(ARCH)-cc))),) TF_CFLAGS_aarch64 += -mcpu=cortex-a72 else TF_CFLAGS_aarch64 += -mtune=cortex-a72 @@ -113,4 +113,3 @@ endif ifeq ($(SMC_PCI_SUPPORT), 1) BL31_SOURCES += plat/rpi/rpi4/rpi4_pci_svc.c endif - diff --git a/plat/st/common/common.mk b/plat/st/common/common.mk index 7f93961d8..f49112dcb 100644 --- a/plat/st/common/common.mk +++ b/plat/st/common/common.mk @@ -43,7 +43,7 @@ STM32MP_EMMC_BOOT ?= 0 STM32MP_UART_PROGRAMMER ?= 0 STM32MP_USB_PROGRAMMER ?= 0 -$(eval DTC_V = $(shell $(DTC) -v | awk '{print $$NF}')) +$(eval DTC_V = $(shell $($(ARCH)-dtc) -v | awk '{print $$NF}')) $(eval DTC_VERSION = $(shell printf "%d" $(shell echo ${DTC_V} | cut -d- -f1 | sed "s/\./0/g" | grep -o "[0-9]*"))) DTC_CPPFLAGS += ${INCLUDES} DTC_FLAGS += -Wno-unit_address_vs_reg diff --git a/plat/st/common/common_rules.mk b/plat/st/common/common_rules.mk index f39caab82..7f45bf255 100644 --- a/plat/st/common/common_rules.mk +++ b/plat/st/common/common_rules.mk @@ -49,7 +49,7 @@ ${BUILD_PLAT}/fdts/%-bl2.dtb: ${BUILD_PLAT}/fdts/%-bl2.dts ${BUILD_PLAT}/$(PLAT)-%.o: ${BUILD_PLAT}/fdts/%-bl2.dtb $(STM32_BINARY_MAPPING) bl2 @echo " AS $${PLAT}.S" - ${Q}${AS} ${ASFLAGS} ${TF_CFLAGS} \ + ${Q}$($(ARCH)-as) -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) ${ASFLAGS} ${TF_CFLAGS} \ -DDTB_BIN_PATH=\"$<\" \ -c $(word 2,$^) -o $@ @@ -57,14 +57,14 @@ $(eval $(call MAKE_LD,${STM32_TF_LINKERFILE},$(STM32_LD_FILE),bl2)) tf-a-%.elf: $(PLAT)-%.o ${STM32_TF_LINKERFILE} @echo " LDS $<" -ifneq ($(findstring gcc,$(notdir $(LD))),) - ${Q}${LD} -o $@ $(subst --,-Wl$(comma)--,${STM32_TF_ELF_LDFLAGS}) -nostartfiles -Wl,-Map=$(@:.elf=.map) -Wl,-dT ${STM32_TF_LINKERFILE} $< +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) + ${Q}$($(ARCH)-ld) -o $@ $(subst --,-Wl$(comma)--,${STM32_TF_ELF_LDFLAGS}) -nostartfiles -Wl,-Map=$(@:.elf=.map) -Wl,-dT ${STM32_TF_LINKERFILE} $< else - ${Q}${LD} -o $@ ${STM32_TF_ELF_LDFLAGS} -Map=$(@:.elf=.map) --script ${STM32_TF_LINKERFILE} $< + ${Q}$($(ARCH)-ld) -o $@ ${STM32_TF_ELF_LDFLAGS} -Map=$(@:.elf=.map) --script ${STM32_TF_LINKERFILE} $< endif tf-a-%.bin: tf-a-%.elf - ${Q}${OC} -O binary $< $@ + ${Q}$($(ARCH)-oc) -O binary $< $@ @echo @echo "Built $@ successfully" @echo diff --git a/plat/st/stm32mp1/cert_create_tbbr.mk b/plat/st/stm32mp1/cert_create_tbbr.mk index 5b1a3ed94..e747e396e 100644 --- a/plat/st/stm32mp1/cert_create_tbbr.mk +++ b/plat/st/stm32mp1/cert_create_tbbr.mk @@ -11,9 +11,8 @@ $(eval $(call add_define,PDEF_CERTS)) PLAT_INCLUDE += -I${PLAT_DIR}include src/stm32mp1_tbb_cert.o: ${PLAT_DIR}stm32mp1_tbb_cert.c - ${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@ + ${Q}$(host-cc) -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@ PLAT_OBJECTS = src/stm32mp1_tbb_cert.o OBJECTS += $(PLAT_OBJECTS) - diff --git a/services/std_svc/rmmd/trp/trp.mk b/services/std_svc/rmmd/trp/trp.mk index b7bd31762..467a4e2ca 100644 --- a/services/std_svc/rmmd/trp/trp.mk +++ b/services/std_svc/rmmd/trp/trp.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2023 Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -10,9 +10,9 @@ RMM_SOURCES += services/std_svc/rmmd/trp/trp_entry.S \ RMM_DEFAULT_LINKER_SCRIPT_SOURCE := services/std_svc/rmmd/trp/linker.ld.S -ifneq ($(findstring gcc,$(notdir $(LD))),) +ifneq ($(findstring gcc,$(notdir $($(ARCH)-ld))),) RMM_LDFLAGS += -Wl,--sort-section=alignment -else ifneq ($(findstring ld,$(notdir $(LD))),) +else ifneq ($(findstring ld,$(notdir $($(ARCH)-ld))),) RMM_LDFLAGS += --sort-section=alignment endif diff --git a/tools/amlogic/Makefile b/tools/amlogic/Makefile index d6d464b45..5ff26e5d4 100644 --- a/tools/amlogic/Makefile +++ b/tools/amlogic/Makefile @@ -30,22 +30,20 @@ else Q := endif -HOSTCC := gcc - .PHONY: all clean distclean all: ${PROJECT} ${PROJECT}: ${OBJECTS} Makefile @echo " HOSTLD $@" - ${Q}${HOSTCC} ${OBJECTS} -o $@ + ${Q}$(host-cc) ${OBJECTS} -o $@ @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} %.o: %.c Makefile @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@ + ${Q}$(host-cc) -c ${HOSTCCFLAGS} $< -o $@ clean: $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile index 4203405de..21523f6c3 100644 --- a/tools/cert_create/Makefile +++ b/tools/cert_create/Makefile @@ -84,8 +84,6 @@ INC_DIR += -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include LIB_DIR := -L ${OPENSSL_DIR}/lib -L ${OPENSSL_DIR} LIB := -lssl -lcrypto -HOSTCC ?= gcc - .PHONY: all clean realclean --openssl all: --openssl ${BINARY} @@ -94,12 +92,12 @@ ${BINARY}: ${OBJECTS} Makefile @echo " HOSTLD $@" @echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \ const char platform_msg[] = "${PLAT_MSG}";' | \ - ${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o - ${Q}${HOSTCC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ + $(host-cc) -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o + ${Q}$(host-cc) src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ %.o: %.c @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@ + ${Q}$(host-cc) -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@ --openssl: ifeq ($(DEBUG),1) diff --git a/tools/encrypt_fw/Makefile b/tools/encrypt_fw/Makefile index b530ccacb..83f2f57e7 100644 --- a/tools/encrypt_fw/Makefile +++ b/tools/encrypt_fw/Makefile @@ -63,8 +63,6 @@ INC_DIR := -I ./include -I ../../include/tools_share -I ${OPENSSL_DIR}/include LIB_DIR := -L ${OPENSSL_DIR}/lib -L ${OPENSSL_DIR} LIB := -lssl -lcrypto -HOSTCC ?= gcc - .PHONY: all clean realclean --openssl all: --openssl ${BINARY} @@ -72,12 +70,12 @@ all: --openssl ${BINARY} ${BINARY}: ${OBJECTS} Makefile @echo " HOSTLD $@" @echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__;' | \ - ${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o - ${Q}${HOSTCC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ + $(host-cc) -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o + ${Q}$(host-cc) src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ %.o: %.c @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@ + ${Q}$(host-cc) -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@ --openssl: ifeq ($(DEBUG),1) diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile index 3cb89c683..865ff4c70 100644 --- a/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile @@ -61,8 +61,6 @@ else Q := endif -HOSTCC ?= gcc - ifneq (${PLAT},) TF_PLATFORM_ROOT := ../../plat/ include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk @@ -84,14 +82,14 @@ all: --openssl ${PROJECT} ${PROJECT}: ${OBJECTS} Makefile @echo " HOSTLD $@" - ${Q}${HOSTCC} ${OBJECTS} -o $@ $(LDOPTS) + ${Q}$(host-cc) ${OBJECTS} -o $@ $(LDOPTS) @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} %.o: %.c Makefile @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} -MD -MP $< -o $@ + ${Q}$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} -MD -MP $< -o $@ -include $(DEPS) diff --git a/tools/fiptool/plat_fiptool/st/stm32mp1/plat_fiptool.mk b/tools/fiptool/plat_fiptool/st/stm32mp1/plat_fiptool.mk index 1ba47c1fe..0d69dbdd0 100644 --- a/tools/fiptool/plat_fiptool/st/stm32mp1/plat_fiptool.mk +++ b/tools/fiptool/plat_fiptool/st/stm32mp1/plat_fiptool.mk @@ -17,7 +17,7 @@ ifeq (${PLAT_DEF_UUID},yes) HOSTCCFLAGS += -DPLAT_DEF_FIP_UUID ${PLAT_DEF_UUID_FILE_NAME}.o: plat_fiptool/st/stm32mp1/${PLAT_DEF_UUID_FILE_NAME}.c - ${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ + $(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ PLAT_OBJECTS += ${PLAT_DEF_UUID_FILE_NAME}.o endif diff --git a/tools/marvell/doimage/Makefile b/tools/marvell/doimage/Makefile index 0766f59ae..6e59aa215 100644 --- a/tools/marvell/doimage/Makefile +++ b/tools/marvell/doimage/Makefile @@ -29,7 +29,6 @@ HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS} # could get pulled in from firmware tree. INCLUDE_PATHS = -I. -HOSTCC ?= gcc RM := rm -rf .PHONY: all clean @@ -38,14 +37,14 @@ all: ${PROJECT} ${PROJECT}: ${OBJECTS} Makefile @echo " HOSTLD $@" - ${Q}${HOSTCC} ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@ + ${Q}$(host-cc) ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@ @echo @echo "Built $@ successfully" @echo %.o: %.c Makefile @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ + ${Q}$(host-cc) -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ clean: ${Q}${RM} ${PROJECT} diff --git a/tools/nxp/create_pbl/Makefile b/tools/nxp/create_pbl/Makefile index 61ba92f23..b6b3b04a9 100644 --- a/tools/nxp/create_pbl/Makefile +++ b/tools/nxp/create_pbl/Makefile @@ -34,30 +34,27 @@ endif INCLUDE_PATHS := -HOSTCC ?= gcc -CC = gcc - .PHONY: all clean distclean all: create_pbl byte_swap ${PROJECT_1}: ${OBJECTS_1} Makefile @echo " LD $@" - ${Q}${HOSTCC} ${OBJECTS_1} -o $@ ${LDLIBS} + ${Q}$(host-cc) ${OBJECTS_1} -o $@ ${LDLIBS} @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} ${PROJECT_2}: ${OBJECTS_2} Makefile @echo " LD $@" - ${Q}${HOSTCC} ${OBJECTS_2} -o $@ ${LDLIBS} + ${Q}$(host-cc) ${OBJECTS_2} -o $@ ${LDLIBS} @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} %.o: %.c %.h Makefile @echo " CC $<" - ${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ + ${Q}$(host-cc) -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ clean: $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1}) diff --git a/tools/renesas/rcar_layout_create/makefile b/tools/renesas/rcar_layout_create/makefile index fefdb1973..baa6e7e75 100644 --- a/tools/renesas/rcar_layout_create/makefile +++ b/tools/renesas/rcar_layout_create/makefile @@ -71,16 +71,9 @@ $(eval $(call add_define,RCAR_VMA_ADJUST_ADDR)) ################################################### #c compiler -CC = $(CROSS_COMPILE)gcc CFLAGS += ${DEFINES} CFLAGS += -I../../include/lib/stdlib -#Linker -LD = $(CROSS_COMPILE)ld - -#objcopy -objcopy = $(CROSS_COMPILE)objcopy - #clean CL = rm -f @@ -96,29 +89,29 @@ all: $(OUTPUT_FILE_SA0) $(OUTPUT_FILE_SA6) # Linker ################################################### $(OUTPUT_FILE_SA0) : $(MEMORY_DEF_SA0) $(OBJ_FILE_SA0) - $(LD) $(OBJ_FILE_SA0) \ + $(aarch64-ld) $(OBJ_FILE_SA0) \ -T $(MEMORY_DEF_SA0) \ -o $(OUTPUT_FILE_SA0) \ -Map $(FILE_NAME_SA0).map \ - $(objcopy) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).srec - $(objcopy) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).bin + $(aarch64-oc) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).srec + $(aarch64-oc) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).bin $(OUTPUT_FILE_SA6) : $(MEMORY_DEF_SA6) $(OBJ_FILE_SA6) - $(LD) $(OBJ_FILE_SA6) \ + $(aarch64-ld) $(OBJ_FILE_SA6) \ -T $(MEMORY_DEF_SA6) \ -o $(OUTPUT_FILE_SA6) \ -Map $(FILE_NAME_SA6).map \ - $(objcopy) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).srec - $(objcopy) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).bin + $(aarch64-oc) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).srec + $(aarch64-oc) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).bin ################################################### # Compile ################################################### %.o: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + $(aarch64-cc) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< .PHONY: clean clean: diff --git a/tools/renesas/rzg_layout_create/makefile b/tools/renesas/rzg_layout_create/makefile index 9cab56fb7..4cab5fba9 100644 --- a/tools/renesas/rzg_layout_create/makefile +++ b/tools/renesas/rzg_layout_create/makefile @@ -66,18 +66,11 @@ $(eval $(call add_define,RCAR_VMA_ADJUST_ADDR)) ################################################### #c compiler -CC = $(CROSS_COMPILE)gcc CFLAGS += ${DEFINES} CFLAGS += -nostdinc \ -I../../../include/lib/libc \ -I../../../include/lib/libc/aarch64 -#Linker -LD = $(CROSS_COMPILE)ld - -#objcopy -objcopy = $(CROSS_COMPILE)objcopy - #clean CL = rm -f @@ -93,29 +86,29 @@ all: $(OUTPUT_FILE_SA0) $(OUTPUT_FILE_SA6) # Linker ################################################### $(OUTPUT_FILE_SA0) : $(MEMORY_DEF_SA0) $(OBJ_FILE_SA0) - $(LD) $(OBJ_FILE_SA0) \ + $(aarch64-ld) $(OBJ_FILE_SA0) \ -T $(MEMORY_DEF_SA0) \ -o $(OUTPUT_FILE_SA0) \ -Map $(FILE_NAME_SA0).map \ - $(objcopy) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).srec - $(objcopy) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).bin + $(aarch64-oc) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).srec + $(aarch64-oc) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA0) $(FILE_NAME_SA0).bin $(OUTPUT_FILE_SA6) : $(MEMORY_DEF_SA6) $(OBJ_FILE_SA6) - $(LD) $(OBJ_FILE_SA6) \ + $(aarch64-ld) $(OBJ_FILE_SA6) \ -T $(MEMORY_DEF_SA6) \ -o $(OUTPUT_FILE_SA6) \ -Map $(FILE_NAME_SA6).map \ - $(objcopy) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).srec - $(objcopy) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).bin + $(aarch64-oc) -O srec --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).srec + $(aarch64-oc) -O binary --adjust-vma=$(RCAR_VMA_ADJUST_ADDR) --srec-forceS3 $(OUTPUT_FILE_SA6) $(FILE_NAME_SA6).bin ################################################### # Compile ################################################### %.o: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + $(aarch64-cc) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< .PHONY: clean clean: diff --git a/tools/sptool/Makefile b/tools/sptool/Makefile index 5dbcbadcf..a913ce541 100644 --- a/tools/sptool/Makefile +++ b/tools/sptool/Makefile @@ -32,22 +32,20 @@ endif INCLUDE_PATHS := -I../../include/tools_share -HOSTCC ?= gcc - .PHONY: all clean distclean all: ${PROJECT} ${PROJECT}: ${OBJECTS} Makefile @echo " HOSTLD $@" - ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} + ${Q}$(host-cc) ${OBJECTS} -o $@ ${LDLIBS} @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} %.o: %.c Makefile @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ + ${Q}$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ clean: $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) diff --git a/tools/stm32image/Makefile b/tools/stm32image/Makefile index 9dfe9cb43..c75e9411b 100644 --- a/tools/stm32image/Makefile +++ b/tools/stm32image/Makefile @@ -29,22 +29,20 @@ else Q := endif -HOSTCC := gcc - .PHONY: all clean distclean all: ${PROJECT} ${PROJECT}: ${OBJECTS} Makefile @echo " HOSTLD $@" - ${Q}${HOSTCC} ${OBJECTS} -o $@ + ${Q}$(host-cc) ${OBJECTS} -o $@ @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} %.o: %.c Makefile @echo " HOSTCC $<" - ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@ + ${Q}$(host-cc) -c ${HOSTCCFLAGS} $< -o $@ clean: $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})