1. 30 Aug, 2019 8 commits
  2. 29 Aug, 2019 24 commits
    • Robert Griesemer's avatar
      cmd/compile: avoid follow-on errors for literals with syntax errors · 5411953d
      Robert Griesemer authored
      - only convert literal strings if there were no syntax errors
        (some of the conversion routines exit if there is an error)
      - mark nodes for literals with syntax errors to avoid follow-on
        errors
      - don't attempt to import packages whose path had syntax errors
      
      Fixes #32133.
      
      Change-Id: I1803ad48c65abfecf6f48ddff1e27eded5e282c5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/192437Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      5411953d
    • Robert Griesemer's avatar
      cmd/compile/internal/syntax: add BasicLit.Bad field for lexical errors · 117400ec
      Robert Griesemer authored
      The new (internal) field scanner.bad indicates whether a syntax error
      occurred while scanning a literal; the corresponding scanner.lit
      string may be syntactically incorrect in that case. Store the value
      of scanner.bad together with the scanner.lit in BasicLit.
      
      Clean up error handling so that all syntactic errors use one of the
      scanner's error reporting methods which also set scanner.bad. Make
      use of the new field in a few places where we used to track a prior
      error separately.
      
      Preliminary step towards fixing #32133 in a comprehensive manner.
      
      Change-Id: I4d79ad6e3b50632dd5fb3fc32ca3df0598ee77b4
      Reviewed-on: https://go-review.googlesource.com/c/go/+/192278Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      117400ec
    • Keith Randall's avatar
      bytes/hash: add hashing package for bytes and strings · bf36219c
      Keith Randall authored
      Fixes #28322
      
      R=go1.14
      
      RELNOTE=yes
      
      Change-Id: Ic29f8b587c8c77472260836a5c3e13edaded13fa
      Reviewed-on: https://go-review.googlesource.com/c/go/+/186877Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      bf36219c
    • Keith Randall's avatar
      runtime: switch default order of hashing algorithms · fbfb41e6
      Keith Randall authored
      Currently the standard hasher is memhash, which checks whether aes
      instructions are available, and if so redirects to aeshash.
      
      With this CL, we call aeshash directly, which then redirects to the
      fallback hash if aes instructions are not available.
      
      This reduces the overhead for the hash function in the common case,
      as it requires just one call instead of two. On architectures which
      have no assembly hasher, it's a single jump slower.
      
      Thanks to Martin for this idea.
      
      name         old time/op  new time/op  delta
      BigKeyMap-4  22.6ns ± 1%  21.1ns ± 2%  -6.55%  (p=0.000 n=9+10)
      
      Change-Id: Ib7ca77b63d28222eb0189bc3d7130531949d853c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/190998Reviewed-by: default avatarMartin Möhrmann <moehrmann@google.com>
      fbfb41e6
    • Josh Bleecher Snyder's avatar
      cmd/compile: add more Neg/Com optimizations · 9675f819
      Josh Bleecher Snyder authored
      This is a grab-bag of minor optimizations.
      
      While we're here, document the c != -(1<<31)
      constraints better (#31888).
      
      file    before    after     Δ       %
      go      14669924  14665828  -4096   -0.028%
      asm     4867088   4858896   -8192   -0.168%
      compile 23988320  23984224  -4096   -0.017%
      cover   5210856   5206760   -4096   -0.079%
      link    6084376   6080280   -4096   -0.067%
      total   132181084 132156508 -24576  -0.019%
      
      file                                                      before    after     Δ       %
      archive/tar.a                                             516708    516702    -6      -0.001%
      bufio.a                                                   182200    181974    -226    -0.124%
      bytes.a                                                   217624    216890    -734    -0.337%
      cmd/compile/internal/gc.a                                 8865412   8865228   -184    -0.002%
      cmd/compile/internal/ssa.a                                29921002  29933976  +12974  +0.043%
      cmd/go/internal/modfetch/codehost.a                       530602    530430    -172    -0.032%
      cmd/go/internal/modfetch.a                                679664    679578    -86     -0.013%
      cmd/go/internal/modfile.a                                 411102    410928    -174    -0.042%
      cmd/go/internal/test.a                                    315218    315126    -92     -0.029%
      cmd/go/internal/tlog.a                                    183242    183256    +14     +0.008%
      cmd/go/internal/txtar.a                                   23148     23060     -88     -0.380%
      cmd/internal/bio.a                                        132064    132060    -4      -0.003%
      cmd/internal/buildid.a                                    107174    107172    -2      -0.002%
      cmd/internal/edit.a                                       33208     33354     +146    +0.440%
      cmd/internal/obj/arm.a                                    416488    416432    -56     -0.013%
      cmd/internal/obj/arm64.a                                  2772626   2772622   -4      -0.000%
      cmd/internal/obj/x86.a                                    923186    923114    -72     -0.008%
      cmd/internal/obj.a                                        679834    679836    +2      +0.000%
      cmd/internal/objfile.a                                    358374    358372    -2      -0.001%
      cmd/internal/test2json.a                                  67482     67434     -48     -0.071%
      cmd/link/internal/ld.a                                    2836280   2836110   -170    -0.006%
      cmd/link/internal/loadpe.a                                148234    147736    -498    -0.336%
      cmd/link/internal/objfile.a                               144534    144434    -100    -0.069%
      cmd/link/internal/ppc64.a                                 170876    170382    -494    -0.289%
      cmd/vendor/github.com/google/pprof/internal/elfexec.a     49896     49892     -4      -0.008%
      cmd/vendor/github.com/google/pprof/internal/graph.a       437478    437404    -74     -0.017%
      cmd/vendor/github.com/google/pprof/profile.a              902040    902044    +4      +0.000%
      cmd/vendor/github.com/ianlancetaylor/demangle.a           1217856   1217854   -2      -0.000%
      cmd/vendor/golang.org/x/arch/x86/x86asm.a                 561332    560684    -648    -0.115%
      cmd/vendor/golang.org/x/crypto/ssh/terminal.a             153788    153784    -4      -0.003%
      cmd/vendor/golang.org/x/sys/unix.a                        1043894   1043814   -80     -0.008%
      cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.a 288458    288414    -44     -0.015%
      compress/flate.a                                          369024    368132    -892    -0.242%
      crypto/aes.a                                              109058    108968    -90     -0.083%
      crypto/cipher.a                                           150410    150544    +134    +0.089%
      crypto/elliptic.a                                         323572    323758    +186    +0.057%
      crypto/md5.a                                              50868     50788     -80     -0.157%
      crypto/rsa.a                                              195292    195214    -78     -0.040%
      crypto/sha1.a                                             70936     70858     -78     -0.110%
      crypto/sha256.a                                           75316     75236     -80     -0.106%
      crypto/sha512.a                                           84846     84768     -78     -0.092%
      crypto/subtle.a                                           6520      6514      -6      -0.092%
      crypto/tls.a                                              1654916   1654852   -64     -0.004%
      crypto/x509.a                                             888674    888638    -36     -0.004%
      database/sql.a                                            730280    730198    -82     -0.011%
      debug/gosym.a                                             184936    184862    -74     -0.040%
      debug/macho.a                                             272138    272136    -2      -0.001%
      debug/plan9obj.a                                          78444     78368     -76     -0.097%
      encoding/base64.a                                         82126     81882     -244    -0.297%
      encoding/binary.a                                         187196    187150    -46     -0.025%
      encoding/gob.a                                            897868    897870    +2      +0.000%
      encoding/json.a                                           659934    659832    -102    -0.015%
      encoding/pem.a                                            59138     58870     -268    -0.453%
      encoding/xml.a                                            694054    693300    -754    -0.109%
      fmt.a                                                     484518    484196    -322    -0.066%
      go/format.a                                               33962     33994     +32     +0.094%
      go/printer.a                                              437132    437134    +2      +0.000%
      go/scanner.a                                              141774    141772    -2      -0.001%
      go/token.a                                                125130    125126    -4      -0.003%
      go/types.a                                                2192086   2191994   -92     -0.004%
      html/template.a                                           599038    598770    -268    -0.045%
      html.a                                                    184842    184710    -132    -0.071%
      image/draw.a                                              129592    129238    -354    -0.273%
      image/gif.a                                               171824    171716    -108    -0.063%
      image/internal/imageutil.a                                20282     19272     -1010   -4.980%
      image/jpeg.a                                              275608    275114    -494    -0.179%
      image/png.a                                               343416    343620    +204    +0.059%
      image.a                                                   362244    362210    -34     -0.009%
      index/suffixarray.a                                       113040    112954    -86     -0.076%
      internal/trace.a                                          518972    518838    -134    -0.026%
      math/big.a                                                1012670   1012354   -316    -0.031%
      math.a                                                    219338    219334    -4      -0.002%
      mime/multipart.a                                          178854    178502    -352    -0.197%
      mime/quotedprintable.a                                    49226     48936     -290    -0.589%
      net/http/cgi.a                                            172328    172324    -4      -0.002%
      net/http.a                                                4000180   3999732   -448    -0.011%
      net.a                                                     1858330   1858252   -78     -0.004%
      path/filepath.a                                           107496    107498    +2      +0.002%
      reflect.a                                                 1439776   1439994   +218    +0.015%
      regexp/syntax.a                                           459430    459432    +2      +0.000%
      regexp.a                                                  416394    416400    +6      +0.001%
      runtime/debug.a                                           42106     42100     -6      -0.014%
      runtime/pprof/internal/profile.a                          608718    608720    +2      +0.000%
      runtime/pprof.a                                           355474    355476    +2      +0.001%
      runtime.a                                                 3555748   3555796   +48     +0.001%
      strconv.a                                                 294432    294410    -22     -0.007%
      strings.a                                                 292148    292090    -58     -0.020%
      syscall.a                                                 859682    859470    -212    -0.025%
      text/tabwriter.a                                          65614     65148     -466    -0.710%
      vendor/golang.org/x/crypto/chacha20poly1305.a             126736    126728    -8      -0.006%
      vendor/golang.org/x/crypto/cryptobyte.a                   269112    269114    +2      +0.001%
      vendor/golang.org/x/crypto/internal/chacha20.a            61842     61262     -580    -0.938%
      vendor/golang.org/x/crypto/poly1305.a                     47410     47404     -6      -0.013%
      vendor/golang.org/x/net/dns/dnsmessage.a                  628700    628012    -688    -0.109%
      vendor/golang.org/x/net/idna.a                            237678    237826    +148    +0.062%
      vendor/golang.org/x/net/route.a                           187852    187458    -394    -0.210%
      vendor/golang.org/x/sys/unix.a                            1022426   1022348   -78     -0.008%
      vendor/golang.org/x/text/transform.a                      117954    118104    +150    +0.127%
      vendor/golang.org/x/text/unicode/bidi.a                   291398    291404    +6      +0.002%
      vendor/golang.org/x/text/unicode/norm.a                   534640    534540    -100    -0.019%
      total                                                     128945190 128945128 -62     -0.000%
      
      Change-Id: I346dc31356d5ef7774b824cf202169610bd26432
      Reviewed-on: https://go-review.googlesource.com/c/go/+/175778
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      9675f819
    • Josh Bleecher Snyder's avatar
      cmd/compile: simplify postorder · 75198b9a
      Josh Bleecher Snyder authored
      Use a bool instead of markKind;
      it doesn't save space, but the semantics are more obvious.
      Move type markKind closer to its only remaining use.
      
      Change-Id: I9945a7baaeb764295a2709f83120ce3a82fa3beb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177880
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      75198b9a
    • Josh Bleecher Snyder's avatar
      cmd/compile: optimize more pointer comparisons · b8cbcaca
      Josh Bleecher Snyder authored
      The existing pointer comparison optimizations
      don't include pointer arithmetic. Add them.
      
      These rules trigger a few times in std cmd, while compiling:
      
      time.Duration.String
      cmd/go/internal/tlog.NodeHash
      crypto/tls.ticketKeyFromBytes (3 times)
      crypto/elliptic.(*p256Point).p256ScalarMult (15 times!)
      crypto/elliptic.initTable
      
      These weird comparisons occur when using the copy builtin,
      which does a pointer comparison between src and dst.
      
      This also happens to fix #32454, by optimizing enough
      early on that all values can be eliminated.
      
      Fixes #32454
      
      Change-Id: I799d45743350bddd15a295dc1e12f8d03c11d1c6
      Reviewed-on: https://go-review.googlesource.com/c/go/+/180940
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b8cbcaca
    • Josh Bleecher Snyder's avatar
      cmd/compile: remove redundant rules · abda0a6a
      Josh Bleecher Snyder authored
      EqPtr and NeqPtr are marked as commutative,
      so the transformations for rules are already
      generated by the preceding two lines.
      
      Change-Id: Ibecba5c8e54d9df00c84e1dae7e5d8cb53eeff43
      Reviewed-on: https://go-review.googlesource.com/c/go/+/180939
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      abda0a6a
    • Cuong Manh Le's avatar
      cmd/compile: emit error message for broken type · 97bc039c
      Cuong Manh Le authored
      The original report in #5172 was that cmd/compile was generating bogus
      follow-on error messages when typechecking a struct failed. Instead of
      fixing those follow-on error messages, golang.org/cl/9614044 suppress all
      follow-on error messages after struct typecheck fails. We should
      continue emitting error messages instead.
      
      While at it, also add the test case for original report.
      
      Fixes #33947
      
      Change-Id: I4a5c6878977128abccd704350a12df743631c7bf
      Reviewed-on: https://go-review.googlesource.com/c/go/+/191944
      Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      97bc039c
    • LE Manh Cuong's avatar
      cmd/compile: fix internal error on complex comparison · 24c6dd98
      LE Manh Cuong authored
      Complex type is the only TIDEAL that lack of support for all comparison
      operators. When rewriting constant comparison into literal node, that
      missing cause compiler raise an internal error.
      
      Checking the operator is available for complex type before that fix the
      problem.
      
      We can make this check works more generally if there's more type lack of
      supporting all comparison operators added, but it does not seem to be
      happened, so just check explicitly for complex only.
      
      Fixes #32723
      
      Change-Id: I4938b1bdcbcdae9a9d87436024984bd2ab12995e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/183459
      Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      24c6dd98
    • LE Manh Cuong's avatar
      cmd/compile: do not set n.Type.Sym in typecheckdeftype · b136267b
      LE Manh Cuong authored
      typecheckdef calls typecheckdeftype, which will also set n.Type.Sym,
      causing duplicated work. So do not set n.Type.Sym in typecheckdeftype to
      prevent this, and also keep populating n.Type info in one place make
      more sense.
      
      Change-Id: I62671babd750f9d5d0bbfcf8d7eecd2cc314c955
      Reviewed-on: https://go-review.googlesource.com/c/go/+/179579
      Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      b136267b
    • Josh Bleecher Snyder's avatar
      cmd/compile: handle infinite loops in shortcircuit pass · 2393d161
      Josh Bleecher Snyder authored
      The newly upgraded shortcircuit pass attempted to remove infinite loops.
      Stop doing that.
      
      Fixes #33903
      
      Change-Id: I0fc9c1b5f2427e54ce650806602ef5e3ad65aca5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/192144
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      2393d161
    • LE Manh Cuong's avatar
      cmd/compile: make typecheck set n.Type.Nod when returning OTYPE · e87fe0f1
      LE Manh Cuong authored
      typecheck only set n.Type.Nod for declared type, and leave it nil for
      anonymous types, type alias. It leads to compiler crashes, because
      n.Type.Nod is nil at the time dowidth was called.
      
      Fixing it by set n.Type.Nod right after n.Type initialization if n.Op is
      OTYPE.
      
      When embedding interface cycles involve in type alias, it also helps
      pointing the error message to the position of the type alias
      declaration, instead of position of embedding interface.
      
      Fixes #31872
      
      Change-Id: Ia18391e987036a91f42ba0c08b5506f52d07f683
      Reviewed-on: https://go-review.googlesource.com/c/go/+/191540
      Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      e87fe0f1
    • Daniel Martí's avatar
      Revert "runtime: don't forward SIGPIPE on macOS" · 647dc1af
      Daniel Martí authored
      This reverts CL 188297.
      
      Reason for revert: broke multiple of the darwin builders.
      
      Fixes #33943.
      
      Change-Id: Iacff98d1450edc70402dc7a220d16fcd73337c9e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/191784
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      647dc1af
    • Than McIntosh's avatar
      test: new testcase for gollvm bug · 35ac1945
      Than McIntosh authored
      Testcase for a gollvm bug (assert in Llvm_backend::materializeComposite).
      
      Updates golang/go#33020.
      
      Change-Id: Icdf5b4b2b6eb55a5b48a31a61c41215b1ae4cf01
      Reviewed-on: https://go-review.googlesource.com/c/go/+/191743Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      35ac1945
    • Jason A. Donenfeld's avatar
      runtime: remove slow time compatibility hacks for wine · b4ad49f9
      Jason A. Donenfeld authored
      A few years ago, Wine-specific detection was added as an ugly hack to
      work around shortcomings in the emulation layer. Probably it's best to
      not special case this emulator versus that emulator versus the real
      deal, but there were two arguments presented in the hack's favor:
      
        1. Wine is useful and developers will appreciate being able to debug
           stuff with it.
      
        2. The existing KUSER_SHARED_DATA technique for gathering time is
           undocumented, and we shouldn't be relying on it anyway, since
           Microsoft might remove it without notice.
      
      As it turns out, neither one of these are, at the time of writing, true.
      (1) has been handled for some time by Wine with the introduction of the
      commit entitled "ntdll: Create thread to update user_shared_data time
      values when necessary". And (2) is in fact documented:
      https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddk/ns-ntddk-kuser_shared_data
      https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-kuser
      It's in use so widely by both third-party software (such as games, a
      massive market segment) and by Microsoft binaries that removing it from
      the operating system will basically never happen.
      
      So with both issues taken care of, this commit simply gets rid of the
      old hack.
      
      Change-Id: I80093f50e0d10d53648128d0f9dd76b1b92a119e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/191759
      Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      b4ad49f9
    • Lynn Boger's avatar
      cmd/internal/obj/ppc64: add support for vmrgow,vmrgew · 8f79ca1d
      Lynn Boger authored
      This adds support for ppc64 instructions vmrgow and vmrgew which
      are needed for an improved implementation of chacha20.
      
      Change-Id: I967a2de54236bcc573a99f7e2b222d5a8bb29e03
      Reviewed-on: https://go-review.googlesource.com/c/go/+/192117
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCarlos Eduardo Seo <cseo@linux.vnet.ibm.com>
      8f79ca1d
    • Elias Naur's avatar
      runtime: don't forward SIGPIPE on macOS · d56a86e0
      Elias Naur authored
      macOS and iOS deliver SIGPIPE signals to the main thread and not
      the thread that raised it by writing to a closed socket or pipe.
      
      SIGPIPE signals can be suppressed for sockets with the SO_NOSIGPIPE
      option, but there is no similar option for pipes. We have no other
      choice but to never forward SIGPIPE on macOS.
      
      Fixes #33384
      
      Change-Id: Ice3de75b121f00006ee11c26d560e619536460be
      Reviewed-on: https://go-review.googlesource.com/c/go/+/188297
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      d56a86e0
    • Constantin Konstantinidis's avatar
      os: return an error when the argument of Mkdir on Windows is os.DevNull · 5cf5a6fc
      Constantin Konstantinidis authored
      Test added.
      
      Fixes #24556
      
      Change-Id: I4d1cd4513142edeea1a983fbfde46c2fccecab2a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/186139
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      5cf5a6fc
    • Tomas Dabasinskas's avatar
      net: fix resolving local windows machine ptr · cb325fed
      Tomas Dabasinskas authored
      Fixes #29600
      
      Change-Id: Ie60b5c8f8356dfc16b3ef6d3cee520b9ce6a61aa
      GitHub-Last-Rev: 76cbdb96a69fb48a2c65966174e53e5aa68ce13d
      GitHub-Pull-Request: golang/go#32214
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178701
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      cb325fed
    • Prashant Agrawal's avatar
      debug/pe: enable parsing of variable length optional header in PE file · 3b92f36d
      Prashant Agrawal authored
      The debug/pe package assumes there are always 16 entries in
      DataDirectory in OptionalHeader32/64
      ref pe.go:
      ...
      NumberOfRvaAndSizes uint32
      DataDirectory [16]DataDirectory
      }
      ...
      
      But that is not always the case, there could be less no of
      entries (PE signed linux kernel for example):
      $ sudo pev /boot/vmlinuz-4.15.0-47-generic
      ....
      Data-dictionary entries:	6
      ....
      
      In such case, the parsing gives incorrect results.
      This changes aims to fix that by:
      1. Determining type of optional header by looking at header
         magic instead of size
      2. Parsing optional header in 2 steps:
         a. Fixed part
         b. Variable data directories part
      
      Testing:
      1. Fixed existing test cases to reflect the change
      2. Added new file (modified linux kernel image)
         which has smaller number of data directories
      
      Fixes #32126
      
      Change-Id: Iee56ecc4369a0e75a4be805e7cb8555c7d81ae2f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177959
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      3b92f36d
    • Agniva De Sarker's avatar
      cmd/compile: refactor zero value size to be a constant · 8e4399ff
      Agniva De Sarker authored
      Change-Id: I31dd4fb55d5974cd45de00148039d04f8a7d5cb3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/187257
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Reviewed-by: default avatarMartin Möhrmann <moehrmann@google.com>
      8e4399ff
    • Tianon Gravi's avatar
      runtime: treat CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT as SIGTERM on Windows · 5d1a9517
      Tianon Gravi authored
      This matches the existing behavior of treating CTRL_C_EVENT, CTRL_BREAK_EVENT as a synthesized SIGINT event.
      
      See https://docs.microsoft.com/en-us/windows/console/handlerroutine for a good documentation source upstream to confirm these values.
      
      As for the usage of these events, the "Timeouts" section of that upstream documentation is important to note, especially the limited window in which to do any cleanup before the program will be forcibly killed (defaults typically 5s, but as low as 500ms, and in many cases configurable system-wide).
      
      These events are especially relevant for Windows containers, where these events (particularly `CTRL_SHUTDOWN_EVENT`) are one of the only ways containers can "gracefully" shut down (https://github.com/moby/moby/issues/25982#issuecomment-466804071).
      
      This was verified by making a simple `main()` which implements the same code as in `ExampleNotify_allSignals` but in a `for` loop, building a `main.exe`, running that in a container, then doing `docker kill -sTERM` on said container.  The program prints `Got signal: SIGTERM`, then exits after the aforementioned timeout, as expected.  Behavior before this patch is that the program gets no notification (and thus no output) but still exits after the timeout.
      
      Fixes #7479
      
      Change-Id: I2af79421cd484a0fbb9467bb7ddb5f0e8bc3610e
      GitHub-Last-Rev: 9e05d631b542393f5ebb0eb3747157c8bd0de635
      GitHub-Pull-Request: golang/go#33311
      Reviewed-on: https://go-review.googlesource.com/c/go/+/187739
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      5d1a9517
    • Tobias Klauser's avatar
      syscall: enable ReadDirent tests on aix, linux and solaris · d865b5ca
      Tobias Klauser authored
      Change-Id: I13fd6bad4600ef909b13ac517ba6a06909b5c703
      Reviewed-on: https://go-review.googlesource.com/c/go/+/182379
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      d865b5ca
  3. 28 Aug, 2019 8 commits