1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:07:59 -07:00

cmd/link: mangle function name with ABI on Mach-O

This is not strictly necessary. But as we already do this on
ELF and PE, do it here as well.

Updates #40724.

Change-Id: Ie6e5211aba116634bc9ed82eb8d22a7fed3b7776
Reviewed-on: https://go-review.googlesource.com/c/go/+/307229
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Cherry Zhang 2021-04-02 21:04:31 -04:00
parent 9e3328e740
commit dcf85b30ba

View File

@ -1022,7 +1022,10 @@ func machosymtab(ctxt *Link) {
symstr.AddUint8('_')
// replace "·" as ".", because DTrace cannot handle it.
symstr.Addstring(strings.Replace(ldr.SymExtname(s), "·", ".", -1))
name := strings.Replace(ldr.SymExtname(s), "·", ".", -1)
name = mangleABIName(ldr, s, name)
symstr.Addstring(name)
if t := ldr.SymType(s); t == sym.SDYNIMPORT || t == sym.SHOSTOBJ || t == sym.SUNDEFEXT {
symtab.AddUint8(0x01) // type N_EXT, external symbol