]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj: replace obj.Addrel func with LSym.AddRel method
authorRuss Cox <rsc@golang.org>
Tue, 5 Nov 2024 18:33:17 +0000 (13:33 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 7 Nov 2024 12:17:10 +0000 (12:17 +0000)
commit5b20eec8a0eb3bd4681e315c0c4023c5164ea7b9
tree184613d170d137337c65c238153caafe4ececa21
parent4ce8c0604ee1c36c221b1a3d767dfa131d5cce8c
cmd/internal/obj: replace obj.Addrel func with LSym.AddRel method

The old API was to do

r := obj.AddRel(sym)
r.Type = this
r.Off = that
etc

The new API is:

sym.AddRel(ctxt, obj.Reloc{Type: this: Off: that, etc})

This new API is more idiomatic and avoids ever having relocations
that are only partially constructed. Most importantly, it sets up
for sym.AddRel being able to check relocation validity in the future.
(Passing ctxt is for use in validity checking.)

Passes golang.org/x/tools/cmd/toolstash/buildall.

Change-Id: I042ea76e61bb3bf6402f98ca11291a13f4799972
Reviewed-on: https://go-review.googlesource.com/c/go/+/625616
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
25 files changed:
src/cmd/compile/internal/dwarfgen/dwarf.go
src/cmd/compile/internal/pkginit/init.go
src/cmd/compile/internal/reflectdata/map_noswiss.go
src/cmd/compile/internal/reflectdata/map_swiss.go
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/rttype/rttype.go
src/cmd/compile/internal/ssagen/pgen.go
src/cmd/compile/internal/staticinit/sched.go
src/cmd/compile/internal/walk/expr.go
src/cmd/internal/obj/arm/asm5.go
src/cmd/internal/obj/arm64/asm7.go
src/cmd/internal/obj/data.go
src/cmd/internal/obj/dwarf.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/loong64/asm.go
src/cmd/internal/obj/mips/asm0.go
src/cmd/internal/obj/mips/obj0.go
src/cmd/internal/obj/objfile_test.go
src/cmd/internal/obj/ppc64/asm9.go
src/cmd/internal/obj/ppc64/obj9.go
src/cmd/internal/obj/riscv/obj.go
src/cmd/internal/obj/s390x/asmz.go
src/cmd/internal/obj/wasm/wasmobj.go
src/cmd/internal/obj/x86/asm6.go
src/cmd/internal/obj/x86/seh.go