ARM: remove unused constructor support
Subsystems (3)
PATCH 1/1 ARM: remove unused constructor support
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.
--- 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(-)
arch/arm/lib32/barebox.lds.S +1 -3
@@ -59,9 +59,7 @@ SECTIONS _sdata = .; . = ALIGN(4); - .data : { *(.data*) - CONSTRUCTORS - } + .data : { *(.data*) } . = .;
common/startup.c +0 -15
@@ -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);
include/asm-generic/barebox.lds.h +0 -12
@@ -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 \
lib/Kconfig +0 -3
@@ -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
lib/kasan/Kconfig +0 -1
@@ -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,
Signature · 1 line
2.47.3
Sascha Hauer
AppliedQuoted 11 lines · Ahmad Fatoum
CONFIG_CONSTRUCTORSwas 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,
Signature · 1 line
Sascha Hauer <[email protected]>