3 //go:build !js && !wasip1 && gc
5 // Copyright 2014 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
21 err := os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
24 f, err := ioutil.TempFile("", "issue9355-*.o")
31 out := run("go", "tool", "compile", "-p=p", "-o", f.Name(), "-S", "a.go")
34 // 6g/8g print the offset as dec, but 5g/9g print the offset as hex.
36 `rel 0\+\d t=R_ADDR p\.x\+8\r?\n`, // y = &x.b
37 `rel 0\+\d t=R_ADDR p\.x\+(28|1c)\r?\n`, // z = &x.d.q
38 `rel 0\+\d t=R_ADDR p\.b\+5\r?\n`, // c = &b[5]
39 `rel 0\+\d t=R_ADDR p\.x\+(88|58)\r?\n`, // w = &x.f[3].r
41 for _, p := range patterns {
42 if ok, err := regexp.Match(p, out); !ok || err != nil {
44 panic("can't find pattern " + p)
49 func run(cmd string, args ...string) []byte {
50 out, err := exec.Command(cmd, args...).CombinedOutput()
52 fmt.Println(string(out))
59 func check(err error) {
61 fmt.Println("BUG:", err)