* [PATCH] ARM: remove unused constructor support
@ 2026-01-05 8:46 Ahmad Fatoum
2026-01-06 7:38 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-05 8:46 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
CONFIG_CONSTRUCTORS was added alongside KASAN support, but it appears to
be unused and not necessary for KASAN to work.
While at it, we also remove the legacy CONSTRUCTORS directive that only
exists in the 32-bit, but not 64-bit ARM linker script.
I suspect that in Linux, constructors are needed for external modules,
but in barebox, we don't currently make use of it, so it should be safe
to drop.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/lib32/barebox.lds.S | 4 +---
common/startup.c | 15 ---------------
include/asm-generic/barebox.lds.h | 12 ------------
lib/Kconfig | 3 ---
lib/kasan/Kconfig | 1 -
5 files changed, 1 insertion(+), 34 deletions(-)
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index 2d08b95758b7..c704dd6d70f3 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -59,9 +59,7 @@ SECTIONS
_sdata = .;
. = ALIGN(4);
- .data : { *(.data*)
- CONSTRUCTORS
- }
+ .data : { *(.data*) }
. = .;
diff --git a/common/startup.c b/common/startup.c
index 81a3ae1513c2..6730b6c49220 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -396,19 +396,6 @@ static int run_init(void)
hang();
}
-typedef void (*ctor_fn_t)(void);
-
-/* Call all constructor functions linked into the kernel. */
-static void do_ctors(void)
-{
-#ifdef CONFIG_CONSTRUCTORS
- ctor_fn_t *fn = (ctor_fn_t *) __ctors_start;
-
- for (; fn < (ctor_fn_t *) __ctors_end; fn++)
- (*fn)();
-#endif
-}
-
int (*barebox_main)(void)
= !IS_ENABLED(CONFIG_SHELL_NONE) &&
IS_ENABLED(CONFIG_COMMAND_SUPPORT) ? run_init : NULL;
@@ -418,8 +405,6 @@ void __noreturn start_barebox(void)
initcall_t *initcall;
int result;
- do_ctors();
-
for (initcall = __barebox_initcalls_start;
initcall < __barebox_initcalls_end; initcall++) {
pr_debug("initcall-> %pS\n", *initcall);
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index 092dbc6dffa6..12082d567a4d 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -129,24 +129,12 @@
#endif
-#ifdef CONFIG_CONSTRUCTORS
-#define KERNEL_CTORS() . = ALIGN(8); \
- __ctors_start = .; \
- KEEP(*(.ctors)) \
- KEEP(*(SORT(.init_array.*))) \
- KEEP(*(.init_array)) \
- __ctors_end = .;
-#else
-#define KERNEL_CTORS()
-#endif
-
#define RO_DATA_SECTION \
BAREBOX_INITCALLS \
BAREBOX_EXITCALLS \
BAREBOX_CMDS \
BAREBOX_RATP_CMDS \
BAREBOX_SYMS \
- KERNEL_CTORS() \
BAREBOX_MAGICVARS \
BAREBOX_CLK_TABLE \
BAREBOX_DTB \
diff --git a/lib/Kconfig b/lib/Kconfig
index 58993bc5d3c9..9b8e0c2fa77d 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -80,9 +80,6 @@ config REED_SOLOMON
config BASE64
bool "include base64 encode/decode support"
-config CONSTRUCTORS
- bool
-
config GENERIC_FIND_NEXT_BIT
def_bool n
diff --git a/lib/kasan/Kconfig b/lib/kasan/Kconfig
index 532412953ba5..62645ba8ea95 100644
--- a/lib/kasan/Kconfig
+++ b/lib/kasan/Kconfig
@@ -7,7 +7,6 @@ config KASAN
bool "KASAN: runtime memory debugger"
depends on (HAVE_ARCH_KASAN && CC_HAS_KASAN_GENERIC)
depends on MALLOC_TLSF
- select CONSTRUCTORS
select PRINTF_HEXSTR
help
Enables KASAN (KernelAddressSANitizer) - runtime memory debugger,
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ARM: remove unused constructor support
2026-01-05 8:46 [PATCH] ARM: remove unused constructor support Ahmad Fatoum
@ 2026-01-06 7:38 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-01-06 7:38 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 05 Jan 2026 09:46:01 +0100, Ahmad Fatoum wrote:
> CONFIG_CONSTRUCTORS was added alongside KASAN support, but it appears to
> be unused and not necessary for KASAN to work.
>
> While at it, we also remove the legacy CONSTRUCTORS directive that only
> exists in the 32-bit, but not 64-bit ARM linker script.
>
> I suspect that in Linux, constructors are needed for external modules,
> but in barebox, we don't currently make use of it, so it should be safe
> to drop.
>
> [...]
Applied, thanks!
[1/1] ARM: remove unused constructor support
https://git.pengutronix.de/cgit/barebox/commit/?id=cb64ad3ea11b (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-06 7:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-05 8:46 [PATCH] ARM: remove unused constructor support Ahmad Fatoum
2026-01-06 7:38 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox