Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dbcf0cb

Browse files
committed
testdata/script: include regression test for LTO
1 parent 70ebb76 commit dbcf0cb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Regression test for https://go.dev/issue/413974:
2+
# cgo build should reproduce binaries with LTO enable
3+
4+
[!cgo] skip
5+
[short] skip 'links cgo binaries'
6+
7+
env GOFLAGS=-ldflags=-linkmode=external
8+
env CGO_CFLAGS=-flto
9+
10+
go build -o main.exe
11+
mv main.exe main1.exe
12+
13+
env GOCACHE=$WORK${/}gocache
14+
mkdir $GOCACHE
15+
go build -o main.exe
16+
mv main.exe main2.exe
17+
18+
cmp -q main2.exe main1.exe
19+
20+
-- go.mod --
21+
module main
22+
23+
go 1.18
24+
-- main.go --
25+
package main
26+
27+
import "C"
28+
29+
var _ C.int
30+
31+
func main() {
32+
println("Hello World")
33+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /