aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
AgeCommit message (Collapse)Author
2023-05-02cmd/link: remove allocation in decoding type nameCherry Mui
The type name symbol is always from a Go object file and we never change it. Convert the data to string using unsafe conversion without allocation. Linking cmd/go (on macOS/amd64), name old alloc/op new alloc/op delta Deadcode_GC 1.25MB ± 0% 1.17MB ± 0% -6.29% (p=0.000 n=20+20) name old allocs/op new allocs/op delta Deadcode_GC 8.98k ± 0% 0.10k ± 3% -98.91% (p=0.000 n=20+20) Change-Id: I33117ad1f991e4f14ce0b38cceec50b041e3c0a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/490915 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2023-05-02cmd/link, cmd/internal/obj: use aux symbol for global variable DWARF infoCherry Mui
Currently, for a global variable, its debug info symbol is a named symbol with the variable's name with a special prefix. And the linker looks it up by name. This CL makes the debug info symbol an aux symbol of the variable symbol. Change-Id: I55614d0ef2af9c53eb40144ad80e09339bf3cbee Reviewed-on: https://go-review.googlesource.com/c/go/+/490816 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2023-04-28cmd/internal/obj/arm64: pass obj.As to oaddi rather than an instructionJoel Sing
This simplifies callers, as they do not need to call opirr before calling oaddi. Additionally, use appropriate types (int16) for registers, which avoids the need to continually cast. Change-Id: I8ca3807a97867ac49d63792f6922a18f35824448 Reviewed-on: https://go-review.googlesource.com/c/go/+/471520 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-28cmd/internal/obj/arm64: use appropriate return type for regoffJoel Sing
All of the callers of regoff cast the return value from uint32 to int32. Instead, simply return int32 in the first place. Change-Id: I43a672bb3143a71f4a37779ed8ae9adcda623ba4 Reviewed-on: https://go-review.googlesource.com/c/go/+/490355 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-04-28Revert "cmd/compile: constant-fold loads from constant dictionaries and types"Chressie Himpel
This reverts CL 486895. Reason for revert: This breaks internal tests at Google, see b/280035614. Change-Id: I48772a44f5f6070a7f06b5704e9f9aa272b5f978 Reviewed-on: https://go-review.googlesource.com/c/go/+/490156 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Stapelberg <stapelberg@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Michael Stapelberg <stapelberg@google.com> Reviewed-by: David Chase <drchase@google.com>
2023-04-27cmd/compile: constant-fold loads from constant dictionaries and typesKeith Randall
Update #59591 Change-Id: Id250a7779c5b53776fff73f3e678fec54d92a8e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/486895 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-21runtime, cmd: rationalize StackLimit and StackGuardAustin Clements
The current definitions of StackLimit and StackGuard only indirectly specify the NOSPLIT stack limit and duplicate a literal constant (928). Currently, they define the stack guard delta, and from there compute the NOSPLIT limit. Rationalize these by defining a new constant, abi.StackNosplitBase, which consolidates and directly specifies the NOSPLIT stack limit (in the default case). From this we then compute the stack guard delta, inverting the relationship between these two constants. While we're here, we rename StackLimit to StackNosplit to make it clearer what's being limited. This change does not affect the values of these constants in the default configuration. It does slightly change how StackGuardMultiplier values other than 1 affect the constants, but this multiplier is a pretty rough heuristic anyway. before after stackNosplit 800 800 _StackGuard 928 928 stackNosplit -race 1728 1600 _StackGuard -race 1856 1728 For #59670. Change-Id: Ia94094c5e47897e7c088d24b4a5e33f5c2768db5 Reviewed-on: https://go-review.googlesource.com/c/go/+/486976 Auto-Submit: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-21internal/abi, runtime, cmd: merge StackSmall, StackBig consts into internal/abiAustin Clements
For #59670. Change-Id: I91448363be2fc678964ce119d85cd5fae34a14da Reviewed-on: https://go-review.googlesource.com/c/go/+/486975 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Auto-Submit: Austin Clements <austin@google.com>
2023-04-21internal/abi, runtime, cmd: merge PCDATA_* and FUNCDATA_* consts into ↵Austin Clements
internal/abi We also rename the constants related to unsafe-points: currently, they follow the same naming scheme as the PCDATA table indexes, but are not PCDATA table indexes. For #59670. Change-Id: I06529fecfae535be5fe7d9ac56c886b9106c74fd Reviewed-on: https://go-review.googlesource.com/c/go/+/485497 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-04-21internal/abi, runtime, cmd: merge funcFlag_* consts into internal/abiAustin Clements
For #59670. Change-Id: Ie784ba4dd2701e4f455e1abde4a6bfebee4b1387 Reviewed-on: https://go-review.googlesource.com/c/go/+/485496 Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Auto-Submit: Austin Clements <austin@google.com>
2023-04-21internal/abi, runtime, cmd: merge funcID_* consts into internal/abiAustin Clements
For #59670. Change-Id: I517e97ea74cf232e5cfbb77b127fa8804f74d84b Reviewed-on: https://go-review.googlesource.com/c/go/+/485495 Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com>
2023-04-21cmd/internal/obj/ppc64: modify PCALIGN to ensure alignmentLynn Boger
The initial purpose of PCALIGN was to identify code where it would be beneficial to align code for performance, but avoid cases where too many NOPs were added. On p10, it is now necessary to enforce a certain alignment in some cases, so the behavior of PCALIGN needs to be slightly different. Code will now be aligned to the value specified on the PCALIGN instruction regardless of number of NOPs added, which is more intuitive and consistent with power assembler alignment directives. This also adds 64 as a possible alignment value. The existing values used in PCALIGN were modified according to the new behavior. A testcase was updated and performance testing was done to verify that this does not adversely affect performance. Change-Id: Iad1cf5ff112e5bfc0514f0805be90e24095e932b Reviewed-on: https://go-review.googlesource.com/c/go/+/485056 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Archana Ravindar <aravind5@in.ibm.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Paul Murphy <murp@ibm.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-04-21cmd/link,cmd/internal/obj/ppc64: enable PCrel on power10/ppc64/linuxPaul E. Murphy
A CI machine has been set up to verify GOPPC64=power10 on ppc64/linux. This should be sufficient to verify the PCrel relocation support works for BE. Note, power10/ppc64/linux is an oddball case. Today, it can only link internally. Furthermore, all PCrel relocs are resolved at link time, so it works despite ELFv1 having no official support for PCrel relocs today. Change-Id: Ibf79df69406ec6f9352c9d7d941ad946dba74e73 Reviewed-on: https://go-review.googlesource.com/c/go/+/485075 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-04-20Revert "internal/abi, runtime, cmd: merge StackSmall, StackBig consts into ↵Austin Clements
internal/abi" This reverts commit CL 486379. Submitted out of order and breaks bootstrap. Change-Id: Ie20a61cc56efc79a365841293ca4e7352b02d86b Reviewed-on: https://go-review.googlesource.com/c/go/+/486917 TryBot-Bypass: Austin Clements <austin@google.com> Reviewed-by: David Chase <drchase@google.com>
2023-04-20Revert "runtime, cmd: rationalize StackLimit and StackGuard"Austin Clements
This reverts commit CL 486380. Submitted out of order and breaks bootstrap. Change-Id: I67bd225094b5c9713b97f70feba04d2c99b7da76 Reviewed-on: https://go-review.googlesource.com/c/go/+/486916 Reviewed-by: David Chase <drchase@google.com> TryBot-Bypass: Austin Clements <austin@google.com>
2023-04-20runtime, cmd: rationalize StackLimit and StackGuardAustin Clements
The current definitions of StackLimit and StackGuard only indirectly specify the NOSPLIT stack limit and duplicate a literal constant (928). Currently, they define the stack guard delta, and from there compute the NOSPLIT limit. Rationalize these by defining a new constant, abi.StackNosplitBase, which consolidates and directly specifies the NOSPLIT stack limit (in the default case). From this we then compute the stack guard delta, inverting the relationship between these two constants. While we're here, we rename StackLimit to StackNosplit to make it clearer what's being limited. This change does not affect the values of these constants in the default configuration. It does slightly change how StackGuardMultiplier values other than 1 affect the constants, but this multiplier is a pretty rough heuristic anyway. before after stackNosplit 800 800 _StackGuard 928 928 stackNosplit -race 1728 1600 _StackGuard -race 1856 1728 For #59670. Change-Id: Ibe20825ebe0076bbd7b0b7501177b16c9dbcb79e Reviewed-on: https://go-review.googlesource.com/c/go/+/486380 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-20internal/abi, runtime, cmd: merge StackSmall, StackBig consts into internal/abiAustin Clements
For #59670. Change-Id: I04a17079b351b9b4999ca252825373c17afb8a88 Reviewed-on: https://go-review.googlesource.com/c/go/+/486379 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-04-14cmd/link: establish dependable package initialization orderKeith Randall
(This is a retry of CL 462035 which was reverted at 474976. The only change from that CL is the aix fix SRODATA->SNOPTRDATA at inittask.go:141) As described here: https://github.com/golang/go/issues/31636#issuecomment-493271830 "Find the lexically earliest package that is not initialized yet, but has had all its dependencies initialized, initialize that package, and repeat." Simplify the runtime a bit, by just computing the ordering required in the linker and giving a list to the runtime. Update #31636 Fixes #57411 RELNOTE=yes Change-Id: I28c09451d6aa677d7394c179d23c2c02c503fc56 Reviewed-on: https://go-review.googlesource.com/c/go/+/478916 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-13cmd/internal/moddeps: preserve PWD more carefully in commandsBryan C. Mills
On macOS, TMPDIR is typically a symlink, and the GOROOT for the buildlet is in TMPDIR as well. PWD must be preserved in order for os.Getwd (and functions based on it) to report paths that remain relative to GOROOT, and paths relative to GOROOT are necessary in order for filepath.Rel to report subdirectories as subdirectories (rather than paths with long "../../…" prefixes). Fortunately, the (*Cmd).Environ method added for #50599 makes preserving PWD somewhat easier. This fixes 'go test cmd/internal/moddeps' on the new darwin-amd64-longtest builder. For #35678. Change-Id: Ibaa458bc9a94b44ba455519bb8da445af07fe0d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/484295 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
2023-04-11all: re-run stringerIan Lance Taylor
Re-run all go:generate stringer commands. This mostly adds checks that the constant values did not change, but does add new strings for the debug/dwarf and internal/pkgbits packages. Change-Id: I5fc41f20da47338152c183d45d5ae65074e2fccf Reviewed-on: https://go-review.googlesource.com/c/go/+/483717 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-04-11cmd/asm,cmd/internal/obj/x86: add RDPID instruction to x86 assemblerJoel Sing
Add support for the Read Processor ID (RDPID) instruction to the x86 assembler. This returns the current logical processor's ID in the specified register, as a faster alternative to RDTSCP. Fixes #56525 Change-Id: I43482e42431dfc385ce2e7f6d44b9746b0cc4548 Reviewed-on: https://go-review.googlesource.com/c/go/+/482955 Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2023-04-11cmd/internal/obj/loong64, cmd/internal/objabi, cmd/link: add support for ↵limeidan
--buildmode=c-shared on loong64 Updates #53301 Updates #58784 Change-Id: Ifcb40871f609531dfd8b568db9ac14da9b451742 Reviewed-on: https://go-review.googlesource.com/c/go/+/425476 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Run-TryBot: WANG Xuerui <git@xen0n.name> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: WANG Xuerui <git@xen0n.name>
2023-04-11runtime,cmd/internal/obj/ppc64: cleanup ppc64le runtime.racecallbackthunkPaul E. Murphy
Update to use the common macros to ensure all ELFv2 callee-save registers are saved properly when transitioning from ELFv2 to Go calling/stack conventions. Simplify the inlined Go function call, and remove the asm hacks which inhibited implicit stack frame management. Change-Id: Iee118a4069962a791436c6fe19370e1929404a8d Reviewed-on: https://go-review.googlesource.com/c/go/+/479795 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-11cmd/internal/obj/loong64: auto-align loop heads to 16-byte boundariesWANG Xuerui
CL 479816 took care of loops in hand-written assembly, but did not account for those written in Go, that may become performance-sensitive as well. In this patch, all loop heads are automatically identified and aligned to 16-byte boundaries, by inserting a synthetic `PCALIGN $16` before them. "Loop heads" are defined as targets of backward branches. While at it, tweak some of the local comments so the flow is hopefully clearer. Because LoongArch instructions are all 32 bits long, at most 3 NOOPs can be inserted for each target Prog. This may sound excessive, but benchmark results indicate the current approach is overall profitable anyway. Benchmark results on Loongson 3A5000 (LA464): goos: linux goarch: loong64 pkg: test/bench/go1 │ CL 479816 │ this CL │ │ sec/op │ sec/op vs base │ BinaryTree17 14.10 ± 1% 14.06 ± 1% ~ (p=0.280 n=10) Fannkuch11 3.579 ± 0% 3.419 ± 0% -4.45% (p=0.000 n=10) FmtFprintfEmpty 94.73n ± 0% 94.44n ± 0% -0.31% (p=0.000 n=10) FmtFprintfString 151.9n ± 0% 149.1n ± 0% -1.84% (p=0.000 n=10) FmtFprintfInt 158.3n ± 0% 155.2n ± 0% -1.96% (p=0.000 n=10) FmtFprintfIntInt 241.4n ± 0% 235.4n ± 0% -2.49% (p=0.000 n=10) FmtFprintfPrefixedInt 320.2n ± 0% 314.7n ± 0% -1.73% (p=0.000 n=10) FmtFprintfFloat 414.3n ± 0% 398.7n ± 0% -3.77% (p=0.000 n=10) FmtManyArgs 949.9n ± 0% 929.8n ± 0% -2.12% (p=0.000 n=10) GobDecode 15.24m ± 0% 15.30m ± 0% +0.38% (p=0.035 n=10) GobEncode 18.10m ± 2% 17.59m ± 1% -2.81% (p=0.002 n=10) Gzip 429.9m ± 0% 421.5m ± 0% -1.97% (p=0.000 n=10) Gunzip 88.31m ± 0% 87.39m ± 0% -1.04% (p=0.000 n=10) HTTPClientServer 85.71µ ± 0% 87.24µ ± 0% +1.79% (p=0.000 n=10) JSONEncode 19.74m ± 0% 18.55m ± 0% -6.00% (p=0.000 n=10) JSONDecode 78.60m ± 1% 77.93m ± 0% -0.84% (p=0.000 n=10) Mandelbrot200 7.208m ± 0% 7.217m ± 0% ~ (p=0.481 n=10) GoParse 7.616m ± 1% 7.630m ± 2% ~ (p=0.796 n=10) RegexpMatchEasy0_32 133.0n ± 0% 134.1n ± 0% +0.83% (p=0.000 n=10) RegexpMatchEasy0_1K 1.362µ ± 0% 1.364µ ± 0% +0.15% (p=0.000 n=10) RegexpMatchEasy1_32 161.8n ± 0% 163.7n ± 0% +1.17% (p=0.000 n=10) RegexpMatchEasy1_1K 1.497µ ± 0% 1.497µ ± 0% ~ (p=1.000 n=10) RegexpMatchMedium_32 1.420µ ± 0% 1.446µ ± 0% +1.83% (p=0.000 n=10) RegexpMatchMedium_1K 42.25µ ± 0% 42.53µ ± 0% +0.65% (p=0.000 n=10) RegexpMatchHard_32 2.108µ ± 0% 2.116µ ± 0% +0.38% (p=0.000 n=10) RegexpMatchHard_1K 62.65µ ± 0% 63.23µ ± 0% +0.93% (p=0.000 n=10) Revcomp 1.192 ± 0% 1.198 ± 0% +0.55% (p=0.000 n=10) Template 115.6m ± 2% 116.9m ± 1% ~ (p=0.075 n=10) TimeParse 418.1n ± 1% 414.7n ± 0% -0.81% (p=0.000 n=10) TimeFormat 517.9n ± 0% 513.7n ± 0% -0.81% (p=0.000 n=10) geomean 103.5µ 102.6µ -0.79% │ CL 479816 │ this CL │ │ B/s │ B/s vs base │ GobDecode 48.04Mi ± 0% 47.86Mi ± 0% -0.38% (p=0.035 n=10) GobEncode 40.44Mi ± 2% 41.61Mi ± 1% +2.89% (p=0.001 n=10) Gzip 43.04Mi ± 0% 43.91Mi ± 0% +2.02% (p=0.000 n=10) Gunzip 209.6Mi ± 0% 211.8Mi ± 0% +1.05% (p=0.000 n=10) JSONEncode 93.76Mi ± 0% 99.75Mi ± 0% +6.39% (p=0.000 n=10) JSONDecode 23.55Mi ± 1% 23.75Mi ± 0% +0.85% (p=0.000 n=10) GoParse 7.253Mi ± 1% 7.238Mi ± 2% ~ (p=0.698 n=10) RegexpMatchEasy0_32 229.4Mi ± 0% 227.6Mi ± 0% -0.82% (p=0.000 n=10) RegexpMatchEasy0_1K 717.3Mi ± 0% 716.2Mi ± 0% -0.15% (p=0.000 n=10) RegexpMatchEasy1_32 188.6Mi ± 0% 186.4Mi ± 0% -1.13% (p=0.000 n=10) RegexpMatchEasy1_1K 652.2Mi ± 0% 652.3Mi ± 0% +0.01% (p=0.005 n=10) RegexpMatchMedium_32 21.49Mi ± 0% 21.11Mi ± 0% -1.73% (p=0.000 n=10) RegexpMatchMedium_1K 23.11Mi ± 0% 22.96Mi ± 0% -0.62% (p=0.000 n=10) RegexpMatchHard_32 14.48Mi ± 0% 14.42Mi ± 0% -0.40% (p=0.000 n=10) RegexpMatchHard_1K 15.59Mi ± 0% 15.44Mi ± 0% -0.98% (p=0.000 n=10) Revcomp 203.4Mi ± 0% 202.3Mi ± 0% -0.55% (p=0.000 n=10) Template 16.00Mi ± 2% 15.83Mi ± 1% ~ (p=0.078 n=10) geomean 60.72Mi 60.89Mi +0.29% The slight regression on the Regexp cases is likely because the previous numbers are just coincidental: indeed, large regressions or improvements (of roughly ±10%) happen with definitely irrelevant changes during development. This CL should (hopefully) bring such random performance fluctuations down a bit. Change-Id: I8bdda6e65336da00d4ad79650937b3eeb9db0e7c Reviewed-on: https://go-review.googlesource.com/c/go/+/479817 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: WANG Xuerui <git@xen0n.name>
2023-04-11cmd/internal/obj/arm64: improve comment and signature of pcAlignPadLengthWANG Xuerui
The function just calculates the number of needed padding bytes, instead of actually carrying out the alignment operation. And it has the context argument at the end of the argument list, while contexts idiomatically come first. Indeed, this is the only case in cmd/internal/obj where ctxt is not the only argument and does not come first. Fix those two nits; no functional change intended. Suggested by Ian during review of CL 479815 (that introduces a copy of this helper into the loong64 port). Change-Id: Ieb221ead23282abe6e04804d537e1234c7ab21d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/483155 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-04-10cmd/internal/obj/loong64, cmd/link/internal: switch to LoongArch ELF psABI ↵WANG Xuerui
v2 relocs The LoongArch ELF psABI v2 [1] relocs are vastly simplified from the v1 which involved a stack machine for computing the reloc values, but the details of PC-relative addressing are changed as well. Specifically, the `pcaddu12i` instruction is substituted with the `pcalau12i`, which is like arm64's `adrp` -- meaning the lower bits of a symbol's address now have to be absolute and not PC-relative. However, apart from the little bit of added complexity, the obvious advantage is that only 1 reloc needs to be emitted for every kind of external reloc we care about. This can mean substantial space savings (each RELA reloc occupies 24 bytes), and no open-coded stack ops has to remain any more. While at it, update the preset value for the output ELF's flags to indicate the psABI update. Fixes #58784 [1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html Change-Id: I5c13bc710eaf58293a32e930dd33feff2ef14c28 Reviewed-on: https://go-review.googlesource.com/c/go/+/455017 Run-TryBot: Ben Shi <powerman1st@163.com> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-04-07cmd/internal/objfile: align the load address of ELF binaryCherry Mui
The ELF ABI just requires that the address and the offset of a segment are congruent modulo the alignment, but does not require the start address to be aligned. While usually the segment's start address is aligned, apparently the zig linker generates binary with unaligned address. At the run time, the memory mapping that contains the segment starts at an aligned address (rounding down). Use the aligned address for the load address, which matches the mapping. Apparently this is what the pprof library expects. Fixes #59466. Change-Id: Ife78909b20b7bc975ac4c76f2c5f5db325ddec9b Reviewed-on: https://go-review.googlesource.com/c/go/+/483035 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-04-07cmd/link, cmd/internal/obj/loong64: support the PCALIGN directiveWANG Xuerui
Allow writing `PCALIGN $imm` where imm is a power-of-2 between 8 and 2048 (inclusive), for ensuring that the following instruction is placed at an imm-byte boundary relative to the beginning of the function. If the PC is not sufficiently aligned, NOOPs will be inserted to make it so, otherwise the directive will do nothing. This could be useful for both asm performance hand-tuning, and future scenarios where a certain bigger alignment might be required. Change-Id: Iad6244669a3d5adea88eceb0dc7be1af4f0d4fc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/479815 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: WANG Xuerui <git@xen0n.name> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: abner chenc <chenguoqi@loongson.cn> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-04-06cmd: add wasip1 supportJohan Brandhorst-Satzkorn
For #58141 Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: I530ea78a3cd142f3a745f650b21c30e7f10ce981 Reviewed-on: https://go-review.googlesource.com/c/go/+/479621 Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-04-05cmd/internal/obj: generate SEH aux symbols for windows/amd64qmuntal
This CL updates the Go compiler so it generate SEH unwind info [1] as a function auxiliary symbol when building for windows/amd64. A follow up CL will teach the Go linker how to assemble these codes into the PE .xdata section. Updates #57302 [1] https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64#struct-unwind_info Change-Id: I40ae0437bfee326c1a67c2b5e1496f0bf3ecea17 Reviewed-on: https://go-review.googlesource.com/c/go/+/461749 Reviewed-by: Davis Goodin <dagood@microsoft.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
2023-04-05cmd/internal/obj/arm64: use more appropriate types for olsr9s/olsr12uJoel Sing
This allows for a large number of casts to be removed at call sites. While here, use consistent register naming. Change-Id: I78a2a928b78c9f09f91fb6ed6ad440aa4e63923d Reviewed-on: https://go-review.googlesource.com/c/go/+/471517 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-04-05cmd/internal/obj/arm64: use more appropriate types for opldpstpJoel Sing
This allows for a large number of casts to be removed at call sites. While here, use consistent register naming. Change-Id: I68cee985f6500ed9523f7fb3efbc11bb849681dc Reviewed-on: https://go-review.googlesource.com/c/go/+/471516 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-04-05cmd/internal/obj/arm64: use more appropriate types for opbfm and opextrJoel Sing
This allows for a large number of casts to be removed at call sites. Change-Id: I44a162040cc5b4de02e106d3a6de10f8e0870cb9 Reviewed-on: https://go-review.googlesource.com/c/go/+/471515 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-04-05all: add wasip1 asm and link logicJohan Brandhorst-Satzkorn
Add wasip1 asm and symbols to cmd/internal/obj, cmd/link and runtime. For #58141 Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: Ie088d9b65ea13e231694af6341465f95be33093f Reviewed-on: https://go-review.googlesource.com/c/go/+/479617 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-04-04all: fix misuses of "a" vs "an"cui fliter
Fixes the misuse of "a" vs "an", according to English grammatical expectations and using https://www.a-or-an.com/ Change-Id: I53ac724070e3ff3d33c304483fe72c023c7cda47 Reviewed-on: https://go-review.googlesource.com/c/go/+/480536 Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-03-31cmd/internal/obj: remove redundant cnames on loong64Guoqi Chen
Change-Id: I5aa6328a12e74b2801ab60b5a5bb8571d382d5ef Reviewed-on: https://go-review.googlesource.com/c/go/+/425301 Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: WANG Xuerui <git@xen0n.name> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-03-31cmd/internal/obj/loong64: remove Optab.family and reorganize operand class ↵WANG Xuerui
fields There is currently no support for GOARCH=loong32, so the Optab.family field is unused so far. Remove it to simplify the optab; the loong assembler backend would likely already be overhauled into a sufficiently different shape by the time we start to care for loong32, that the data we have today would be useless anyway. While at it, add a operand class slot for the 3rd source operand (support for which will arrive in later commits), and rename the other operand class fields to be self-documenting. The changes are being merged into this patch for sake of reducing code churn. Change-Id: Icf0988e34ff1c0f762c8e0708cfcef2e7954760c Reviewed-on: https://go-review.googlesource.com/c/go/+/477715 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Run-TryBot: Ben Shi <powerman1st@163.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
2023-03-31cmd/internal/obj/loong64: assemble BEQ/BNEs comparing with 0 as beqz/bnezWANG Xuerui
LoongArch (except for the extremely reduced LA32 Primary subset) has dedicated beqz/bnez instructions as alternative encodings for beq/bne with one of the source registers being R0, that allow the offset field to occupy 5 more bits, giving 21 bits in total (equal to the FP branches). Make use of them instead of beq/bne if one source operand is omitted in asm, or if one of the registers being compared is R0. Multiple go1 benchmark runs indicate the change is not perf-sensitive. Change-Id: If6267623c82092e81d75578091fb4e013658b9f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/478377 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Run-TryBot: Ben Shi <powerman1st@163.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
2023-03-30all: add wasip1 definitionsJohan Brandhorst-Satzkorn
Add wasip1 GOOS definitions to the compiler and build definitions. Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: I087e7ff4205a34187bbca18b1693ad911ddd1219 Reviewed-on: https://go-review.googlesource.com/c/go/+/479616 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-03-29cmd/link,cmd/internal/objabi: support ADDR32NB relocations on windowsqmuntal
This CL updates the linker to support IMAGE_REL_[I386|AMD64|ARM|ARM64]_ADDR32NB relocations via the new R_PEIMAGEOFF relocation type. This relocation type references symbols using RVAs instead of VA, so it can use 4-byte offsets to reference symbols that would normally require 8-byte offsets. This new relocation is still not used, but will be useful when generating Structured Exception Handling (SEH) metadata, which needs to reference functions only using 4-byte addresses, thus using RVAs instead of VA is of great help. Updates #57302 Change-Id: I28d73e97d5cb78a3bc7194dc7d2fcb4a03f9f4d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/461737 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Davis Goodin <dagood@microsoft.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-03-28cmd/internal/obj/loong64: save LR after decrementing SPGuoqi Chen
Refer to CL 413428 and 412474, for loong64, like mips, s390x and riscv, there is no single instruction that saves the LR and decrements the SP, so we also need to insert an instruction to save the LR after decrementing the SP. Fixes #56623. Updates #53374. Change-Id: I3de040792f0a041d3d2a98ea89c23a2dd2f4ad10 Reviewed-on: https://go-review.googlesource.com/c/go/+/416154 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: WANG Xuerui <git@xen0n.name> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn>
2023-03-27cmd/internal/obj/loong64: clean up code for short conditional branchesWANG Xuerui
Untangle the logic so the preparation of operands and actual assembling (branch range checking included) are properly separated, making future changes easier to review and maintain. No functional change intended. Change-Id: I1f73282f9d92ff23d84846453d3597ba66d207d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/478376 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Auto-Submit: Ian Lance Taylor <iant@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-03-24cmd/internal/obj/ppc64: fix incorrect base reg causing segvLynn Boger
This fixes a segv that was reported due to building minio. The problem occurred because of an incorrect selection of the base register, which was introduced by CL 306369. Fixes #59196 Change-Id: Ieb77b2afa8fb4e6f3943df5ce138679f6750d376 Reviewed-on: https://go-review.googlesource.com/c/go/+/478920 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Archana Ravindar <aravind5@in.ibm.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Auto-Submit: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-03-22cmd/internal/obj/loong64: realize all unconditional jumps with B/BLWANG Xuerui
The current practice of using the "PC-relative" `BEQ ZERO, ZERO` for short jumps is inherited from the MIPS port, where the pre-R6 long jumps are PC-regional instead of PC-relative. This quirk is not present in LoongArch from the very beginning so there is no reason to keep the behavior any more. While at it, simplify the code to not place anything in the jump offset field if a relocation is to take place. (It may be relic of a previous REL-era treatment where the addend is to be stored in the instruction word, but again, loong64 is exclusively RELA from day 1 so no point in doing so either.) Benchmark shows very slight improvement on a 3A5000 box, indicating the LA464 micro-architecture presumably *not* seeing the always-true BEQs as equivalent to B: goos: linux goarch: loong64 pkg: test/bench/go1 │ 2ef70d9d0f │ this CL │ │ sec/op │ sec/op vs base │ BinaryTree17 14.57 ± 4% 14.54 ± 1% ~ (p=0.353 n=10) Fannkuch11 3.570 ± 0% 3.570 ± 0% ~ (p=0.529 n=10) FmtFprintfEmpty 92.84n ± 0% 92.84n ± 0% ~ (p=0.970 n=10) FmtFprintfString 150.0n ± 0% 149.9n ± 0% ~ (p=0.350 n=10) FmtFprintfInt 153.3n ± 0% 153.3n ± 0% ~ (p=1.000 n=10) ¹ FmtFprintfIntInt 235.8n ± 0% 235.8n ± 0% ~ (p=0.963 n=10) FmtFprintfPrefixedInt 318.5n ± 0% 318.5n ± 0% ~ (p=0.474 n=10) FmtFprintfFloat 410.4n ± 0% 410.4n ± 0% ~ (p=0.628 n=10) FmtManyArgs 944.9n ± 0% 945.0n ± 0% ~ (p=0.240 n=10) GobDecode 13.97m ± 12% 12.83m ± 21% ~ (p=0.165 n=10) GobEncode 17.84m ± 5% 18.60m ± 4% ~ (p=0.123 n=10) Gzip 421.0m ± 0% 421.0m ± 0% ~ (p=0.579 n=10) Gunzip 89.80m ± 0% 89.77m ± 0% ~ (p=0.529 n=10) HTTPClientServer 86.54µ ± 1% 86.25µ ± 0% -0.33% (p=0.003 n=10) JSONEncode 18.57m ± 0% 18.57m ± 0% ~ (p=0.353 n=10) JSONDecode 77.48m ± 0% 77.30m ± 0% -0.23% (p=0.035 n=10) Mandelbrot200 7.217m ± 0% 7.217m ± 0% ~ (p=0.436 n=10) GoParse 7.599m ± 2% 7.632m ± 1% ~ (p=0.353 n=10) RegexpMatchEasy0_32 140.1n ± 0% 140.1n ± 0% ~ (p=0.582 n=10) RegexpMatchEasy0_1K 1.538µ ± 0% 1.538µ ± 0% ~ (p=1.000 n=10) ¹ RegexpMatchEasy1_32 161.7n ± 0% 161.7n ± 0% ~ (p=1.000 n=10) ¹ RegexpMatchEasy1_1K 1.632µ ± 0% 1.632µ ± 0% ~ (p=1.000 n=10) ¹ RegexpMatchMedium_32 1.369µ ± 0% 1.369µ ± 0% ~ (p=1.000 n=10) RegexpMatchMedium_1K 39.96µ ± 0% 39.96µ ± 0% +0.01% (p=0.010 n=10) RegexpMatchHard_32 2.099µ ± 0% 2.099µ ± 0% ~ (p=1.000 n=10) ¹ RegexpMatchHard_1K 62.50µ ± 0% 62.50µ ± 0% ~ (p=0.099 n=10) Revcomp 1.349 ± 0% 1.347 ± 0% -0.14% (p=0.001 n=10) Template 118.4m ± 0% 118.0m ± 0% -0.36% (p=0.023 n=10) TimeParse 407.8n ± 0% 407.9n ± 0% +0.02% (p=0.000 n=10) TimeFormat 508.0n ± 0% 507.9n ± 0% ~ (p=0.421 n=10) geomean 103.5µ 103.3µ -0.17% ¹ all samples are equal │ 2ef70d9d0f │ this CL │ │ B/s │ B/s vs base │ GobDecode 52.67Mi ± 11% 57.04Mi ± 17% ~ (p=0.149 n=10) GobEncode 41.03Mi ± 4% 39.35Mi ± 4% ~ (p=0.118 n=10) Gzip 43.95Mi ± 0% 43.95Mi ± 0% ~ (p=0.428 n=10) Gunzip 206.1Mi ± 0% 206.1Mi ± 0% ~ (p=0.399 n=10) JSONEncode 99.64Mi ± 0% 99.66Mi ± 0% ~ (p=0.304 n=10) JSONDecode 23.88Mi ± 0% 23.94Mi ± 0% +0.22% (p=0.030 n=10) GoParse 7.267Mi ± 2% 7.238Mi ± 1% ~ (p=0.360 n=10) RegexpMatchEasy0_32 217.8Mi ± 0% 217.8Mi ± 0% -0.00% (p=0.006 n=10) RegexpMatchEasy0_1K 635.0Mi ± 0% 635.0Mi ± 0% ~ (p=0.194 n=10) RegexpMatchEasy1_32 188.7Mi ± 0% 188.7Mi ± 0% ~ (p=0.338 n=10) RegexpMatchEasy1_1K 598.5Mi ± 0% 598.5Mi ± 0% -0.00% (p=0.000 n=10) RegexpMatchMedium_32 22.30Mi ± 0% 22.30Mi ± 0% ~ (p=0.211 n=10) RegexpMatchMedium_1K 24.43Mi ± 0% 24.43Mi ± 0% ~ (p=1.000 n=10) RegexpMatchHard_32 14.54Mi ± 0% 14.54Mi ± 0% ~ (p=0.474 n=10) RegexpMatchHard_1K 15.62Mi ± 0% 15.62Mi ± 0% ~ (p=1.000 n=10) ¹ Revcomp 179.7Mi ± 0% 180.0Mi ± 0% +0.14% (p=0.001 n=10) Template 15.63Mi ± 0% 15.68Mi ± 0% +0.34% (p=0.022 n=10) geomean 60.29Mi 60.44Mi +0.24% ¹ all samples are equal Change-Id: I112dd663c49567386ea75dd4966a9f8127ffb90e Reviewed-on: https://go-review.googlesource.com/c/go/+/478075 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-03-22cmd/internal/obj/ppc64: add VC[LT]ZLSBB instructionsPaul E. Murphy
These are ISA 3.0 power9 instructions which are helpful when reducing a vector compare result into a GPR. They are used in a future patch to improve the bytes.IndexByte asm routine. Change-Id: I424e2628e577167b9b7c0fcbd82099daf568ea35 Reviewed-on: https://go-review.googlesource.com/c/go/+/478115 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-03-21cmd/internal/obj/loong64: add support for movgr2cf and movcf2gr instructionsHuang Qiqi
Change-Id: I7ff3c8df24ed7990fe104bc2530354c0bd5fe018 Reviewed-on: https://go-review.googlesource.com/c/go/+/475576 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Reviewed-by: WANG Xuerui <git@xen0n.name>
2023-03-16cmd/internal/obj/loong64: add the PCALAU12I instruction for reloc useWANG Xuerui
The LoongArch ELF psABI v2.00 revamped the relocation design, largely moving to using the `pcalau12i + addi/ld/st` pair for PC-relative addressing within +/- 32 bits. The "pcala" in `pcalau12i` stands for "PC-aligned add"; the instruction's semantics happen to coincide with arm64's `adrp`. Add support for emitting this instruction as part of the relevant addressing ops, for use with new reloc types later. Updates #58784 Change-Id: Ic1747cd9745aad0d1abb9bd78400cd5ff5978bc8 Reviewed-on: https://go-review.googlesource.com/c/go/+/455016 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-03-15cmd/asm: improve detector for incorrect R15 usage when dynamic linkingKeith Randall
Fixes #58632 Change-Id: Idb19af2ac693ea5920da57c1808f1bc02702929d Reviewed-on: https://go-review.googlesource.com/c/go/+/476295 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org>
2023-03-13cmd/internal/obj/loong64: remove invalid branch delay slotsGuoqi Chen
Change-Id: I222717771019f7aefa547971b2d94ef4677a42c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/420979 Reviewed-by: WANG Xuerui <git@xen0n.name> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Run-TryBot: hopehook <hopehook@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
2023-03-09Revert "cmd/link: establish dependable package initialization order"Keith Randall
This reverts commit ce2a609909d9de3391a99a00fe140506f724f933. aka CL 462035 Reason for revert: this CL is causing some problems in some internal Google programs. Change-Id: I4476b8d8d2c3d7b5703d1d85c93baebb4b4e5d26 Reviewed-on: https://go-review.googlesource.com/c/go/+/474976 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>