jhuber6 added a comment.

In D130096#3666155 <https://reviews.llvm.org/D130096#3666155>, @yaxunl wrote:
> The current patch does not consider HIP/OpenCL compile options, therefore the 
> value of these variables are not correct for OpenCL/HIP. They need to be 
> overridden by the variables with the same name in device libraries by clang 
> through -mlink-builtin-bitcode.
>
> If the patch check HIP/OpenCL compilation options to set the correct value 
> for these variables, then it does not need weak linkage.

Is we instead add it to `compiler.used` it should be propagated while staying 
alive for the linker https://godbolt.org/z/MG5n1MWWj. The downside is that this 
symbol will not be removed and a symbol to it will live in the binary. The 
symbol will have weak binding, so it won't cause any linker errors. But it's a 
little annoying to have things stick around like that. I'm considering making 
this code generation be controlled by a clang driver flag so we could 
potentially change behavior as needed there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130096

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to