]> Cypherpunks repositories - gostls13.git/commit
cmd/link: mangle symbol ABI name for linker-generated symbols
authorCherry Mui <cherryyz@google.com>
Mon, 11 Apr 2022 22:57:44 +0000 (18:57 -0400)
committerCherry Mui <cherryyz@google.com>
Tue, 12 Apr 2022 23:24:32 +0000 (23:24 +0000)
commit9c7f0b1ccd37b6f41a5326c451c633c92e93870c
tree0567a5f6f00a0e81c6645ed4ba525486d49d348d
parent1f97f960e76d1b722b7c4a0dd61e9b20ec6c2a37
cmd/link: mangle symbol ABI name for linker-generated symbols

The ABI mangling code skips symbols that are not loaded from Go
objects. Usually that is fine, as other symbols don't need name
mangling. But trampolines are linker generated and have the same
symbol version (ABI) as the underlying symbol. We need to avoid
symbol name collisions for trampolines, such as a trampoline to
f<ABI0> and a trampoline to f<ABIInternal>. We could explicitly
incorportate the ABI into the trampoline name. But as we already
have the name mangling scheme we could just use that.

The original code excludes external symbols probably because
symbols from C object don't need mangling. But a C symbol and a
Go symbol shouldn't have same name, and so the condition won't
apply.

Also exclude static symbols as they don't need mangling.

Change-Id: I298eb1d64bc0c3da0154f0146b95c4d26ca2f47a
Reviewed-on: https://go-review.googlesource.com/c/go/+/399894
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/symtab.go