https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/130285
Summary: Thanks to @Meinersbur for finding this. The `:` character used in AMD's target-id's is invalid on windows. This patch replaces them with `_`. >From d39b407a6ae2000f91a345c18cb710647b86c1c8 Mon Sep 17 00:00:00 2001 From: Joseph Huber <hube...@outlook.com> Date: Fri, 7 Mar 2025 07:54:50 -0600 Subject: [PATCH] [LinkerWrapper] Try to fix testing on Windows Summary: Thanks to @Meinersbur for finding this. The `:` character used in AMD's target-id's is invalid on windows. This patch replaces them with `_`. --- clang/test/Driver/linker-wrapper.c | 6 ++---- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c index 7586b87743bf5..1f7a065fec0dc 100644 --- a/clang/test/Driver/linker-wrapper.c +++ b/clang/test/Driver/linker-wrapper.c @@ -2,8 +2,6 @@ // REQUIRES: nvptx-registered-target // REQUIRES: amdgpu-registered-target -// REQUIRES: system-linux - // An externally visible variable so static libraries extract. __attribute__((visibility("protected"), used)) int x; @@ -120,7 +118,7 @@ __attribute__((visibility("protected"), used)) int x; // HIP: clang{{.*}} -o [[IMG_GFX90A:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx90a // HIP: clang{{.*}} -o [[IMG_GFX908:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx908 -// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input=/dev/null -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb +// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input={{/dev/null|NUL}} -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb // RUN: clang-offload-packager -o %t.out \ // RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \ @@ -211,7 +209,7 @@ __attribute__((visibility("protected"), used)) int x; // RUN: %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-HIP // RELOCATABLE-LINK-HIP: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa--gfx90a -input=/dev/null -input={{.*}} -output={{.*}} +// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa--gfx90a -input={{/dev/null|NUL}} -input={{.*}} -output={{.*}} // RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r // RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 10dfb008cbec2..f111a9cadac6a 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -599,9 +599,10 @@ Expected<StringRef> writeOffloadFile(const OffloadFile &File) { StringRef Prefix = sys::path::stem(Binary.getMemoryBufferRef().getBufferIdentifier()); - - auto TempFileOrErr = createOutputFile( - Prefix + "-" + Binary.getTriple() + "-" + Binary.getArch(), "o"); + std::string Filename = + (Prefix + "-" + Binary.getTriple() + "-" + Binary.getArch()).str(); + llvm::replace(Filename, ':', '-'); + auto TempFileOrErr = createOutputFile(Filename, "o"); if (!TempFileOrErr) return TempFileOrErr.takeError(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits