<div dir="ltr">What exactly is failing? The cast to GlobalValue? If so, try stripping casts, as in this existing code:<div><div> setDSOLocal(cast<llvm::GlobalValue>(Ret->stripPointerCasts()));</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 24, 2018 at 1:50 PM Manoj Gupta via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">+ llvm-dev .<br><div><br></div><div>Any ideas about the semantics of "__CFConstantStringClassReference" and the best way to fix the clang crash issue.</div><div><br></div><div>Thanks,</div><div>Manoj</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 21, 2018 at 5:08 PM Manoj Gupta <<a href="mailto:manojgupta@google.com" target="_blank">manojgupta@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am looking for some help regarding a clang crash when building opencflite. The root cause of the crash is because clang tries to create a GlobalValue "__CFConstantStringClassReference" but a variable of same name is also present in the source file.</div><div><br></div><div>Crash location:</div><div><div><a href="https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/CodeGenModule.cpp#L4058" target="_blank">https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/CodeGenModule.cpp#L4058</a></div><div><br></div><div><div> // If we don't already have it, get __CFConstantStringClassReference.</div><div> if (!CFConstantStringClassRef) {</div><div> llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy);</div><div> Ty = llvm::ArrayType::get(Ty, 0);</div><div> llvm::GlobalValue *GV = cast<llvm::GlobalValue>(</div><div> CreateRuntimeVariable(Ty, "__CFConstantStringClassReference")); // Crashes here</div></div></div><div><br></div><div>Opencflite also declares __CFConstantStringClassReference as a variable, <a href="https://github.com/nevali/opencflite/blob/03999700cf3b79975ae2f2e5f4100ea7096acb3a/CFInternal.h#L364" target="_blank">https://github.com/nevali/opencflite/blob/03999700cf3b79975ae2f2e5f4100ea7096acb3a/CFInternal.h#L364</a> :</div><div><br></div><div>extern int __CFConstantStringClassReference[];</div><div><br></div><div>I do not know the semantics of the name __CFConstantStringClassReference. Is this a reserved name and should opencflite not be declaring this variable ? If so, appreciate any advice on how to fix the offending code. </div><div><br></div><div>Or is this a bug in clang?<br></div><div><br></div><div>For reference, r327993 (<a href="https://reviews.llvm.org/rL327993" target="_blank">https://reviews.llvm.org/rL327993</a>) introduced this code.</div><div><div><br></div><div>Author: Rafael Espindola <<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>><br></div><div>AuthorDate: Tue Mar 20 15:48:00 2018 +0000</div><div><br></div><div> Set dso_local for CFConstantStringClassReference.</div><div> </div><div> This one cannot use setGVProperties since it has special logic for</div><div> when it is dllimport or not.</div></div><div><div> git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@" target="_blank">https://llvm.org/svn/llvm-project/cfe/trunk@</a><b>327993</b> 91177308-0d34-0410-b5e6-96231b3b80d8</div></div><div><br></div><div>Thanks,</div><div>Manoj</div></div>
</blockquote></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>