@@ -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}
0 commit comments