[clang] [Offload] Do not pass `-fcf-protection=` for offloading (PR #88402)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 06:18:54 PDT 2024


================
@@ -0,0 +1,39 @@
+// Check that -fcf-protection does not get passed to the device-side
+// compilation.
+
+// RUN: %clang -### -x cuda --target=x86_64-unknown-linux-gnu -nogpulib \
+// RUN:   -nogpuinc --offload-arch=sm_52 -fcf-protection=full -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CUDA
+
+// CUDA: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-NOT: "-fcf-protection=full"
+// CUDA: "-cc1" "-triple" "x86_64-unknown-linux-gnu"
+// CUDA: "-fcf-protection=full"
+
+// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -nogpulib \
+// RUN:   -nogpuinc --offload-arch=gfx90a -fcf-protection=full -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=HIP
+
+// HIP: "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// HIP-NOT: "-fcf-protection=full"
+// HIP: "-cc1" "-triple" "x86_64-unknown-linux-gnu"
+// HIP: "-fcf-protection=full"
+
----------------
jhuber6 wrote:

I don't know how that would be possible. We have options like `-Xarch_device`, but those are stripped by the time we create the synthetic arguments that make it to the tool builder. Potentially we could do this logic where we build the args and just prevent the offloading toolchain from seeing it at all?

https://github.com/llvm/llvm-project/pull/88402


More information about the cfe-commits mailing list