[PATCH] D26045: [cfi] Fix weak functions handling.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 15:43:21 PDT 2016

pcc added inline comments.

Comment at: lib/Transforms/IPO/LowerTypeTests.cpp:747
+            : ".text.startup");
+    appendToGlobalCtors(M, WeakInitializerFn, /* Priority */ 0);
+  }
eugenis wrote:
> I wonder if the priority should be lower. Regular constructors have priority of 65535, we definitely want higher than that, but maybe lower than ASan, etc constructors which use 1 and 2 currently.
I think this constructor is equivalent to relocation application so it should run as close to that as possible, i.e. it should have the highest priority.

Please document the reasons for our choice of priority.

Comment at: lib/Transforms/IPO/LowerTypeTests.cpp:764
+  for (auto *U : F->users())
+    if (auto *GV = dyn_cast<GlobalVariable>(U))
+      GlobalVarUses.push_back(GV);
What if the use is an element of an aggregate that initializes a GlobalVariable?



More information about the llvm-commits mailing list