-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang-repl] Fix target creation in Wasm.cpp #130909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang Author: Anutosh Bhat (anutosh491) ChangesAfter #129868 went in, I realize some updates have been made to the Triple. Not sure if @nikic overlooked including this change in his PR (hence I have having build issue when compiling clang against emscripten while building for wasm) But yeah just like the change was addressed in other files, we need to make the change here too I think llvm-project/clang/lib/Interpreter/DeviceOffload.cpp Lines 79 to 86 in d921bf2
Full diff: https://github.com/llvm/llvm-project/pull/130909.diff 1 Files Affected:
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index aa10b160ccf84..c12412c26d6e0 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -74,7 +74,7 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
llvm::TargetOptions TO = llvm::TargetOptions();
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
- PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
+ PTU.TheModule->getTargetTriple().str(), "", "", TO, llvm::Reloc::Model::PIC_);
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";
@@ -146,4 +146,4 @@ llvm::Error WasmIncrementalExecutor::cleanUp() {
WasmIncrementalExecutor::~WasmIncrementalExecutor() = default;
-} // namespace clang
\ No newline at end of file
+} // namespace clang
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/cherry-pick 369c0a7 |
Cherry picking this as it ends up being a major blocker for running clang-repl in the browser while using llvm 20. Would be great to have this picked up and addressed by |
The relevant change is only in LLVM 21, so I have no idea how this can possibly be a blocker for LLVM 20. Are you testing the correct version? |
Error: Command failed due to missing milestone. |
Oops yes, I ended up missing that completely ! Was testing the wrong version. |
After #129868 went in, I realize some updates have been made to the Triple.
Not sure if @nikic overlooked including this change in his PR (hence I was having build issue when compiling clang against emscripten while building for wasm)
But yeah just like the change was addressed in other files, we need to make the change here too I think
llvm-project/clang/lib/Interpreter/DeviceOffload.cpp
Lines 79 to 86 in d921bf2