| 1 |
# Verify the linker will correctly resolve |
| 2 |
# ppc64le objects compiled with gcc's -fno-plt |
| 3 |
# option. This inlines PLT calls, and generates |
| 4 |
# additional reloc types which the internal linker |
| 5 |
# should handle. |
| 6 |
# |
| 7 |
# Verifies golang.org/issue/53345 |
| 8 |
# |
| 9 |
# Note, older gcc/clang may accept this option, but |
| 10 |
# ignore it if binutils does not support the relocs. |
| 11 |
[!compiler:gc] skip |
| 12 |
[!cgo] skip |
| 13 |
[!GOARCH:ppc64le] skip |
| 14 |
|
| 15 |
env CGO_CFLAGS='-fno-plt -O2 -g' |
| 16 |
|
| 17 |
go build -ldflags='-linkmode=internal' |
| 18 |
exec ./noplttest |
| 19 |
stdout helloworld |
| 20 |
|
| 21 |
-- go.mod -- |
| 22 |
module noplttest |
| 23 |
|
| 24 |
-- noplttest.go -- |
| 25 |
package main |
| 26 |
|
| 27 |
/* |
| 28 |
#include <stdio.h> |
| 29 |
void helloworld(void) { |
| 30 |
printf("helloworld\n"); |
| 31 |
fflush(stdout); |
| 32 |
} |
| 33 |
*/ |
| 34 |
import "C" |
| 35 |
|
| 36 |
func main() { |
| 37 |
C.helloworld() |
| 38 |
} |