<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86450>86450</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AMDGPU] Do not emit -fcf-protection=full on GPU architectures
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AngryLoki
</td>
</tr>
</table>
<pre>
In Gentoo 23.0 (upcoming) and hardened profile `-fcf-protection=full` is added automatically via `/etc/clang/x86_64-pc-linux-gnu-clang++.cfg` (as well as [other flags](https://wiki.gentoo.org/wiki/Hardened/Toolchain#Changes)). However this flag does not work well with heterogeneous hip code:
```
cd /tmp && wget https://raw.githubusercontent.com/ROCm-Developer-Tools/HIP-CPU/master/examples/vadd_hip/vadd_hip.cpp
# -fcf-protection=full is added manually for demonstration
/usr/lib/llvm/18/bin/clang++ --offload-arch=native -x hip vadd_hip.cpp -o vadd_hip -fno-stack-protector --hip-link -fcf-protection=full -nogpulib
error: option 'cf-protection=return' cannot be specified on this target
```
Although it is possible to use `-fcf-protection=full -Xarch_device -fcf-protection=none`, to override this, but it is very irritating and it can not be added to all files, as it produces `warning: argument unused during compilation: '-Xarch_device -fcf-protection=none'` for non-hip files.
In https://github.com/llvm/llvm-project/pull/70799 you added code to "not emit the stack protector metadata on unsupported architectures". Can you do the same for `-fcf-protection=...`, to apply CET only for host code? Thanks!
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVdtu2zgTfhr6ZiBBHvl44Qsn_tUW-BcbLFpg7wqaHEncUByBBzt--wVltU2KdLELBIolUcPvMN9QhmA6R3QQ6wexPi1kij37w9F1_vZ_fjaLM-vb4ZODD-QiM2BdViBwl0bFg3GdwD1Ip6GXXpMjDaPn1lgCsamKVrXF6DmSioadqE9tslZsKjABpNakQabIg4xGSWtvcDEyfyewoagENsrKvEPzstt83ayKURXWuPRSdC4V87sHg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