mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: put shlib ".type" functions in internal ABI
These functions are compiler generated, and as such are only available in the internal ABI. Doing this avoids generating an alias symbol. Doing that avoids confusion between unmangled and mangled type symbols. Fixes #30768 Change-Id: I197a5ba6403aac11989ffa951dbe35bd0506de91 Reviewed-on: https://go-review.googlesource.com/c/go/+/186077 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
24a6ca09d0
commit
37b194a422
4 changed files with 50 additions and 2 deletions
|
|
@ -1902,7 +1902,15 @@ func ldshlibsyms(ctxt *Link, shlib string) {
|
|||
if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
|
||||
continue
|
||||
}
|
||||
lsym := ctxt.Syms.Lookup(elfsym.Name, 0)
|
||||
|
||||
// Symbols whose names start with "type." are compiler
|
||||
// generated, so make functions with that prefix internal.
|
||||
ver := 0
|
||||
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC && strings.HasPrefix(elfsym.Name, "type.") {
|
||||
ver = sym.SymVerABIInternal
|
||||
}
|
||||
|
||||
lsym := ctxt.Syms.Lookup(elfsym.Name, ver)
|
||||
// Because loadlib above loads all .a files before loading any shared
|
||||
// libraries, any non-dynimport symbols we find that duplicate symbols
|
||||
// already loaded should be ignored (the symbols from the .a files
|
||||
|
|
@ -1930,7 +1938,7 @@ func ldshlibsyms(ctxt *Link, shlib string) {
|
|||
// the ABIs are actually different. We might have to
|
||||
// mangle Go function names in the .so to include the
|
||||
// ABI.
|
||||
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC {
|
||||
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC && ver == 0 {
|
||||
alias := ctxt.Syms.Lookup(elfsym.Name, sym.SymVerABIInternal)
|
||||
if alias.Type != 0 {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue