# TODO: support arm64, at least
[!386] [!amd64] skip 'the assembly is only written for 386 and amd64'

env GOGARBLE=test/main

garble build
exec ./main
cmp stderr main.stderr
! binsubstr main$exe 'privateAdd' 'PublicAdd'

[short] stop # no need to verify this with -short

garble -tiny build
exec ./main
cmp stderr main.stderr
! binsubstr main$exe 'privateAdd' 'PublicAdd'

go build
exec ./main
cmp stderr main.stderr
binsubstr main$exe 'privateAdd' 'PublicAdd'

-- go.mod --
module test/main

go 1.18
-- main.go --
package main

import (
	"test/main/imported"
)

func privateAdd(x, y int32) int32

func main() {
	println(privateAdd(1, 2))
	println(imported.PublicAdd(3, 4))
}
-- main_x86.s --
//go:build 386 || amd64

TEXT ·privateAdd(SB),$0-16
	MOVL x+0(FP), BX
	MOVL y+4(FP), BP
	ADDL BP, BX
	MOVL BX, ret+8(FP)
	RET
-- imported/imported.go --
package imported

func PublicAdd(x, y int32) int32
-- imported/imported_x86.s --
//go:build 386 || amd64

TEXT ·PublicAdd(SB),$0-16
	MOVL x+0(FP), BX
	MOVL y+4(FP), BP
	ADDL BP, BX
	MOVL BX, ret+8(FP)
	RET
-- main.stderr --
3
7
