public static LLVMValueRef GetSymbolValuePointer(LLVMModuleRef module, ISymbolNode symbol, NameMangler nameMangler, bool objectWriterUse = false) { if (symbol is WebAssemblyMethodCodeNode) { ThrowHelper.ThrowInvalidProgramException(); } string symbolAddressGlobalName = symbol.GetMangledName(nameMangler) + "___SYMBOL"; LLVMValueRef symbolAddress; if (s_symbolValues.TryGetValue(symbolAddressGlobalName, out symbolAddress)) { return(symbolAddress); } var intPtrType = LLVMTypeRef.CreatePointer(LLVMTypeRef.Int32, 0); var myGlobal = module.AddGlobalInAddressSpace(intPtrType, symbolAddressGlobalName, 0); myGlobal.IsGlobalConstant = true; myGlobal.Linkage = LLVMLinkage.LLVMInternalLinkage; s_symbolValues.Add(symbolAddressGlobalName, myGlobal); return(myGlobal); }