cmd/link: adjust symkind comparisons in XCOFF code

This XCOFF symkind comparison broke when STYPE moved in CL 723580.
These comparisons are unmaintainable, but at least the new code
is no worse than the old code.

Change-Id: I1be9de6afdf1814aaadcd2105e6247a4b66b46fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/740200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Ian Lance Taylor 2026-01-28 23:28:09 -08:00 committed by Gopher Robot
parent baa6b1f2bf
commit 5593ea4634

View file

@ -952,7 +952,7 @@ func putaixsym(ctxt *Link, x loader.Sym, t SymbolType) {
Xscnlenhi: uint32(size >> 32),
}
if ty := ldr.SymType(x); ty >= sym.STYPE && ty <= sym.SPCLNTAB {
if ty := ldr.SymType(x); ty >= sym.SSTRING && ty <= sym.STYPELINK {
if ctxt.IsExternal() && strings.HasPrefix(ldr.SymSect(x).Name, ".data.rel.ro") {
// During external linking, read-only datas with relocation
// must be in .data.