Skip to content

Commit abf2d7d

Browse files
authored
build: use -trimpath flag when building executables (#21374)
* Disable symbol table and DWARF generation by default. Trimpath if compiling with Go >= 1.13 * Set Go to minimum version 1.13. Revert debug symbol changes.
1 parent 1976bb3 commit abf2d7d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

build/ci.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ func doInstall(cmdline []string) {
215215
var minor int
216216
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
217217

218-
if minor < 11 {
218+
if minor < 13 {
219219
log.Println("You have Go version", runtime.Version())
220-
log.Println("go-ethereum requires at least Go version 1.11 and cannot")
220+
log.Println("go-ethereum requires at least Go version 1.13 and cannot")
221221
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
222222
os.Exit(1)
223223
}
@@ -233,6 +233,7 @@ func doInstall(cmdline []string) {
233233
if runtime.GOARCH == "arm64" {
234234
goinstall.Args = append(goinstall.Args, "-p", "1")
235235
}
236+
goinstall.Args = append(goinstall.Args, "-trimpath")
236237
goinstall.Args = append(goinstall.Args, "-v")
237238
goinstall.Args = append(goinstall.Args, packages...)
238239
build.MustRun(goinstall)
@@ -241,6 +242,7 @@ func doInstall(cmdline []string) {
241242

242243
// Seems we are cross compiling, work around forbidden GOBIN
243244
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
245+
goinstall.Args = append(goinstall.Args, "-trimpath")
244246
goinstall.Args = append(goinstall.Args, "-v")
245247
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
246248
goinstall.Args = append(goinstall.Args, packages...)

0 commit comments

Comments
 (0)