Skip to content

Fix clang2whirl build with LLVM 11#45

Open
noafroboy wants to merge 1 commit intoopen64-compiler:developfrom
noafroboy:fix/clang2whirl-llvm11
Open

Fix clang2whirl build with LLVM 11#45
noafroboy wants to merge 1 commit intoopen64-compiler:developfrom
noafroboy:fix/clang2whirl-llvm11

Conversation

@noafroboy
Copy link

Summary

  • Add missing clang/LLVM static libraries to the clang2whirl link step (clangARCMigrate, clangStaticAnalyzerFrontend, clangStaticAnalyzerCheckers, clangStaticAnalyzerCore, clangCrossTU, clangIndex, clangASTMatchers, clangToolingCore) plus system libraries -lz (zlib) and -ltinfo (terminfo) that LLVM depends on
  • Guard BIstrlcpy/BIstrlcat builtin case range in c2w_builtin.cxx with #if LLVM_VERSION_MAJOR >= 14, since these builtins were added in Clang 14 and do not exist in LLVM 11

Motivation

Building with LLVM 11 (the version available on Ubuntu 20.04) produces undefined reference link errors in clang2whirl, and a compile error for the missing BIstrlcpy/BIstrlcat identifiers. These are straightforward compatibility fixes.

Test plan

  • Build clang2whirl with LLVM 11 on Ubuntu 20.04 — link succeeds
  • Build clang2whirl with LLVM 14/15 — existing behavior unchanged

🤖 Generated with Claude Code

The clang2whirl frontend fails to build with LLVM 11 due to two issues:

1. Missing clang/LLVM static libraries at link time. The Makefile only
   listed a subset of the required clang static libraries, causing
   undefined reference errors for symbols in clangARCMigrate,
   clangStaticAnalyzer*, clangCrossTU, clangIndex, clangASTMatchers,
   and clangToolingCore. Also add -lz (zlib, required by LLVM bitcode
   reader) and -ltinfo (terminfo, required by LLVM Support).

2. BIstrlcpy and BIstrlcat builtin IDs do not exist in LLVM 11 (they
   were added in LLVM 14). Guard the case range with a version check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant