diff --git a/compiler-rt/lib/builtins/cpu_model/riscv.c b/compiler-rt/lib/builtins/cpu_model/riscv.c index 052124fdde447..74534896057ef 100644 --- a/compiler-rt/lib/builtins/cpu_model/riscv.c +++ b/compiler-rt/lib/builtins/cpu_model/riscv.c @@ -335,7 +335,8 @@ static void initRISCVFeature(struct riscv_hwprobe Hwprobes[]) { static int FeaturesBitCached = 0; -void __init_riscv_feature_bits(void *) CONSTRUCTOR_ATTRIBUTE; +void __init_riscv_feature_bits(void *); +static void __init_riscv_feature_bits_ctor(void) CONSTRUCTOR_ATTRIBUTE; // A constructor function that sets __riscv_feature_bits, and // __riscv_vendor_feature_bits to the right values. This needs to run @@ -343,10 +344,14 @@ void __init_riscv_feature_bits(void *) CONSTRUCTOR_ATTRIBUTE; // run before constructors without the priority set. However, it still runs // after ifunc initializers and needs to be called explicitly there. +static void CONSTRUCTOR_ATTRIBUTE __init_riscv_feature_bits_ctor(void) { + __init_riscv_feature_bits(0); +} + // PlatformArgs allows the platform to provide pre-computed data and access it // without extra effort. For example, Linux could pass the vDSO object to avoid // an extra system call. -void CONSTRUCTOR_ATTRIBUTE __init_riscv_feature_bits(void *PlatformArgs) { +void __init_riscv_feature_bits(void *PlatformArgs) { if (FeaturesBitCached) return;