1 # Tests that the linker implements the PPC64 ELFv2 ABI
2 # register save and restore functions as defined in
3 # section 2.3.3.1 of the PPC64 ELFv2 ABI when linking
4 # external objects most likely compiled with gcc's
5 # -Os option.
6 #
7 # Verifies golang.org/issue/52366 for linux/ppc64le
8 [!GOOS:linux] skip
9 [!compiler:gc] skip
10 [!cgo] skip
11 [!GOARCH:ppc64le] skip
12
13 go build -ldflags='-linkmode=internal'
14 exec ./abitest
15 stdout success
16
17 go build -buildmode=pie -o abitest.pie -ldflags='-linkmode=internal'
18 exec ./abitest.pie
19 stdout success
20
21 -- go.mod --
22 module abitest
23
24 -- abitest.go --
25 package main
26
27 /*
28 #cgo CFLAGS: -Os
29
30 int foo_fpr() {
31 asm volatile("":::"fr31","fr30","fr29","fr28");
32 }
33 int foo_gpr0() {
34 asm volatile("":::"r30","r29","r28");
35 }
36 int foo_gpr1() {
37 asm volatile("":::"fr31", "fr30","fr29","fr28","r30","r29","r28");
38 }
39 int foo_vr() {
40 asm volatile("":::"v31","v30","v29","v28");
41 }
42 */
43 import "C"
44
45 import "fmt"
46
47 func main() {
48 C.foo_fpr()
49 C.foo_gpr0()
50 C.foo_gpr1()
51 C.foo_vr()
52 fmt.Println("success")
53 }
54
View as plain text