diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0ce5085ac8f617f74ad556f5af3d2ae50209ef37..d30bd49376b52c2c00baed9efb0efa6cffd46852 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ image: rust:1 variables: - LLVM_SYS_201_FFI_WORKAROUND: "YES" + LLVM_SYS_211_FFI_WORKAROUND: "YES" .build_definition: script: &default_build_script @@ -18,12 +18,12 @@ variables: test:alpine-rustc-llvm-tarball: image: rust:alpine3.20 variables: - LLVM_SYS_201_PREFIX: /usr/lib/llvm-rustc + LLVM_SYS_211_PREFIX: /usr/lib/llvm-rustc # Commit in github.com/rust-lang/rust which corresponds to the newest LLVM. # Rust CI hosts tarballs with their LLVM builds, which are more up to date # than packages in distros where we can't use LLVM's nightly packages # (e.g. Alpine), which are usually one version behind. - RUSTC_COMMIT: ce36a966c79e109dabeef7a47fe68e5294c6d71e + RUSTC_COMMIT: dc0bae1db725fbba8524f195f74f680995fd549e before_script: # LLVM from Rust CI, even for the musl targets, is linked against libgcc_s # and libstdc++, not compiler-rt nor libc++. @@ -43,7 +43,7 @@ test:debian: - chmod +x llvm.sh # Workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1043101 - echo >> /etc/apt/sources.list - - ./llvm.sh 20 all + - ./llvm.sh 21 all script: - *default_build_script # LLJIT uses `dlopen()` to open the shared libLLVM library. Therefore, we diff --git a/Cargo.toml b/Cargo.toml index f5f97aa337316951c33959ef18fb3f1e1773ddc1..bb1441274a3603fa81bc1481329f815a56ca1f06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,9 @@ readme = "README.md" license = "MIT" keywords = ["bindings", "llvm"] categories = ["external-ffi-bindings"] -links = "llvm-20" +links = "llvm-21" name = "llvm-sys" -version = "201.0.1" +version = "211.0.0-rc1" authors = ["Peter Marheine "] build = "build.rs" diff --git a/README.md b/README.md index f1949964dcfd259c382d0e879c37cc63d5109131..f88d8de7f3e11950c723308d590296ef5a20bb0c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Rust bindings to LLVM's C API. ```toml [dependencies] -llvm-sys = "201.0.0-rc1" +llvm-sys = "211.0.0-rc1" ``` There must be a compatible version of LLVM available. By default `llvm-sys` @@ -118,7 +118,7 @@ compile it yourself. `LLVM_SYS__PREFIX` specifies the install prefix for a compiled and installed copy of the libraries, where `` is the major version of -`llvm-sys` (for example, `LLVM_SYS_201_PREFIX`). The llvm-sys build scripts +`llvm-sys` (for example, `LLVM_SYS_211_PREFIX`). The llvm-sys build scripts will look for a `llvm-config` binary in the directory `/bin/` in addition to searching for a copy on `$PATH`, and verify that the LLVM version reported by `llvm-config` is compatible with the current crate version. diff --git a/src/core.rs b/src/core.rs index 112c6061312670df59ac403de962311d3b1ce1e0..449ca404a39c813507185ecbcddb878dfc70ea5b 100644 --- a/src/core.rs +++ b/src/core.rs @@ -656,6 +656,11 @@ extern "C" { ) -> LLVMValueRef; pub fn LLVMIsConstantString(c: LLVMValueRef) -> LLVMBool; pub fn LLVMGetAsString(C: LLVMValueRef, Length: *mut ::libc::size_t) -> *const ::libc::c_char; + /// Get the raw, underlying bytes of the given constant data sequential. + /// + /// This is the same as LLVMGetAsString except it works for all constant data + /// sequentials, not just i8 arrays. + pub fn LLVMGetRawDataValues(c: LLVMValueRef, SizeInBytes: usize) -> *const ::libc::c_char; pub fn LLVMConstStructInContext( C: LLVMContextRef, ConstantVals: *mut LLVMValueRef, @@ -682,6 +687,16 @@ extern "C" { ConstantVals: *mut LLVMValueRef, Length: u64, ) -> LLVMValueRef; + /// Create a ConstantDataArray from raw values. + /// + /// ElementTy must be one of i8, i16, i32, i64, half, bfloat, float, or double. + /// Data points to a contiguous buffer of raw values in the host endianness. The + /// element count is inferred from the element type and the data size in bytes. + pub fn LLVMConstDataArray( + ElementTy: LLVMTypeRef, + Data: *const ::libc::c_char, + SizeInBytes: usize, + ) -> LLVMValueRef; pub fn LLVMConstNamedStruct( StructTy: LLVMTypeRef, ConstantVals: *mut LLVMValueRef, @@ -1215,6 +1230,14 @@ extern "C" { pub fn LLVMDeleteInstruction(Inst: LLVMValueRef); pub fn LLVMGetInstructionOpcode(Inst: LLVMValueRef) -> LLVMOpcode; pub fn LLVMGetICmpPredicate(Inst: LLVMValueRef) -> LLVMIntPredicate; + /// Get whether or not an icmp instruction has the samesign flag. + /// + /// This is only valid for instructions that correspond to `llvm::ICmpInst`. + pub fn LLVMGetICmpSameSign(Inst: LLVMValueRef) -> LLVMBool; + /// Set the samesign flag on an icmp instruction. + /// + /// This is only valid for instructions that correspond to `llvm::ICmpInst`. + pub fn LLVMSetICmpSameSign(Inst: LLVMValueRef, SameSign: LLVMBool); pub fn LLVMGetFCmpPredicate(Inst: LLVMValueRef) -> LLVMRealPredicate; pub fn LLVMInstructionClone(Inst: LLVMValueRef) -> LLVMValueRef; pub fn LLVMIsATerminatorInst(Inst: LLVMValueRef) -> LLVMValueRef; diff --git a/src/debuginfo.rs b/src/debuginfo.rs index 38ef6dc7792d96288fc64f0b5b3f918873f8eb4b..e99a0cbfa28a5a5a25e445ec154758d2e1677da3 100644 --- a/src/debuginfo.rs +++ b/src/debuginfo.rs @@ -161,6 +161,8 @@ pub enum LLVMMetadataKind { LLVMDIGenericSubrangeMetadataKind, LLVMDIArgListMetadataKind, LLVMDIAssignIDMetadataKind, + LLVMDISubrangeTypeMetadataKind, + LLVMDIFixedPointTypeMetadataKind, } pub type LLVMDWARFTypeEncoding = ::libc::c_uint; @@ -414,6 +416,16 @@ extern "C" { IsUnsigned: LLVMBool, ) -> LLVMMetadataRef; + /// Create debugging information entry for an enumerator of arbitrary precision. + pub fn LLVMDIBuilderCreateEnumeratorOfArbitraryPrecision( + Builder: LLVMDIBuilderRef, + Name: *const ::libc::c_char, + NameLen: ::libc::size_t, + SizeInBits: u64, + Words: *const u64, + IsUnsigned: LLVMBool, + ) -> LLVMMetadataRef; + /// Create debugging information entry for an enumeration. pub fn LLVMDIBuilderCreateEnumerationType( Builder: LLVMDIBuilderRef, @@ -457,6 +469,65 @@ extern "C" { NumSubscripts: ::libc::c_uint, ) -> LLVMMetadataRef; + /// Create debugging information entry for a set. + pub fn LLVMDIBuilderCreateSetType( + Builder: LLVMDIBuilderRef, + Scope: LLVMMetadataRef, + Name: *const ::libc::c_char, + NameLen: ::libc::size_t, + File: LLVMMetadataRef, + LineNumber: ::libc::c_uint, + SizeInBits: u64, + AlignInBits: u32, + BaseTy: LLVMMetadataRef, + ) -> LLVMMetadataRef; + + /// Create a descriptor for a subrange with dynamic bounds. + pub fn LLVMDIBuilderCreateSubrangeType( + Builder: LLVMDIBuilderRef, + Scope: LLVMMetadataRef, + Name: *const ::libc::c_char, + NameLen: ::libc::size_t, + LineNo: ::libc::c_uint, + File: LLVMMetadataRef, + SizeInBits: u64, + AlignInBits: u32, + Flags: LLVMDIFlags, + BaseTy: LLVMMetadataRef, + LowerBound: LLVMMetadataRef, + UpperBound: LLVMMetadataRef, + Stride: LLVMMetadataRef, + Bias: LLVMMetadataRef, + ) -> LLVMMetadataRef; + + /// Create debugging information entry for a dynamic array. + pub fn LLVMDIBuilderCreateDynamicArrayType( + Builder: LLVMDIBuilderRef, + Scope: LLVMMetadataRef, + Name: *const ::libc::c_char, + NameLen: ::libc::size_t, + LineNo: ::libc::c_uint, + File: LLVMMetadataRef, + Size: u64, + AlignInBits: u32, + Ty: LLVMMetadataRef, + Subscripts: LLVMMetadataRef, + NumSubscripts: ::libc::c_uint, + DataLocation: LLVMMetadataRef, + Associated: LLVMMetadataRef, + Allocated: LLVMMetadataRef, + Rank: LLVMMetadataRef, + BitStride: LLVMMetadataRef, + ) -> LLVMMetadataRef; + + /// Replace arrays. + pub fn LLVMReplaceArrays( + Builder: LLVMDIBuilderRef, + T: *mut LLVMMetadataRef, + Elements: *mut LLVMMetadataRef, + NumElements: ::libc::c_uint, + ); + /// Create debugging information entry for a vector type. pub fn LLVMDIBuilderCreateVectorType( Builder: LLVMDIBuilderRef, diff --git a/src/lib.rs b/src/lib.rs index 63195a4370ff7b0055fd10adec16ad54a6f31158..682a698a6773dbc388c1e4512f03a988e6e5c975 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -391,13 +391,6 @@ pub enum LLVMRealPredicate { LLVMRealPredicateTrue = 15, } -#[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum LLVMLandingPadClauseTy { - LLVMLandingPadCatch = 0, - LLVMLandingPadFilter = 1, -} - #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq)] pub enum LLVMThreadLocalMode { @@ -444,6 +437,12 @@ pub enum LLVMAtomicRMWBinOp { LLVMAtomicRMWBinOpUSubCond, /// Subtracts the value, clamping to zero. LLVMAtomicRMWBinOpUSubSat, + /// Sets the value if it's greater than the original using an floating + /// point comparison and return the old one. + LLVMAtomicRMWBinOpFMaximum, + /// Sets the value if it's smaller than the original using an floating + /// point comparison and return the old one. + LLVMAtomicRMWBinOpFMinimum, } #[repr(C)] diff --git a/src/lto.rs b/src/lto.rs index 7efddd9fe25da794aac4d248949fd76c30f1aa6e..1af55135c9882d6c7cad9181a904b8c37766682d 100644 --- a/src/lto.rs +++ b/src/lto.rs @@ -159,6 +159,17 @@ extern "C" { _mod: lto_module_t, index: ::libc::c_uint, ) -> lto_symbol_attributes; + /// Returns the number of asm undefined symbols in the object module. + /// + /// Available since before LTO API version 30. + pub fn lto_module_get_num_asm_undef_symbols(mod_: lto_module_t) -> ::libc::c_uint; + /// Returns the name of the ith asm undefined symbol in the object module. + /// + /// Available since before LTO API version 30. + pub fn lto_module_get_asm_undef_symbol_name( + mod_: lto_module_t, + index: ::libc::c_uint, + ) -> *const ::libc::c_char; /// Returns the module's linker options. /// /// The linker options may consist of multiple flags. It is the linker's