Index: llvm/lib/CodeGen/MIRFSDiscriminator.cpp =================================================================== --- llvm/lib/CodeGen/MIRFSDiscriminator.cpp +++ llvm/lib/CodeGen/MIRFSDiscriminator.cpp @@ -132,8 +132,9 @@ if (!M->getGlobalVariable(FSDiscriminatorVar)) { auto &Context = M->getContext(); // Create a global variable to flag that FSDiscriminators are used. + // Using "common" linkage so that it will not gc GC'ed. new GlobalVariable(*M, Type::getInt1Ty(Context), true, - GlobalValue::WeakAnyLinkage, + GlobalValue::CommonLinkage, ConstantInt::getTrue(Context), FSDiscriminatorVar); }