[PATCH v2 02/12] sandbox: Rename EFI runtime sections

Andrew Scull ascull at google.com
Thu Apr 14 15:59:31 CEST 2022


Rename the sections used for placing the EFI runtime so they don't start
with a '.'. ELF says that sections starting with a '.' are reserved for
system use whereas they are actually user sections in sandbox.

When they weren't user sections, clang's ASAN added redzones to the
sections and the extra padding meant that the relocation list was no
longer in the expected format. Naming the sections as user sections
resolves this issue.

Signed-off-by: Andrew Scull <ascull at google.com>
---
 arch/sandbox/cpu/u-boot.lds | 22 ++++++++++------------
 arch/sandbox/lib/sections.c |  8 ++++----
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds
index 64db801018..7abe232ad9 100644
--- a/arch/sandbox/cpu/u-boot.lds
+++ b/arch/sandbox/cpu/u-boot.lds
@@ -19,33 +19,31 @@ SECTIONS
 		*(.u_boot_sandbox_getopt_end)
 	}
 
-	.__efi_runtime_start : {
-		*(.__efi_runtime_start)
+	efi_runtime_start : {
+		*(___efi_runtime_start)
 	}
 
-	.efi_runtime : {
+	efi_runtime : {
 		*(.text.efi_runtime*)
 		*(.rodata.efi_runtime*)
 		*(.data.efi_runtime*)
 	}
 
-	.__efi_runtime_stop : {
-		*(.__efi_runtime_stop)
+	efi_runtime_stop : {
+		*(___efi_runtime_stop)
 	}
 
-	.efi_runtime_rel_start :
-	{
-		*(.__efi_runtime_rel_start)
+	efi_runtime_rel_start : {
+		*(___efi_runtime_rel_start)
 	}
 
-	.efi_runtime_rel : {
+	efi_runtime_rel : {
 		*(.rel*.efi_runtime)
 		*(.rel*.efi_runtime.*)
 	}
 
-	.efi_runtime_rel_stop :
-	{
-		*(.__efi_runtime_rel_stop)
+	efi_runtime_rel_stop : {
+		*(___efi_runtime_rel_stop)
 	}
 
 	.dynsym :
diff --git a/arch/sandbox/lib/sections.c b/arch/sandbox/lib/sections.c
index 2559eeea38..2f2f3fbfdb 100644
--- a/arch/sandbox/lib/sections.c
+++ b/arch/sandbox/lib/sections.c
@@ -5,9 +5,9 @@
  */
 #include <linux/compiler.h>
 
-char __efi_runtime_start[0] __section(".__efi_runtime_start");
-char __efi_runtime_stop[0] __section(".__efi_runtime_stop");
+char __efi_runtime_start[0] __section("___efi_runtime_start");
+char __efi_runtime_stop[0] __section("___efi_runtime_stop");
 char __efi_runtime_rel_start[0]
-		__section(".__efi_runtime_rel_start");
+		__section("___efi_runtime_rel_start");
 char __efi_runtime_rel_stop[0]
-		__section(".__efi_runtime_rel_stop");
+		__section("___efi_runtime_rel_stop");
-- 
2.35.1.1178.g4f1659d476-goog



More information about the U-Boot mailing list