1. 25 Oct, 2019 2 commits
    • Than McIntosh's avatar
      [dev.link] cmd/link/internal/loader: add PkgNone resolver cache · 2e2ef666
      Than McIntosh authored
      Add a cache for the loader.Loader.resolve() method to use when
      looking mapping local PkgNone symbols to global symbol indices.
      This helps avoid repeated map lookups during deadcode and other
      early phases of the linker when we haven't fully read in all
      of object file symbols. Benchstat numbers:
      
      name                      old time/op       new time/op       delta
      LinkCompiler                    1.97s ±13%        1.67s ± 8%  -15.34%  (p=0.000 n=20+20)
      LinkWithoutDebugCompiler        1.48s ±12%        1.21s ±11%  -18.14%  (p=0.000 n=20+20)
      
      name                      old user-time/op  new user-time/op  delta
      LinkCompiler                    2.19s ± 9%        2.04s ±17%   -6.98%  (p=0.002 n=19+20)
      LinkWithoutDebugCompiler        1.29s ±13%        1.20s ±13%   -7.70%  (p=0.000 n=20+20)
      
      Change-Id: I4b0b05c8208ee44ee9405b24774b84443e486831
      Reviewed-on: https://go-review.googlesource.com/c/go/+/203197
      Run-TryBot: Than McIntosh <thanm@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      2e2ef666
    • Than McIntosh's avatar
      [dev.link] cmd/link: rework relocation handling in new deadcode · 376ef734
      Than McIntosh authored
      Do a better job of reading relocations in the new deadcode pass.
      Specifically, during method type processing, read relocations for the
      symbol we're working on into a slice, and then pass the slice to
      helper functions, as opposed to rereading relocs at each stage.
      
      Change-Id: I95e3737ae91bb09b4da8e6ee68112ec255ceb0fc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201722
      Run-TryBot: Than McIntosh <thanm@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      376ef734
  2. 24 Oct, 2019 3 commits
  3. 21 Oct, 2019 4 commits
    • Cherry Zhang's avatar
      [dev.link] cmd/link: do not put static symbols into name lookup table · c480d32f
      Cherry Zhang authored
      Since the previous CL, we will not reference static symbols by
      name. Therefore no need to put them into the name lookup table.
      
      On Linux/ARM, in runtime/internal/atomic/sys_linux_arm.s, the
      kernelcas function has a definition and a reference written in
      two different forms, one with package prefix, one without. This
      way, the assembler cannot know they are the same symbol, only the
      linker knows. This is quite unusual, unify the names to so the
      assembler can resolve it to index.
      
      Change-Id: Ie7223097be6a3b65f3fa43ed4575da9972ef5b69
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201998
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      c480d32f
    • Cherry Zhang's avatar
      [dev.link] cmd/internal/obj: use index for static symbols · d56c8149
      Cherry Zhang authored
      In assembly we always reference symbols by name. But for static
      symbols, as they are reachable only within the current file, we
      can assign them local indices and use the indices to reference
      them. The index is only meaningful locally, and it is fine.
      
      Change-Id: I16e011cd41575ef703ceb6f35899e5fa58fbcf1e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201997
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      d56c8149
    • Cherry Zhang's avatar
      [dev.link] cmd/dist: reenable shared library tests · 4fa524b7
      Cherry Zhang authored
      Change-Id: Ifa4de9333b9275d832ebf68c89d3239ed438b104
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201819
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      4fa524b7
    • Cherry Zhang's avatar
      [dev.link] cmd: reference symbols by name when linking against Go shared library · 97e497b2
      Cherry Zhang authored
      When building a program that links against Go shared libraries,
      it needs to reference symbols defined in the shared library. At
      compile time, we don't know where the shared library boundary is.
      If we reference a symbol in package p by index, and package p is
      actually part of a shared library, we cannot resolve the index at
      link time, as the linker doesn't see the object file of p.
      
      So when linking against Go shared libraries, always use named
      reference for now.
      
      To do this, the compiler needs to know whether we will be linking
      against Go shared libraries. The -dynlink flag kind of indicates
      that (as the document says), but currently it is actually
      overloaded: it is also used when building a plugin or a shared
      library, which is self-contained (if -linkshared is not otherwise
      specified) and could use index for symbol reference. So we
      introduce another compiler flag, -linkshared, specifically for
      linking against Go shared libraries. The go command will pass
      this flag if its -linkshared flag is specified
      ("go build -linkshared").
      
      There may be better way to handle this. For example, we can
      put the symbol indices in a special section in the shared library
      that the linker can read. Or we can generate some per-package
      description file to include the indices. (Currently we generate
      a .shlibname file for each package that is included in a shared
      library, which contains the path of the library. We could
      consider extending this.) That said, this CL is a stop-gap
      solution. And it is no worse than the old object files.
      
      If we were to redesign the build system so that the shared
      library boundary is known at compile time, we could use indices
      for symbol references that do not cross shared library boundary,
      as well as doing other things better.
      
      Change-Id: I9c02aad36518051cc4785dbe25c4b4cef8f3faeb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201818
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      97e497b2
  4. 19 Oct, 2019 1 commit
  5. 18 Oct, 2019 8 commits
  6. 17 Oct, 2019 22 commits