diff mbox series

[RFC,6/6] arm: move image_copy_start/end to linker symbols

Message ID 20240228104811.1366694-7-ilias.apalodimas@linaro.org
State New
Headers show
Series Clean up arm linker scripts | expand

Commit Message

Ilias Apalodimas Feb. 28, 2024, 10:48 a.m. UTC
image_copy_start/end are defined as c variables in order to force the compiler
emit relative references. However, defining those within a section definition
will do the same thing.

So let's remove the special sections from the linker scripts, the
variable definitions from sections.c and define them as a symbols within
a section.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 arch/arm/cpu/armv8/u-boot.lds             | 10 ++--------
 arch/arm/cpu/u-boot.lds                   | 10 ++--------
 arch/arm/lib/sections.c                   |  2 --
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds  |  8 ++------
 arch/arm/mach-zynq/u-boot.lds             |  9 ++-------
 board/qualcomm/dragonboard820c/u-boot.lds | 11 ++---------
 6 files changed, 10 insertions(+), 40 deletions(-)

--
2.37.2
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds
index e737de761a9d..340acf5c043b 100644
--- a/arch/arm/cpu/armv8/u-boot.lds
+++ b/arch/arm/cpu/armv8/u-boot.lds
@@ -23,7 +23,7 @@  SECTIONS
 	. = ALIGN(8);
 	.text :
 	{
-		*(.__image_copy_start)
+		__image_copy_start = .;
 		CPUDIR/start.o (.text*)
 	}

@@ -120,13 +120,7 @@  SECTIONS
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
                 __efi_runtime_rel_stop = .;
-	}
-
-	. = ALIGN(8);
-
-	.image_copy_end :
-	{
-		*(.__image_copy_end)
+		__image_copy_end = .;
 	}

 	.rela.dyn ALIGN(8) : {
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index df55bb716e35..7c4f9c2d4dd3 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -37,7 +37,7 @@  SECTIONS
 	. = ALIGN(4);
 	.text :
 	{
-		*(.__image_copy_start)
+		__image_copy_start = .;
 		*(.vectors)
 		CPUDIR/start.o (.text*)
 	}
@@ -151,13 +151,7 @@  SECTIONS
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
 		__efi_runtime_rel_stop = .;
-	}
-
-	. = ALIGN(4);
-
-	.image_copy_end :
-	{
-		*(.__image_copy_end)
+		__image_copy_end = .;
 	}

 	.rel.dyn ALIGN(4) : {
diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c
index a4d4202e99f5..db5463b2bbbc 100644
--- a/arch/arm/lib/sections.c
+++ b/arch/arm/lib/sections.c
@@ -19,8 +19,6 @@ 
  * aliasing warnings.
  */

-char __image_copy_start[0] __section(".__image_copy_start");
-char __image_copy_end[0] __section(".__image_copy_end");
 char __secure_start[0] __section(".__secure_start");
 char __secure_end[0] __section(".__secure_end");
 char __secure_stack_start[0] __section(".__secure_stack_start");
diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
index b7887194026e..4b480ebb0c4d 100644
--- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
+++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
@@ -24,7 +24,7 @@  SECTIONS

 	.text : {
 		. = ALIGN(8);
-		*(.__image_copy_start)
+		__image_copy_start = .;
 		CPUDIR/start.o (.text*)
 		*(.text*)
 	}
@@ -42,11 +42,7 @@  SECTIONS
 	__u_boot_list : {
 		. = ALIGN(8);
 		KEEP(*(SORT(__u_boot_list*)));
-	}
-
-	.image_copy_end : {
-		. = ALIGN(8);
-		*(.__image_copy_end)
+		__image_copy_end = .;
 	}

 	.end : {
diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds
index fcd0f42a7106..553bcf182272 100644
--- a/arch/arm/mach-zynq/u-boot.lds
+++ b/arch/arm/mach-zynq/u-boot.lds
@@ -16,7 +16,7 @@  SECTIONS
 	. = ALIGN(4);
 	.text :
 	{
-		*(.__image_copy_start)
+		__image_copy_start = .;
 		*(.vectors)
 		CPUDIR/start.o (.text*)
 	}
@@ -57,12 +57,7 @@  SECTIONS
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
 		__efi_runtime_rel_stop = .;
-	}
-
-	. = ALIGN(8);
-	.image_copy_end :
-	{
-		*(.__image_copy_end)
+		__image_copy_end = .;
 	}

 	.rel.dyn ALIGN(8) : {
diff --git a/board/qualcomm/dragonboard820c/u-boot.lds b/board/qualcomm/dragonboard820c/u-boot.lds
index 2969f139bfd2..f8d3c030ef32 100644
--- a/board/qualcomm/dragonboard820c/u-boot.lds
+++ b/board/qualcomm/dragonboard820c/u-boot.lds
@@ -17,7 +17,7 @@  SECTIONS
 	. = ALIGN(8);
 	.text :
 	{
-		*(.__image_copy_start)
+		__image_copy_start = .;
 		board/qualcomm/dragonboard820c/head.o (.text*)
 		CPUDIR/start.o (.text*)
 	}
@@ -60,16 +60,9 @@  SECTIONS
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
                 __efi_runtime_rel_stop = .;
+		__image_copy_end = .;
 	}

-	. = ALIGN(8);
-
-	.image_copy_end :
-	{
-		*(.__image_copy_end)
-	}
-
-
 	.rela.dyn ALIGN(8) : {
 		__rel_dyn_start = .;
 		*(.rela*)