summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-16 17:39:55 -0400
committerRuss Cox <rsc@golang.org>2014-09-16 17:39:55 -0400
commit49f4c39e491fe81c849d206d91e47b8a757b232a (patch)
treebb226f52c46ce72ead725a9d047755cd3d0fe095
parentb8bda7526a56e959b2aade18c392fb6e4d39e7b5 (diff)
downloadgo-49f4c39e491fe81c849d206d91e47b8a757b232a.tar.gz
liblink: make GO_ARGS the default for functions beginning with ?
If there is a leading ?, assume there is a Go prototype and attach the Go prototype information to the function. If the function is not called from Go and does not need a Go prototype, it can be made file-local instead (using name<>(SB)). This fixes the current BSD build failures, by giving functions like sync/atomic.StoreUint32 argument stack map information. Fixes issue 8753. LGTM=khr, iant R=golang-codereviews, iant, khr, bradfitz CC=golang-codereviews, r, rlh https://codereview.appspot.com/142150043
-rw-r--r--src/liblink/objfile.c23
-rw-r--r--src/runtime/asm_386.s9
-rw-r--r--src/runtime/asm_amd64.s9
-rw-r--r--src/runtime/asm_arm.s9
-rw-r--r--src/syscall/asm_darwin_386.s5
-rw-r--r--src/syscall/asm_darwin_amd64.s4
-rw-r--r--src/syscall/asm_dragonfly_386.s5
-rw-r--r--src/syscall/asm_dragonfly_amd64.s5
-rw-r--r--src/syscall/asm_freebsd_386.s5
-rw-r--r--src/syscall/asm_freebsd_amd64.s5
-rw-r--r--src/syscall/asm_freebsd_arm.s5
-rw-r--r--src/syscall/asm_linux_386.s7
-rw-r--r--src/syscall/asm_linux_amd64.s5
-rw-r--r--src/syscall/asm_linux_arm.s5
-rw-r--r--src/syscall/asm_nacl_386.s1
-rw-r--r--src/syscall/asm_nacl_amd64p32.s1
-rw-r--r--src/syscall/asm_nacl_arm.s1
-rw-r--r--src/syscall/asm_netbsd_386.s5
-rw-r--r--src/syscall/asm_netbsd_amd64.s5
-rw-r--r--src/syscall/asm_netbsd_arm.s5
-rw-r--r--src/syscall/asm_openbsd_386.s5
-rw-r--r--src/syscall/asm_openbsd_amd64.s5
-rw-r--r--src/syscall/asm_plan9_386.s6
-rw-r--r--src/syscall/asm_plan9_amd64.s6
-rw-r--r--test/nosplit.go13
25 files changed, 42 insertions, 112 deletions
diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c
index 02cfae495..7d4b28c9a 100644
--- a/src/liblink/objfile.c
+++ b/src/liblink/objfile.c
@@ -125,7 +125,7 @@ static LSym *rdsym(Link*, Biobuf*, char*);
void
writeobj(Link *ctxt, Biobuf *b)
{
- int flag;
+ int flag, found;
Hist *h;
LSym *s, *text, *etext, *curtext, *data, *edata;
Plist *pl;
@@ -251,6 +251,27 @@ writeobj(Link *ctxt, Biobuf *b)
s->etext = p;
}
}
+
+ // Add reference to Go arguments for C or assembly functions without them.
+ for(s = text; s != nil; s = s->next) {
+ if(strncmp(s->name, "\"\".", 3) != 0)
+ continue;
+ found = 0;
+ for(p = s->text; p != nil; p = p->link) {
+ if(p->as == ctxt->arch->AFUNCDATA && p->from.type == ctxt->arch->D_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) {
+ found = 1;
+ break;
+ }
+ }
+ if(!found) {
+ p = appendp(ctxt, s->text);
+ p->as = ctxt->arch->AFUNCDATA;
+ p->from.type = ctxt->arch->D_CONST;
+ p->from.offset = FUNCDATA_ArgsPointerMaps;
+ p->to.type = ctxt->arch->D_EXTERN;
+ p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", s->name), s->version);
+ }
+ }
// Turn functions into machine code images.
for(s = text; s != nil; s = s->next) {
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index 21065b6d6..2961f10f2 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -646,15 +646,13 @@ TEXT gosave<>(SB),NOSPLIT,$0
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
// See cgocall.c for more details.
-TEXT runtime·asmcgocall(SB),NOSPLIT,$0-8
- GO_ARGS
+TEXT ·asmcgocall(SB),NOSPLIT,$0-8
MOVL fn+0(FP), AX
MOVL arg+4(FP), BX
CALL asmcgocall<>(SB)
RET
-TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-12
- GO_ARGS
+TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-12
MOVL fn+0(FP), AX
MOVL arg+4(FP), BX
CALL asmcgocall<>(SB)
@@ -714,8 +712,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$12-12
// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize)
// See cgocall.c for more details.
-TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$12-12
- GO_ARGS
+TEXT ·cgocallback_gofunc(SB),NOSPLIT,$12-12
NO_LOCAL_POINTERS
// If g is nil, Go did not create the current thread.
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index da29f61ed..44159bb57 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -623,15 +623,13 @@ TEXT gosave<>(SB),NOSPLIT,$0
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
// See cgocall.c for more details.
-TEXT runtime·asmcgocall(SB),NOSPLIT,$0-16
- GO_ARGS
+TEXT ·asmcgocall(SB),NOSPLIT,$0-16
MOVQ fn+0(FP), AX
MOVQ arg+8(FP), BX
CALL asmcgocall<>(SB)
RET
-TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-20
- GO_ARGS
+TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-20
MOVQ fn+0(FP), AX
MOVQ arg+8(FP), BX
CALL asmcgocall<>(SB)
@@ -700,8 +698,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$24-24
// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize)
// See cgocall.c for more details.
-TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$8-24
- GO_ARGS
+TEXT ·cgocallback_gofunc(SB),NOSPLIT,$8-24
NO_LOCAL_POINTERS
// If g is nil, Go did not create the current thread.
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index 3e78d9114..f67f94939 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -480,15 +480,13 @@ TEXT gosave<>(SB),NOSPLIT,$0
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
// See cgocall.c for more details.
-TEXT runtime·asmcgocall(SB),NOSPLIT,$0-8
- GO_ARGS
+TEXT ·asmcgocall(SB),NOSPLIT,$0-8
MOVW fn+0(FP), R1
MOVW arg+4(FP), R0
BL asmcgocall<>(SB)
RET
-TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-12
- GO_ARGS
+TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-12
MOVW fn+0(FP), R1
MOVW arg+4(FP), R0
BL asmcgocall<>(SB)
@@ -551,8 +549,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$12-12
// cgocallback_gofunc(void (*fn)(void*), void *frame, uintptr framesize)
// See cgocall.c for more details.
-TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$8-12
- GO_ARGS
+TEXT ·cgocallback_gofunc(SB),NOSPLIT,$8-12
NO_LOCAL_POINTERS
// Load m and g from thread-local storage.
diff --git a/src/syscall/asm_darwin_386.s b/src/syscall/asm_darwin_386.s
index 7d8ddf437..7205deb12 100644
--- a/src/syscall/asm_darwin_386.s
+++ b/src/syscall/asm_darwin_386.s
@@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
diff --git a/src/syscall/asm_darwin_amd64.s b/src/syscall/asm_darwin_amd64.s
index a3b1bd534..e57199d2b 100644
--- a/src/syscall/asm_darwin_amd64.s
+++ b/src/syscall/asm_darwin_amd64.s
@@ -17,7 +17,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -67,7 +65,6 @@ ok6:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -89,7 +86,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
diff --git a/src/syscall/asm_dragonfly_386.s b/src/syscall/asm_dragonfly_386.s
index 0d7d6ba1e..7012d23c2 100644
--- a/src/syscall/asm_dragonfly_386.s
+++ b/src/syscall/asm_dragonfly_386.s
@@ -14,7 +14,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-32
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -39,7 +38,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-44
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -67,7 +65,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-56
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -98,7 +95,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-32
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -120,7 +116,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-44
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
diff --git a/src/syscall/asm_dragonfly_amd64.s b/src/syscall/asm_dragonfly_amd64.s
index b81cf8dda..004d36089 100644
--- a/src/syscall/asm_dragonfly_amd64.s
+++ b/src/syscall/asm_dragonfly_amd64.s
@@ -15,7 +15,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-64
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -39,7 +38,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-88
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -63,7 +61,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-112
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX
MOVQ 16(SP), DI
@@ -97,7 +94,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-64
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -118,7 +114,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
diff --git a/src/syscall/asm_freebsd_386.s b/src/syscall/asm_freebsd_386.s
index ff5f9f4a2..1400d5fea 100644
--- a/src/syscall/asm_freebsd_386.s
+++ b/src/syscall/asm_freebsd_386.s
@@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
diff --git a/src/syscall/asm_freebsd_amd64.s b/src/syscall/asm_freebsd_amd64.s
index 47ceb9287..c52519098 100644
--- a/src/syscall/asm_freebsd_amd64.s
+++ b/src/syscall/asm_freebsd_amd64.s
@@ -23,7 +23,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -47,7 +46,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -71,7 +69,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-104
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX
MOVQ 16(SP), DI
@@ -105,7 +102,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -126,7 +122,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
diff --git a/src/syscall/asm_freebsd_arm.s b/src/syscall/asm_freebsd_arm.s
index ed369ce73..6b0c182a7 100644
--- a/src/syscall/asm_freebsd_arm.s
+++ b/src/syscall/asm_freebsd_arm.s
@@ -14,7 +14,6 @@
// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, errno uintptr)
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
@@ -37,7 +36,6 @@ error:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
@@ -64,7 +62,6 @@ error6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
@@ -91,7 +88,6 @@ error9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
@@ -111,7 +107,6 @@ errorr:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
diff --git a/src/syscall/asm_linux_386.s b/src/syscall/asm_linux_386.s
index 2ce51822d..fa1b37120 100644
--- a/src/syscall/asm_linux_386.s
+++ b/src/syscall/asm_linux_386.s
@@ -16,7 +16,6 @@
// Trap # in AX, args in BX CX DX SI DI, return in AX
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
@@ -42,7 +41,6 @@ ok:
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
@@ -69,7 +67,6 @@ ok6:
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
MOVL 12(SP), CX
@@ -92,7 +89,6 @@ ok1:
// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
MOVL 12(SP), CX
@@ -119,7 +115,6 @@ ok2:
// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
// Kernel interface gets call sub-number and pointer to a0.
TEXT ·socketcall(SB),NOSPLIT,$0-36
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL $SYS_SOCKETCALL, AX // syscall entry
MOVL 4(SP), BX // socket call number
@@ -144,7 +139,6 @@ oksock:
// func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
// Kernel interface gets call sub-number and pointer to a0.
TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
- GO_ARGS
MOVL $SYS_SOCKETCALL, AX // syscall entry
MOVL 4(SP), BX // socket call number
LEAL 8(SP), CX // pointer to call arguments
@@ -170,7 +164,6 @@ oksock1:
// Underlying system call is
// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
TEXT ·seek(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL $SYS__LLSEEK, AX // syscall entry
MOVL 4(SP), BX // fd
diff --git a/src/syscall/asm_linux_amd64.s b/src/syscall/asm_linux_amd64.s
index 0277c506c..b3ce2165d 100644
--- a/src/syscall/asm_linux_amd64.s
+++ b/src/syscall/asm_linux_amd64.s
@@ -18,7 +18,6 @@
// would pass 4th arg in CX, not R10.
TEXT ·Syscall(SB),NOSPLIT,$0-56
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -44,7 +43,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@@ -70,7 +68,6 @@ ok6:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -93,7 +90,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -116,7 +112,6 @@ ok2:
RET
TEXT ·gettimeofday(SB),NOSPLIT,$0-16
- GO_ARGS
MOVQ 8(SP), DI
MOVQ $0, SI
MOVQ runtime·__vdso_gettimeofday_sym(SB), AX
diff --git a/src/syscall/asm_linux_arm.s b/src/syscall/asm_linux_arm.s
index 945101381..352653301 100644
--- a/src/syscall/asm_linux_arm.s
+++ b/src/syscall/asm_linux_arm.s
@@ -14,7 +14,6 @@
// func Syscall(syscall uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 4(SP), R7
MOVW 8(SP), R0
@@ -46,7 +45,6 @@ ok:
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually Syscall5 but the rest of the code expects it to be named Syscall6.
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
@@ -78,7 +76,6 @@ ok6:
// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually RawSyscall5 but the rest of the code expects it to be named RawSyscall6.
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
MOVW 12(SP), R1
@@ -111,7 +108,6 @@ ok2:
// Underlying system call is
// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
TEXT ·seek(SB),NOSPLIT,$0-32
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW $SYS__LLSEEK, R7 // syscall entry
MOVW 4(SP), R0 // fd
@@ -139,7 +135,6 @@ okseek:
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
MOVW 12(SP), R1
diff --git a/src/syscall/asm_nacl_386.s b/src/syscall/asm_nacl_386.s
index 5352b7697..cb6fb4416 100644
--- a/src/syscall/asm_nacl_386.s
+++ b/src/syscall/asm_nacl_386.s
@@ -17,7 +17,6 @@
MOVL $(0x10000 + ((code)<<5)), AX; JMP AX
TEXT syscall·Syscall(SB),NOSPLIT,$12-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX
MOVL a1+4(FP), BX
diff --git a/src/syscall/asm_nacl_amd64p32.s b/src/syscall/asm_nacl_amd64p32.s
index 637fafab4..72391c431 100644
--- a/src/syscall/asm_nacl_amd64p32.s
+++ b/src/syscall/asm_nacl_amd64p32.s
@@ -17,7 +17,6 @@
MOVL $(0x10000 + ((code)<<5)), AX; JMP AX
TEXT syscall·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX
MOVL a1+4(FP), DI
diff --git a/src/syscall/asm_nacl_arm.s b/src/syscall/asm_nacl_arm.s
index 3e4479432..78e10bf7a 100644
--- a/src/syscall/asm_nacl_arm.s
+++ b/src/syscall/asm_nacl_arm.s
@@ -17,7 +17,6 @@
MOVW $(0x10000 + ((code)<<5)), R8; B (R8)
TEXT syscall·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW trap+0(FP), R8
MOVW a1+4(FP), R0
diff --git a/src/syscall/asm_netbsd_386.s b/src/syscall/asm_netbsd_386.s
index 29442ca9d..a8c4849f2 100644
--- a/src/syscall/asm_netbsd_386.s
+++ b/src/syscall/asm_netbsd_386.s
@@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
diff --git a/src/syscall/asm_netbsd_amd64.s b/src/syscall/asm_netbsd_amd64.s
index 6d0f311f4..b300148f4 100644
--- a/src/syscall/asm_netbsd_amd64.s
+++ b/src/syscall/asm_netbsd_amd64.s
@@ -18,7 +18,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@@ -66,7 +64,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-104
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@@ -99,7 +96,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -120,7 +116,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
diff --git a/src/syscall/asm_netbsd_arm.s b/src/syscall/asm_netbsd_arm.s
index c4190ea33..290bb5806 100644
--- a/src/syscall/asm_netbsd_arm.s
+++ b/src/syscall/asm_netbsd_arm.s
@@ -14,7 +14,6 @@
// func Syscall9(trap int32, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int32)
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
@@ -37,7 +36,6 @@ error:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
@@ -63,7 +61,6 @@ error6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
- GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
@@ -89,7 +86,6 @@ error9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
MOVW 8(FP), R2 // a2
@@ -109,7 +105,6 @@ errorr:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
MOVW 8(FP), R2 // a2
diff --git a/src/syscall/asm_openbsd_386.s b/src/syscall/asm_openbsd_386.s
index e448a70ca..6458bdf02 100644
--- a/src/syscall/asm_openbsd_386.s
+++ b/src/syscall/asm_openbsd_386.s
@@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
diff --git a/src/syscall/asm_openbsd_amd64.s b/src/syscall/asm_openbsd_amd64.s
index 654e3df74..1e981fc01 100644
--- a/src/syscall/asm_openbsd_amd64.s
+++ b/src/syscall/asm_openbsd_amd64.s
@@ -18,7 +18,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@@ -66,7 +64,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-104
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@@ -99,7 +96,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@@ -120,7 +116,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
diff --git a/src/syscall/asm_plan9_386.s b/src/syscall/asm_plan9_386.s
index 46562de84..fc13640b9 100644
--- a/src/syscall/asm_plan9_386.s
+++ b/src/syscall/asm_plan9_386.s
@@ -19,7 +19,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-32
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -55,7 +54,6 @@ copyresult3:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-44
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@@ -94,7 +92,6 @@ copyresult4:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -110,7 +107,6 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-28
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@@ -132,7 +128,6 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
TEXT ·seek(SB),NOSPLIT,$0-36
- GO_ARGS
LEAL newoffset+24(SP), AX
MOVL AX, placeholder+4(SP)
@@ -164,7 +159,6 @@ copyresult6:
//func exit(code int)
// Import runtime·exit for cleanly exiting.
TEXT ·exit(SB),NOSPLIT,$4-4
- GO_ARGS
NO_LOCAL_POINTERS
MOVL code+0(FP), AX
MOVL AX, 0(SP)
diff --git a/src/syscall/asm_plan9_amd64.s b/src/syscall/asm_plan9_amd64.s
index 283e28999..92419b717 100644
--- a/src/syscall/asm_plan9_amd64.s
+++ b/src/syscall/asm_plan9_amd64.s
@@ -18,7 +18,6 @@
//func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall(SB),NOSPLIT,$0-64
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
@@ -54,7 +53,6 @@ copyresult3:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-88
- GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
@@ -93,7 +91,6 @@ copyresult4:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- GO_ARGS
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
LEAQ 16(SP), SI
@@ -109,7 +106,6 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- GO_ARGS
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
LEAQ 16(SP), SI
@@ -131,7 +127,6 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
TEXT ·seek(SB),NOSPLIT,$0-56
- GO_ARGS
LEAQ newoffset+40(SP), AX
MOVQ AX, placeholder+8(SP)
@@ -162,7 +157,6 @@ copyresult6:
//func exit(code int)
// Import runtime·exit for cleanly exiting.
TEXT ·exit(SB),NOSPLIT,$8-8
- GO_ARGS
NO_LOCAL_POINTERS
MOVQ code+0(FP), AX
MOVQ AX, 0(SP)
diff --git a/test/nosplit.go b/test/nosplit.go
index c9d008acd..953a5bf0a 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -12,6 +12,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
+ "log"
"os"
"os/exec"
"path/filepath"
@@ -190,7 +191,6 @@ func main() {
return
}
defer os.RemoveAll(dir)
- ioutil.WriteFile(filepath.Join(dir, "main.go"), []byte("package main\nfunc main()\n"), 0666)
tests = strings.Replace(tests, "\t", " ", -1)
tests = commentRE.ReplaceAllString(tests, "")
@@ -230,6 +230,9 @@ TestCases:
continue
}
+ var gobuf bytes.Buffer
+ fmt.Fprintf(&gobuf, "package main\n")
+
var buf bytes.Buffer
if goarch == "arm" {
fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (R0)\n")
@@ -277,11 +280,17 @@ TestCases:
body = callRE.ReplaceAllString(body, "CALL ·$1(SB);")
body = callindRE.ReplaceAllString(body, "CALL REGISTER;")
+ fmt.Fprintf(&gobuf, "func %s()\n", name)
fmt.Fprintf(&buf, "TEXT ·%s(SB)%s,$%d-0\n\t%s\n\tRET\n\n", name, nosplit, size, body)
}
}
- ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666)
+ if err := ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666); err != nil {
+ log.Fatal(err)
+ }
+ if err := ioutil.WriteFile(filepath.Join(dir, "main.go"), gobuf.Bytes(), 0666); err != nil {
+ log.Fatal(err)
+ }
cmd := exec.Command("go", "build")
cmd.Dir = dir