]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: treat cgo exported symbols as C symbols
authorIan Lance Taylor <iant@golang.org>
Mon, 11 Jun 2018 23:46:23 +0000 (16:46 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 12 Jun 2018 01:25:11 +0000 (01:25 +0000)
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: Russ Cox <rsc@golang.org>
src/cmd/link/internal/ld/pcln.go

index 50ac6d0743996a2d9b7261d23053fac05f98aa5d..7b7f7068e74118f4c6f5ff59b02cd91dfd0efdfa 100644 (file)
@@ -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
 }