From f766b8da6c6e78bfbd549931ad44e0a2386a32ba Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Fri, 30 Jan 2026 14:12:25 -0800 Subject: [PATCH] cmd/link: remove obsolete duffzero/duffcopy code Change-Id: Icf94808a6c137c3c114a0be1f8da85ee5f68d58e Reviewed-on: https://go-review.googlesource.com/c/go/+/740740 Reviewed-by: Keith Randall Reviewed-by: Jorropo LUCI-TryBot-Result: Go LUCI Auto-Submit: Keith Randall Reviewed-by: Michael Pratt --- src/cmd/link/internal/arm64/asm.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/cmd/link/internal/arm64/asm.go b/src/cmd/link/internal/arm64/asm.go index 7c4546fb17..e615bf52d0 100644 --- a/src/cmd/link/internal/arm64/asm.go +++ b/src/cmd/link/internal/arm64/asm.go @@ -1267,9 +1267,6 @@ func gensymlate(ctxt *ld.Link, ldr *loader.Loader) { // addend. For large symbols, we generate "label" symbols in the middle, so // that relocations can target them with smaller addends. // On Windows, we only get 21 bits, again (presumably) signed. - // Also, on Windows (always) and Darwin (for very large binaries), the external - // linker doesn't support CALL relocations with addend, so we generate "label" - // symbols for functions of which we can target the middle (Duff's devices). if !ctxt.IsDarwin() && !ctxt.IsWindows() || !ctxt.IsExternal() { return } @@ -1298,14 +1295,6 @@ func gensymlate(ctxt *ld.Link, ldr *loader.Loader) { } } - // Generate symbol names for every offset we need in duffcopy/duffzero (only 64 each). - if s := ldr.Lookup("runtime.duffcopy", sym.SymVerABIInternal); s != 0 && ldr.AttrReachable(s) { - addLabelSyms(s, 8, 8*64) - } - if s := ldr.Lookup("runtime.duffzero", sym.SymVerABIInternal); s != 0 && ldr.AttrReachable(s) { - addLabelSyms(s, 4, 4*64) - } - if ctxt.IsDarwin() { big := false for _, seg := range ld.Segments { @@ -1325,8 +1314,7 @@ func gensymlate(ctxt *ld.Link, ldr *loader.Loader) { } t := ldr.SymType(s) if t.IsText() { - // Except for Duff's devices (handled above), we don't - // target the middle of a function. + // We don't target the middle of a function. continue } if t >= sym.SDWARFSECT { -- 2.52.0