From 9f98aa1a7e33dd55851fd4feec0de9b40b6d9f10 Mon Sep 17 00:00:00 2001 From: Jeenu Viswambharan Date: Tue, 11 Mar 2014 11:06:45 +0000 Subject: [PATCH] Specify image entry in linker script At present, the entry point for each BL image is specified via the Makefiles and provided on the command line to the linker. When using a link script the entry point should rather be specified via the ENTRY() directive in the link script. This patch updates linker scripts of all BL images to specify the entry point using the ENTRY() directive. It also removes the --entry flag passed to the linker through Makefile. Fixes issue ARM-software/tf-issues#66 Change-Id: I1369493ebbacea31885b51185441f6b628cf8da0 --- Makefile | 3 +-- bl1/aarch64/bl1_entrypoint.S | 6 +++--- bl1/bl1.ld.S | 1 + bl1/bl1.mk | 1 - bl2/bl2.ld.S | 1 + bl2/bl2.mk | 1 - bl31/bl31.ld.S | 1 + bl31/bl31.mk | 1 - bl32/tsp/tsp.ld.S | 2 ++ bl32/tsp/tsp.mk | 1 - 10 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 18b7c8ae08..7e0179da8c 100644 --- a/Makefile +++ b/Makefile @@ -345,8 +345,7 @@ $(ELF) : $(OBJS) $(LINKERFILE) @echo 'const char build_message[] = "Built : "__TIME__", "__DATE__;' | \ $$(CC) $$(CFLAGS) -xc - -o $(BUILD_DIR)/build_message.o $$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \ - --entry=$(BL$(1)_ENTRY_POINT) $(OBJS) \ - $(BUILD_DIR)/build_message.o + $(BUILD_DIR)/build_message.o $(OBJS) $(DUMP) : $(ELF) @echo " OD $$@" diff --git a/bl1/aarch64/bl1_entrypoint.S b/bl1/aarch64/bl1_entrypoint.S index 197eac00b0..8d120453b7 100644 --- a/bl1/aarch64/bl1_entrypoint.S +++ b/bl1/aarch64/bl1_entrypoint.S @@ -30,19 +30,19 @@ #include - .globl reset_handler + .globl bl1_entrypoint .section .text, "ax"; .align 3 /* ----------------------------------------------------- - * reset_handler() is the entry point into the trusted + * bl1_entrypoint() is the entry point into the trusted * firmware code when a cpu is released from warm or * cold reset. * ----------------------------------------------------- */ -reset_handler: ; .type reset_handler, %function +bl1_entrypoint: ; .type bl1_entrypoint, %function /* --------------------------------------------- * Perform any processor specific actions upon * reset e.g. cache, tlb invalidations etc. diff --git a/bl1/bl1.ld.S b/bl1/bl1.ld.S index 0663b6fc28..012ff58238 100644 --- a/bl1/bl1.ld.S +++ b/bl1/bl1.ld.S @@ -32,6 +32,7 @@ OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) OUTPUT_ARCH(PLATFORM_LINKER_ARCH) +ENTRY(bl1_entrypoint) MEMORY { ROM (rx): ORIGIN = TZROM_BASE, LENGTH = TZROM_SIZE diff --git a/bl1/bl1.mk b/bl1/bl1.mk index bc14ddc0e3..0d5eca7d46 100644 --- a/bl1/bl1.mk +++ b/bl1/bl1.mk @@ -49,5 +49,4 @@ BL1_SOURCES += bl1_arch_setup.c \ bl1_main.c \ cpu_helpers.S -BL1_ENTRY_POINT := reset_handler BL1_LINKERFILE := bl1.ld.S diff --git a/bl2/bl2.ld.S b/bl2/bl2.ld.S index ea86e0aa9d..09dec758f2 100644 --- a/bl2/bl2.ld.S +++ b/bl2/bl2.ld.S @@ -32,6 +32,7 @@ OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) OUTPUT_ARCH(PLATFORM_LINKER_ARCH) +ENTRY(bl2_entrypoint) MEMORY { RAM (rwx): ORIGIN = TZRAM_BASE, LENGTH = TZRAM_SIZE diff --git a/bl2/bl2.mk b/bl2/bl2.mk index f6787ee204..8b8d9a9aa4 100644 --- a/bl2/bl2.mk +++ b/bl2/bl2.mk @@ -46,7 +46,6 @@ BL2_SOURCES += bl2_entrypoint.S \ spinlock.S \ early_exceptions.S -BL2_ENTRY_POINT := bl2_entrypoint BL2_LINKERFILE := bl2.ld.S CFLAGS += $(DEFINES) diff --git a/bl31/bl31.ld.S b/bl31/bl31.ld.S index 0a78c41ad9..844f169674 100644 --- a/bl31/bl31.ld.S +++ b/bl31/bl31.ld.S @@ -32,6 +32,7 @@ OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) OUTPUT_ARCH(PLATFORM_LINKER_ARCH) +ENTRY(bl31_entrypoint) MEMORY { diff --git a/bl31/bl31.mk b/bl31/bl31.mk index 8f6998c623..dffe33686e 100644 --- a/bl31/bl31.mk +++ b/bl31/bl31.mk @@ -69,5 +69,4 @@ BL31_SOURCES += bl31_arch_setup.c \ context_mgmt.c \ context.S -BL31_ENTRY_POINT := bl31_entrypoint BL31_LINKERFILE := bl31.ld.S diff --git a/bl32/tsp/tsp.ld.S b/bl32/tsp/tsp.ld.S index 30d9a93bcf..74b03ad542 100644 --- a/bl32/tsp/tsp.ld.S +++ b/bl32/tsp/tsp.ld.S @@ -32,6 +32,8 @@ OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) OUTPUT_ARCH(PLATFORM_LINKER_ARCH) +ENTRY(tsp_entrypoint) + MEMORY { RAM (rwx): ORIGIN = TZDRAM_BASE, LENGTH = TZDRAM_SIZE diff --git a/bl32/tsp/tsp.mk b/bl32/tsp/tsp.mk index a16c97026c..99c83708cb 100644 --- a/bl32/tsp/tsp.mk +++ b/bl32/tsp/tsp.mk @@ -44,7 +44,6 @@ BL32_SOURCES += tsp_entrypoint.S \ spinlock.S \ early_exceptions.S -BL32_ENTRY_POINT := tsp_entrypoint BL32_LINKERFILE := tsp.ld.S vpath %.ld.S ${BL32_ROOT}