rustc_llvm: Expose setting more DLL storage classes
Currently only `dllexport` is used, but more integration will require using `dllimport` as well.
This commit is contained in:
parent
2d5e5777fd
commit
40570eb49e
2 changed files with 21 additions and 3 deletions
|
@ -55,6 +55,7 @@ pub use self::CallConv::*;
|
||||||
pub use self::Visibility::*;
|
pub use self::Visibility::*;
|
||||||
pub use self::DiagnosticSeverity::*;
|
pub use self::DiagnosticSeverity::*;
|
||||||
pub use self::Linkage::*;
|
pub use self::Linkage::*;
|
||||||
|
pub use self::DLLStorageClassTypes::*;
|
||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
@ -123,6 +124,15 @@ pub enum DiagnosticSeverity {
|
||||||
Note,
|
Note,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub enum DLLStorageClassTypes {
|
||||||
|
DefaultStorageClass = 0,
|
||||||
|
DLLImportStorageClass = 1,
|
||||||
|
DLLExportStorageClass = 2,
|
||||||
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
flags Attribute : u32 {
|
flags Attribute : u32 {
|
||||||
const ZExt = 1 << 0,
|
const ZExt = 1 << 0,
|
||||||
|
@ -2075,7 +2085,8 @@ extern {
|
||||||
pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
|
pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
|
||||||
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
|
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
|
||||||
|
|
||||||
pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
|
pub fn LLVMRustSetDLLStorageClass(V: ValueRef,
|
||||||
|
C: DLLStorageClassTypes);
|
||||||
|
|
||||||
pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
|
pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
|
||||||
data: *mut *const c_char) -> c_int;
|
data: *mut *const c_char) -> c_int;
|
||||||
|
@ -2125,6 +2136,12 @@ pub fn SetLinkage(global: ValueRef, link: Linkage) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn SetDLLStorageClass(global: ValueRef, class: DLLStorageClassTypes) {
|
||||||
|
unsafe {
|
||||||
|
LLVMRustSetDLLStorageClass(global, class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn SetUnnamedAddr(global: ValueRef, unnamed: bool) {
|
pub fn SetUnnamedAddr(global: ValueRef, unnamed: bool) {
|
||||||
unsafe {
|
unsafe {
|
||||||
LLVMSetUnnamedAddr(global, unnamed as Bool);
|
LLVMSetUnnamedAddr(global, unnamed as Bool);
|
||||||
|
|
|
@ -837,9 +837,10 @@ LLVMRustArchiveChildData(Archive::Child *child, size_t *size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
LLVMRustSetDLLExportStorageClass(LLVMValueRef Value) {
|
LLVMRustSetDLLStorageClass(LLVMValueRef Value,
|
||||||
|
GlobalValue::DLLStorageClassTypes Class) {
|
||||||
GlobalValue *V = unwrap<GlobalValue>(Value);
|
GlobalValue *V = unwrap<GlobalValue>(Value);
|
||||||
V->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
|
V->setDLLStorageClass(Class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that the two following functions look quite similar to the
|
// Note that the two following functions look quite similar to the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue