Skip to content

Commit db7e714

Browse files
committed
feat: remove llvm 10 support
1 parent 8cfe464 commit db7e714

File tree

17 files changed

+8
-76
lines changed

17 files changed

+8
-76
lines changed

.github/workflows/linux.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
strategy:
1717
matrix:
1818
llvm-version:
19-
- ["10", "10-0", "v10.0.1-rust-1.46/llvm-10.0.1-rust-1.46-linux-x86_64.tar.gz", "libLLVM-10.so"]
2019
- ["11", "11-0", "v11.0.1-rust-1.51/llvm-lld-11.0.1-rust-1.51-linux-x86_64.tar.gz", "libLLVM-11.so"]
2120
- ["12", "12-0", "v12.0.1-rust-1.55/llvm-lld-12.0.1-rust-1.55-linux-x86_64.tar.gz", "libLLVM-12.so"]
2221
- ["13", "13-0", "v13.0.0-rust-1.59/llvm-lld-13.0.0-rust-1.59-linux-x86_64.tar.gz", "libLLVM-13.so"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ When importing this crate in your `Cargo.toml`, you will need to specify the LLV
3030
llvm-plugin = { git = "https://github.com/jamesmth/llvm-plugin-rs", features = ["llvm19-1"] }
3131
```
3232

33-
Supported versions: LLVM 10-19 mapping to a cargo feature flag `llvmX-Y` where `X` and `Y` are the LLVM major and minor versions.
33+
Supported versions: LLVM 11-19 mapping to a cargo feature flag `llvmX-Y` where `X` and `Y` are the LLVM major and minor versions.
3434

3535
## Getting Started
3636

examples/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ achieved with simple LLVM passes.
99
<summary><em>Execute the example</em></summary>
1010

1111
```shell
12-
$ cargo b --example hello-world --features llvm10-0
12+
$ cargo b --example hello-world --features llvm19-1
1313
$ opt --load-pass-plugin=target/debug/examples/libhello_world.so --passes=hello-world in.ll -S -o out.ll
1414
```
1515

@@ -21,7 +21,7 @@ achieved with simple LLVM passes.
2121
<summary><em>Execute the example</em></summary>
2222

2323
```shell
24-
$ cargo b --example opcode-counter --features llvm10-0
24+
$ cargo b --example opcode-counter --features llvm19-1
2525
$ opt --load-pass-plugin=target/debug/examples/libopcode_counter.so --passes=opcode-counter-printer in.ll -S -o out.ll
2626
```
2727

@@ -33,7 +33,7 @@ achieved with simple LLVM passes.
3333
<summary><em>Execute the example</em></summary>
3434

3535
```shell
36-
$ cargo b --example inject-printf --features llvm10-0
36+
$ cargo b --example inject-printf --features llvm19-1
3737
$ opt --load-pass-plugin=target/debug/examples/libinject_printf.so --passes=inject-func-call in.ll -S -o out.ll
3838
```
3939

@@ -45,7 +45,7 @@ achieved with simple LLVM passes.
4545
<summary><em>Execute the example</em></summary>
4646

4747
```shell
48-
$ cargo b --example static-call-counter --features llvm10-0
48+
$ cargo b --example static-call-counter --features llvm19-1
4949
$ opt --load-pass-plugin=target/debug/examples/libstatic_call_counter.so --passes=static-cc-printer in.ll -S -o out.ll
5050
```
5151

@@ -57,7 +57,7 @@ achieved with simple LLVM passes.
5757
<summary><em>Execute the example</em></summary>
5858

5959
```shell
60-
$ cargo b --example string-obf --features llvm10-0
60+
$ cargo b --example string-obf --features llvm19-1
6161
$ opt --load-pass-plugin=target/debug/examples/libstring_obf.so --passes=string-obfuscator-pass in.ll -S -o out.ll
6262
```
6363

llvm-plugin/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ readme = "README.md"
1212
repository = "https://github.com/jamesmth/llvm-plugin-rs"
1313

1414
[package.metadata.docs.rs]
15-
features = ["llvm15-0"] # any version >10 will do
15+
features = ["llvm15-0"]
1616
rustdoc-args = ["--cfg", "docsrs"]
1717

1818
[features]
@@ -24,7 +24,6 @@ macros = ["llvm-plugin-macros"]
2424
win-link-opt = []
2525
win-link-lld = []
2626

27-
llvm10-0 = ["inkwell/llvm10-0-no-llvm-linking"]
2827
llvm11-0 = ["inkwell/llvm11-0-no-llvm-linking"]
2928
llvm12-0 = ["inkwell/llvm12-0-no-llvm-linking"]
3029
llvm13-0 = ["inkwell/llvm13-0-no-llvm-linking"]

llvm-plugin/build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ mod llvm_sys {
198198
}
199199

200200
fn llvm_version_from_features() -> (u32, u32) {
201-
if cfg!(feature = "llvm10-0") {
202-
(10, 0)
203-
} else if cfg!(feature = "llvm11-0") {
201+
if cfg!(feature = "llvm11-0") {
204202
(11, 0)
205203
} else if cfg!(feature = "llvm12-0") {
206204
(12, 0)

llvm-plugin/cpp/ffi.cc

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ enum class OptimizationLevel { kO0, kO1, kO2, kO3, kOs, kOz };
2525

2626
namespace {
2727
auto getFFIOptimizationLevel(LlvmOptLevel Opt) -> OptimizationLevel {
28-
#if defined(LLVM_VERSION_MAJOR) && (LLVM_VERSION_MAJOR == 10)
29-
if (Opt == LlvmOptLevel::O0) {
30-
return OptimizationLevel::kO0;
31-
}
32-
if (Opt == LlvmOptLevel::O1) {
33-
return OptimizationLevel::kO1;
34-
}
35-
if (Opt == LlvmOptLevel::O2) {
36-
return OptimizationLevel::kO2;
37-
}
38-
if (Opt == LlvmOptLevel::O3) {
39-
return OptimizationLevel::kO3;
40-
}
41-
if (Opt == LlvmOptLevel::Os) {
42-
return OptimizationLevel::kOs;
43-
}
44-
#else
4528
// Starting from LLVM-11, llvm::OptimizationLevel::Ox is no longer
4629
// an enum but a global static. Using these global statics on Windows
4730
// would not compile, because an LLVM plugin links to opt.exe. The
@@ -64,7 +47,6 @@ auto getFFIOptimizationLevel(LlvmOptLevel Opt) -> OptimizationLevel {
6447
if (Opt.getSpeedupLevel() == 2 && Opt.getSizeLevel() == 2) {
6548
return OptimizationLevel::kOz;
6649
}
67-
#endif
6850
return OptimizationLevel::kOz;
6951
}
7052
} // namespace
@@ -127,7 +109,6 @@ auto passBuilderAddFullLinkTimeOptimizationEarlyEPCallback(
127109
}
128110
#endif
129111

130-
#if defined(LLVM_VERSION_MAJOR) && (LLVM_VERSION_MAJOR >= 11)
131112
auto passBuilderAddOptimizerLastEPCallback(
132113
llvm::PassBuilder &Builder, const void *DataPtr,
133114
void (*Deleter)(const void *),
@@ -142,7 +123,6 @@ auto passBuilderAddOptimizerLastEPCallback(
142123
Callback(Data.get(), PassManager, OptFFI);
143124
});
144125
}
145-
#endif
146126

147127
#if defined(LLVM_VERSION_MAJOR) && (LLVM_VERSION_MAJOR >= 15)
148128
auto passBuilderAddOptimizerEarlyEPCallback(

llvm-plugin/src/ffi.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ extern "C" {
4646
cb_sys: extern "C" fn(*const c_void, *mut c_void, crate::OptimizationLevel),
4747
);
4848

49-
#[cfg(any(
50-
feature = "llvm11-0",
51-
feature = "llvm12-0",
52-
feature = "llvm13-0",
53-
feature = "llvm14-0",
54-
feature = "llvm15-0",
55-
feature = "llvm16-0",
56-
feature = "llvm17-0",
57-
feature = "llvm18-1",
58-
feature = "llvm19-1",
59-
))]
6049
pub(crate) fn passBuilderAddOptimizerLastEPCallback(
6150
builder: *mut c_void,
6251
cb: *const c_void,

llvm-plugin/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,6 @@ pub struct PassPluginLibraryInfo {
308308
#[cfg(feature = "macros")]
309309
pub use llvm_plugin_macros::*;
310310

311-
// See https://github.com/jamesmth/llvm-plugin-rs/issues/3
312-
#[cfg(all(target_os = "windows", feature = "llvm10-0"))]
313-
compile_error!("LLVM 10 not supported on Windows");
314-
315311
#[cfg(all(
316312
target_os = "windows",
317313
any(

llvm-plugin/src/pass_builder.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -420,17 +420,6 @@ impl PassBuilder {
420420
///
421421
/// This extension point allows adding passes that run after everything
422422
/// else.
423-
#[cfg(any(
424-
feature = "llvm11-0",
425-
feature = "llvm12-0",
426-
feature = "llvm13-0",
427-
feature = "llvm14-0",
428-
feature = "llvm15-0",
429-
feature = "llvm16-0",
430-
feature = "llvm17-0",
431-
feature = "llvm18-1",
432-
feature = "llvm19-1",
433-
))]
434423
pub fn add_optimizer_last_ep_callback<T>(&mut self, cb: T)
435424
where
436425
T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

tests/plugins/plugin1/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ crate-type = ["cdylib"]
1010
default = ["target-all"]
1111
win-link-opt = ["llvm-plugin/win-link-opt"]
1212

13-
llvm10-0 = ["llvm-plugin/llvm10-0"]
1413
llvm11-0 = ["llvm-plugin/llvm11-0"]
1514
llvm12-0 = ["llvm-plugin/llvm12-0"]
1615
llvm13-0 = ["llvm-plugin/llvm13-0"]

0 commit comments

Comments
 (0)