Skip to content

Commit

Permalink
build: use -trimpath flag when building executables (ethereum#21374)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jyap808 authored and enriquefynn committed Feb 15, 2021
1 parent 3970e11 commit 2647b65
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ func doInstall(cmdline []string) {
var minor int
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)

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

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

0 comments on commit 2647b65

Please sign in to comment.