From 98989f2a74aa53e9ea64c41c94e66f02beceecc9 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Tue, 21 Sep 2021 14:35:37 -0400 Subject: cmd/compile, cmd/link: avoid ABI aliases In the past we introduced ABI aliases, in preparation for ABI wrappers. Now that we have ABI wrappers implemented, we don't need ABI aliases. If ABI wrappers are not enabled, ABI0 and ABIInternal are actually identical, so we can resolve symbol references without distinguish them. This CL does so by normalizing ABIInternal to ABI0 at link time. This way, we no longer need to generate ABI aliases. This CL doesn't clean up everything related to ABI aliases, which will be done in followup CLs. Change-Id: I5b5db43370d29b8ad153078c70a853e3263ae6f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/351271 Trust: Cherry Mui Run-TryBot: Cherry Mui TryBot-Result: Go Bot Reviewed-by: Than McIntosh --- src/cmd/link/internal/ld/deadcode.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/cmd/link/internal/ld/deadcode.go') diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go index dd5dafc21b..0221024d56 100644 --- a/src/cmd/link/internal/ld/deadcode.go +++ b/src/cmd/link/internal/ld/deadcode.go @@ -96,8 +96,10 @@ func (d *deadcodePass) init() { for _, name := range names { // Mark symbol as a data/ABI0 symbol. d.mark(d.ldr.Lookup(name, 0), 0) - // Also mark any Go functions (internal ABI). - d.mark(d.ldr.Lookup(name, sym.SymVerABIInternal), 0) + if abiInternalVer != 0 { + // Also mark any Go functions (internal ABI). + d.mark(d.ldr.Lookup(name, abiInternalVer), 0) + } } // All dynamic exports are roots. @@ -327,8 +329,8 @@ func deadcode(ctxt *Link) { d.init() d.flood() - methSym := ldr.Lookup("reflect.Value.Method", sym.SymVerABIInternal) - methByNameSym := ldr.Lookup("reflect.Value.MethodByName", sym.SymVerABIInternal) + methSym := ldr.Lookup("reflect.Value.Method", abiInternalVer) + methByNameSym := ldr.Lookup("reflect.Value.MethodByName", abiInternalVer) if ctxt.DynlinkingGo() { // Exported methods may satisfy interfaces we don't know -- cgit v1.3-5-g9baa