aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-03-17 13:27:40 -0700
committerMatthew Dempsky <mdempsky@google.com>2022-05-16 18:19:47 +0000
commitab8d7dd75ea4918cde5e71b4482ff5b4f0f69273 (patch)
tree694f3fcae4f11f3abeeefd0cca39ecbf31b63278 /test/codegen
parentdb875f4d1b125e41a3999e3dd5c30d6b1bce235c (diff)
downloadgo-ab8d7dd75ea4918cde5e71b4482ff5b4f0f69273.tar.xz
cmd/compile: set LocalPkg.Path to -p flag
Since CL 391014, cmd/compile now requires the -p flag to be set the build system. This CL changes it to initialize LocalPkg.Path to the provided path, rather than relying on writing out `"".` into object files and expecting cmd/link to substitute them. However, this actually involved a rather long tail of fixes. Many have already been submitted, but a few notable ones that have to land simultaneously with changing LocalPkg: 1. When compiling package runtime, there are really two "runtime" packages: types.LocalPkg (the source package itself) and ir.Pkgs.Runtime (the compiler's internal representation, for synthetic references). Previously, these ended up creating separate link symbols (`"".xxx` and `runtime.xxx`, respectively), but now they both end up as `runtime.xxx`, which causes lsym collisions (notably inittask and funcsyms). 2. test/codegen tests need to be updated to expect symbols to be named `command-line-arguments.xxx` rather than `"".foo`. 3. The issue20014 test case is sensitive to the sort order of field tracking symbols. In particular, the local package now sorts to its natural place in the list, rather than to the front. Thanks to David Chase for helping track down all of the fixes needed for this CL. Updates #51734. Change-Id: Iba3041cf7ad967d18c6e17922fa06ba11798b565 Reviewed-on: https://go-review.googlesource.com/c/go/+/393715 Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/clobberdead.go12
-rw-r--r--test/codegen/comparisons.go16
-rw-r--r--test/codegen/memcombine.go2
-rw-r--r--test/codegen/memops.go10
-rw-r--r--test/codegen/select.go2
-rw-r--r--test/codegen/zerosize.go4
6 files changed, 23 insertions, 23 deletions
diff --git a/test/codegen/clobberdead.go b/test/codegen/clobberdead.go
index c490790bb6..732be5f73b 100644
--- a/test/codegen/clobberdead.go
+++ b/test/codegen/clobberdead.go
@@ -15,16 +15,16 @@ var p1, p2, p3 T
func F() {
// 3735936685 is 0xdeaddead. On ARM64 R27 is REGTMP.
// clobber x, y at entry. not clobber z (stack object).
- // amd64:`MOVL\t\$3735936685, ""\.x`, `MOVL\t\$3735936685, ""\.y`, -`MOVL\t\$3735936685, ""\.z`
- // arm64:`MOVW\tR27, ""\.x`, `MOVW\tR27, ""\.y`, -`MOVW\tR27, ""\.z`
+ // amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, `MOVL\t\$3735936685, command-line-arguments\.y`, -`MOVL\t\$3735936685, command-line-arguments\.z`
+ // arm64:`MOVW\tR27, command-line-arguments\.x`, `MOVW\tR27, command-line-arguments\.y`, -`MOVW\tR27, command-line-arguments\.z`
x, y, z := p1, p2, p3
addrTaken(&z)
// x is dead at the call (the value of x is loaded before the CALL), y is not
- // amd64:`MOVL\t\$3735936685, ""\.x`, -`MOVL\t\$3735936685, ""\.y`
- // arm64:`MOVW\tR27, ""\.x`, -`MOVW\tR27, ""\.y`
+ // amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, -`MOVL\t\$3735936685, command-line-arguments\.y`
+ // arm64:`MOVW\tR27, command-line-arguments\.x`, -`MOVW\tR27, command-line-arguments\.y`
use(x)
- // amd64:`MOVL\t\$3735936685, ""\.x`, `MOVL\t\$3735936685, ""\.y`
- // arm64:`MOVW\tR27, ""\.x`, `MOVW\tR27, ""\.y`
+ // amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, `MOVL\t\$3735936685, command-line-arguments\.y`
+ // arm64:`MOVW\tR27, command-line-arguments\.x`, `MOVW\tR27, command-line-arguments\.y`
use(y)
}
diff --git a/test/codegen/comparisons.go b/test/codegen/comparisons.go
index 181bb93496..7e9d4745f1 100644
--- a/test/codegen/comparisons.go
+++ b/test/codegen/comparisons.go
@@ -45,7 +45,7 @@ func CompareString3(s string) bool {
// Check that arrays compare use 2/4/8 byte compares
func CompareArray1(a, b [2]byte) bool {
- // amd64:`CMPW\t""[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPW\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// arm64:-`MOVBU\t`
// ppc64le:-`MOVBZ\t`
// s390x:-`MOVBZ\t`
@@ -53,25 +53,25 @@ func CompareArray1(a, b [2]byte) bool {
}
func CompareArray2(a, b [3]uint16) bool {
- // amd64:`CMPL\t""[.+_a-z0-9]+\(SP\), [A-Z]`
- // amd64:`CMPW\t""[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPL\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPW\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b
}
func CompareArray3(a, b [3]int16) bool {
- // amd64:`CMPL\t""[.+_a-z0-9]+\(SP\), [A-Z]`
- // amd64:`CMPW\t""[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPL\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPW\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b
}
func CompareArray4(a, b [12]int8) bool {
- // amd64:`CMPQ\t""[.+_a-z0-9]+\(SP\), [A-Z]`
- // amd64:`CMPL\t""[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPL\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b
}
func CompareArray5(a, b [15]byte) bool {
- // amd64:`CMPQ\t""[.+_a-z0-9]+\(SP\), [A-Z]`
+ // amd64:`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b
}
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index 0292d7f0f3..1427f7a7d5 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -335,7 +335,7 @@ func load_op_no_merge(p, q *int) {
// Make sure offsets are folded into loads and stores.
func offsets_fold(_, a [20]byte) (b [20]byte) {
- // arm64:`MOVD\t""\.a\+[0-9]+\(FP\), R[0-9]+`,`MOVD\tR[0-9]+, ""\.b\+[0-9]+\(FP\)`
+ // arm64:`MOVD\tcommand-line-arguments\.a\+[0-9]+\(FP\), R[0-9]+`,`MOVD\tR[0-9]+, command-line-arguments\.b\+[0-9]+\(FP\)`
b = a
return
}
diff --git a/test/codegen/memops.go b/test/codegen/memops.go
index fb8208f984..7e59d88560 100644
--- a/test/codegen/memops.go
+++ b/test/codegen/memops.go
@@ -13,23 +13,23 @@ var x32 [2]uint32
var x64 [2]uint64
func compMem1() int {
- // amd64:`CMPB\t"".x\+1\(SB\), [$]0`
+ // amd64:`CMPB\tcommand-line-arguments.x\+1\(SB\), [$]0`
if x[1] {
return 1
}
- // amd64:`CMPB\t"".x8\+1\(SB\), [$]7`
+ // amd64:`CMPB\tcommand-line-arguments.x8\+1\(SB\), [$]7`
if x8[1] == 7 {
return 1
}
- // amd64:`CMPW\t"".x16\+2\(SB\), [$]7`
+ // amd64:`CMPW\tcommand-line-arguments.x16\+2\(SB\), [$]7`
if x16[1] == 7 {
return 1
}
- // amd64:`CMPL\t"".x32\+4\(SB\), [$]7`
+ // amd64:`CMPL\tcommand-line-arguments.x32\+4\(SB\), [$]7`
if x32[1] == 7 {
return 1
}
- // amd64:`CMPQ\t"".x64\+8\(SB\), [$]7`
+ // amd64:`CMPQ\tcommand-line-arguments.x64\+8\(SB\), [$]7`
if x64[1] == 7 {
return 1
}
diff --git a/test/codegen/select.go b/test/codegen/select.go
index 4426924b36..82f6d1c7ef 100644
--- a/test/codegen/select.go
+++ b/test/codegen/select.go
@@ -10,7 +10,7 @@ func f() {
ch1 := make(chan int)
ch2 := make(chan int)
for {
- // amd64:-`MOVQ\t[$]0, ""..autotmp_3`
+ // amd64:-`MOVQ\t[$]0, command-line-arguments..autotmp_3`
select {
case <-ch1:
case <-ch2:
diff --git a/test/codegen/zerosize.go b/test/codegen/zerosize.go
index 292c5a018b..ecf3305461 100644
--- a/test/codegen/zerosize.go
+++ b/test/codegen/zerosize.go
@@ -12,12 +12,12 @@ package codegen
func zeroSize() {
c := make(chan struct{})
- // amd64:`MOVQ\t\$0, ""\.s\+56\(SP\)`
+ // amd64:`MOVQ\t\$0, command-line-arguments\.s\+56\(SP\)`
var s *int
// force s to be a stack object, also use some (fixed) stack space
g(&s, 1, 2, 3, 4, 5)
- // amd64:`LEAQ\t""\..*\+55\(SP\)`
+ // amd64:`LEAQ\tcommand-line-arguments\..*\+55\(SP\)`
c <- struct{}{}
}