[clang] [ClangLinkerWrapper] Use discrete steps in verbose mode (PR #204186)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 22 07:30:47 PDT 2026
================
@@ -790,8 +855,52 @@ wrapDeviceImages(ArrayRef<std::unique_ptr<MemoryBuffer>> Buffers,
return *FileOrErr;
}
+/// Perform the OpenMP bundling with 'llvm-offload-binary' in verbose mode.
Expected<SmallVector<std::unique_ptr<MemoryBuffer>>>
-bundleOpenMP(ArrayRef<OffloadingImage> Images) {
+bundleOpenMPVerbose(ArrayRef<OffloadingImage> Images, const ArgList &Args) {
+ Expected<std::string> OffloadBinaryPath = findProgram(
+ "llvm-offload-binary", {getExecutableDir("llvm-offload-binary")});
+ if (!OffloadBinaryPath)
+ return OffloadBinaryPath.takeError();
+
+ BumpPtrAllocator Alloc;
+ StringSaver Saver(Alloc);
+ SmallVector<std::unique_ptr<MemoryBuffer>> Buffers;
+ for (const OffloadingImage &Image : Images) {
+ StringRef ImageFile = Image.Image->getBufferIdentifier();
+ auto BinaryOrErr =
+ createOutputFile(sys::path::stem(ImageFile) + "." +
+ getOffloadKindName(Image.TheOffloadKind),
+ "offload");
+ if (!BinaryOrErr)
+ return BinaryOrErr.takeError();
+
+ std::string ImageArg = ("--image=file=" + ImageFile +
----------------
jhuber6 wrote:
Honestly, the `IMG_xyz` metadata is functionally unused. Maybe some placed try to infer some filename on it? But all the real users just use the magic bytes. I think the only case that it would make a difference is like `PTX`, but all PTX used in practice is already in a CUDA fatbinary which has magic. I suppose the one thing people would notice is that the `llvm-objdump --offloading` wouldn't display anything, half considering just making that print based off of the magic instead as well.
I could maybe make it work, but I don't think it's a major priority.
https://github.com/llvm/llvm-project/pull/204186
More information about the cfe-commits
mailing list