| 1 |
# This test checks that external linking with --gc-sections does not strip version information. |
| 2 |
|
| 3 |
[short] skip |
| 4 |
[!cgo] skip |
| 5 |
[GOOS:aix] skip # no --gc-sections |
| 6 |
[GOOS:darwin] skip # no --gc-sections |
| 7 |
|
| 8 |
go build -ldflags='-linkmode=external -extldflags=-Wl,--gc-sections' |
| 9 |
go version hello$GOEXE |
| 10 |
! stdout 'not a Go executable' |
| 11 |
! stderr 'not a Go executable' |
| 12 |
|
| 13 |
-- go.mod -- |
| 14 |
module hello |
| 15 |
-- hello.go -- |
| 16 |
package main |
| 17 |
|
| 18 |
/* |
| 19 |
*/ |
| 20 |
import "C" |
| 21 |
|
| 22 |
func main() { |
| 23 |
println("hello") |
| 24 |
} |