From 674b506bb215a4949b343929337428e79b9ac327 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 30 Aug 2018 22:38:21 +0200 Subject: [PATCH] Replace compiler hack for sync package with //go:linkname --- compiler.go | 5 ----- src/runtime/sync.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/runtime/sync.go diff --git a/compiler.go b/compiler.go index dee6c5eb..5b48e7b1 100644 --- a/compiler.go +++ b/compiler.go @@ -1325,11 +1325,6 @@ func (c *Compiler) parseBuiltin(frame *Frame, args []ssa.Value, callName string) } func (c *Compiler) parseFunctionCall(frame *Frame, args []ssa.Value, llvmFn llvm.Value, blocking bool, parentHandle llvm.Value) (llvm.Value, error) { - if llvmFn.Name() == "sync.runtime_registerPoolCleanup" || llvmFn.Name() == "sync.runtime_notifyListCheck" { - // Ignore these functions calls for now, as a hack. - // TODO: implement //go:linkname. - return llvm.Value{}, nil - } var params []llvm.Value if blocking { if parentHandle.IsNil() { diff --git a/src/runtime/sync.go b/src/runtime/sync.go new file mode 100644 index 00000000..765ecba2 --- /dev/null +++ b/src/runtime/sync.go @@ -0,0 +1,13 @@ +package runtime + +// This file contains support code for the sync package. + +//go:linkname registerPoolCleanup sync.runtime_registerPoolCleanup +func registerPoolCleanup(cleanup func()) { + // Ignore. +} + +//go:linkname notifyListCheck sync.runtime_notifyListCheck +func notifyListCheck(size uintptr) { + // Ignore. +}