Skip to content

Commit 699c6d7

Browse files
committed
Add emscripten patch cross compilation
1 parent 9c64f35 commit 699c6d7

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.github/workflows/emscripten.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,13 @@ jobs:
250250
brew link --overwrite "$pkg"
251251
done
252252
brew upgrade openssl >/dev/null 2>&1
253-
brew install ninja
254253
brew upgrade
255254
256255
- name: Install deps on Linux
257256
if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }}
258257
run: |
259258
# Install deps
260259
sudo apt-get update
261-
sudo apt-get install ninja-build
262260
sudo apt-get autoremove
263261
sudo apt-get clean
264262
@@ -300,13 +298,12 @@ jobs:
300298
-DLLVM_INCLUDE_EXAMPLES=OFF \
301299
-DLLVM_INCLUDE_TESTS=OFF \
302300
-DLLVM_ENABLE_THREADS=OFF \
303-
-G Ninja \
304301
../llvm
305-
emmake ninja clang cling lld gtest_main -j ${{ env.ncpus }}
302+
emmake make clang cling lld gtest_main -j ${{ env.ncpus }}
306303
else
307304
# Apply patches
308305
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
309-
if [[ "${llvm_vers}" == "19" ]]; then
306+
if [[ "${llvm_vers}" == "19" ]]||[[ "${llvm_vers}" == "20" ]]; then
310307
git apply -v ../patches/llvm/emscripten-clang${{ matrix.clang-runtime }}-*.patch
311308
echo "Apply emscripten-clang${{ matrix.clang-runtime }}-*.patch patches:"
312309
fi
@@ -327,9 +324,8 @@ jobs:
327324
-DLLVM_INCLUDE_EXAMPLES=OFF \
328325
-DLLVM_INCLUDE_TESTS=OFF \
329326
-DLLVM_ENABLE_THREADS=OFF \
330-
-G Ninja \
331327
../llvm
332-
emmake ninja clang clangInterpreter clangStaticAnalyzerCore lld -j ${{ env.ncpus }}
328+
emmake make clang clangInterpreter clangStaticAnalyzerCore lld -j ${{ env.ncpus }}
333329
fi
334330
cd ../
335331
rm -rf $(find . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
2+
index aa10b160ccf8..184867e2b55f 100644
3+
--- a/clang/lib/Interpreter/Wasm.cpp
4+
+++ b/clang/lib/Interpreter/Wasm.cpp
5+
@@ -76,8 +76,8 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
6+
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
7+
PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
8+
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
9+
- std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
10+
- std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";
11+
+ std::string ObjectFileName = "/tmp/" + PTU.TheModule->getName().str() + ".o";
12+
+ std::string BinaryFileName = "/tmp/" + PTU.TheModule->getName().str() + ".wasm";
13+
14+
std::error_code Error;
15+
llvm::raw_fd_ostream ObjectFileOutput(llvm::StringRef(ObjectFileName), Error);

0 commit comments

Comments
 (0)