cmd/link: remove obsolete duffzero/duffcopy code

Change-Id: Icf94808a6c137c3c114a0be1f8da85ee5f68d58e
Reviewed-on: https://go-review.googlesource.com/c/go/+/740740
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Keith Randall 2026-01-30 14:12:25 -08:00 committed by Gopher Robot
parent 28fbdf7acb
commit f766b8da6c

View file

@ -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 {