Commit f861f66d authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/link: treat cgo exported symbols as C symbols

Fixes #25827

Change-Id: I6736c3ac061ca32aac2eb68b01ba53a179d68cf4
Reviewed-on: https://go-review.googlesource.com/118076
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent d0d47bb9
......@@ -11,6 +11,7 @@ import (
"log"
"os"
"path/filepath"
"strings"
)
// iteration over encoded pcdata tables.
......@@ -159,13 +160,15 @@ func renumberfiles(ctxt *Link, files []*sym.Symbol, d *sym.Pcdata) {
*d = out
}
// onlycsymbol reports whether this is a cgo symbol provided by the
// runtime and only used from C code.
// onlycsymbol reports whether this is a symbol that is referenced by C code.
func onlycsymbol(s *sym.Symbol) bool {
switch s.Name {
case "_cgo_topofstack", "_cgo_panic", "crosscall2":
return true
}
if strings.HasPrefix(s.Name, "_cgoexp_") {
return true
}
return false
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment