[PATCH] D103988: SampleFDO] place the discriminator flag variable into the used list.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 10:29:46 PDT 2021


hoy added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SampleProfileLoaderBaseUtil.cpp:171
+  appendToUsed(*M, {new GlobalVariable(*M, Type::getInt1Ty(Context), true,
+                                       GlobalValue::WeakODRLinkage,
+                                       ConstantInt::getTrue(Context),
----------------
There's a `CommonLinkage` type and from its description, it looks like command variables should not be GC-ed but they can only have a zero value. Not sure if `-Wl,--export-dynamic-symbol` is needed with the common linkage type.

common
“common” linkage is most similar to “weak” linkage, but they are used for tentative definitions in C, such as “int X;” at global scope. Symbols with “common” linkage are merged in the same way as weak symbols, and they may not be deleted if unreferenced. common symbols may not have an explicit section, must have a zero initializer, and may not be marked ‘constant’. Functions and aliases may not have common linkage.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103988/new/

https://reviews.llvm.org/D103988



More information about the llvm-commits mailing list