Message ID | 20240617151419.13383-1-ilias.apalodimas@linaro.org |
---|---|
State | Accepted |
Commit | f0a5d2dfaae6b895e7eb02c67271cc3eba5ee6c8 |
Headers | show |
Series | [v2] sandbox: cleanup linker scripts and sections | expand |
commit 6e2228fb052b ("Merge patch series "Clean up arm linker scripts"") was cleaning up linker scripts for armv7 and v8 in a similar fashion. Several commits in the past -- e.g commit d0b5d9da5de2 ("arm: make _end compiler-generated") was moving symbols to be compiler generated. They were defined as c variables in its own section to force the compiler emit relative a reference. However, defining those in the linker script will do the same thing since [0]. So let's remove the special sections from the linker scripts, the variable definitions from sections.c, and define them as a symbols. It's worth noting that the linker was discarding the symbols in the older binary completely since the symbol definition had an extra _. - new binary $~ aarch64-linux-gnu-readelf -sW u-boot | grep efi_runtim 246: 000000000004acbe 13 FUNC LOCAL DEFAULT 14 vbe_req_efi_runtime_rand 3198: 0000000000318690 16 OBJECT LOCAL DEFAULT 29 efi_runtime_mmio 6359: 00000000000dedff 217 FUNC LOCAL DEFAULT 14 efi_runtime_relocate 7942: 00000000003074c0 136 OBJECT GLOBAL HIDDEN 29 efi_runtime_services 8869: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_rel_stop 9159: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_stop 9410: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_start 10137: 00000000005981bd 0 NOTYPE WEAK HIDDEN 33 efi_runtime.c.de5bed54 10470: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_rel_start - old binary $~ aarch64-linux-gnu-readelf -sW u-boot.old | grep efi_runtim 246: 000000000004acbe 13 FUNC LOCAL DEFAULT 14 vbe_req_efi_runtime_rand 3198: 0000000000318690 16 OBJECT LOCAL DEFAULT 29 efi_runtime_mmio 6359: 00000000000dedff 221 FUNC LOCAL DEFAULT 14 efi_runtime_relocate 7942: 00000000003074c0 136 OBJECT GLOBAL HIDDEN 29 efi_runtime_services 10135: 0000000000598320 0 NOTYPE WEAK HIDDEN 33 efi_runtime.c.de5bed54 $~ bloat-o-meter u-bool.old u-boot add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-4 (3) Function old new delta efi_memory_init 343 350 +7 efi_runtime_relocate 221 217 -4 Total: Before=2009902, After=2009905, chg +0.00% [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> # sandbox_defconfig on amd64, arm64, riscv64 Reviewed-by: Simon Glass <sjg@chromium.org> Fixes: commit aac53d3d96a2 ("sandbox: Rename EFI runtime sections") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> --- Changes since v1: - Added Fixes tag - Collected tags from Heinrich and Simon arch/sandbox/cpu/u-boot.lds | 20 ++++---------------- arch/sandbox/lib/Makefile | 2 +- arch/sandbox/lib/sections.c | 13 ------------- 3 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 arch/sandbox/lib/sections.c Applied to u-boot-dm, thanks!
diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds index 52f13af3742f..6ee8095b6cbb 100644 --- a/arch/sandbox/cpu/u-boot.lds +++ b/arch/sandbox/cpu/u-boot.lds @@ -19,30 +19,18 @@ SECTIONS *(_u_boot_sandbox_getopt_end) } - efi_runtime_start : { - *(___efi_runtime_start) - } - efi_runtime : { + __efi_runtime_start = .; *(efi_runtime_text) *(efi_runtime_data) - } - - efi_runtime_stop : { - *(___efi_runtime_stop) - } - - efi_runtime_rel_start : { - *(___efi_runtime_rel_start) + __efi_runtime_stop = .; } efi_runtime_rel : { + __efi_runtime_rel_start = .; *(.relefi_runtime_text) *(.relefi_runtime_data) - } - - efi_runtime_rel_stop : { - *(___efi_runtime_rel_stop) + __efi_runtime_rel_stop = .; } .dynsym : diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile index a2bc5a7ee60f..d7d15a50bb6c 100644 --- a/arch/sandbox/lib/Makefile +++ b/arch/sandbox/lib/Makefile @@ -5,7 +5,7 @@ # (C) Copyright 2002-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-y += fdt_fixup.o interrupts.o sections.o +obj-y += fdt_fixup.o interrupts.o obj-$(CONFIG_PCI) += pci_io.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o diff --git a/arch/sandbox/lib/sections.c b/arch/sandbox/lib/sections.c deleted file mode 100644 index 2f2f3fbfdb86..000000000000 --- a/arch/sandbox/lib/sections.c +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net> - * - */ -#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_rel_start[0] - __section("___efi_runtime_rel_start"); -char __efi_runtime_rel_stop[0] - __section("___efi_runtime_rel_stop");