Specify image entry in linker script
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>
Tue, 11 Mar 2014 11:06:45 +0000 (11:06 +0000)
committerDan Handley <dan.handley@arm.com>
Thu, 20 Mar 2014 11:16:23 +0000 (11:16 +0000)
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
bl1/aarch64/bl1_entrypoint.S
bl1/bl1.ld.S
bl1/bl1.mk
bl2/bl2.ld.S
bl2/bl2.mk
bl31/bl31.ld.S
bl31/bl31.mk
bl32/tsp/tsp.ld.S
bl32/tsp/tsp.mk

index 18b7c8ae08cf8c6816261c751e08b04e955b4d97..7e0179da8c279950cb6dfe982dce56d67bfbc5ff 100644 (file)
--- 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      $$@"
index 197eac00b02b9c33e54a7e8b06be397238c115c4..8d120453b742699bf1b8622a9d81fe2952bd1759 100644 (file)
 
 #include <arch.h>
 
-       .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.
index 0663b6fc28307cb5aa7993a9ea6ee8affa668ce1..012ff5823881152937008babd10220f4725ba0cd 100644 (file)
@@ -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
index bc14ddc0e3f1c505805c1c635c3860542040d8cb..0d5eca7d46309dd714b04395a7efd928042ca289 100644 (file)
@@ -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
index ea86e0aa9d61b31cbd688ec9619da1f63629a169..09dec758f28ec805a10b62b16da5cedf97c88e70 100644 (file)
@@ -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
index f6787ee2043c8116551d83bff84271d1e3fb280a..8b8d9a9aa4e95aca4abf7f231b89c2ab41e8a8c5 100644 (file)
@@ -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)
index 0a78c41ad9e55d95f229b0f09ea22b671a9f514c..844f1696747520967ff97b3e887efd8c3d2b6876 100644 (file)
@@ -32,6 +32,7 @@
 
 OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
 OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
+ENTRY(bl31_entrypoint)
 
 
 MEMORY {
index 8f6998c6233510f7aa3b9c238eec82ac6b18b869..dffe33686eb058e762264c958f5940901a3a32d3 100644 (file)
@@ -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
index 30d9a93bcfce46f97a1cac383ad8c042f7a2d9b5..74b03ad5420035da70c393fc7fb69843f934f165 100644 (file)
@@ -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
index a16c97026c16d746e689204952057866d686adcb..99c83708cb9b9f37fd445d5e896833b8898a74f4 100644 (file)
@@ -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}