Skip to content

Update llvm to 20.1.4 #2287

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

Merged
merged 2 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions recipes/recipes_emscripten/llvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ emcmake cmake ${CMAKE_ARGS} -S ../llvm -B . \
-DLLVM_ENABLE_THREADS=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_BUILD_TOOLS=OFF \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
-DCLANG_BUILD_TOOLS=OFF \
-DCMAKE_CXX_FLAGS="-Dwait4=__syscall_wait4 -fexceptions"

# Build step
emmake make -j4

# Install step
emmake make install

# Copy all files with ".wasm" extension to $PREFIX/bin
cp $SRC_DIR/build/bin/*.wasm $PREFIX/bin
# Build and Install step
emmake make clangInterpreter lldWasm -j16 install
26 changes: 0 additions & 26 deletions recipes/recipes_emscripten/llvm/patches/define_LLVM_ABI.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index f91563dd0378..37cf3b62e6ec 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -142,6 +142,48 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
return std::move(Clang);
}

+static llvm::Error HandleFrontendOptions(const CompilerInstance &CI) {
+ const auto &FrontendOpts = CI.getFrontendOpts();
+
+ if (FrontendOpts.ShowHelp) {
+ driver::getDriverOptTable().printHelp(
+ llvm::outs(), "clang -cc1 [options] file...",
+ "LLVM 'Clang' Compiler: http://clang.llvm.org",
+ /*ShowHidden=*/false, /*ShowAllAliases=*/false,
+ llvm::opt::Visibility(driver::options::CC1Option));
+ return llvm::createStringError(llvm::errc::not_supported, "Help displayed");
+ }
+
+ if (FrontendOpts.ShowVersion) {
+ llvm::cl::PrintVersionMessage();
+ return llvm::createStringError(llvm::errc::not_supported,
+ "Version displayed");
+ }
+
+ if (!FrontendOpts.LLVMArgs.empty()) {
+ unsigned NumArgs = FrontendOpts.LLVMArgs.size();
+ auto Args = std::make_unique<const char *[]>(NumArgs + 2);
+ Args[0] = "clang-repl (LLVM option parsing)";
+ for (unsigned i = 0; i != NumArgs; ++i) {
+ Args[i + 1] = FrontendOpts.LLVMArgs[i].c_str();
+ // remove the leading '-' from the option name
+ if (Args[i + 1][0] == '-') {
+ auto *option = static_cast<llvm::cl::opt<bool> *>(
+ llvm::cl::getRegisteredOptions()[Args[i + 1] + 1]);
+ if (option) {
+ option->setInitialValue(true);
+ } else {
+ llvm::errs() << "Unknown LLVM option: " << Args[i + 1] << "\n";
+ }
+ }
+ }
+ Args[NumArgs + 1] = nullptr;
+ llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get());
+ }
+
+ return llvm::Error::success();
+}
+
} // anonymous namespace

namespace clang {
@@ -452,7 +494,12 @@ const char *const Runtimes = R"(

llvm::Expected<std::unique_ptr<Interpreter>>
Interpreter::create(std::unique_ptr<CompilerInstance> CI) {
- llvm::Error Err = llvm::Error::success();
+
+ llvm::Error Err = HandleFrontendOptions(*CI);
+ if (Err) {
+ return std::move(Err);
+ }
+
auto Interp =
std::unique_ptr<Interpreter>(new Interpreter(std::move(CI), Err));
if (Err)
Loading