diff options
| author | Colin Pronovost <colin.pron@live.com> | 2018-05-23 15:19:07 -0400 |
|---|---|---|
| committer | Colin Pronovost <colin.pron@live.com> | 2018-07-31 23:45:18 -0400 |
| commit | 02190f397ecb32bca42e5b631dc235381d01b377 (patch) | |
| tree | d160894619868dd7116a5bfdff9fef44e2c8a042 /src/rustllvm/RustWrapper.cpp | |
| parent | e94df4acb4c3f42fdc224a7164b63a99240add1e (diff) | |
| download | rust-02190f397ecb32bca42e5b631dc235381d01b377.tar.gz rust-02190f397ecb32bca42e5b631dc235381d01b377.zip | |
Make globals with private linkage unnamed. Fixes #50862.
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 f2b5297285c..ce865dfbec2 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))); } |
