[PATCH 1/2] ARM/ARM64/RISC-V: pbl: guard constructor support
Stefan Kerkmann
s.kerkmann at pengutronix.de
Wed Aug 19 07:12:50 PDT 2026
The PBL ctors source file was compiled and linked for all arches. This
broke compilation for unsupported arches as the references to the
external symbols `__ctors_start` and `__ctors_end` couldn't be resolved
as they are only defined in the PBL linker scripts for ARM/ARM64/RISC-V.
Guard the ctors compilation behind CONFIG_PBL_CONSTRUCTORS and only
enable them for supported arches.
Fixes: bb07ef11d6 ("ARM/ARM64/RISC-V: pbl: add constructor support")
Signed-off-by: Stefan Kerkmann <s.kerkmann at pengutronix.de>
---
arch/arm/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
pbl/Kconfig | 3 +++
pbl/Makefile | 2 +-
4 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fe4fd3f471..ac68f07aa7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -13,6 +13,7 @@ config ARM
select HAVE_PBL_IMAGE
select HAVE_PBL_MULTI_IMAGES
select RELOCATABLE
+ select PBL_CONSTRUCTORS
select PBL_RELOCATABLE
select USE_COMPRESSED_DTB
select HAVE_ARCH_BOARD_GENERIC_DT if OFDEVICE
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 452e3d6cfc..40a79b6834 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -19,6 +19,7 @@ config RISCV
select HAS_KALLSYMS
select RISCV_TIMER if RISCV_SBI
select HW_HAS_PCI
+ select PBL_CONSTRUCTORS
select PBL_IMAGE_ELF
select HAVE_ARCH_BOARD_GENERIC_DT
select HAVE_ARCH_BOOTM_OFTREE
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 63f29cd613..e6b168c4de 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -74,6 +74,9 @@ config PBL_VERIFY_PIGGY
depends on ARM || MIPS || RISCV
bool "Verify barebox proper hash before decompression" if COMPILE_TEST
+config PBL_CONSTRUCTORS
+ bool
+
config PBL_CLOCKSOURCE
bool
diff --git a/pbl/Makefile b/pbl/Makefile
index 7ce8cee077..9cbd481640 100644
--- a/pbl/Makefile
+++ b/pbl/Makefile
@@ -3,7 +3,7 @@
#
# only unsed by the pbl
#
-pbl-y += ctors.o
+pbl-$(CONFIG_PBL_CONSTRUCTORS) += ctors.o
pbl-y += misc.o
pbl-y += string.o
pbl-y += malloc.o
--
2.47.3
More information about the barebox
mailing list