...

Text file src/cmd/go/testdata/script/test_ppc64le_cgo_inline_plt.txt

Documentation: cmd/go/testdata/script

     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
    15env CGO_CFLAGS='-fno-plt -O2 -g'
    16
    17go build -ldflags='-linkmode=internal'
    18exec ./noplttest
    19stdout helloworld
    20
    21-- go.mod --
    22module noplttest
    23
    24-- noplttest.go --
    25package main
    26
    27/*
    28#include <stdio.h>
    29void helloworld(void) {
    30   printf("helloworld\n");
    31   fflush(stdout);
    32}
    33*/
    34import "C"
    35
    36func main() {
    37	C.helloworld()
    38}

View as plain text