================
@@ -357,6 +357,18 @@ void CIRGenNVCUDARuntime::emitDeviceStub(CIRGenFunction 
&cgf, cir::FuncOp fn,
     globalOp->removeAttr("sym_visibility");
     globalOp->setAttr("alignment", builder.getI64IntegerAttr(
                                        cgm.getPointerAlign().getQuantity()));
+
+    // The handle must track the kernel stub's linkage/visibility, not the
+    // global-op default (external).
+    globalOp.setLinkage(fn.getLinkage());
----------------
steffenlarsen wrote:

>From what I can trace, the linkage set in OGCG's version of `getKernelHandle` 
>is a red herring, as `setFunctionLinkage` has not run by this time, which in 
>turn means that all kernels will have `external` linkage. The actual linkage 
>of the stubs is actually set in a function similar to this:
https://github.com/llvm/llvm-project/blob/042302b03bd4de1ed59a9f945f4b2565dba1b7e8/clang/lib/CodeGen/CGCUDANV.cpp#L331-L346
That said, if we want consistency between the two, I suppose it wouldn't hurt 
to copy the DSO, but it is also unused work.


https://github.com/llvm/llvm-project/pull/227267
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to