Source file test/codegen/retpoline.go
1 // +build amd64 2 // asmcheck -gcflags=-spectre=ret 3 4 package codegen 5 6 func CallFunc(f func()) { 7 // amd64:`CALL\truntime.retpoline` 8 f() 9 } 10 11 func CallInterface(x interface{ M() }) { 12 // amd64:`CALL\truntime.retpoline` 13 x.M() 14 } 15 16 // Check to make sure that jump tables are disabled 17 // when retpoline is on. See issue 57097. 18 func noJumpTables(x int) int { 19 switch x { 20 case 0: 21 return 0 22 case 1: 23 return 1 24 case 2: 25 return 2 26 case 3: 27 return 3 28 case 4: 29 return 4 30 case 5: 31 return 5 32 case 6: 33 return 6 34 case 7: 35 return 7 36 case 8: 37 return 8 38 case 9: 39 return 9 40 } 41 return 10 42 } 43