From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
"open list:BAREBOX" <barebox@lists.infradead.org>
Cc: Stefan Kerkmann <s.kerkmann@pengutronix.de>
Subject: [PATCH 1/2] ARM/ARM64/RISC-V: pbl: guard constructor support
Date: Wed, 19 Aug 2026 16:12:50 +0200 [thread overview]
Message-ID: <20260819-next-v1-1-c1a1a8b44d02@pengutronix.de> (raw)
In-Reply-To: <20260819-next-v1-0-c1a1a8b44d02@pengutronix.de>
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@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
next prev parent reply other threads:[~2026-08-19 14:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 14:12 [PATCH 0/2] PBL: constructor fixes Stefan Kerkmann
2026-08-19 14:12 ` Stefan Kerkmann [this message]
2026-08-19 14:12 ` [PATCH 2/2] ARM64: setup_c: abi safe link register storage Stefan Kerkmann
2026-08-19 14:16 ` [PATCH 0/2] PBL: constructor fixes Ahmad Fatoum
2026-08-19 15:01 ` Sascha Hauer
2026-08-20 7:14 ` Stefan Kerkmann
2026-08-20 7:18 ` Sascha Hauer
2026-08-20 7:24 ` Stefan Kerkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260819-next-v1-1-c1a1a8b44d02@pengutronix.de \
--to=s.kerkmann@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox