]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
linker_script: move .rela.dyn section to bl_common.ld.h
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 22 Apr 2020 02:27:55 +0000 (11:27 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 29 Jun 2020 06:51:50 +0000 (15:51 +0900)
The .rela.dyn section is the same for BL2-AT-EL3, BL31, TSP.

Move it to the common header file.

I slightly changed the definition so that we can do "RELA_SECTION >RAM".
It still produced equivalent elf images.

Please note I got rid of '.' from the VMA field. Otherwise, if the end
of previous .data section is not 8-byte aligned, it fails to link.

aarch64-linux-gnu-ld.bfd: warning: changing start of section .rela.dyn by 4 bytes
aarch64-linux-gnu-ld.bfd: warning: changing start of section .rela.dyn by 4 bytes
aarch64-linux-gnu-ld.bfd: warning: changing start of section .rela.dyn by 4 bytes
make: *** [Makefile:1071: build/qemu/release/bl31/bl31.elf] Error 1

Change-Id: Iba7422d99c0374d4d9e97e6fd47bae129dba5cc9
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
bl2/bl2_el3.ld.S
bl31/bl31.ld.S
bl32/tsp/tsp.ld.S
include/common/bl_common.ld.h

index 8c45d9898f28e8da883647b4f13af219364379ec..bc1794c069c6f690e88da949bbff3bf388a8dff7 100644 (file)
@@ -105,17 +105,7 @@ SECTIONS
     __DATA_RAM_START__ = __DATA_START__;
     __DATA_RAM_END__ = __DATA_END__;
 
-    /*
-     * .rela.dyn needs to come after .data for the read-elf utility to parse
-     * this section correctly. Ensure 8-byte alignment so that the fields of
-     * RELA data structure are aligned.
-     */
-    . = ALIGN(8);
-    __RELA_START__ = .;
-    .rela.dyn . : {
-    } >RAM
-    __RELA_END__ = .;
-
+    RELA_SECTION >RAM
     STACK_SECTION >RAM
     BSS_SECTION >RAM
     XLAT_TABLE_SECTION >RAM
index 11e86a3c13ffd2c41c33f6deeb710b74fd437bca..5026500979cb345633d00048ddb865ba764531eb 100644 (file)
@@ -115,17 +115,7 @@ SECTIONS
     __RW_START__ = . ;
 
     DATA_SECTION >RAM
-
-    /*
-     * .rela.dyn needs to come after .data for the read-elf utility to parse
-     * this section correctly. Ensure 8-byte alignment so that the fields of
-     * RELA data structure are aligned.
-     */
-    . = ALIGN(8);
-    __RELA_START__ = .;
-    .rela.dyn . : {
-    } >RAM
-    __RELA_END__ = .;
+    RELA_SECTION >RAM
 
 #ifdef BL31_PROGBITS_LIMIT
     ASSERT(. <= BL31_PROGBITS_LIMIT, "BL31 progbits has exceeded its limit.")
index bdcd2cf708f7923748b81406d18fd49c89ddd0af..d86ae5587bce91ce9106b22ce0a4710faf1b8c6e 100644 (file)
@@ -71,17 +71,7 @@ SECTIONS
     __RW_START__ = . ;
 
     DATA_SECTION >RAM
-
-    /*
-     * .rela.dyn needs to come after .data for the read-elf utility to parse
-     * this section correctly. Ensure 8-byte alignment so that the fields of
-     * RELA data structure are aligned.
-     */
-    . = ALIGN(8);
-    __RELA_START__ = .;
-    .rela.dyn . : {
-    } >RAM
-    __RELA_END__ = .;
+    RELA_SECTION >RAM
 
 #ifdef TSP_PROGBITS_LIMIT
     ASSERT(. <= TSP_PROGBITS_LIMIT, "TSP progbits has exceeded its limit.")
index 208e3d6819b71cea9dd9f0cd04749d6e65c9d6b0..ab3391aa21c5f0c1f25c8cf7e6fa08191ecee00d 100644 (file)
                __DATA_END__ = .;                       \
        }
 
+/*
+ * .rela.dyn needs to come after .data for the read-elf utility to parse
+ * this section correctly.
+ */
+#define RELA_SECTION                                   \
+       .rela.dyn : ALIGN(STRUCT_ALIGN) {               \
+               __RELA_START__ = .;                     \
+               *(.rela*)                               \
+               __RELA_END__ = .;                       \
+       }
+
 #if !(defined(IMAGE_BL31) && RECLAIM_INIT_CODE)
 #define STACK_SECTION                                  \
        stacks (NOLOAD) : {                             \