]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: mangle function name with ABI on Mach-O
authorCherry Zhang <cherryyz@google.com>
Sat, 3 Apr 2021 01:04:31 +0000 (21:04 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 5 Apr 2021 16:37:20 +0000 (16:37 +0000)
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>
src/cmd/link/internal/ld/macho.go

index 3630e67c25d60c7b1fddb843a57b8edb80c8884b..872144e723e30d2f938a207c7d8c0758fc1eecbf 100644 (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