1. 09 Nov, 2017 2 commits
    • Russ Cox's avatar
      cmd/go: implement per-package asmflags, gcflags, ldflags, gccgoflags · 5993251c
      Russ Cox authored
      It has always been problematic that there was no way to specify
      tool flags that applied only to the build of certain packages;
      it was only to specify flags for all packages being built.
      The usual workaround was to install all dependencies of something,
      then build just that one thing with different flags. Since the
      dependencies appeared to be up-to-date, they were not rebuilt
      with the different flags. The new content-based staleness
      (up-to-date) checks see through this trick, because they detect
      changes in flags. This forces us to address the underlying problem
      of providing a way to specify per-package flags.
      
      The solution is to allow -gcflags=pattern=flags, which means
      that flags apply to packages matching pattern, in addition to the
      usual -gcflags=flags, which is now redefined to apply only to
      the packages named on the command line.
      
      See #22527 for discussion and rationale.
      
      Fixes #22527.
      
      Change-Id: I6716bed69edc324767f707b5bbf3aaa90e8e7302
      Reviewed-on: https://go-review.googlesource.com/76551
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      5993251c
    • Russ Cox's avatar
      cmd/go: move cfg.ExternalLinkingForced to internal/load · 98f1bfbb
      Russ Cox authored
      It needs to refer to packages, so it can no longer be in cfg.
      No semantic changes here.
      
      Can now be unexported, so that was a net win anyway.
      
      Change-Id: I58bf6cdcd435e6e019291bb8dcd5d5b7f1ac03a3
      Reviewed-on: https://go-review.googlesource.com/76550
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      98f1bfbb
  2. 08 Nov, 2017 8 commits
  3. 07 Nov, 2017 16 commits
  4. 06 Nov, 2017 14 commits
    • griesemer's avatar
      cmd/compile/internal/syntax: better syntax errors for typos in if/switch/for headers · 17ff23f7
      griesemer authored
      Be more pessimistic when parsing if/switch/for headers for better error
      messages when things go wrong.
      
      Fixes #22581.
      
      Change-Id: Ibb99925291ff53f35021bc0a59a4c9a7f695a194
      Reviewed-on: https://go-review.googlesource.com/76290
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      17ff23f7
    • Carlos Eduardo Seo's avatar
      runtime: improve IndexByte for ppc64x · be943df5
      Carlos Eduardo Seo authored
      This change adds a better implementation of IndexByte in asm that uses the
      vector registers/instructions on ppc64x.
      
      benchmark                            old ns/op     new ns/op     delta
      BenchmarkIndexByte/10-8              9.70          9.37          -3.40%
      BenchmarkIndexByte/32-8              10.9          10.9          +0.00%
      BenchmarkIndexByte/4K-8              254           92.8          -63.46%
      BenchmarkIndexByte/4M-8              249246        118435        -52.48%
      BenchmarkIndexByte/64M-8             10737987      7383096       -31.24%
      
      benchmark                            old MB/s     new MB/s     speedup
      BenchmarkIndexByte/10-8              1030.63      1067.24      1.04x
      BenchmarkIndexByte/32-8              2922.69      2928.53      1.00x
      BenchmarkIndexByte/4K-8              16065.95     44156.45     2.75x
      BenchmarkIndexByte/4M-8              16827.96     35414.21     2.10x
      BenchmarkIndexByte/64M-8             6249.67      9089.53      1.45x
      
      Change-Id: I81dbdd620f7bb4e395ce4d1f2a14e8e91e39f9a1
      Reviewed-on: https://go-review.googlesource.com/71710
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarLynn Boger <laboger@linux.vnet.ibm.com>
      be943df5
    • Joe Tsai's avatar
      archive/zip: add FileHeader.NonUTF8 field · 4fcc8359
      Joe Tsai authored
      The NonUTF8 field provides users with a way to explictly tell the
      ZIP writer to avoid setting the UTF-8 flag.
      This is necessary because many readers:
      	1) (Still) do not support UTF-8
      	2) And use the local system encoding instead
      
      Thus, even though character encodings other than CP-437 and UTF-8
      are not officially supported by the ZIP specification, pragmatically
      the world has permitted use of them.
      
      When a non-standard encoding is used, it is the user's responsibility
      to ensure that the target system is expecting the encoding used
      (e.g., producing a ZIP file you know is used on a Chinese version of Windows).
      
      We adjust the detectUTF8 function to account for Shift-JIS and EUC-KR
      not being identical to ASCII for two characters.
      
      We don't need an API for users to explicitly specify that they are encoding
      with UTF-8 since all single byte characters are compatible with all other
      common encodings (Windows-1256, Windows-1252, Windows-1251, Windows-1250,
      IEC-8859, EUC-KR, KOI8-R, Latin-1, Shift-JIS, GB-2312, GBK) except for
      the non-printable characters and the backslash character (all of which
      are invalid characters in a path name anyways).
      
      Fixes #10741
      
      Change-Id: I9004542d1d522c9137973f1b6e2b623fa54dfd66
      Reviewed-on: https://go-review.googlesource.com/75592
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      4fcc8359
    • Emmanuel Odeke's avatar
      cmd/compile: lock in test for column numbers in unused error · 0c554957
      Emmanuel Odeke authored
      Updates #21317
      
      @mdempsky fixed issue #21317 with CL 66810,
      so lock a test in to ensure we don't regress.
      
      The test is manual for now before test/run.go
      has support for matching column numbers so do
      it old school and match expected output after
      an exec.
      
      Change-Id: I6c2a66ddf04248f79d17ed7033a3280d50e41562
      Reviewed-on: https://go-review.googlesource.com/76150
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0c554957
    • Austin Clements's avatar
      cmd/compile: []T where T is go:notinheap does not need write barriers · 3a446d86
      Austin Clements authored
      Currently, assigning a []T where T is a go:notinheap type generates an
      unnecessary write barrier for storing the slice pointer.
      
      This fixes this by teaching HasHeapPointer that this type does not
      have a heap pointer, and tweaking the lowering of slice assignments so
      the pointer store retains the correct type rather than simply lowering
      it to a *uint8 store.
      
      Change-Id: I8bf7c66e64a7fefdd14f2bd0de8a5a3596340bab
      Reviewed-on: https://go-review.googlesource.com/76027
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3a446d86
    • Cherry Zhang's avatar
      cmd/dist: include "cmd/buildid" in toolchain in debug mode · 0838c0f2
      Cherry Zhang authored
      Fixes #22599.
      
      Change-Id: I2d59a8fae457881f681184fc6ed1f2aa597699b3
      Reviewed-on: https://go-review.googlesource.com/76026
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      0838c0f2
    • Russ Cox's avatar
      cmd/dist: do not reinstall runtime/cgo with -tags lldb on ios builders · fa62ea69
      Russ Cox authored
      The cache will take care of keeping go test -tags lldb fast.
      Installing runtime/cgo this way just makes all the checkNotStale
      tests think runtime/cgo is out of date.
      
      Should fix ios builders.
      
      Fixes #22509.
      
      Change-Id: If092cc4feb189eb848b6a22f6d22b89b70df219c
      Reviewed-on: https://go-review.googlesource.com/76020
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      fa62ea69
    • Russ Cox's avatar
      cmd/dist, cmd/go: make GODEBUG=godebughash=1 ./make.bash work better · 1ca4768e
      Russ Cox authored
      The change in cmd/dist ignores debug output, instead of assuming
      any output is from the template.
      
      The change in cmd/go makes the debug output show the package name
      on every line, so that interlaced prints can be deinterlaced.
      
      Change-Id: Ic3d59ee0256271067cb9be2fde643a0e19405375
      Reviewed-on: https://go-review.googlesource.com/76019
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      1ca4768e
    • Russ Cox's avatar
      cmd/dist, cmd/cgo, cmd/go: allow per-goos/goarch default CC · 4739c0db
      Russ Cox authored
      Even though cmd/dist has historically distinguished "CC for gohostos/gohostarch"
      from "CC for target goos/goarch", it has not recorded that distinction
      for later use by cmd/cgo and cmd/go. Now that content-based staleness
      includes the CC setting in the decision about when to rebuild packages,
      the go command needs to know the details of which CC to use when.
      Otherwise lots of things look out of date and (worse) may be rebuilt with
      the wrong CC.
      
      A related issue is that users may want to be able to build a toolchain
      capable of cross-compiling for two different non-host targets, and
      to date we've required that CC_FOR_TARGET apply to both.
      This CL introduces CC_FOR_${GOOS}_${GOARCH}, so that you can
      (for example) set CC_FOR_linux_arm and CC_FOR_linux_arm64
      separately on a linux/ppc64 host and be able to cross-compile to
      either arm or arm64 with the right toolchain.
      
      Fixes #8161.
      Half of a fix for #22509.
      
      Change-Id: I7a43769f39d859f659d31bc96980918ba102fb83
      Reviewed-on: https://go-review.googlesource.com/76018
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      4739c0db
    • Russ Cox's avatar
      cmd/go: ignore stderr from tool version checks · 5e48d2b6
      Russ Cox authored
      There are multiple valid reasons a tool might print to stderr.
      As long as we get the expected output on stdout, that's fine.
      
      Fixes #22588.
      
      Change-Id: I9c5d32da08288cb26dd575530a8257cd5f375367
      Reviewed-on: https://go-review.googlesource.com/76017
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      5e48d2b6
    • Russ Cox's avatar
      cmd/go: do not use cache when -a is specified · eca28cc4
      Russ Cox authored
      Clearly -a means don't use the cache.
      An oversight that it did.
      
      Fixes #22586.
      
      Change-Id: I250b351439bd3fb5f8d6efc235b614f0a75ca64c
      Reviewed-on: https://go-review.googlesource.com/76016
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      eca28cc4
    • Russ Cox's avatar
      cmd/go: drop runtime, runtime/internal/sys, runtime/internal/atomic, unsafe as deps of everything · f3c46355
      Russ Cox authored
      This was a hack to make a new make.bash avoid reusing installed packages.
      The new content-based staleness is precise enough not to need this hack;
      now it's just causing unnecessary rebuilds: if a package doesn't import "runtime",
      for example, it doesn't need to be recompiled when runtime changes.
      (It does need to be relinked, and we still arrange that.)
      
      Change-Id: I4ddf6e16d754cf21b16e9db1ed52bddbf82e96c6
      Reviewed-on: https://go-review.googlesource.com/76015
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      f3c46355
    • Cherry Zhang's avatar
      cmd/compile: enable ssacheck for tests in ssa_test.go · da109c60
      Cherry Zhang authored
      I thought SSA check was enabled for those tests, but in fact it
      was not. Enable it. So we have SSA check on for at least some
      tests on all architectures.
      
      Updates #22499.
      
      Change-Id: I51fcdda3af7faab5aeb33bf46c6db309285ce42c
      Reviewed-on: https://go-review.googlesource.com/76024Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      da109c60
    • Joe Tsai's avatar
      archive/zip: add FileHeader.Modified field · 6e8894d5
      Joe Tsai authored
      The ModifiedTime and ModifiedDate fields are not expressive enough
      for many of the time extensions that have since been added to ZIP,
      nor are they easy to access since they in a legacy MS-DOS format,
      and must be set and retrieved via the SetModTime and ModTime methods.
      
      Instead, we add new field Modified of time.Time type that contains
      all of the previous information and more.
      
      Support for extended timestamps have been attempted before, but the
      change was reverted because it provided no ability for the user to
      specify the timezone of the legacy MS-DOS fields.
      Technically the old API did not either, but users were manually offsetting
      the timestamp to achieve the same effect.
      
      The Writer now writes the legacy timestamps according to the timezone
      of the FileHeader.Modified field. When the Modified field is set via
      the SetModTime method, it is in UTC, which preserves the old behavior.
      
      The Reader attempts to determine the timezone if both the legacy
      and extended timestamps are present since it can compute the delta
      between the two values.
      
      Since Modified is a superset of the information in ModifiedTime and ModifiedDate,
      we mark ModifiedTime, ModifiedDate, ModTime, and SetModTime as deprecated.
      
      Fixes #18359
      
      Change-Id: I29c6bc0a62908095d02740df3e6902f50d3152f1
      Reviewed-on: https://go-review.googlesource.com/74970
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      6e8894d5