Skip to content

Commit 616728e

Browse files
maarquitos14jsji
authored andcommitted
[sycl-web] Undo bad conflict resolution and adjust tests to new upstream behavior. (#15051)
Signed-off-by: Marcos Maronas <[email protected]>
1 parent 2b80605 commit 616728e

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

clang/test/Driver/linker-wrapper-libs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int bar() { return weak; }
161161
// RUN: --linker-path=/usr/bin/ld %t.o %t.a %t.a -o a.out 2>&1 \
162162
// RUN: | FileCheck %s --check-prefix=LIBRARY-GLOBAL-DEFINED
163163

164-
// LIBRARY-GLOBAL-DEFINED: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 {{.*}}.o {{.*}}.o
164+
// LIBRARY-GLOBAL-DEFINED: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 {{.*}} {{.*}}.o
165165
// LIBRARY-GLOBAL-DEFINED-NOT: {{.*}}gfx1030{{.*}}.o
166166
// LIBRARY-GLOBAL-DEFINED: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx1030 {{.*}}.o {{.*}}.o
167167

@@ -185,7 +185,7 @@ int bar() { return weak; }
185185
// RUN: --linker-path=/usr/bin/ld %t.o --whole-archive %t.a -o a.out 2>&1 \
186186
// RUN: | FileCheck %s --check-prefix=LIBRARY-WHOLE-ARCHIVE
187187

188-
// LIBRARY-WHOLE-ARCHIVE: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 {{.*}}.o {{.*}}.o
188+
// LIBRARY-WHOLE-ARCHIVE: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_70 {{.*}} {{.*}}.o
189189
// LIBRARY-WHOLE-ARCHIVE: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx1030 {{.*}}.o {{.*}}.o
190190
// LIBRARY-WHOLE-ARCHIVE: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda -march=sm_52 {{.*}}.o
191191
// LIBRARY-WHOLE-ARCHIVE: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a {{.*}}.o

clang/test/Driver/linker-wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ __attribute__((visibility("protected"), used)) int x;
4848
// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run --save-temps -O2 \
4949
// RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=AMDGPU-LTO-TEMPS
5050

51-
// AMDGPU-LTO-TEMPS: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx1030 -O2 -Wl,--no-undefined {{.*}}.o -save-temps
51+
// AMDGPU-LTO-TEMPS: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx1030 -O2 -Wl,--no-undefined {{.*}} -save-temps
5252

5353
// RUN: clang-offload-packager -o %t.out \
5454
// RUN: --image=file=%t.elf.o,kind=openmp,triple=x86_64-unknown-linux-gnu \

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,21 +2316,18 @@ Expected<SmallVector<StringRef>> linkAndWrapDeviceFiles(
23162316
}
23172317
}
23182318

2319-
// Link the remaining device files using the device linker.
2320-
auto OutputOrErr =
2321-
!Args.hasArg(OPT_embed_bitcode) || linkerSupportsLTO(LinkerArgs)
2322-
? linkDevice(InputFiles, LinkerArgs)
2323-
: InputFiles.front();
2324-
if (!OutputOrErr)
2325-
return OutputOrErr.takeError();
2319+
// TODO(NOM7): Remove this call and use community flow for bundle/wrap
2320+
auto OutputFile = sycl::runWrapperAndCompile(SplitModules, LinkerArgs);
2321+
if (!OutputFile)
2322+
return OutputFile.takeError();
23262323

23272324
// SYCL offload kind images are all ready to be sent to host linker.
23282325
// TODO: Currently, device code wrapping for SYCL offload happens in a
23292326
// separate path inside 'linkDevice' call seen above.
23302327
// This will eventually be refactored to use the 'common' wrapping logic
23312328
// that is used for other offload kinds.
23322329
std::scoped_lock Guard(ImageMtx);
2333-
WrappedOutput.push_back(*OutputOrErr);
2330+
WrappedOutput.push_back(*OutputFile);
23342331
}
23352332
if (HasNonSYCLOffloadKinds) {
23362333
// First link and remove all the input files containing bitcode.

0 commit comments

Comments
 (0)