Skip to content

Commit 6c4f8cd

Browse files
author
Elias Naur
committed
misc/cgo/test: fix issue9400 test on android/386
The test for #9400 relies on an assembler function that manipulates the stack pointer. Meanwile, it uses a global variable for synchronization. However, position independent code on 386 use a function call to fetch the base address for global variables. That function call in turn overwrites the Go stack. Fix that by fetching the global variable address once before the stack register manipulation. Fixes the android/386 builder. Change-Id: Ib77bd80affaa12f09d582d09d8b84a73bd021b60 Reviewed-on: https://go-review.googlesource.com/23683 Run-TryBot: Elias Naur <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: David Crawshaw <[email protected]>
1 parent 42c51de commit 6c4f8cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

misc/cgo/test/issue9400/asm_386.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
#include "textflag.h"
88

99
TEXT ·RewindAndSetgid(SB),NOSPLIT,$0-0
10+
MOVL $·Baton(SB), BX
1011
// Rewind stack pointer so anything that happens on the stack
1112
// will clobber the test pattern created by the caller
1213
ADDL $(1024 * 8), SP
1314

1415
// Ask signaller to setgid
15-
MOVL $1, ·Baton(SB)
16+
MOVL $1, (BX)
1617

1718
// Wait for setgid completion
1819
loop:
1920
PAUSE
20-
MOVL ·Baton(SB), AX
21+
MOVL (BX), AX
2122
CMPL AX, $0
2223
JNE loop
2324

0 commit comments

Comments
 (0)