aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
AgeCommit message (Collapse)Author
2026-02-22cmd/internal/obj: support arm64 FMOVQ from/to global addressAlexander Musman
Support arm64 FMOVQ from/to global address. Currently there are no global addresses known to be aligned by 16 bytes, and with this CL we will always use R_ADDRARM64 relocation with ADRP+ADD+FMOVQ instructions. Change-Id: I283009eda151d1875cf4457734e79b68a941a6df Reviewed-on: https://go-review.googlesource.com/c/go/+/718001 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-02-21cmd/compile: pointer-shaped types are SSAable even if lots of 0-sized fieldsKeith Randall
Normally we don't SSA-ify variables with types that have more than 4 fields. But we really do want to SSA-ify them if they are pointer shaped. An odd case, but the compiler shouldn't barf on them. Failure probably started with CL 714421. Fixes #77534 Change-Id: I51ef87676cc31df1e51e164bbd58d58c0ab72436 Reviewed-on: https://go-review.googlesource.com/c/go/+/744280 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-21cmd/compile: add flag for emitting diagnostics unsortedDaniel Morsing
The prove pass uses warnings with locations that are sorted before they are emitted. When debugging on level 3, this sorting can obscure which log lines happened before each other, obscuring the flow of control. This gets doubly confusing when debugging issues that include use of the inliner, where 2 related log lines can be present at the far ends of the output. Make the sorting optional. This allows both the errorcheck tests to keep working and for developers to use the logs as printf-style debugging. Change-Id: I1c1d88696e830da71eeeca8e324ef9856a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/742341 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2026-02-19cmd/cgo/internal/test: add a test for C calling into Go before init doneCherry Mui
Test that C code can call back into Go (on a separate thread) before init is done. The callback should wait for the init done. And this should not cause a false race. This corresponds to the runtime fix in CL 746581. Change-Id: I10e6a9d5fe056be16143f5f6a322f51e56fc9fdf Reviewed-on: https://go-review.googlesource.com/c/go/+/746780 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-02-19cmd/compile, go/*: move method type parameter checks from parsers to type ↵Robert Griesemer
checkers The parsers (cmd/compile/internal/syntax and go/parser) always accepted type parameters on methods for parser robustness but reported an error. With this change, the parsers accept the type parameters on methods, and then the type checkers (cmd/compile/internal/types2 and go/types) complain about them. Add test case for method type parameters when running the parsers only. Adjust some existing test cases as needed. This change is a necessary first step towards implementing generic methods but does not enable them. For #77273. Change-Id: I291fcf0aef0c917c74b32131c88b9e4ed71c5060 Reviewed-on: https://go-review.googlesource.com/c/go/+/738441 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-02-19cmd/link: use bfd ld 2.36+ on linux/arm64 instead of goldDimitri John Ledkov
The bfd linker has been fixed for a while. In the mean time gold got deprecated and has stopped receiving new features. Add runtime version checking and only use gold, if bfd ld 2.35 and lower is detected. This enables using `-buildmode=shared` on arm64 without installing binutils-gold (on distributions that split package this), as well as to use external ldflags that ld.bfd supports, and ld.gold does not. For example, this enables to specify gcs-report-dynamic=none when building with GCC-15. Fixes #22040. Change-Id: I4eb8b3dabb78844ff662332ad63a4625278271b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/740480 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Cherry Mui <cherryyz@google.com>
2026-02-19cmd/dist: clean up test.goqmuntal
test.go has accumulated some technical debt over time. This CL removes unused functions and parameters and uses tagged switches instead of if-else chains. Change-Id: Ifc9cd15c84026fb2cf9ed672dfee6fe527e8b17a Reviewed-on: https://go-review.googlesource.com/c/go/+/735600 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-02-18cmd/link: don't pass -Wl,-S on illumosPeter Tribble
The change in CL 707096 to exclude GOOS=solaris needs to also be applied for GOOS=illumos, which shares the same linker lineage. Fixes #77530 Change-Id: Ifc2047595af2db52870f9fb0a9faf646666d9e61 Reviewed-on: https://go-review.googlesource.com/c/go/+/746560 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-02-17all: use LF line ending for C filesCherry Mui
For Go files, gofmt already converts CRLF line ending to LF. For C and assembly files, we don't enforce a format, but most files in tree are written with LF line ending, and the C toolchain can handle them file, even on Windows. Convert all to LF line ending for consistency. Will look into adding a test for them. Updates #9281. Change-Id: Idc0dc13f0ab90b8cd8ea118abf9cb195ec438fe7 Reviewed-on: https://go-review.googlesource.com/c/go/+/746220 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-17cmd/covdata: update test expectations after coverage position changeRudy Regazzoni
CL 726800 changed cmd/cover to exclude brace tokens from coverage ranges, shifting where coverage spans start (from the opening brace to the first executable token inside the block). Update the hardcoded position expectations in TestCovTool subtests (Textfmt, MergeSimple, Subtract) to match the new positions. Fixes #77608 Change-Id: Ia67ac8fac05d802b0e6ba25a4fbedf7e2f1ca8b4 GitHub-Last-Rev: e24345873b179605d10168d22fc7d09a3fec9ae8 GitHub-Pull-Request: golang/go#77637 Reviewed-on: https://go-review.googlesource.com/c/go/+/746000 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-02-17cmd/internal/obj: remove ARM64 prefix from encoding helpersAlexander Musman
Remove the ARM64 prefix from encoding helper functions that were moved to cmd/internal/obj to be used by both cmd/asm and cmd/compile. These functions now use the package prefix and look like: arm64.EncodeRegisterExtension and arm64.RegisterListOffset. Change-Id: I3548a4fce1072083eb2f55310c9f7ca6a8e12253 Reviewed-on: https://go-review.googlesource.com/c/go/+/714320 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-02-17cmd/internal/obj: move ARM64RegisterListOffset from cmd/asm/internal/archAlexander Musman
Change-Id: Ieaacd8c40495e7dad61a068125b1d0e0cee832c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/713500 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-15cmd/compile: don't drop same register twicekhr@golang.org
For instructions that clobber both of their input registers, make sure we don't clobber the same register twice when both input registers are the same. This is rare, but it can happen. Fixes #77604 Change-Id: I794249cf43a8cc4ab3262055daef9193e2442f73 Reviewed-on: https://go-review.googlesource.com/c/go/+/745621 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-02-14cmd/compile: avoid folding 64-bit integers into 32-bit constantsYoulin Feng
Folding a 64-bit integer into a 32-bit constant may result in a negative integer if the value exceeds math.MaxInt32 (the maximum value of a 32- bit signed integer). This negative value will be sign-extended to 64 bits at runtime, leading to unexpected results when used in bitwise AND/OR operations. Fixes #77613 Change-Id: Idb081a3c20c28bddddcc8eff1225d62123b37a2d Reviewed-on: https://go-review.googlesource.com/c/go/+/745581 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-02-14cmd/internal/obj/loong64: improve ARNG type register name conversionGuoqi Chen
When resolving ARNG type names, the base value was not subtracted when calculating the variable simd_type, causing its actual value to not match the expected meaning after the base value adjustment. Fixes #77414 Change-Id: I713bab849ecdb5610d2593ba9bd9e1169842f00e Reviewed-on: https://go-review.googlesource.com/c/go/+/742980 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: WANG Xuerui <git@xen0n.name> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn>
2026-02-14cmd/go: validate inferred module path for go mod initYanchen Chen
Ensure `go mod init` validates the module path even when it is inferred from GOPATH. Fixes #73121 Change-Id: I8b7785ff57eec17bba432f48c8e3a18a2f92aab5 GitHub-Last-Rev: 8ff1ca2d71bee2b948f114ad1f0a4706a4c0b152 GitHub-Pull-Request: golang/go#76432 Reviewed-on: https://go-review.googlesource.com/c/go/+/723640 Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-13cmd/go/internal/vcs: delete go-internal argument handling dead codeTony Tang
These two code paths handle arguments internally used by the go command, but CL 736710 removed all of their uses. Remove their handling code too. Change-Id: I99f50ef4916f29e56f5d5aaeb3c48bae4bf0b74d GitHub-Last-Rev: 0f109f2c48098c4ac5a8b695cead075f12e22e81 GitHub-Pull-Request: golang/go#77600 Reviewed-on: https://go-review.googlesource.com/c/go/+/745300 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Tony Tang <jianfeng.tony@gmail.com>
2026-02-13cmd/go: document PATH behavior for `go run` and `go tool`Paschalis T
Fixes #77509 Change-Id: I1b6b38f86e4c8b18dd7638b4dd8246e2993e8307 Reviewed-on: https://go-review.googlesource.com/c/go/+/745100 Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2026-02-13cmd/link: support PIE on linux/s390x without cgoGeorge Adams
Enable PIE builds on linux/s390x when CGO is disabled by teaching the linker to handle dynamic relocations against SDYNIMPORT symbols. This adds support for TLS_IE and handles R_CALL, R_PCRELDBL, and R_ADDR relocations by generating the appropriate PLT/GOT entries instead of rejecting them as unsupported. Fixes #77449 Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x Change-Id: Ib6586780073fedbcbd42b9a2c554a99dd7386aa6 Reviewed-on: https://go-review.googlesource.com/c/go/+/742342 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-13cmd/cover: exclude commented-out code from coverage instrumentationRudy Regazzoni
Add logic to exclude purely commented lines from coverage instrumentation. When instrumenting Go code for coverage, the cover tool now identifies and excludes lines that contain only comments from coverage blocks. This prevents commented-out code from being reported as "uncovered" in coverage reports, which can be misleading. The implementation adds a splitBlockByComments function that parses source code character by character to identify segments containing executable code versus segments containing only comments. The addCounters function now uses this to create coverage counters only for segments that contain actual executable code. The parser correctly handles: - Single-line comments (//) - Multi-line comments (/* */) - String literals containing comment-like sequences - Raw string literals with fake comments - Mixed lines with both code and comments This improves the accuracy of coverage reports by ensuring that commented-out code, TODOs, and documentation comments don't inflate the count of uncovered lines. Fixes #22545 Change-Id: Ib428e6569011abb5f315387e81547147a2dadd2b GitHub-Last-Rev: 915058146bb5f929f08d63ee191edebd51b2ab56 GitHub-Pull-Request: golang/go#76692 Reviewed-on: https://go-review.googlesource.com/c/go/+/726800 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-12cmd/go: do not collect build information for test packages when not neededPierre Gimalac
When build information is not needed for go list output (when -export=false and Stale and StaleReason fields are not printed), the "SuppressBuildInfo" option is set to true, so that cmd/go/internal/load does not collect it (in particular VCS information, which is costly to compute). However the option is only checked in "PackagesAndErrors", not in "TestPackagesAndErrors", so when running go list -test=true, build information is still collected, significantly increasing the duration of the command. This CL updates TestPackagesAndErrors to check SuppressBuildInfo before calling setBuildInfo, like PackagesAndErrors does. Fixes #77419 Change-Id: I13f60d179c26d79d94899498f76ba9093566eeb6 Reviewed-on: https://go-review.googlesource.com/c/go/+/740901 Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Ian Alexander <jitsu@google.com> Auto-Submit: Ian Alexander <jitsu@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev>
2026-02-12cmd/go: fix panic in 'go run -C'Oleksandr Redko
Fixes #77483 Change-Id: Ie772ce1619beadc1a6db87aaf28a8d9c31f7d1b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/742860 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Alexander <jitsu@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Ian Alexander <jitsu@google.com> Auto-Submit: Sean Liao <sean@liao.dev>
2026-02-12cmd/go/internal/bug: sync go bug headings with GitHub formThanhNguyxn
Keep the issue body generated by go bug in the same order as the GitHub bug form: what happened first, then what was expected. This updates the footer headings and replaces the old "What did you see instead?" wording. Fixes #77488. Change-Id: Id20d68c1e109abb0d0397a7522fea91c5f2f3609 GitHub-Last-Rev: fa463a42a13cb1ad2ab33675ea2eefaa337e11c7 GitHub-Pull-Request: golang/go#77500 Reviewed-on: https://go-review.googlesource.com/c/go/+/743162 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2026-02-12cmd/compile: make the cached sdom always return the reverse PODaniel Morsing
The sdom tree has a feature where the ordering of child nodes could be customized, but in actuality, we only ever used one ordering: reverse postorder. This order has a nice property that walking the tree will always visit the source block of any non-retreating edge before the destination block. Make this ordering the default and document it. This allows passes that use it to use the cached sdom tree instead of calculating it from scratch each time. Change-Id: I907b8ff7cc722e94bf364c183f26ead66a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/742340 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-12cmd/go/internal/modindex: eliminate duplicated varsKir Kolyshkin
There is no need to have two sets of the same slices. The names are chosen to be the same as in ../imports. Change-Id: I92dca46127e25b5226cce3cc11749cd5957ad609 Reviewed-on: https://go-review.googlesource.com/c/go/+/718800 Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-12cmd/compile: fix slice bounds check elimination after function inliningYoulin Feng
When creating a dynamically-sized slice, the compiler attempts to use a stack-allocated buffer if the slice does not escape and its buffer size is ≤ 32 bytes. In this case, the SSA will contain a (OpPhi (OpSliceMake) (OpSliceMake)) value: one OpSliceMake uses the stack-allocated buffer, and the other uses the heap-allocated buffer. The len and cap arguments for these two OpSliceMake values are expected to be identical. This CL enables the prove pass to recognize this scenario and handle OpSliceLen and OpSliceCap as intended. Fixes #77375 Change-Id: Id77a2473caf66d366f5c94108aa6cb6d3df5b887 Reviewed-on: https://go-review.googlesource.com/c/go/+/740840 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2026-02-12cmd/compile/internal/bitvec: remove 2GB allocation limit in NewBulkMichael Podtserkovskii
Remove the "NewBulk too big" check that prevented bulk bit vector allocations exceeding ~2GB. This limit was overly restrictive and caused compilation failures for large generated code. The actual constraint is in the runtime's stackmap reader, which uses int32 arithmetic. Add overflow checks in cmd/compile/internal/liveness before stackmap serialization to detect this condition, allowing NewBulk itself to allocate bulk large bit vector. Fixes #77170 Change-Id: Ib7f2cabb28683258fc4e85418ba7fa70b48620b0 Reviewed-on: https://go-review.googlesource.com/c/go/+/736240 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-12cmd/compile: set alignment for all content-addressable symbolsIan Lance Taylor
There is nothing particularly special about content-addressable symbols, it's just a place to start. This reduces the size of the tailscaled binary by about 16K. This happens mainly because before this CL the linker's symalign function kicks in for all static composite literals and PCDATA symbols, and gives them an alignment based on their size. If the size happens to be a multiple of 32, it gets an alignment of 32. That wastes space. For #6853 For #36313 Change-Id: I2f049eee8f2463dd2b5e20d7c9a270ac32a31e50 Reviewed-on: https://go-review.googlesource.com/c/go/+/727920 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-12cmd/compile: replace conditions to CCMP instructions on ARM64Ch1n-ch1nless
This change introduces a new SSA pass that converts conditionals with logical AND into CMP/CCMP instruction sequences on ARM64. Fixes #71268 Change-Id: I3eba9c05b88ed6eb70350d30f6e805e6a4dddbf1 Reviewed-on: https://go-review.googlesource.com/c/go/+/698099 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-12cmd/link: handle runtime.type based on size, not GOOSIan Lance Taylor
When handling type descriptors, we add some space at the start to ensure that offset 0 does not refer to a valid type descriptor. AIX has an initial runtime.types symbol with a non-zero size, so we used that instead of adding some space. In some cases Darwin also has a runtime.types symbol with a non-zero size. Before CL 727021, this was always fine, because the 8 byte size of runtime.types was swamped by the 32-byte alignment of type descriptors. That didn't work for AIX with the external linker, because on AIX the external linker lays out each symbol separately. Darwin doesn't have that problem, so the layout of the internal linker was preserved. However, CL 727021 changed the alignment of type descriptors to 8. That means that on Darwin the 8 byte size of runtime.types was no longer hidden by the alignment. In effect we were skipping twice: once for runtime.types, and then again explicitly. This only failed when runtime.types has a non-zero size, which is only in a few specific cases. This CL cleans this up by not skipping explicitly in any case where runtime.types has a non-zero size. That handles both AIX and Darwin consistently. To make this clearer, I changed the skip from a single byte to the size of a pointer in all cases. I considered always giving runtime.types a non-zero size, but that is a bigger change, and potentially confusing since there really isn't any data associated with runtime.types. The cases where we must give it a non-zero size are special, and I think it's simpler to keep it that way. For #6853 For #36313 Fixes #77569 Change-Id: I22ebbd0194527ecca96d48849aa00a4fc899e55c Reviewed-on: https://go-review.googlesource.com/c/go/+/744820 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-02-11cmd/link: correct libc dynamic linker pathMeng Zhuo
Ref: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/114 Fixes #77209 Change-Id: I8b575a95ad4e6a7e792514d7fcf9497599c1e404 Reviewed-on: https://go-review.googlesource.com/c/go/+/737180 Reviewed-by: Pengcheng Wang <wangpengcheng.pp@bytedance.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> TryBot-Bypass: Meng Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-02-10cmd/compile, runtime: set alignment of type descriptorsIan Lance Taylor
This trivial change reduces the size of cmd/go by 88K. For #6853 For #36313 Change-Id: I5e74acf118bd1c63cbdd256879d8aa8d72a50505 Reviewed-on: https://go-review.googlesource.com/c/go/+/727021 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-02-10cmd/internal/obj: add Align field to LSymIan Lance Taylor
This will permit the compiler and assembler to specify the alignment of symbols that they create. Careful placement of the new field, plus rearranging an existing field, means that LSym does not change size (as tested by TestSizeof). The new alignment field is int16, permitting alignment up to 16384, more than we ever need in practice. If necessary we could change the field to uint8 and store the alignment as a power of two, as is done in the linker. This replaces the Align field in FuncInfo. For #6853 For #36313 Change-Id: I421e8238ab57958fea8e4eab0649ce5288e7f92f Reviewed-on: https://go-review.googlesource.com/c/go/+/727020 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-02-10cmd/compile: move likely used values into registers before entering loopKeith Randall
When we are about to enter a loop, we try to put values that will be used soon into registers, so we put them into registers once outside the loop instead of N times inside the loop. But we currently don't kick out values we won't use for a while to make room. This CL does that. So even if register pressure is large around the loop, we can still use registers for all the in-loop values. The values generating the register pressure, but not used inside the loop, will get spilled around the loop. This is particularly useful for Phi arguments. We want to promote from fixed zero registers or other rematerializeable values to a general register before the loop starts. Fixes #77299 Change-Id: I00efc3d3014163aaf377693830c7d7957eaa515f Reviewed-on: https://go-review.googlesource.com/c/go/+/743640 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-07internal/abi, runtime: put type descriptor sizes in internal/abiIan Lance Taylor
Change-Id: I4ecfda9f85b00a228e8cf51d7ff4457ef7f83ce5 Reviewed-on: https://go-review.googlesource.com/c/go/+/726160 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-06cmd/link: run ELF tests on SolarisIan Lance Taylor
Change-Id: If06d5b5f4a491ea80f001d930f3f4a5f22290460 Reviewed-on: https://go-review.googlesource.com/c/go/+/742560 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2026-02-06cmd/link: only run ELF tests on ELF systemsIan Lance Taylor
Running these tests on other systems is a pointless waste of time. This runs cmd/link/internal/ld/elf_test.go in the same cases that we run cmd/link/elf_test.go. Change-Id: I318fb5c2de9e4cfdb976bc2389c72cede6661b47 Reviewed-on: https://go-review.googlesource.com/c/go/+/740782 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-06cmd/link: make TestTypePlacement work on AIXIan Lance Taylor
The existing code was just wrong. On AIX the go.type section is folded into the .text section (when internally linking), or the .data section (when externally linking). It follows that the data section adjustment is useless when internally linking, which is currently what happens with this test. Change-Id: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b Reviewed-on: https://go-review.googlesource.com/c/go/+/740821 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-06cmd/link: use correct alignment for type descriptors on AIXIan Lance Taylor
CL 724261 changed the linker to put all type descriptors that are used for typelinks in a single list. This caused trouble on AIX when linking externally, because the AIX linker aligns symbols individually, rather than honoring the layout of the object file generated by the internal linker. I fixed internal linking problems with CL 740220, but that just made things worse for the external linker. This CL rolls back 740220, and adds commentary. With this CL we force a smaller alignment for type descriptors, use the same alignment for runtime.types and type:*, and use a consistent size for runtime.types in all cases. With this change all the type descriptor related code passes again on AIX, except for the new TestTypePlacement test which I will fix in a followup CL. Fixes #77400 Change-Id: I9f25847eb0588001cb4ce453f211a655400d6a59 Reviewed-on: https://go-review.googlesource.com/c/go/+/740820 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-06cmd/link: align covctrs symbolKeith Randall
If we start the covctrs blob at an odd alignment, then covctrs will not be correctly aligned. Each individual entry is aligned properly, but the start marker may be before any padding inserted to enforce that alignment. Fixes #58936 Change-Id: I802fbe40eacfa5a3c8c4864e078b0e078da956d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/733740 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-02-06cmd/compile: allow equal functions to perform unaligned load on loong64Guoqi Chen
The Go compiler always generates Loong64 binaries, which can execute any processor of LA364, LA464, LA664 or higher core. And these processors support unaligned memory access [1]. goos: linux goarch: loong64 pkg: strings cpu: Loongson-3A6000 @ 2500.00MHz | old.txt | new.txt | | sec/op | sec/op vs base | StringPrefix3 4.0040n ± 0% 0.4003n ± 0% -90.00% (p=0.000 n=10) StringPrefix5 4.0040n ± 0% 0.4003n ± 0% -90.00% (p=0.000 n=10) StringPrefix6 3.6030n ± 0% 0.4002n ± 0% -88.89% (p=0.000 n=10) StringPrefix7 4.0040n ± 0% 0.4002n ± 0% -90.00% (p=0.000 n=10) geomean 3.900n 0.4003n -89.74% goos: linux goarch: loong64 pkg: strings cpu: Loongson-3A5000-HV @ 2500.00MHz | old.txt │ new.txt | | sec/op │ sec/op vs base | StringPrefix3 5.6160n ± 0% 0.4011n ± 0% -92.86% (p=0.000 n=10) StringPrefix5 5.6180n ± 0% 0.4011n ± 0% -92.86% (p=0.000 n=10) StringPrefix6 5.2170n ± 0% 0.4011n ± 0% -92.31% (p=0.000 n=10) StringPrefix7 5.6170n ± 0% 0.4009n ± 0% -92.86% (p=0.000 n=10) geomean 5.514n 0.4010n -92.73% goos: linux goarch: loong64 pkg: strings cpu: Loongson-3B6000M @ 2400.00MHz | old.txt │ new.txt | | sec/op │ sec/op vs base | StringPrefix3 5.0060n ± 0% 0.4223n ± 1% -91.56% (p=0.000 n=10) StringPrefix5 4.5890n ± 0% 0.4214n ± 0% -90.82% (p=0.000 n=10) StringPrefix6 4.5890n ± 0% 0.4190n ± 1% -90.87% (p=0.000 n=10) StringPrefix7 4.5890n ± 0% 0.4226n ± 1% -90.79% (p=0.000 n=10) geomean 4.690n 0.4213n -91.02% [1]: https://go.dev/wiki/MinimumRequirements#loong64 Change-Id: I1870080e0122a7d136685e3045699d0cf1e4194d Reviewed-on: https://go-review.googlesource.com/c/go/+/742260 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2026-02-06cmd/compile/internal/ssagen: fix typo GrtCallerSP -> GetCallerSPyongqijia
Fix a typo in findIntrinsic function where "GrtCallerSP" should be "GetCallerSP". This typo was in the condition checking for runtime intrinsic functions that don't have definitions. Fixes #77432 Change-Id: I8667a42456b4b2c4533dfcbca198b46793f71c89 GitHub-Last-Rev: 00ea4034177381ca7f851ae002487dba3dba20f8 GitHub-Pull-Request: golang/go#77476 Reviewed-on: https://go-review.googlesource.com/c/go/+/742680 Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-06runtime: add explicit lower bounds check to decoderuneJonah Uellenberg
decoderune is only called by generated code, so we can guarantee that it's non-negative. This allows eliminating the automatic bounds check in it. To make this work, we need to expand the existing optimization to uints. This generally enables BCE for cases like this: ```go func test(list []int, idx uint64) int { if idx >= uint64(len(list)) { return 0 } list1 := list[idx:] return list1[0] } ``` Change-Id: I86a51b26ca0e63522dec99f7d6efe6bdcd2d6487 GitHub-Last-Rev: 82d44e0a080b53ee02c31ee1f92a8a0acd8d2621 GitHub-Pull-Request: golang/go#76610 Reviewed-on: https://go-review.googlesource.com/c/go/+/725101 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2026-02-06cmd/link: ignore GCC generated .wm4/.wm8 symbols with no typeIan Lance Taylor
Fixes #77436 Change-Id: I37d852a89678c929156c4765e774c819eb515e6f Reviewed-on: https://go-review.googlesource.com/c/go/+/742220 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-02-06cmd/link: correct error message in loadelf.LoadIan Lance Taylor
The message said we were ignoring the symbols, but we aren't. We are treating them as an error. For #77436 Change-Id: I5492d81717c539b09f6956b591178f1f3a42893d Reviewed-on: https://go-review.googlesource.com/c/go/+/742060 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-06cmd/compile: fix SIMD type parameter instantiationCuong Manh Le
When a SIMD type is used to instantiate a type parameter, the SIMD's underlying type is its shape. This shape type must be marked as a SIMD type, otherwise, the backend will confuse and does not know how to put this SIMD type to proper registers. Fixing this by marking a type as SIMD type if its underlying is already a SIMD one. Fixes #77444 Change-Id: I745c474469889c94bc68435472ba4820e9f752a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/742320 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2026-02-05go/types, types2: mechanically swap x.mode() == invalid for !x.isValid()Mark Freeman
Change-Id: I2e98178a42ad225aa3803dc4ccd26d50938f29b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/742501 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com>
2026-02-05go/types, types2: mechanically swap x.mode_ = invalid for x.invalidate()Mark Freeman
Change-Id: I7802b10f63a52e5f864d550a7ad7678d4581a796 Reviewed-on: https://go-review.googlesource.com/c/go/+/742500 Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-02-05go/types, types2: mechanically replace read accesses to operand.mode_Mark Freeman
Change-Id: Ib832f4f9fde45b1308208f05756960191953e8f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/742081 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-05go/types, types2: mechanically replace read accesses to operand.typ_Mark Freeman
This provides a hook to enforce that operand.typ is only observed where operand.mode is not invalid. For #76110 Change-Id: I915f3ac09dc10bfe3f9f688d6190ad58e195ddcb Reviewed-on: https://go-review.googlesource.com/c/go/+/741220 Auto-Submit: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>