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 457c06c

Browse files
committed
testdata/script: include regression test for LTO
1 parent 03a849f commit 457c06c

File tree

1 file changed

+37
-0
lines changed

1 file changed

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

0 commit comments

Comments
(0)

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