From: Ian Lance Taylor Date: Mon, 11 Jun 2018 23:46:23 +0000 (-0700) Subject: cmd/link: treat cgo exported symbols as C symbols X-Git-Tag: go1.11beta1~152 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f861f66d1db9f1abcdf91fc54d0d84bd3f9e9310;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox --- diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go index 50ac6d0743..7b7f7068e7 100644 --- a/src/cmd/link/internal/ld/pcln.go +++ b/src/cmd/link/internal/ld/pcln.go @@ -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 }