[PATCH 7/7 v2] arm: remove redundant section alignments

Ilias Apalodimas ilias.apalodimas at linaro.org
Tue Mar 12 15:08:29 CET 2024


Previous patches cleaning up linker symbols, also merged any explicit
. = ALIGN(x); into section definitions -- e.g '.bss ALIGN(x) :' instead
of '. - ALIGN(x); bss : {...}'

However, if the output address is not specified then one will be chosen
for the section. This address will be adjusted to fit the alignment
requirement of the output section following the strictest alignment of
any input section contained within the output section. So let's get rid
of the redundant ALIGN directives.

It's worth noting that the only platform the alignment is preserved on
.rel.dyn is mach-zynq, which was explicitly  aligning that section on an 8b
boundary instead of the automatically chosen 4b alignment.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
 arch/arm/cpu/armv8/u-boot.lds            | 6 +++---
 arch/arm/cpu/u-boot.lds                  | 6 +++---
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 2 +-
 arch/arm/mach-zynq/u-boot.lds            | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds
index 33f4624b561d..ccdd1966cfbc 100644
--- a/arch/arm/cpu/armv8/u-boot.lds
+++ b/arch/arm/cpu/armv8/u-boot.lds
@@ -115,7 +115,7 @@ SECTIONS
 		KEEP(*(SORT(__u_boot_list*)));
 	}

-	.efi_runtime_rel ALIGN(8) : {
+	.efi_runtime_rel : {
                 __efi_runtime_rel_start = .;
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
@@ -124,7 +124,7 @@ SECTIONS

 	__image_copy_end = .;

-	.rela.dyn ALIGN(8) : {
+	.rela.dyn : {
 		__rel_dyn_start = .;
 		*(.rela*)
 		__rel_dyn_end = .;
@@ -132,7 +132,7 @@ SECTIONS

 	_end = .;

-	.bss ALIGN(8): {
+	.bss : {
 		__bss_start = .;
 		*(.bss*)
 		__bss_end = .;
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index b6b19a4174fe..a9fcbbf22e96 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -43,7 +43,7 @@ SECTIONS
 	}

 	/* This needs to come before *(.text*) */
-	.efi_runtime ALIGN(4) : {
+	.efi_runtime : {
 		__efi_runtime_start = .;
 		*(.text.efi_runtime*)
 		*(.rodata.efi_runtime*)
@@ -146,7 +146,7 @@ SECTIONS
 		KEEP(*(SORT(__u_boot_list*)));
 	}

-	.efi_runtime_rel ALIGN(4) : {
+	.efi_runtime_rel : {
 		__efi_runtime_rel_start = .;
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
@@ -155,7 +155,7 @@ SECTIONS

 	__image_copy_end = .;

-	.rel.dyn ALIGN(4) : {
+	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
 		__rel_dyn_end = .;
diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
index 8ff35b5c17cf..e67416c09c1c 100644
--- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
+++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
@@ -53,7 +53,7 @@ SECTIONS

 	_image_binary_end = .;

-	.bss ALIGN(8) : {
+	.bss : {
 		__bss_start = .;
 		*(.bss*)
 		__bss_end = .;
diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds
index f739d1cfce85..111410215072 100644
--- a/arch/arm/mach-zynq/u-boot.lds
+++ b/arch/arm/mach-zynq/u-boot.lds
@@ -22,7 +22,7 @@ SECTIONS
 	}

 	/* This needs to come before *(.text*) */
-	.efi_runtime ALIGN(4) : {
+	.efi_runtime : {
 		__efi_runtime_start = .;
 		*(.text.efi_runtime*)
 		*(.rodata.efi_runtime*)
@@ -52,7 +52,7 @@ SECTIONS
 		KEEP(*(SORT(__u_boot_list*)));
 	}

-	.efi_runtime_rel ALIGN(4) : {
+	.efi_runtime_rel : {
 		__efi_runtime_rel_start = .;
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
--
2.37.2



More information about the U-Boot mailing list