From a7a74c79fa09d918703083f35d22c77351bfc992 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Mon, 13 Aug 2012 11:19:52 -0700 Subject: [PATCH] rustc: Emit index of tydescs by addrspace. --- src/rustc/middle/trans/base.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 8aaf50dd52f..90b314aac30 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -657,6 +657,16 @@ fn emit_tydescs(ccx: @crate_ctxt) { llvm::LLVMSetInitializer(gvar, tydesc); llvm::LLVMSetGlobalConstant(gvar, True); lib::llvm::SetLinkage(gvar, lib::llvm::InternalLinkage); + + // Index tydesc by addrspace. + let llty = T_ptr(ccx.tydesc_type); + let addrspace_name = #fmt("_gc_addrspace_metadata_%u", + ti.addrspace as uint); + let addrspace_gvar = str::as_c_str(addrspace_name, |buf| { + llvm::LLVMAddGlobal(ccx.llmod, llty, buf) + }); + lib::llvm::SetLinkage(addrspace_gvar, lib::llvm::InternalLinkage); + llvm::LLVMSetInitializer(addrspace_gvar, gvar); }; }