From 6c4f8cd0d17c8147319effcffcb608fc42eaf307 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 2 Jun 2016 15:00:34 +0200 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: David Crawshaw --- misc/cgo/test/issue9400/asm_386.s | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/cgo/test/issue9400/asm_386.s b/misc/cgo/test/issue9400/asm_386.s index 83ca38531ab..7f158b5c39d 100644 --- a/misc/cgo/test/issue9400/asm_386.s +++ b/misc/cgo/test/issue9400/asm_386.s @@ -7,17 +7,18 @@ #include "textflag.h" TEXT ·RewindAndSetgid(SB),NOSPLIT,$0-0 + MOVL $·Baton(SB), BX // Rewind stack pointer so anything that happens on the stack // will clobber the test pattern created by the caller ADDL $(1024 * 8), SP // Ask signaller to setgid - MOVL $1, ·Baton(SB) + MOVL $1, (BX) // Wait for setgid completion loop: PAUSE - MOVL ·Baton(SB), AX + MOVL (BX), AX CMPL AX, $0 JNE loop