Skip to content

Commit a11a5ed

Browse files
authored
[Driver][SYCL][NFC] Fix verbose output for offload bundle check steps (#7243)
When performing any checks using clang-offload-bundler, the verbose output using -### was only emitting the tool name and not the full absolute path to the binary. This causes a disconnect in regards to the other bundler calls. Clean this up so the output is consistent.
1 parent a67807a commit a11a5ed

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,12 +3177,16 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
31773177
}
31783178
}
31793179

3180-
static bool runBundler(const SmallVectorImpl<StringRef> &BundlerArgs,
3180+
static bool runBundler(const SmallVectorImpl<StringRef> &InputArgs,
31813181
Compilation &C) {
31823182
// Find bundler.
31833183
StringRef ExecPath(C.getArgs().MakeArgString(C.getDriver().Dir));
31843184
llvm::ErrorOr<std::string> BundlerBinary =
31853185
llvm::sys::findProgramByName("clang-offload-bundler", ExecPath);
3186+
SmallVector<StringRef, 6> BundlerArgs;
3187+
BundlerArgs.push_back(BundlerBinary.getError() ? "clang-offload-bundler"
3188+
: BundlerBinary.get().c_str());
3189+
BundlerArgs.append(InputArgs);
31863190
// Since this is run in real time and not in the toolchain, output the
31873191
// command line if requested.
31883192
bool OutputOnly = C.getArgs().hasArg(options::OPT__HASH_HASH_HASH);
@@ -3223,8 +3227,8 @@ static bool hasFPGABinary(Compilation &C, std::string Object, types::ID Type) {
32233227
const char *Inputs = C.getArgs().MakeArgString(Twine("-input=") + Object);
32243228
// Always use -type=ao for aocx/aocr bundle checking. The 'bundles' are
32253229
// actually archives.
3226-
SmallVector<StringRef, 6> BundlerArgs = {"clang-offload-bundler", "-type=ao",
3227-
Targets, Inputs, "-check-section"};
3230+
SmallVector<StringRef, 6> BundlerArgs = {"-type=ao", Targets, Inputs,
3231+
"-check-section"};
32283232
return runBundler(BundlerArgs, C);
32293233
}
32303234

@@ -3309,8 +3313,7 @@ static bool hasSYCLDefaultSection(Compilation &C, const StringRef &File) {
33093313
const char *Targets =
33103314
C.getArgs().MakeArgString(Twine("-targets=sycl-") + TT.str());
33113315
const char *Inputs = C.getArgs().MakeArgString(Twine("-input=") + File.str());
3312-
SmallVector<StringRef, 6> BundlerArgs = {"clang-offload-bundler",
3313-
IsArchive ? "-type=ao" : "-type=o",
3316+
SmallVector<StringRef, 6> BundlerArgs = {IsArchive ? "-type=ao" : "-type=o",
33143317
Targets, Inputs, "-check-section"};
33153318
return runBundler(BundlerArgs, C);
33163319
}
@@ -3332,8 +3335,7 @@ static bool hasOffloadSections(Compilation &C, const StringRef &File,
33323335
// of the generic host availability.
33333336
const char *Targets = Args.MakeArgString(Twine("-targets=host-") + TT.str());
33343337
const char *Inputs = Args.MakeArgString(Twine("-input=") + File.str());
3335-
SmallVector<StringRef, 6> BundlerArgs = {"clang-offload-bundler",
3336-
IsArchive ? "-type=ao" : "-type=o",
3338+
SmallVector<StringRef, 6> BundlerArgs = {IsArchive ? "-type=ao" : "-type=o",
33373339
Targets, Inputs, "-check-section"};
33383340
return runBundler(BundlerArgs, C);
33393341
}

clang/test/Driver/sycl-offload.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@
147147
// RUN: | FileCheck -check-prefix CHECK_SECTION %s
148148
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu %S/Inputs/SYCL/liblin64.a %s 2>&1 \
149149
// RUN: | FileCheck -check-prefix NO_CHECK_SECTION %s
150-
// CHECK_SECTION: clang-offload-bundler{{.*}} "-type=ao" "-targets=host-x86_64-unknown-linux-gnu"{{.*}} "-check-section"
151-
// CHECK_SECTION: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocr-intel-unknown"{{.*}} "-check-section"
152-
// CHECK_SECTION: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocx-intel-unknown"{{.*}} "-check-section"
153-
// CHECK_SECTION: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocr_emu-intel-unknown"{{.*}} "-check-section"
150+
// CHECK_SECTION: {{(/|\\\\)}}clang-offload-bundler{{.*}} "-type=ao" "-targets=host-x86_64-unknown-linux-gnu"{{.*}} "-check-section"
151+
// CHECK_SECTION: {{(/|\\\\)}}clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocr-intel-unknown"{{.*}} "-check-section"
152+
// CHECK_SECTION: {{(/|\\\\)}}clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocx-intel-unknown"{{.*}} "-check-section"
153+
// CHECK_SECTION: {{(/|\\\\)}}clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocr_emu-intel-unknown"{{.*}} "-check-section"
154154
// NO_CHECK_SECTION-NOT: clang-offload-bundler{{.*}} "-type=ao" "-targets=host-x86_64-unknown-linux-gnu"{{.*}} "-check-section"
155155
// NO_CHECK_SECTION-NOT: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocr-intel-unknown"{{.*}} "-check-section"
156156
// NO_CHECK_SECTION-NOT: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aocx-intel-unknown"{{.*}} "-check-section"

0 commit comments

Comments
 (0)