aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-04-11 15:15:04 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-04-12 21:53:39 +0000
commitce3ee7cdae9059a2cfb1a801a34712f413afb211 (patch)
treeec23161c4ba9d7a5fe95af90813569e2c983525a /src/cmd/asm
parent4eb48a336e5a7ac519611cf8360909e0ac37f018 (diff)
downloadgo-ce3ee7cdae9059a2cfb1a801a34712f413afb211.tar.xz
cmd/internal/obj: stop storing Text flags in From3
Prior to this CL, flags such as NOSPLIT on ATEXT Progs were stored in From3.Offset. Some but not all of those flags were also duplicated into From.Sym.Attribute. This CL migrates all of those flags into From.Sym.Attribute and stops creating a From3. A side-effect of this is that printing an ATEXT Prog can no longer simply dump From3.Offset. That's kind of good, since the raw flag value wasn't very informative anyway, but it did necessitate a bunch of updates to the cmd/asm tests. The reason I'm doing this work now is that avoiding storing flags in both From.Sym and From3.Offset simplifies some other changes to fix the data race first described in CL 40254. This CL almost passes toolstash-check -all. The only changes are in cases where the assembler has decided that a function's flags may be altered, e.g. to make a function with no calls in it NOSPLIT. Prior to this CL, that information was not printed. Sample before: "".Ctz64 t=1 size=63 args=0x10 locals=0x0 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) TEXT "".Ctz64(SB), $0-16 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) FUNCDATA $0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB) Sample after: "".Ctz64 t=1 nosplit size=63 args=0x10 locals=0x0 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) TEXT "".Ctz64(SB), NOSPLIT, $0-16 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) FUNCDATA $0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB) Observe the additional "nosplit" in the first line and the additional "NOSPLIT" in the second line. Updates #15756 Change-Id: I5c59bd8f3bdc7c780361f801d94a261f0aef3d13 Reviewed-on: https://go-review.googlesource.com/40495 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/asm.go6
-rw-r--r--src/cmd/asm/internal/asm/endtoend_test.go5
-rw-r--r--src/cmd/asm/internal/asm/testdata/386.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/amd64.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/amd64enc.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/arm.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/arm64.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/mips.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/mips64.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/ppc64.s4
-rw-r--r--src/cmd/asm/internal/asm/testdata/s390x.s8
11 files changed, 35 insertions, 16 deletions
diff --git a/src/cmd/asm/internal/asm/asm.go b/src/cmd/asm/internal/asm/asm.go
index 0e31677a3f..7e3a8418dd 100644
--- a/src/cmd/asm/internal/asm/asm.go
+++ b/src/cmd/asm/internal/asm/asm.go
@@ -165,10 +165,6 @@ func (p *Parser) asmText(word string, operands [][]lex.Token) {
As: obj.ATEXT,
Pos: p.pos(),
From: nameAddr,
- From3: &obj.Addr{
- Type: obj.TYPE_CONST,
- Offset: flag,
- },
To: obj.Addr{
Type: obj.TYPE_TEXTSIZE,
Offset: frameSize,
@@ -176,7 +172,7 @@ func (p *Parser) asmText(word string, operands [][]lex.Token) {
},
}
prog.To.Val = int32(argSize)
- p.ctxt.InitTextSym(prog)
+ p.ctxt.InitTextSym(prog, int(flag))
p.append(prog, "", true)
}
diff --git a/src/cmd/asm/internal/asm/endtoend_test.go b/src/cmd/asm/internal/asm/endtoend_test.go
index f9d95ebc8c..36aa4aedd8 100644
--- a/src/cmd/asm/internal/asm/endtoend_test.go
+++ b/src/cmd/asm/internal/asm/endtoend_test.go
@@ -62,6 +62,11 @@ Diff:
for _, line := range lines {
lineno++
+ // Ignore include of textflag.h.
+ if strings.HasPrefix(line, "#include ") {
+ continue
+ }
+
// The general form of a test input line is:
// // comment
// INST args [// printed form] [// hex encoding]
diff --git a/src/cmd/asm/internal/asm/testdata/386.s b/src/cmd/asm/internal/asm/testdata/386.s
index 4d969d1539..ad8affd854 100644
--- a/src/cmd/asm/internal/asm/testdata/386.s
+++ b/src/cmd/asm/internal/asm/testdata/386.s
@@ -2,7 +2,9 @@
// the old assembler's (8a's) grammar and hand-writing complete
// instructions for each rule, to guarantee we cover the same space.
-TEXT foo(SB), 7, $0
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB), DUPOK|NOSPLIT, $0
// LTYPE1 nonrem { outcode(int($1), &$2); }
SETCC AX
diff --git a/src/cmd/asm/internal/asm/testdata/amd64.s b/src/cmd/asm/internal/asm/testdata/amd64.s
index da0144230d..d07cf0d213 100644
--- a/src/cmd/asm/internal/asm/testdata/amd64.s
+++ b/src/cmd/asm/internal/asm/testdata/amd64.s
@@ -6,7 +6,9 @@
// the old assembler's (6a's) grammar and hand-writing complete
// instructions for each rule, to guarantee we cover the same space.
-TEXT foo(SB), 7, $0
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB), DUPOK|NOSPLIT, $0
// LTYPE1 nonrem { outcode($1, &$2); }
NEGQ R11
diff --git a/src/cmd/asm/internal/asm/testdata/amd64enc.s b/src/cmd/asm/internal/asm/testdata/amd64enc.s
index b27faa5a36..3d6061f839 100644
--- a/src/cmd/asm/internal/asm/testdata/amd64enc.s
+++ b/src/cmd/asm/internal/asm/testdata/amd64enc.s
@@ -1,7 +1,9 @@
// generated by x86test -amd64
// DO NOT EDIT
-TEXT asmtest(SB),7,$0
+#include "../../../../../runtime/textflag.h"
+
+TEXT asmtest(SB),DUPOK|NOSPLIT,$0
ADCB $7, AL // 1407
ADCW $61731, AX // 661523f1
ADCL $4045620583, AX // 15674523f1
diff --git a/src/cmd/asm/internal/asm/testdata/arm.s b/src/cmd/asm/internal/asm/testdata/arm.s
index 0ae031ee81..969fb66cdf 100644
--- a/src/cmd/asm/internal/asm/testdata/arm.s
+++ b/src/cmd/asm/internal/asm/testdata/arm.s
@@ -6,7 +6,9 @@
// the old assembler's (5a's) grammar and hand-writing complete
// instructions for each rule, to guarantee we cover the same space.
-TEXT foo(SB), 7, $0
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB), DUPOK|NOSPLIT, $0
// ADD
//
diff --git a/src/cmd/asm/internal/asm/testdata/arm64.s b/src/cmd/asm/internal/asm/testdata/arm64.s
index 28b34e3d72..9dfcab5fba 100644
--- a/src/cmd/asm/internal/asm/testdata/arm64.s
+++ b/src/cmd/asm/internal/asm/testdata/arm64.s
@@ -6,7 +6,9 @@
// the old assembler's (7a's) grammar and hand-writing complete
// instructions for each rule, to guarantee we cover the same space.
-TEXT foo(SB), 7, $-8
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB), DUPOK|NOSPLIT, $-8
//
// ADD
diff --git a/src/cmd/asm/internal/asm/testdata/mips.s b/src/cmd/asm/internal/asm/testdata/mips.s
index f48d91885d..0f0226de0c 100644
--- a/src/cmd/asm/internal/asm/testdata/mips.s
+++ b/src/cmd/asm/internal/asm/testdata/mips.s
@@ -5,7 +5,9 @@
// This input was created by taking the mips64 testcase and modified
// by hand.
-TEXT foo(SB),7,$0
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB),DUPOK|NOSPLIT,$0
//inst:
//
diff --git a/src/cmd/asm/internal/asm/testdata/mips64.s b/src/cmd/asm/internal/asm/testdata/mips64.s
index e217d35a13..e3d898af87 100644
--- a/src/cmd/asm/internal/asm/testdata/mips64.s
+++ b/src/cmd/asm/internal/asm/testdata/mips64.s
@@ -5,7 +5,9 @@
// This input was created by taking the ppc64 testcase and modified
// by hand.
-TEXT foo(SB),7,$0
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB),DUPOK|NOSPLIT,$0
//inst:
//
diff --git a/src/cmd/asm/internal/asm/testdata/ppc64.s b/src/cmd/asm/internal/asm/testdata/ppc64.s
index 8498f5804a..14b0de1271 100644
--- a/src/cmd/asm/internal/asm/testdata/ppc64.s
+++ b/src/cmd/asm/internal/asm/testdata/ppc64.s
@@ -6,7 +6,9 @@
// the old assembler's (9a's) grammar and hand-writing complete
// instructions for each rule, to guarantee we cover the same space.
-TEXT foo(SB),7,$0
+#include "../../../../../runtime/textflag.h"
+
+TEXT foo(SB),DUPOK|NOSPLIT,$0
//inst:
//
diff --git a/src/cmd/asm/internal/asm/testdata/s390x.s b/src/cmd/asm/internal/asm/testdata/s390x.s
index 55df0f953a..1ab07b65e8 100644
--- a/src/cmd/asm/internal/asm/testdata/s390x.s
+++ b/src/cmd/asm/internal/asm/testdata/s390x.s
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-TEXT main·foo(SB),7,$16-0 // TEXT main.foo(SB), 7, $16-0
+#include "../../../../../runtime/textflag.h"
+
+TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-0
MOVD R1, R2 // b9040021
MOVW R3, R4 // b9140043
MOVH R5, R6 // b9070065
@@ -350,9 +352,9 @@ TEXT main·foo(SB),7,$16-0 // TEXT main.foo(SB), 7, $16-0
RET
-TEXT main·init(SB),7,$0 // TEXT main.init(SB), 7, $0
+TEXT main·init(SB),DUPOK|NOSPLIT,$0 // TEXT main.init(SB), DUPOK|NOSPLIT, $0
RET
-TEXT main·main(SB),7,$0 // TEXT main.main(SB), 7, $0
+TEXT main·main(SB),DUPOK|NOSPLIT,$0 // TEXT main.main(SB), DUPOK|NOSPLIT, $0
BL main·foo(SB) // CALL main.foo(SB)
RET