Skip to content

Prefer LLVMGetVersion for runtime info - #162153

Open
cuviper wants to merge 1 commit into
rust-lang:mainfrom
cuviper:llvm-get-version
Open

Prefer LLVMGetVersion for runtime info#162153
cuviper wants to merge 1 commit into
rust-lang:mainfrom
cuviper:llvm-get-version

Conversation

@cuviper

@cuviper cuviper commented Sep 1, 2026

Copy link
Copy Markdown
Member

Our LLVMRustVersion* functions get hard-coded LLVM_VERSION_* values
when we build RustWrapper.cpp, but this could be different than the
actual LLVM library at runtime. This should never happen with toolchains
from rustup, but with external LLVM in a distro build, for example,
rustc and LLVM can be upgraded independently.

Most of the time when we check the LLVM version, we're only looking at
the major version anyway, and we already assert that these are equal in
configure_llvm. However, for anything that does check the minor or
patch version too, the runtime version is probably more relevant.

Our `LLVMRustVersion*` functions get hard-coded `LLVM_VERSION_*` values
when we build `RustWrapper.cpp`, but this could be different than the
actual LLVM library at runtime. This should never happen with toolchains
from `rustup`, but with external LLVM in a distro build, for example,
`rustc` and `LLVM` can be upgraded independently.

Most of the time when we check the LLVM version, we're only looking at
the major version anyway, and we already assert that these are equal in
`configure_llvm`. However, for anything that does check the minor or
patch version too, the runtime version is probably more relevant.
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 1, 2026
@rustbot

rustbot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 21 candidates

@wesleywiser

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d08a6b has been approved by wesleywiser

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants