diff options
| author | bors <bors@rust-lang.org> | 2018-08-07 02:12:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-07 02:12:35 +0000 |
| commit | 11a902431b8e66da8486b3b9a2d8527746c6ab1a (patch) | |
| tree | 18d8ba46199784701fbd8f0a8cbaf5bc9902a0dc /src/rustllvm/RustWrapper.cpp | |
| parent | f9b9b6e078aa81c0faa064bf861e88001684765c (diff) | |
| parent | 3da7c65e92e212143bafdb4adf9cfb8054209a93 (diff) | |
| download | rust-11a902431b8e66da8486b3b9a2d8527746c6ab1a.tar.gz rust-11a902431b8e66da8486b3b9a2d8527746c6ab1a.zip | |
Auto merge of #51007 - AstralSorcerer:master, r=nagisa
Make globals with private linkage unnamed. Fixes #50862. cc @oli-obk @nagisa
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 4bcb4fd7ad3..9b9c908ea52 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -12,6 +12,7 @@ #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" +#include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Instructions.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ObjectFile.h" @@ -116,6 +117,15 @@ LLVMRustGetOrInsertGlobal(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty) { return wrap(unwrap(M)->getOrInsertGlobal(Name, unwrap(Ty))); } +extern "C" LLVMValueRef +LLVMRustInsertPrivateGlobal(LLVMModuleRef M, LLVMTypeRef Ty) { + return wrap(new GlobalVariable(*unwrap(M), + unwrap(Ty), + false, + GlobalValue::PrivateLinkage, + nullptr)); +} + extern "C" LLVMTypeRef LLVMRustMetadataTypeInContext(LLVMContextRef C) { return wrap(Type::getMetadataTy(*unwrap(C))); } |
