From 3b10f5f51ec223aa4df2045ab6afb3d779aa7049 Mon Sep 17 00:00:00 2001 From: Francesco Conti Date: Sun, 19 May 2024 23:38:39 +0200 Subject: [PATCH] Make init.c LLVM-compliant by disabling .ctors --- kernel/init.c | 6 ++++++ rules/pulpos/targets/pulpissimo.mk | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/init.c b/kernel/init.c index 8a7d254..5386dc2 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -22,6 +22,7 @@ typedef void (*fptr)(void); +#ifndef PULP_LLVM static fptr ctor_list[1] __attribute__((section(".ctors.start"))) = { (fptr) -1 }; static fptr dtor_list[1] __attribute__((section(".dtors.start"))) = { (fptr) -1 }; @@ -46,6 +47,7 @@ static void pos_init_do_dtors(void) (**fpp)(); } } +#endif extern int main(int argc, const char * const argv[]); @@ -72,7 +74,9 @@ void pos_init_start() // Call global and static constructors // Each module may do private initializations there +#ifndef PULP_LLVM pos_init_do_ctors(); +#endif // Now that the system is ready, activate IO pos_io_start(); @@ -93,5 +97,7 @@ void pos_init_stop() pos_io_stop(); /* Call global and static destructors */ +#ifndef PULP_LLVM pos_init_do_dtors(); +#endif } diff --git a/rules/pulpos/targets/pulpissimo.mk b/rules/pulpos/targets/pulpissimo.mk index 1002edf..70a9e3c 100644 --- a/rules/pulpos/targets/pulpissimo.mk +++ b/rules/pulpos/targets/pulpissimo.mk @@ -17,9 +17,9 @@ endif PULP_ARCH_OBJDFLAGS ?= else ifdef USE_CV32E40X PULP_LDFLAGS += -PULP_CFLAGS += -D__riscv__ -UARCHI_CORE_HAS_PULPV2 -DRV_ISA_RV32 -PULP_ARCH_CFLAGS ?= -march=rv32imc --target=riscv32 -PULP_ARCH_LDFLAGS ?= -march=rv32imc --target=riscv32 +PULP_CFLAGS += -D__riscv__ -UARCHI_CORE_HAS_PULPV2 -DRV_ISA_RV32 -DPULP_LLVM +PULP_ARCH_CFLAGS ?= -march=rv32imcxfir --target=riscv32 +PULP_ARCH_LDFLAGS ?= -march=rv32imcxfir --target=riscv32 PULP_ARCH_OBJDFLAGS ?= -D else PULP_LDFLAGS +=