aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/noder.go13
-rw-r--r--src/internal/syscall/unix/empty.s5
-rw-r--r--src/runtime/testdata/testprog/empty.s5
3 files changed, 12 insertions, 11 deletions
diff --git a/src/cmd/compile/internal/gc/noder.go b/src/cmd/compile/internal/gc/noder.go
index b9849e7a84..23c9539b0a 100644
--- a/src/cmd/compile/internal/gc/noder.go
+++ b/src/cmd/compile/internal/gc/noder.go
@@ -497,7 +497,18 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
}
} else {
if pure_go || strings.HasPrefix(f.funcname(), "init.") {
- yyerrorl(f.Pos, "missing function body")
+ // Linknamed functions are allowed to have no body. Hopefully
+ // the linkname target has a body. See issue 23311.
+ isLinknamed := false
+ for _, n := range p.linknames {
+ if f.funcname() == n.local {
+ isLinknamed = true
+ break
+ }
+ }
+ if !isLinknamed {
+ yyerrorl(f.Pos, "missing function body")
+ }
}
}
diff --git a/src/internal/syscall/unix/empty.s b/src/internal/syscall/unix/empty.s
deleted file mode 100644
index 717189c658..0000000000
--- a/src/internal/syscall/unix/empty.s
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This exists solely so we can linkname in symbols from syscall.
diff --git a/src/runtime/testdata/testprog/empty.s b/src/runtime/testdata/testprog/empty.s
deleted file mode 100644
index c5aa6f8a54..0000000000
--- a/src/runtime/testdata/testprog/empty.s
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This exists solely so we can linkname in symbols from runtime.