irgen: Create functions instead of global variables for builtin hash and equal algorithms. These are in fact functions, and have function type, so it is invalid to represent them using global variables. llvm-svn: 304689 GitOrigin-RevId: 08b4728f5194cd03b1100b00d4d08ac2d468a400
diff --git a/irgen/typemap.go b/irgen/typemap.go index 2ae1a4e..7da752e 100644 --- a/irgen/typemap.go +++ b/irgen/typemap.go
@@ -151,9 +151,9 @@ hashDescriptorName := hashFnName + "_descriptor" equalFnName := "__go_type_equal_" + typeAlgs.Name equalDescriptorName := equalFnName + "_descriptor" - typeAlgs.hash = llvm.AddGlobal(tm.module, tm.hashFnType, hashFnName) + typeAlgs.hash = llvm.AddFunction(tm.module, hashFnName, tm.hashFnType) typeAlgs.hashDescriptor = llvm.AddGlobal(tm.module, tm.funcValType, hashDescriptorName) - typeAlgs.equal = llvm.AddGlobal(tm.module, tm.equalFnType, equalFnName) + typeAlgs.equal = llvm.AddFunction(tm.module, equalFnName, tm.equalFnType) typeAlgs.equalDescriptor = llvm.AddGlobal(tm.module, tm.funcValType, equalDescriptorName) }