good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit abf2d7d7 authored by Julian Y's avatar Julian Y Committed by GitHub
Browse files

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.
parent 1976bb3d
No related branches found
No related tags found
No related merge requests found
...@@ -215,9 +215,9 @@ func doInstall(cmdline []string) { ...@@ -215,9 +215,9 @@ func doInstall(cmdline []string) {
var minor int var minor int
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor) 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("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.") log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
os.Exit(1) os.Exit(1)
} }
...@@ -233,6 +233,7 @@ func doInstall(cmdline []string) { ...@@ -233,6 +233,7 @@ func doInstall(cmdline []string) {
if runtime.GOARCH == "arm64" { if runtime.GOARCH == "arm64" {
goinstall.Args = append(goinstall.Args, "-p", "1") goinstall.Args = append(goinstall.Args, "-p", "1")
} }
goinstall.Args = append(goinstall.Args, "-trimpath")
goinstall.Args = append(goinstall.Args, "-v") goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, packages...) goinstall.Args = append(goinstall.Args, packages...)
build.MustRun(goinstall) build.MustRun(goinstall)
...@@ -241,6 +242,7 @@ func doInstall(cmdline []string) { ...@@ -241,6 +242,7 @@ func doInstall(cmdline []string) {
// Seems we are cross compiling, work around forbidden GOBIN // Seems we are cross compiling, work around forbidden GOBIN
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...) goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
goinstall.Args = append(goinstall.Args, "-trimpath")
goinstall.Args = append(goinstall.Args, "-v") goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...) goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
goinstall.Args = append(goinstall.Args, packages...) goinstall.Args = append(goinstall.Args, packages...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment