[clang] df41577 - [LinkerWrapper] Fix use-after-free when using JIT
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 5 05:52:00 PST 2022
Author: Joseph Huber
Date: 2022-12-05T07:51:20-06:00
New Revision: df415774d2a584fb6a62bedf9a4ee936396a0e41
URL: https://github.com/llvm/llvm-project/commit/df415774d2a584fb6a62bedf9a4ee936396a0e41
DIFF: https://github.com/llvm/llvm-project/commit/df415774d2a584fb6a62bedf9a4ee936396a0e41.diff
LOG: [LinkerWrapper] Fix use-after-free when using JIT
Summary:
This portion of the code was unused until now and wasn't properly
updated after we moved to using `StringRef`.
Added:
Modified:
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 844927d04cc4d..3920c4e4549de 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -876,7 +876,7 @@ Error linkBitcodeFiles(SmallVectorImpl<OffloadFile> &InputFiles,
if (BitcodeOutput.size() != 1 || !SingleOutput)
return createStringError(inconvertibleErrorCode(),
"Cannot embed bitcode with multiple files.");
- OutputFiles.push_back(static_cast<std::string>(BitcodeOutput.front()));
+ OutputFiles.push_back(Args.MakeArgString(BitcodeOutput.front()));
return Error::success();
}
@@ -1187,7 +1187,8 @@ linkAndWrapDeviceFiles(SmallVectorImpl<OffloadFile> &LinkerInputFiles,
return createFileError(*OutputOrErr, EC);
OffloadingImage TheImage{};
- TheImage.TheImageKind = IMG_Object;
+ TheImage.TheImageKind =
+ Args.hasArg(OPT_embed_bitcode) ? IMG_Bitcode : IMG_Object;
TheImage.TheOffloadKind = Kind;
TheImage.StringData = {
{"triple",
More information about the cfe-commits
mailing list