================
@@ -280,14 +280,18 @@ static void initRISCVFeature(struct riscv_hwprobe 
Hwprobes[]) {
 
 static int FeaturesBitCached = 0;
 
-void __init_riscv_feature_bits() CONSTRUCTOR_ATTRIBUTE;
+void __init_riscv_feature_bits(void *) CONSTRUCTOR_ATTRIBUTE;
 
 // A constructor function that sets __riscv_feature_bits, and
 // __riscv_vendor_feature_bits to the right values.  This needs to run
 // only once.  This constructor is given the highest priority and it should
 // run before constructors without the priority set.  However, it still runs
 // after ifunc initializers and needs to be called explicitly there.
-void CONSTRUCTOR_ATTRIBUTE __init_riscv_feature_bits() {
+
+// 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) {
----------------
jrtc27 wrote:

I think my point was more "having it be a constructor _and_ called doesn't seem 
to make a lot of sense", because if the expectation is that every user of the 
global variable calls the function first then the constructor is pointless, 
unless it's an "ifunc resolvers must call the function, other users need not" 
situation? Also, if everyone's calling the function, it could just return the 
pointer to the data rather than requiring the caller to then get a pointer to 
the global.

https://github.com/llvm/llvm-project/pull/101472
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to