================
@@ -1162,6 +1281,54 @@ std::optional<std::string> searchLibrary(StringRef
Input, StringRef Root,
return searchLibraryBaseName(Input, Root, SearchPaths);
}
+/// In verbose mode we need to replay the extracted files so the user can
+/// reproduce the generated. This only prints the steps that would result in
the
+/// same output files given the input.
+Error emitExtractCommands(
+ ArrayRef<SmallVector<OffloadFile>> InputsForTarget,
+ const DenseMap<StringRef, StringRef> &SourceForImage) {
+ Expected<std::string> OffloadBinaryPath = findProgram(
+ "llvm-offload-binary", {getExecutableDir("llvm-offload-binary")});
+ if (!OffloadBinaryPath)
+ return OffloadBinaryPath.takeError();
+
+ BumpPtrAllocator Alloc;
+ StringSaver Saver(Alloc);
+ MapVector<StringRef, SmallVector<StringRef>> Commands;
+ DenseSet<StringRef> Seen;
+ for (const auto &Input : InputsForTarget) {
+ for (const OffloadFile &File : Input) {
+ const OffloadBinary &Binary = *File.getBinary();
+ StringRef Identifier = Binary.getMemoryBufferRef().getBufferIdentifier();
+ StringRef Source = SourceForImage.lookup(Identifier);
+ if (Source.empty())
+ Source = Identifier;
+
+ StringRef TripleStr = Binary.getTriple();
+ StringRef Arch = Binary.getArch();
+ StringRef Kind = getOffloadKindName(Binary.getOffloadKind());
+
+ std::string ImageArg =
----------------
jhuber6 wrote:
Yeah, this was mostly a workaround for a limitation in the
`llvm-offload-binary` for archive files. Two options, either let
`llvm-offload-binary` accept archive members and we extract them all
individually, or change the flow to extract it from a `.a`, turn it into a new
`.a.` and pass it to the embedded job w/ `-Wl,--whole-archive`, then we can use
the existing handling.
https://github.com/llvm/llvm-project/pull/204186
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits