Skip to content

Commit b4a0665

Browse files
committed
[release-branch.go1.21] all: merge master (b7e7467) into release-branch.go1.21
Merge List: + 2023-06-15 b7e7467 test/codegen: add fsqrt test for riscv64 + 2023-06-15 befec5d text/template: set variables correctly in range assignment + 2023-06-15 c546321 cmd/api: skip TestIssue29837 when -short is set + 2023-06-15 9fc8436 cmd/asm: fix encoding errors for FMOVD and FMOVS instructions on arm64 + 2023-06-14 da94586 cmd/go: check for errors reading gccgo package list + 2023-06-14 b01cd41 cmd/go: use gover.Local for $goversion in TestScript + 2023-06-14 3aea422 crypto/x509: use synthetic root for platform testing Change-Id: Icec55130749c52eef75c0e0325d889ff18b067f6
2 parents 577e7b9 + b7e7467 commit b4a0665

File tree

11 files changed

+325
-42
lines changed

11 files changed

+325
-42
lines changed

src/cmd/api/api_test.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,7 @@ func BenchmarkAll(b *testing.B) {
209209
}
210210
}
211211

212-
func TestIssue21181(t *testing.T) {
213-
if testing.Short() {
214-
t.Skip("skipping with -short")
215-
}
216-
if *flagCheck {
217-
// slow, not worth repeating in -check
218-
t.Skip("skipping with -check set")
219-
}
220-
testenv.MustHaveGoBuild(t)
221-
212+
var warmupCache = sync.OnceFunc(func() {
222213
// Warm up the import cache in parallel.
223214
var wg sync.WaitGroup
224215
for _, context := range contexts {
@@ -230,6 +221,19 @@ func TestIssue21181(t *testing.T) {
230221
}()
231222
}
232223
wg.Wait()
224+
})
225+
226+
func TestIssue21181(t *testing.T) {
227+
if testing.Short() {
228+
t.Skip("skipping with -short")
229+
}
230+
if *flagCheck {
231+
// slow, not worth repeating in -check
232+
t.Skip("skipping with -check set")
233+
}
234+
testenv.MustHaveGoBuild(t)
235+
236+
warmupCache()
233237

234238
for _, context := range contexts {
235239
w := NewWalker(context, "testdata/src/issue21181")
@@ -243,11 +247,17 @@ func TestIssue21181(t *testing.T) {
243247
}
244248

245249
func TestIssue29837(t *testing.T) {
250+
if testing.Short() {
251+
t.Skip("skipping with -short")
252+
}
246253
if *flagCheck {
247254
// slow, not worth repeating in -check
248255
t.Skip("skipping with -check set")
249256
}
250257
testenv.MustHaveGoBuild(t)
258+
259+
warmupCache()
260+
251261
for _, context := range contexts {
252262
w := NewWalker(context, "testdata/src/issue29837")
253263
_, err := w.ImportFrom("p", "", 0)

src/cmd/asm/internal/asm/testdata/arm64.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
238238
FMOVS $0, F0 // e003271e
239239
FMOVD ZR, F0 // e003679e
240240
FMOVS ZR, F0 // e003271e
241+
FMOVD F1, ZR // 3f00669e
242+
FMOVS F1, ZR // 3f00261e
241243
VUADDW V9.B8, V12.H8, V14.H8 // 8e11292e
242244
VUADDW V13.H4, V10.S4, V11.S4 // 4b116d2e
243245
VUADDW V21.S2, V24.D2, V29.D2 // 1d13b52e

src/cmd/go/internal/work/action.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,16 +382,23 @@ func (b *Builder) NewObjdir() string {
382382
func readpkglist(shlibpath string) (pkgs []*load.Package) {
383383
var stk load.ImportStack
384384
if cfg.BuildToolchainName == "gccgo" {
385-
f, _ := elf.Open(shlibpath)
385+
f, err := elf.Open(shlibpath)
386+
if err != nil {
387+
base.Fatal(fmt.Errorf("failed to open shared library: %v", err))
388+
}
386389
sect := f.Section(".go_export")
387-
data, _ := sect.Data()
388-
scanner := bufio.NewScanner(bytes.NewBuffer(data))
389-
for scanner.Scan() {
390-
t := scanner.Text()
391-
var found bool
392-
if t, found = strings.CutPrefix(t, "pkgpath "); found {
393-
t = strings.TrimSuffix(t, ";")
394-
pkgs = append(pkgs, load.LoadPackageWithFlags(t, base.Cwd(), &stk, nil, 0))
390+
if sect == nil {
391+
base.Fatal(fmt.Errorf("%s: missing .go_export section", shlibpath))
392+
}
393+
data, err := sect.Data()
394+
if err != nil {
395+
base.Fatal(fmt.Errorf("%s: failed to read .go_export section: %v", shlibpath, err))
396+
}
397+
pkgpath := []byte("pkgpath ")
398+
for _, line := range bytes.Split(data, []byte{'\n'}) {
399+
if path, found := bytes.CutPrefix(line, pkgpath); found {
400+
path = bytes.TrimSuffix(path, []byte{';'})
401+
pkgs = append(pkgs, load.LoadPackageWithFlags(string(path), base.Cwd(), &stk, nil, 0))
395402
}
396403
}
397404
} else {

src/cmd/go/script_test.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ import (
1414
"bytes"
1515
"context"
1616
"flag"
17-
"fmt"
18-
"go/build"
1917
"internal/testenv"
2018
"internal/txtar"
2119
"net/url"
2220
"os"
2321
"path/filepath"
24-
"regexp"
2522
"runtime"
2623
"strings"
2724
"testing"
2825
"time"
2926

3027
"cmd/go/internal/cfg"
28+
"cmd/go/internal/gover"
3129
"cmd/go/internal/script"
3230
"cmd/go/internal/script/scripttest"
3331
"cmd/go/internal/vcweb/vcstest"
@@ -209,10 +207,6 @@ func scriptEnv(srv *vcstest.Server, srvCertFile string) ([]string, error) {
209207
if err != nil {
210208
return nil, err
211209
}
212-
version, err := goVersion()
213-
if err != nil {
214-
return nil, err
215-
}
216210
env := []string{
217211
pathEnvName() + "=" + testBin + string(filepath.ListSeparator) + os.Getenv(pathEnvName()),
218212
homeEnvName() + "=/no-home",
@@ -243,7 +237,7 @@ func scriptEnv(srv *vcstest.Server, srvCertFile string) ([]string, error) {
243237
"GONOSUMDB=",
244238
"GOVCS=*:all",
245239
"devnull=" + os.DevNull,
246-
"goversion=" + version,
240+
"goversion=" + gover.Local(),
247241
"CMDGO_TEST_RUN_MAIN=true",
248242
"HGRCPATH=",
249243
"GOTOOLCHAIN=auto",
@@ -281,16 +275,6 @@ func scriptEnv(srv *vcstest.Server, srvCertFile string) ([]string, error) {
281275
return env, nil
282276
}
283277

284-
// goVersion returns the current Go version.
285-
func goVersion() (string, error) {
286-
tags := build.Default.ReleaseTags
287-
version := tags[len(tags)-1]
288-
if !regexp.MustCompile(`^go([1-9][0-9]*)\.(0|[1-9][0-9]*)$`).MatchString(version) {
289-
return "", fmt.Errorf("invalid go version %q", version)
290-
}
291-
return version[2:], nil
292-
}
293-
294278
var extraEnvKeys = []string{
295279
"SYSTEMROOT", // must be preserved on Windows to find DLLs; golang.org/issue/25210
296280
"WINDIR", // must be preserved on Windows to be able to run PowerShell command; golang.org/issue/30711

src/cmd/internal/obj/arm64/asm7.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3880,7 +3880,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
38803880
case 29: /* op Rn, Rd */
38813881
fc := c.aclass(&p.From)
38823882
tc := c.aclass(&p.To)
3883-
if (p.As == AFMOVD || p.As == AFMOVS) && (fc == C_REG || fc == C_ZREG || tc == C_REG) {
3883+
if (p.As == AFMOVD || p.As == AFMOVS) && (fc == C_REG || fc == C_ZREG || tc == C_REG || tc == C_ZREG) {
38843884
// FMOV Rx, Fy or FMOV Fy, Rx
38853885
o1 = FPCVTI(0, 0, 0, 0, 6)
38863886
if p.As == AFMOVD {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIB/DCCAaOgAwIBAgICIzEwCgYIKoZIzj0EAwIwLDEqMCgGA1UEAxMhR28gcGxh
3+
dGZvcm0gdmVyaWZpZXIgdGVzdGluZyByb290MB4XDTIzMDUyNjE3NDQwMVoXDTI4
4+
MDUyNDE4NDQwMVowLDEqMCgGA1UEAxMhR28gcGxhdGZvcm0gdmVyaWZpZXIgdGVz
5+
dGluZyByb290MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5dNQY4FY29i2g3xx
6+
7FyH4XiZz0C0AM4uyPUsXCZNb7CsctHDLhLtzABWSfFz76j+oVhq+qKrwIHsLX+7
7+
f6YTQqOBtDCBsTAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0lBAwwCgYIKwYBBQUHAwEw
8+
DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUEJInRbtQR6xTUSwvtdAe9A4XHwQw
9+
WgYDVR0eAQH/BFAwTqAaMBiCFnRlc3RpbmcuZ29sYW5nLmludmFsaWShMDAKhwgA
10+
AAAAAAAAADAihyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAKBggq
11+
hkjOPQQDAgNHADBEAiBgzgLyQm4rK1AuIcElH3MdRqlteq3nzZCxKOI4xHXYjQIg
12+
BCSzaCb1+/AK+mhRubrdebFYlUdveTH98wAfKQHaw64=
13+
-----END CERTIFICATE-----

src/crypto/x509/platform_root_key.pem

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-----BEGIN EC PRIVATE KEY-----
2+
MHcCAQEEIHhv8LVzb9gqJzAY0P442+FW0oqbfBrLnfqxyyAujOFSoAoGCCqGSM49
3+
AwEHoUQDQgAE5dNQY4FY29i2g3xx7FyH4XiZz0C0AM4uyPUsXCZNb7CsctHDLhLt
4+
zABWSfFz76j+oVhq+qKrwIHsLX+7f6YTQg==
5+
-----END EC PRIVATE KEY-----

0 commit comments

Comments
 (0)