Make init.c LLVM-compliant by disabling .ctors

This commit is contained in:
Francesco Conti 2024-05-19 23:38:39 +02:00
parent d812c92404
commit 3b10f5f51e
2 changed files with 9 additions and 3 deletions

View file

@ -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
}

View file

@ -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 +=