Skip to content

Commit

Permalink
tast: Disable cgo on building Tast binaries.
Browse files Browse the repository at this point in the history
Also disable PIE because it does not work without cgo:
golang/go#30986 (comment)

Consequently, we also end up disabling ASLR for Tast binaries.
This should be okay since Tast binaries are not shipped to users.

BUG=chromium:976196
TEST=fast_build.sh -T
TEST=fast_build.sh && ~/go/bin/tast run betty example.Pass

Cq-Depend: chromium:1663975
Change-Id: I0da6cfbe45622ec874f94e74bc3b5a0bc4661508
Reviewed-on: https://chromium-review.googlesource.com/1664194
Tested-by: Shuhei Takahashi <nya@chromium.org>
Commit-Ready: Shuhei Takahashi <nya@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
  • Loading branch information
nya3jp authored and chrome-bot committed Jun 28, 2019
1 parent f9f8382 commit 386fb77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions fast_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ readonly TAST_OUT="${GOHOME}/bin/tast"
# be emerged beforehand.
export GOPATH="$(IFS=:; echo "${SRCDIRS[*]}"):/usr/lib/gopath"

# Disable cgo and PIE on building Tast binaries. See:
# https://crbug.com/976196
# https://github.com/golang/go/issues/30986#issuecomment-475626018
export CGO_ENABLED=0
export GOPIE=0

readonly CMD=$(basename "${0}")

# Prints usage information and exits.
Expand Down
8 changes: 7 additions & 1 deletion src/chromiumos/cmd/tast/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ func Build(ctx context.Context, cfg *Config, pkg, outDir, stageName string) (out

const ldFlags = "-ldflags=-s -w"

env := append(os.Environ(), "GOPATH="+strings.Join(cfg.Workspaces, ":"))
env := append(os.Environ(),
"GOPATH="+strings.Join(cfg.Workspaces, ":"),
// Disable cgo and PIE on building Tast binaries. See:
// https://crbug.com/976196
// https://github.com/golang/go/issues/30986#issuecomment-475626018
"CGO_ENABLED=0",
"GOPIE=0")

// This is frustrating:
//
Expand Down

0 comments on commit 386fb77

Please sign in to comment.