From 40570eb49eb1cb688637cb58d14cdb9664ea1039 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 11 May 2015 12:24:12 -0700 Subject: rustc_llvm: Expose setting more DLL storage classes Currently only `dllexport` is used, but more integration will require using `dllimport` as well. --- src/rustllvm/RustWrapper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/rustllvm/RustWrapper.cpp') diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 375c5fc746c..5a2d1ec4207 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -837,9 +837,10 @@ LLVMRustArchiveChildData(Archive::Child *child, size_t *size) { } extern "C" void -LLVMRustSetDLLExportStorageClass(LLVMValueRef Value) { +LLVMRustSetDLLStorageClass(LLVMValueRef Value, + GlobalValue::DLLStorageClassTypes Class) { GlobalValue *V = unwrap(Value); - V->setDLLStorageClass(GlobalValue::DLLExportStorageClass); + V->setDLLStorageClass(Class); } // Note that the two following functions look quite similar to the -- cgit 1.4.1-3-g733a5 From 847c8520b14e3ae9aec26a33f70750a071d3f18d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 11 May 2015 21:07:38 -0700 Subject: rustc_llvm: Don't export constants across dlls For imports of constants across DLLs to work on Windows it *requires* that the import be marked with `dllimport` (unlike functions where the marker is optional, but strongly recommended). This currently isn't working for importing FFI constants across boundaries, however, so the one constant exported from `rustc_llvm.dll` is now a function to be called instead. --- src/librustc_llvm/lib.rs | 2 +- src/librustc_trans/trans/debuginfo/mod.rs | 2 +- src/rustllvm/RustWrapper.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/rustllvm/RustWrapper.cpp') diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 54031e4b04d..3e575785d27 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -1771,7 +1771,7 @@ extern { Dialect: c_uint) -> ValueRef; - pub static LLVMRustDebugMetadataVersion: u32; + pub fn LLVMRustDebugMetadataVersion() -> u32; pub fn LLVMRustAddModuleFlag(M: ModuleRef, name: *const c_char, diff --git a/src/librustc_trans/trans/debuginfo/mod.rs b/src/librustc_trans/trans/debuginfo/mod.rs index e4312b669ad..4e5407016ba 100644 --- a/src/librustc_trans/trans/debuginfo/mod.rs +++ b/src/librustc_trans/trans/debuginfo/mod.rs @@ -193,7 +193,7 @@ pub fn finalize(cx: &CrateContext) { // Prevent bitcode readers from deleting the debug info. let ptr = "Debug Info Version\0".as_ptr(); llvm::LLVMRustAddModuleFlag(cx.llmod(), ptr as *const _, - llvm::LLVMRustDebugMetadataVersion); + llvm::LLVMRustDebugMetadataVersion()); }; } diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 5a2d1ec4207..66db7326d21 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -233,7 +233,9 @@ DIT unwrapDI(LLVMMetadataRef ref) { return DIT(ref ? unwrap(ref) : NULL); } -extern "C" const uint32_t LLVMRustDebugMetadataVersion = DEBUG_METADATA_VERSION; +extern "C" const uint32_t LLVMRustDebugMetadataVersion() { + return DEBUG_METADATA_VERSION; +} extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M, const char *name, -- cgit 1.4.1-3-g733a5