From 6398b4725caa3867e5f02f344c82a0da53cb750a Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 16 Oct 2020 17:37:52 -0400 Subject: [PATCH] cmd/link: put C static symbols in the symbol table We don't put Go static symbols in the symbol table, as they are always compiler-generated (there is no way to define a static symbol in user code in Go). We retain static symbols in assembly code, as it may be user-defined. Also retain static symbols in C. Change-Id: Ie0425bb4df33f183857b1fd5ba4b2bdfdc497571 Reviewed-on: https://go-review.googlesource.com/c/go/+/263259 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Than McIntosh --- src/cmd/link/internal/ld/symtab.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go index dd82963a41..245a320493 100644 --- a/src/cmd/link/internal/ld/symtab.go +++ b/src/cmd/link/internal/ld/symtab.go @@ -518,7 +518,7 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind { nsym := loader.Sym(ldr.NSym()) symGroupType := make([]sym.SymKind, nsym) for s := loader.Sym(1); s < nsym; s++ { - if !ctxt.IsExternal() && ldr.IsFileLocal(s) && !ldr.IsFromAssembly(s) { + if !ctxt.IsExternal() && ldr.IsFileLocal(s) && !ldr.IsFromAssembly(s) && !ldr.IsExternal(s) { ldr.SetAttrNotInSymbolTable(s, true) } if !ldr.AttrReachable(s) || ldr.AttrSpecial(s) || (ldr.SymType(s) != sym.SRODATA && ldr.SymType(s) != sym.SGOFUNC) { -- 2.50.0