aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
AgeCommit message (Collapse)Author
2021-08-24cmd/link: guarantee "section .debug_gdb_scripts" is always ↵crazycomputer
"$GOROOT/src/runtime/runtime-gdb.py". to guarantee the "section .debug_gdb_scripts" is always "$GOROOT/src/runtime/runtime-gdb.py" , a check for package name is needed when search "runtime/proc.go". Fixes #47881 Change-Id: Ib471314ca1a6777f625b488e5ae3790457540ef9 Reviewed-on: https://go-review.googlesource.com/c/go/+/344229 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Trust: Michael Knyszek <mknyszek@google.com>
2021-08-17cmd/link: do not use GO_LDSO when cross compileCherry Mui
GO_LDSO is a setting that is set when the toolchain is build. It only makes sense to use it on the host platform. Do not use it when targetting a different platform. In the past it was not a problem as GO_LDSO was almost always unset. Now, with CL 301989 it is almost always set (maybe we want to revisit it). Fixes #47760. Change-Id: I2704b9968781f46e2d2f8624090db19689b1a32f Reviewed-on: https://go-review.googlesource.com/c/go/+/343010 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-17cmd/link: remove elfwritedynentsymCherry Mui
elfwritedynentsym and elfWriteDynEntSym are identical. Change-Id: I893a9a65fdc496f98ba6e66c2bf1ed8dd52f52fd Reviewed-on: https://go-review.googlesource.com/c/go/+/342709 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-08-16cmd: support space and quotes in CC and CXXJay Conrod
The CC and CXX environment variables now support spaces and quotes (both double and single). This fixes two issues: first, if CC is a single path that contains spaces (like 'c:\Program Files\gcc\bin\gcc.exe'), that should now work if the space is quoted or escaped (#41400). Second, if CC or CXX has multiple arguments (like 'gcc -O2'), they are now split correctly, and the arguments are passed before other arguments when invoking the C compiler. Previously, strings.Fields was used to split arguments, and the arguments were placed later in the command line. (#43078). Fixes golang/go#41400 Fixes golang/go#43078 NOTE: This change also includes a fix (CL 341929) for a test that was broken by the original CL. Commit message for the fix is below. [dev.cmdgo] cmd/link: fix TestBuildForTvOS This test was broken in CL 334732 on darwin. The test invokes 'go build' with a CC containing the arguments -framework CoreFoundation. Previously, the go command split CC on whitespace, and inserted the arguments after the command line when running CC directly. Those arguments weren't passed to cgo though, so cgo ran CC without -framework CoreFoundation (or any of the other flags). In CL 334732, we pass CC through to cgo, and cgo splits arguments using str.SplitQuotedFields. So -framework CoreFoundation actually gets passed to the C compiler. It appears that -framework flags are only meant to be used in linking operations, so when cgo invokes clang with -E (run preprocessor only), clang emits an error that -framework is unused. This change fixes the test by moving -framework CoreFoundation out of CC and into CGO_LDFLAGS. Change-Id: I2d5d89ddb19c94adef65982a8137b01f037d5c11 Reviewed-on: https://go-review.googlesource.com/c/go/+/334732 Trust: Jay Conrod <jayconrod@google.com> Trust: Michael Matloob <matloob@golang.org> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/341936 Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-08-16cmd/link: start at address 0 when external linkingCherry Mui
When external linking, we are creating an object file, instead of a executable. The absolute address is irrelevant. The external linker will set it up. Start at address 0. Change-Id: I3a2e0b8087b328d5c3144f29ca8ba6311aa39cba Reviewed-on: https://go-review.googlesource.com/c/go/+/319830 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-08-13cmd/link: fix dead reference linkkorzhao
Change-Id: I0f53cc2b845f8a52fece2aaba1445a0ecb9cdc53 Reviewed-on: https://go-review.googlesource.com/c/go/+/341129 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-09[dev.typeparams] cmd/compile: use types2.Constraint() rather than types2.Bound()Dan Scales
types2.Constraint() returns the top-level constraint type, including any unions or other interface elements. Because of that, we needed to add/fix some code in the type substituter and generic type instantiater in the importer to deal with unions and non-method members of an interface. Also, NewUnion was not correctly setting the HasTParam flag. I also added a better error message when a symbol is not found in (*deadcodePass).decodeIfaceMethod(). Change-Id: Id3668dc596dce63690fa05a9e5e42295b5e2bbb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/340670 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2021-08-03[dev.typeparams] runtime,cmd/compile,cmd/link: replace jmpdefer with a loopAustin Clements
Currently, deferreturn runs deferred functions by backing up its return PC to the deferreturn call, and then effectively tail-calling the deferred function (via jmpdefer). The effect of this is that the deferred function appears to be called directly from the deferee, and when it returns, the deferee calls deferreturn again so it can run the next deferred function if necessary. This unusual flow control leads to a large number of special cases and complications all over the tool chain. This used to be necessary because deferreturn copied the deferred function's argument frame directly into its caller's frame and then had to invoke that call as if it had been called from its caller's frame so it could access it arguments. But now that we've simplified defer processing so the runtime only deals with argument-less closures, this approach is no longer necessary. This CL simplifies all of this by making deferreturn simply call deferred functions in a loop. This eliminates the need for jmpdefer, so we can delete a bunch of per-architecture assembly code. This eliminates several special cases on Wasm, since it couldn't support these calling shenanigans directly and thus had to simulate the loop a different way. Now Wasm can largely work the way the other platforms do. This eliminates the per-architecture Ginsnopdefer operation. On PPC64, this was necessary to reload the TOC pointer after the tail call (since TOC pointers in general make tail calls impossible). The tail call is gone, and in the case where we do force a jump to the deferreturn call when recovering from an open-coded defer, we go through gogo (via runtime.recovery), which handles the TOC. On other platforms, we needed a NOP so traceback didn't get confused by seeing the return to the CALL instruction, rather than the usual return to the instruction following the CALL instruction. Now we don't inject a return to the CALL instruction at all, so this NOP is also unnecessary. The one potential effect of this is that deferreturn could now appear in stack traces from deferred functions. However, this could already happen from open-coded defers, so we've long since marked deferreturn as a "wrapper" so it gets elided not only from printed stack traces, but from runtime.Callers*. This is a retry of CL 337652 because we had to back out its parent. There are no changes in this version. Change-Id: I3f54b7fec1d7ccac71cc6cf6835c6a46b7e5fb6c Reviewed-on: https://go-review.googlesource.com/c/go/+/339397 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-30[dev.typeparams] Revert "[dev.typeparams] runtime,cmd/compile,cmd/link: ↵Austin Clements
replace jmpdefer with a loop" This reverts CL 227652. I'm reverting CL 337651 and this builds on top of it. Change-Id: I03ce363be44c2a3defff2e43e7b1aad83386820d Reviewed-on: https://go-review.googlesource.com/c/go/+/338709 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-30[dev.typeparams] runtime,cmd/compile,cmd/link: replace jmpdefer with a loopAustin Clements
Currently, deferreturn runs deferred functions by backing up its return PC to the deferreturn call, and then effectively tail-calling the deferred function (via jmpdefer). The effect of this is that the deferred function appears to be called directly from the deferee, and when it returns, the deferee calls deferreturn again so it can run the next deferred function if necessary. This unusual flow control leads to a large number of special cases and complications all over the tool chain. This used to be necessary because deferreturn copied the deferred function's argument frame directly into its caller's frame and then had to invoke that call as if it had been called from its caller's frame so it could access it arguments. But now that we've simplified defer processing so the runtime only deals with argument-less closures, this approach is no longer necessary. This CL simplifies all of this by making deferreturn simply call deferred functions in a loop. This eliminates the need for jmpdefer, so we can delete a bunch of per-architecture assembly code. This eliminates several special cases on Wasm, since it couldn't support these calling shenanigans directly and thus had to simulate the loop a different way. Now Wasm can largely work the way the other platforms do. This eliminates the per-architecture Ginsnopdefer operation. On PPC64, this was necessary to reload the TOC pointer after the tail call (since TOC pointers in general make tail calls impossible). The tail call is gone, and in the case where we do force a jump to the deferreturn call when recovering from an open-coded defer, we go through gogo (via runtime.recovery), which handles the TOC. On other platforms, we needed a NOP so traceback didn't get confused by seeing the return to the CALL instruction, rather than the usual return to the instruction following the CALL instruction. Now we don't inject a return to the CALL instruction at all, so this NOP is also unnecessary. The one potential effect of this is that deferreturn could now appear in stack traces from deferred functions. However, this could already happen from open-coded defers, so we've long since marked deferreturn as a "wrapper" so it gets elided not only from printed stack traces, but from runtime.Callers*. Change-Id: Ie9f700cd3fb774f498c9edce363772a868407bf7 Reviewed-on: https://go-review.googlesource.com/c/go/+/337652 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-20[dev.typeparams] all: merge master (c8f4e61) into dev.typeparamsMatthew Dempsky
Conflicts: - src/runtime/internal/sys/zgoarch_386.go - src/runtime/internal/sys/zgoarch_amd64.go - src/runtime/internal/sys/zgoarch_arm.go - src/runtime/internal/sys/zgoarch_arm64.go - src/runtime/internal/sys/zgoarch_arm64be.go - src/runtime/internal/sys/zgoarch_armbe.go - src/runtime/internal/sys/zgoarch_mips.go - src/runtime/internal/sys/zgoarch_mips64.go - src/runtime/internal/sys/zgoarch_mips64le.go - src/runtime/internal/sys/zgoarch_mips64p32.go - src/runtime/internal/sys/zgoarch_mips64p32le.go - src/runtime/internal/sys/zgoarch_mipsle.go - src/runtime/internal/sys/zgoarch_ppc.go - src/runtime/internal/sys/zgoarch_ppc64.go - src/runtime/internal/sys/zgoarch_ppc64le.go - src/runtime/internal/sys/zgoarch_riscv.go - src/runtime/internal/sys/zgoarch_riscv64.go - src/runtime/internal/sys/zgoarch_s390.go - src/runtime/internal/sys/zgoarch_s390x.go - src/runtime/internal/sys/zgoarch_sparc.go - src/runtime/internal/sys/zgoarch_sparc64.go - src/runtime/internal/sys/zgoarch_wasm.go On dev.typeparams, CL 328336 moved these files to internal/goarch; whereas on master, CL 333909 reserved GOARCH=loong64. For this CL, I resolved the conflict by simply running "go generate internal/goarch". Merge List: + 2021-07-19 c8f4e6152d spec: correct example comment in Conversions from slice to array + 2021-07-19 1d91551b73 time: correct typo in documentation for UnixMicro + 2021-07-19 404127c30f cmd/compile: fix off-by-one error in traceback argument counting + 2021-07-19 6298cfe672 cmd/compile: fix typo in fatal message of builtinCall + 2021-07-19 49402bee36 cmd/{compile,link}: fix bug in map.zero handling + 2021-07-18 a66190ecee test/bench/go1: fix size for RegexpMatchMedium_32 + 2021-07-18 650fc2117a text/scanner: use Go convention in Position doc comment + 2021-07-16 aa4e0f528e net/http: correct capitalization in cancelTimeBody comment + 2021-07-15 0941dbca6a testing: clarify in docs that TestMain is advanced + 2021-07-15 69728ead87 cmd/go: update error messages in tests to match CL 332573 + 2021-07-15 c1cc9f9c3d cmd/compile: fix lookup package of redeclared dot import symbol + 2021-07-15 21a04e3335 doc/go1.17: mention GOARCH=loong64 + 2021-07-14 2b00a54baf go/build, runtime/internal/sys: reserve GOARCH=loong64 + 2021-07-14 60ddf42b46 cmd/go: change link in error message from /wiki to /doc. + 2021-07-13 d8f348a589 cmd/go: remove a duplicated word from 'go help mod graph' + 2021-07-12 a98589711d crypto/tls: test key type when casting + 2021-07-12 cfbd73ba33 doc/go1.17: editing pass over the "Compiler" section + 2021-07-09 ab4085ce84 runtime/pprof: call runtime.GC twice in memory profile test Change-Id: I1490a4c7e4c560659c21a4eb67d243f35d1f908e
2021-07-19cmd/{compile,link}: fix bug in map.zero handlingThan McIntosh
In CL 326211 a change was made to switch "go.map.zero" symbols from non-pkg DUPOK symbols to hashed symbols. The intent of this change was ensure that in cases where there are multiple competing go.map.zero symbols feeding into a link, the largest map.zero symbol is selected. The change was buggy, however, and resulted in duplicate symbols in the final binary (see bug cited below for details). This duplication was relatively benign for linux/ELF, but causes duplicate definition errors on Windows. This patch switches "go.map.zero" symbols back from hashed symbols to non-pkg DUPOK symbols, and updates the relevant code in the loader to ensure that we do the right thing when there are multiple competing DUPOK symbols with different sizes. Fixes #47185. Change-Id: I8aeb910c65827f5380144d07646006ba553c9251 Reviewed-on: https://go-review.googlesource.com/c/go/+/334930 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-08[dev.typeparams] all: merge master (296ddf2) into dev.typeparamsMatthew Dempsky
Conflicts: - src/runtime/runtime2.go On master, CL 317191 fixed the mentions of gc/reflect.go in comments to reflectdata/reflect.go; but on dev.typeparams, CL 325921 fixed that the same comment to reflect that deferstruct actually ended up in ssagen/ssa.go. Merge List: + 2021-07-08 296ddf2a93 net: filter bad names from Lookup functions instead of hard failing + 2021-07-08 ce76298ee7 Update oudated comment + 2021-07-08 2ca44fe221 doc/go1.17: linkify time.UnixMilli and time.UnixMicro + 2021-07-07 5c59e11f5e cmd/compile: remove special-casing of blank in types.sconv{,2} + 2021-07-07 b003a8b1ae cmd/compile: optimize types.sconv + 2021-07-07 11f5df2d67 cmd/compile: extract pkgqual from symfmt + 2021-07-07 991fd381d5 cmd/go: don't lock .mod and .sum files for read in overlay + 2021-07-07 186a3bb4b0 cmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present + 2021-07-07 00c00558e1 cmd/go/internal/modload: remove unused functions + 2021-07-07 f264879f74 cmd/go/internal/modload: fix an apparent typo in the AutoRoot comment + 2021-07-07 c96833e5ba doc: remove stale comment about arm64 port Change-Id: I849046b6d8f7421f60323549f3f763ef418bf9e7
2021-07-08Update oudated commentmakdon
Update comment cause gc/select.go has been moved to walk/select.go and gc/reflect.go has been moved to reflectdata/reflect.go Change-Id: I6894527e1e9dbca50ace92a51bf942f9495ce88c GitHub-Last-Rev: 6d6a4471440403218b68ba32d4038ca41eae2901 GitHub-Pull-Request: golang/go#45976 Reviewed-on: https://go-review.googlesource.com/c/go/+/317191 Reviewed-by: Keith Randall <khr@golang.org> Trust: Michael Pratt <mpratt@google.com>
2021-06-30[dev.typeparams] all: merge master (4711bf3) into dev.typeparamsMatthew Dempsky
Conflicts: - src/cmd/compile/internal/walk/builtin.go On dev.typeparams, CL 330194 changed OCHECKNIL to not require manual SetTypecheck(1) anymore; while on master, CL 331070 got rid of the OCHECKNIL altogether by moving the check into the runtime support functions. - src/internal/buildcfg/exp.go On master, CL 331109 refactored the logic for parsing the GOEXPERIMENT string, so that it could be more easily reused by cmd/go; while on dev.typeparams, several CLs tweaked the regabi experiment defaults. Merge List: + 2021-06-30 4711bf30e5 doc/go1.17: linkify "language changes" in the runtime section + 2021-06-30 ed56ea73e8 path/filepath: deflake TestEvalSymlinksAboveRoot on darwin + 2021-06-30 c080d0323b cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto + 2021-06-30 7d0e9e6e74 image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader) + 2021-06-30 0fa3265fe1 os: change example to avoid deprecated function + 2021-06-30 d19a53338f image: add Uniform.RGBA64At and Rectangle.RGBA64At + 2021-06-30 c45e800e0c crypto/x509: don't fail on optional auth key id fields + 2021-06-29 f9d50953b9 net: fix failure of TestCVE202133195 + 2021-06-29 e294b8a49e doc/go1.17: fix typo "MacOS" -> "macOS" + 2021-06-29 3463852b76 math/big: fix typo of comment (`BytesScanner` to `ByteScanner`) + 2021-06-29 fd4b587da3 cmd/compile: suppress details error for invalid variadic argument type + 2021-06-29 e2e05af6e1 cmd/internal/obj/arm64: fix an encoding error of CMPW instruction + 2021-06-28 4bb0847b08 cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil) + 2021-06-28 1519271a93 spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil) + 2021-06-28 5385e2386b runtime/internal/atomic: drop Cas64 pointer indirection in comments + 2021-06-28 956c81bfe6 cmd/go: add GOEXPERIMENT to `go env` output + 2021-06-28 a1d27269d6 cmd/go: prep for 'go env' refactoring + 2021-06-28 901510ed4e cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0 + 2021-06-28 361159c055 cmd/cgo: fix 'see gmp.go' to 'see doc.go' + 2021-06-27 c95464f0ea internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat + 2021-06-25 ed01ceaf48 runtime/race: use race build tag on syso_test.go + 2021-06-25 d1916e5e84 go/types: in TestCheck/issues.src, import regexp/syntax instead of cmd/compile/internal/syntax + 2021-06-25 5160896c69 go/types: in TestStdlib, import from source instead of export data + 2021-06-25 d01bc571f7 runtime: make ncgocall a global counter Change-Id: I1ce4a3b3ff7c824c67ad66dd27d9d5f1d25c0023
2021-06-28cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0hao
the test case is still using gcc when CGO is disabled. Change-Id: I2d255bfaeb92816c8343ab72fd7984b6632d421d GitHub-Last-Rev: de14748bd54c7db8687263a7c37080ec884d982a GitHub-Pull-Request: golang/go#46120 Reviewed-on: https://go-review.googlesource.com/c/go/+/319169 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-16[dev.typeparams] all: merge master (785a8f6) into dev.typeparamsCuong Manh Le
- test/run.go CL 328050 added fixedbugs/issue46749.go to -G=3 excluded files list Merge List: + 2021-06-16 785a8f677f cmd/compile: better error message for invalid untyped operation + 2021-06-16 a752bc0746 syscall: fix TestGroupCleanupUserNamespace test failure on Fedora + 2021-06-15 d77f4c0c5c net/http: improve some server docs + 2021-06-15 219fe9d547 cmd/go: ignore UTF8 BOM when reading source code + 2021-06-15 723f199edd cmd/link: set correct flags in .dynamic for PIE buildmode + 2021-06-15 4d2d89ff42 cmd/go, go/build: update docs to use //go:build syntax + 2021-06-15 033d885315 doc/go1.17: document go run pkg@version + 2021-06-15 ea8612ef42 syscall: disable c-shared test when no cgo, for windows/arm + 2021-06-15 abc56fd1a0 internal/bytealg: remove duplicate go:build line + 2021-06-15 4061d3463b syscall: rewrite handle inheritance test to use C rather than Powershell + 2021-06-15 cf4e3e3d3b reflect: explain why convertible or comparable types may still panic + 2021-06-14 7841cb14d9 doc/go1.17: assorted fixes + 2021-06-14 8a5a6f46dc debug/elf: don't apply DWARF relocations for ET_EXEC binaries + 2021-06-14 9d13f8d43e runtime: update the variable name in comment + 2021-06-14 0fd20ed5b6 reflect: use same conversion panic in reflect and runtime + 2021-06-14 6bbb0a9d4a cmd/internal/sys: mark windows/arm64 as c-shared-capable + 2021-06-14 d4f34f8c63 doc/go1.17: reword "results" in stack trace printing Change-Id: I60d1f67c4d48cd4093c350fc89bd60c454d23944
2021-06-15cmd/link: set correct flags in .dynamic for PIE buildmodeThan McIntosh
For internal linking, when generating a PIE binary, set the proper .dynamic section flags to mark the binary as position-independent. Fixes #46747. Change-Id: I2b899148c6d06f92c9d12257a9761278b4236dfc Reviewed-on: https://go-review.googlesource.com/c/go/+/328089 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Than McIntosh <thanm@google.com>
2021-06-14[dev.typeparams] all: merge master (fdab5be) into dev.typeparamsMatthew Dempsky
Two non-conflict changes included because they're needed for all.bash: 1. Bump internal/goversion.Version to 18. This will happen eventually anyway (dev.typeparams will not be merged back to Go 1.17), and is needed for cmd/api to allow new API additions. 2. Add fixedbugs/issue46725.go (new test added on master) to the list of known failures for -G=3. This test exercises a bug that was fixed in typecheck, but -G=3 mode has duplicated that code and will need to be fixed as well. That's outside of the scope of a merge. Conflicts: - src/runtime/traceback.go Nearby lines were removed on both master and dev.typeparams. Merge List: + 2021-06-14 fdab5be159 doc/go1.17: further revise OpenBSD release notes + 2021-06-14 326ea438bb cmd/compile: rewrite a, b = f() to use temporaries when type not identical + 2021-06-14 3249b645c9 cmd/compile: factor out rewrite multi-valued f() + 2021-06-13 14305bf0b9 misc/cgo: generate Windows import libraries for clang + 2021-06-13 24cff0f044 cmd/go, misc/cgo: skip test if no .edata + 2021-06-13 67b1b6a2e3 cmd/compile: allow ir.OSLICE2ARRPTR in mayCall + 2021-06-12 1ed0d129e9 runtime: testprogcgo: don't call exported Go functions directly from Go + 2021-06-12 9d46ee5ac4 reflect: handle stack-to-register translation in callMethod + 2021-06-11 e552a6d312 cmd/go: remove hint when no module is suggested + 2021-06-11 16b5d766d8 syscall: do not load native libraries on non-native powershell on arm + 2021-06-11 77aa209b38 runtime: loop on EINTR in macOS sigNoteSleep + 2021-06-11 e2dc6dd5c9 doc/go1.17: clean up formatting of gofmt section + 2021-06-11 2f1128461d cmd/go: match Windows paths in TestScript/mod_invalid_version + 2021-06-11 2721da2608 doc/go1.17: fix formatting near httptest + 2021-06-10 770f1de8c5 net/http: remove test-only private key from production binaries + 2021-06-10 8d11b1d117 cmd/go: report the imports of CompiledGoFiles in ImportMap + 2021-06-10 dc00dc6c6b crypto/tls: let HTTP/1.1 clients connect to servers with NextProtos "h2" + 2021-06-09 27f83723e9 api: promote next to go1.17 + 2021-06-09 182157c81a doc/go1.17: remove lingering TODO + 2021-06-09 a5bc060b42 doc/go1.17: document strconv changes for Go 1.17 + 2021-06-09 1402b27d46 strconv: document parsing of leading +/- + 2021-06-09 df35ade067 doc/go1.17: document //go:build lines + 2021-06-09 e4e7807d24 net/http: add AllowQuerySemicolons + 2021-06-09 ec3026d032 doc/go1.17: remove TODO for ports section + 2021-06-09 e6dda19888 net/url: reject query values with semicolons + 2021-06-09 139e935d3c math/big: comment division + 2021-06-09 aa5540cd82 cmd/compile: make map.zero symbol content-addressable + 2021-06-09 07ca28d529 cmd/link: fix bug in -strictdups checking of BSS symbols + 2021-06-08 bcecae2af6 doc/go1.17: mention new possibility of type conversion panicking + 2021-06-08 63dcab2e91 doc/go1.17: mention new vet checks sigchanyzer and stdmethods. + 2021-06-08 6551763a60 doc/go1.17: mention block profile bias fix + 2021-06-08 cb80937bf6 Revert "doc/go1.17: mention block profile bias fix" + 2021-06-08 d3e3d03666 net: reject leading zeros in IP address parsers + 2021-06-08 da4a640141 doc/go1.17: revise OpenBSD release notes + 2021-06-08 689f4c7415 doc/go1.17: mention block profile bias fix + 2021-06-08 9afe071c60 doc/go1.17: remove TODO for Tools section + 2021-06-08 f753d7223e doc/go1.17: resolve TODO for cmd/cover + 2021-06-08 9498b0155d cmd/go: in Go 1.17+ modules, add indirect go.mod dependencies separately from direct ones + 2021-06-08 949f00cebe doc/go1.17: add release notes for crypto packages + 2021-06-08 0fb3e2c184 doc/go1.17: add a release note for the '-compat' flag to 'go mod tidy' + 2021-06-08 2169deb352 cmd/compile: use t.AllMethods when sorting typesByString + 2021-06-08 c20bcb6488 runtime: remove out-of-date comments about frame skipping + 2021-06-07 39c39ae52f doc: document Go 1.17 language changes + 2021-06-07 dc8b558951 cmd/dist: pass -Wno-lto-type-mismatch in swig_callback_lto + 2021-06-07 909dd5e010 strconv: ParseFloat: always return ErrSyntax for bad syntax Change-Id: Iffdf379d0275bbd12d50149ce38634773ced481d
2021-06-09cmd/link: fix bug in -strictdups checking of BSS symbolsThan McIntosh
The linker's -strictdups debugging option was not properly checking for cases where you have two dupok BSS symbols with different length (the check examined data length and content, but not symbol size). Updates #46653. Change-Id: I3844f25ef76dd6e4a84ffd5caed5d19a1b1a57c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/326210 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-06-07[dev.typeparams] all: merge master (8212707) into dev.typeparamsMatthew Dempsky
Conflicts: - src/go/internal/gcimporter/iimport.go CL 325429 and CL 319931 made unrelated changes to adjacent lines Merge List: + 2021-06-07 8212707871 crypto/elliptic: update P-521 docs to say it's constant-time + 2021-06-07 7406180012 fmt: split package documentation into more sections + 2021-06-07 e3176bbc3e crypto/tls: fix typo in Config.NextProtos docs + 2021-06-05 e1fa26026d spec: improve wording consistency by eliminating "specifier" + 2021-06-05 f490134126 spec: improve wording by choosing an official term "keyword" + 2021-06-05 e3cb381704 go/internal/gcimporter: don't waste CPU copying bytes in `io.ReadAll` + 2021-06-05 9d669ed47a misc/cgo/errors: use expected column numbers + 2021-06-04 95939e8de7 cmd/compile/internal/abi: fix typo in comment + 2021-06-04 831f9376d8 net/http: fix ResponseWriter.ReadFrom with short reads + 2021-06-04 3a9d906edc os: avoid finalizer race in windows process object + 2021-06-04 105c5b50e0 os: terminate windows processes via handle directly + 2021-06-04 79cd407f88 syscall: regenerate zsyscall_windows.go + 2021-06-04 c6b6211229 doc/go1.17: document testing changes for Go 1.17 + 2021-06-04 0214440075 syscall: do not pass console handles to PROC_THREAD_ATTRIBUTE_HANDLE_LIST on Windows 7 + 2021-06-04 962d5c997a cmd/compile,go/types: restrict use of unsafe.{Add,Slice} to go1.17 or newer + 2021-06-04 b29b123e07 cmd/compile: remove spurious ir.Dump + 2021-06-03 6d98301114 cmd/link: use correct alignment in PE DWARF sections + 2021-06-03 e0d029f758 runtime: avoid gp.lockedm race in exitsyscall0 + 2021-06-02 dd7ba3ba2c net: don't rely on system hosts in TestCVE202133195 + 2021-06-02 4f572d7076 io/fs: minor corrections to Sub docs + 2021-06-02 e11d14225c doc/go1.17: remove runtime section + 2021-06-02 6e189afd3e doc/go1.17: mention SYS_WAIT6/WEXITED on NetBSD + 2021-06-02 ff9f5fb859 cmd/link: recognize clang linker error in testCGOLTO + 2021-06-02 1c6a2ea2ea doc/go1.17: document time changes for Go1.17 + 2021-06-02 d743e67e06 doc/go1.17: document flag changes for Go 1.17 + 2021-06-02 dc8f87b749 runtime/internal/sys: generate //go:build lines in gengoos.go + 2021-06-02 84c0e5d47f cmd/link: move issue 43830 tests out of TestScript + 2021-06-02 cae68700cc runtime: fix formatting + 2021-06-01 567ee865f6 cmd/go: add declaration to cgo_lto_issue43830 test + 2021-06-01 24e9707cbf cmd/link, cmd/cgo: support -flto in CFLAGS Change-Id: I9ef88e7de0f8b1841ed9604b613b41672df67e71
2021-06-03cmd/link: use correct alignment in PE DWARF sectionsThan McIntosh
Set the correct section flags to insure that .debug_* sections are using 1-byte alignment instead of the default. This seems to be important for later versions of LLVM-mingw on windows (shows up on the windows/arm64 builder). Updates #46406. Change-Id: I023d5208374f867552ba68b45011f7990159868f Reviewed-on: https://go-review.googlesource.com/c/go/+/324763 Trust: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-06-03[dev.typeparams] cmd/link: take function address in assembly in TestFuncAlignCherry Mui
In TestFuncAlign we want to get the address of an assembly function. Take the address in assembly, so we get the actual function's address, not the wrapper's. Change-Id: Idc1fe2c8426562c70f8f7d6e489584ef059bc556 Reviewed-on: https://go-review.googlesource.com/c/go/+/324249 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-06-02[dev.typeparams] cmd/link: include "go build" output in test logsMatthew Dempsky
If running "go build" outputs anything, write it to the test log even if the test succeeds. This makes it easier to diagnose errors within the compiler by adding print statements and finding them in the test log, even if the compiler exits successfully. Change-Id: Id04716c4e1dcd9220c35ea0040ea516c1dd5237c Reviewed-on: https://go-review.googlesource.com/c/go/+/324329 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-06-02cmd/link: recognize clang linker error in testCGOLTOIan Lance Taylor
Also recognize a case in which GCC does not run (from https://build.golang.org/log/7f6d8b35c905b9829f05906beccca44f208aa569). Fixes #46517 Change-Id: I4fe4164a5df92b2dec08fd767f65a4d5479f3f36 Reviewed-on: https://go-review.googlesource.com/c/go/+/324169 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-06-02cmd/link: move issue 43830 tests out of TestScriptIan Lance Taylor
These tests pass or fail depending on the exact compiler version, which the TestScript tests don't support. Rewrite into Go. For #43830 For #46295 Change-Id: I91b61dfe329d518e461ee56f186f0e9b42858e77 Reviewed-on: https://go-review.googlesource.com/c/go/+/324049 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-06-01cmd/link, cmd/cgo: support -flto in CFLAGSIan Lance Taylor
The linker now accepts unrecognized object files in external linking mode. These objects will simply be passed to the external linker. This permits using -flto which can generate pure byte code objects, whose symbol table the linker does not know how to read. The cgo tool now passes -fno-lto when generating objects whose symbols it needs to read. The cgo tool now emits matching types in different objects, so that the lto linker does not report a mismatch. This is based on https://golang.org/cl/293290 by Derek Parker. For #43505 Fixes #43830 Fixes #46295 Change-Id: I6787de213417466784ddef5af8899e453b4ae1ad Reviewed-on: https://go-review.googlesource.com/c/go/+/322614 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2021-06-01[dev.typeparams] all: merge master (2725522) into dev.typeparamsCherry Mui
Merge List: + 2021-06-01 272552275f A+C: update name + 2021-06-01 2bec019fb5 doc/go1.17: add release notes for register ABI + 2021-06-01 2e59cc5fb4 cmd/go: add [-src] to documentation + 2021-06-01 0b80cf1136 cmd/go: make 'go get' save sums for incidentally updated modules + 2021-05-30 3b770f2ccb go/types: don't declare 'comparable' when typeparams are disabled + 2021-05-30 1607c28172 go/types: unexport the GoVersion configuration option for Go 1.17 + 2021-05-29 79bda65041 doc/go1.17: mention time.Layout + 2021-05-29 f6cc392d1d doc/go1.17: document text/template/parse.SkipFuncCheck + 2021-05-28 1419ca7cea doc/go1.17: mention new definitions of MSG_CMSG_CLOEXEC + 2021-05-28 6624771c83 doc/go1.17: mention testing.[TB].Setenv methods + 2021-05-28 bbda923592 doc/go1.17: mention new Windows SysProcAttr fields + 2021-05-28 6f58088bd8 doc/go1.17: document new go/build/BuildContext.ToolTags field + 2021-05-28 c295107708 doc/go1.17: mention new encoding/csv/Reader.FieldPos method + 2021-05-28 ccd9784edf doc/go1.17: document new debug/elf constant + 2021-05-28 3de3440fb9 go/ast: remove FuncDecl.IsMethod for Go 1.17 + 2021-05-27 639acdc833 doc/go1.17: clarify that compress/lzw Reader and Writer types are new + 2021-05-27 193d514131 net/http: correct Client.Do doc about context cancelation + 2021-05-27 ab2ef4aaa7 doc/go1.17: document reflect changes + 2021-05-27 0ece95a0fe cmd/go: don't let 'go mod download' save sums for inconsistent requirements + 2021-05-27 cdcd02842d net: verify results from Lookup* are valid domain names + 2021-05-27 8bf5bf5173 cmd/compile: improve debug locations for partially live in-params + 2021-05-27 56af34f875 cmd/compile: place reg spills after OpArg{Int,Float}Reg ops + 2021-05-27 db66e9e15d cmd/link: accept Windows line-ending in TestTrampolineCgo + 2021-05-27 6b8c94b6c5 go/types: guard against check==nil in newNamed + 2021-05-27 fca7b8f3e6 Revert "net: verify results from Lookup* are valid domain names" + 2021-05-27 950fa11c4c net/http/httputil: always remove hop-by-hop headers + 2021-05-27 9bc52686da cmd/go,cmd/link: do not check for staleness in most tests + 2021-05-27 6ff0ae2aa4 crypto/elliptic: fix typo in p521Point type name + 2021-05-26 3075ffc93e os: deflake TestFdReadRace + 2021-05-26 a62c08734f src/os: revert accidentally submitted change + 2021-05-26 1d5298d46a doc/go1.17: document net/... changes + 2021-05-26 0fbecece98 doc/go1.17: document syscall changes + 2021-05-26 02beecb397 mime: document use of the Shared MIME-Info Database + 2021-05-26 a92460fd2f doc/go1.17: add release notes for runtime/metrics package + 2021-05-26 55aefbb268 doc/go1.17: mention enabling frame pointer on all ARM64 + 2021-05-26 39da9ae513 go/types: ensure that Named.check is nilled out once it is expanded + 2021-05-26 bfd7798a6c runtime,cmd/link/internal/ld: fix typos + 2021-05-26 e4615ad74d math/big: move division into natdiv.go + 2021-05-26 d050238bb6 doc/go1.17: fix formatting for time changes + 2021-05-25 74242baa41 archive/zip: only preallocate File slice if reasonably sized Change-Id: I8a02edee1a6889547c52aa28c53cf8250766ab2c
2021-05-27cmd/link: accept Windows line-ending in TestTrampolineCgoCherry Mui
Apparently C printf emits "\r\n" on Windows. Accept that. Change-Id: If87ba41435e3147d3892cfc3fe3a105b066ff0aa Reviewed-on: https://go-review.googlesource.com/c/go/+/322973 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-27cmd/go,cmd/link: do not check for staleness in most testsBryan C. Mills
Instead, check that stale packages in the standard library are not rebuilt when already present in the build cache, and are not installed implicitly when rebuilt. We retain the staleness checks for the runtime package in tests involving '-i', because those are guaranteed to fail anyway if the package is stale and the "stale" failure message is arguably clearer. They can be removed if/when we remove the '-i' flag, but the runtime package is less likely to become stale because it does not have cgo dependencies. Fixes #46347 Updates #33598 Updates #35459 Updates #41696 Change-Id: I7b0a808addd930f9f4911ff53ded62272af75a40 Reviewed-on: https://go-review.googlesource.com/c/go/+/322629 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-05-26runtime,cmd/link/internal/ld: fix typostyltr
Change-Id: I558590cef7e2311aadbdcb4088033e350d3aae32 GitHub-Last-Rev: 513944a6238e0e32e2a2c266b70f7d50c9db508d GitHub-Pull-Request: golang/go#46389 Reviewed-on: https://go-review.googlesource.com/c/go/+/322809 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-20[dev.typeparams] cmd/link: mangle symbol ABI name on Plan 9Cherry Mui
It is probably not strictly necessary (as we don't support external linking on Plan 9). Do it for consistency (and less confusion). Change-Id: I0b48562061273ccbd4be83db4a981b8e465b1c95 Reviewed-on: https://go-review.googlesource.com/c/go/+/321331 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-13cmd/link: always mark runtime.unreachableMethod symbolCherry Mui
In the deadcode path we mark runtime.unreachableMethod symbol, which is a special symbol used for redirecting unreachable methods. Currently this code is conditioned on not -linkshared. This is wrong. It should be marked with -linkshared mode as well. In fact, -linkshared should only affect the entry symbol. Change the code accordingly. Change-Id: I252abf850212a930f275589ef0035a43e52cb9cc Reviewed-on: https://go-review.googlesource.com/c/go/+/319893 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-05-13cmd/link: resolve ABI alias for runtime.unreachableMethodCherry Mui
We redirect references to unreachable methods to runtime.unreachableMethod. We choose to use ABIInternal symbol for this, because runtime.unreachableMethod is a defined Go function. When linking against shared libraries, and ABI wrappers are not enabled, the imported function symbols are all ABI0 and aliased to ABIInternal. We need to resolve ABI alias in this case. Change-Id: Idd64ef46ce0b5f54882ea0069ce0d59dc9b7a599 Reviewed-on: https://go-review.googlesource.com/c/go/+/319891 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-05-13cmd/compile/internal/dwarfgen: fix DWARF param DIE orderingThan McIntosh
The DWARF standard requires that the DIEs in a subprogram corresponding to input and output parameters appear in declaration order; this patch adds some new code in dwarfgen to enforce this ordering (relying on the existing fn.Dcl ordering is not sufficient). Prior to the register ABI, it was easy to keep vars/decls sorted during DWARF generation since you could always rely on frame offset; with the ABI sorting by frame offset no longer gives you the original declaration order in all cases. Fixes #46055. Change-Id: I0e070cb781d6453caba896e5d3bee7cd5388050d Reviewed-on: https://go-review.googlesource.com/c/go/+/318829 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-12cmd/link: check mmap errorCherry Mui
We already check mmap errors on some code paths, but we missed one. Add error check there. Change-Id: Ic0e9cb0eb03c805de40802cfc5d5500e3e065d99 Reviewed-on: https://go-review.googlesource.com/c/go/+/319290 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-12cmd/link: don't cast end address to int32Cherry Mui
When linking a very large binary, the section address may not fit in int32. Don't truncate it. Change-Id: Ibcc8d74bf5662611949e547ce44ca8b973de383f Reviewed-on: https://go-review.googlesource.com/c/go/+/319289 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-05-10cmd/compile,reflect: allow longer type namesKeith Randall
Encode the length of type names and tags in a varint encoding instead of a fixed 2-byte encoding. This allows lengths longer than 65535 (which can happen for large unnamed structs). Removed the alignment check for #14962, it isn't relevant any more since we're no longer reading pointers directly out of this data (it is encoded as an offset which is copied out bytewise). Fixes #44155 Update #14962 Change-Id: I6084f6027e5955dc16777c87b0dd5ea2baa49629 Reviewed-on: https://go-review.googlesource.com/c/go/+/318249 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-07cmd/link: don't include arginfo symbols in symbol tableCherry Mui
We recently add arginfo symbols for traceback argument metadata. Like other metadata symbols (GC bitmaps, opendefer info, etc.), skip arginfo symbols for symbol table as well. Fixes #45971. Change-Id: I7a126b75f70ec88e2170e9a274d968762c7bce56 Reviewed-on: https://go-review.googlesource.com/c/go/+/317769 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-06cmd/link: split large text sections on Darwin/ARM64 when external linkingCherry Mui
The Darwin linker does not like text sections that are larger than the jump limit (even if we already inserted trampolines). Split the text section to multiple smaller sections. Now external linking very large binaries works on Darwin/ARM64. Updates #40492. Change-Id: I584f1ec673170c5e4d2dc1e00c701964d6f14333 Reviewed-on: https://go-review.googlesource.com/c/go/+/316050 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-03cmd/link: unify text segment writeCherry Zhang
Currently we have two code paths of writing the text segment. They are semantically the same: - if we split text sections, we write all ".text" sections as text and the the rest as data. - if we do not split text sections, we write the first section as text and the rest as data. The first section is named ".text" and is the only one in this case. Unify the code. Change-Id: Ic639eed625615be3c8a8d41f5b47e901552f587a Reviewed-on: https://go-review.googlesource.com/c/go/+/316049 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-03cmd/link/internal: fix use of DynlinkingGo with ppc64le trampolinesLynn Boger
When creating programs with large text sections on ppc64le, trampolines are needed for calls that are too far; however they are not created if the code is generated such that the TOC register r2 is initialized and maintained in the code because then the external linker can create the trampolines. Previously the function DynlinkingGo was used to determine this but in the case where plugins are used, this could return true even though r2 is not valid. To fix this problem I've added a new function r2Valid which returns true when the build options indicate that the r2 is initialized and maintained. Because of the ways that DynlinkingGo is used I wanted to maintain its previous behavior. Fixes #45850 Change-Id: I6d902eba6ad41757aa6474948b79acdbd479cb38 Reviewed-on: https://go-review.googlesource.com/c/go/+/315289 Trust: Lynn Boger <laboger@linux.vnet.ibm.com> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-05-01cmd/link: emit better error for duplicated definitionCherry Zhang
Print the packages where the duplicates come from. Change-Id: Ib3dc9aa0a3f5ddd97b03744be6d01d4bfcb33996 Reviewed-on: https://go-review.googlesource.com/c/go/+/315949 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-01cmd/link: mangle ABI name for shared linkageCherry Zhang
Currently, when ABI wrappers are used, we don't use ABI aliases. One exception is shared linkage. When loading a shared library, if a symbol has only one ABI, and the name is not mangled, we don't know what ABI it is, so we have to use ABI aliases. This CL makes it always mangle ABIInternal function name in shared linkage, so we know what ABI to choose when loading a shared library. And we now can fully stop using ABI aliases when ABI wrappers are used. Change-Id: Id15d9cd72a59f391f54574710ebba7dc44cb6e23 Reviewed-on: https://go-review.googlesource.com/c/go/+/315869 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-30cmd/compile: fix abbrev selection for output paramsThan McIntosh
In Cl 302071 we changed the compiler to use a different recipe for selecting the DWARF frame offset for output parameters, to reflect the fact that registerized output params don't have a stack memory location on entry to the function. In the process, however, we switched from using an abbrev pf DW_ABRV_PARAM to an abbrev of DW_ABRV_AUTO, which means that Delve can't recognize them correctly. To fix the problem, switch back to picking the correct abbrev entry, while leaving the new offset recipe intact. Updates #40724. Updates #45720. Change-Id: If721c9255bcd030177806576cde3450563f7a235 Reviewed-on: https://go-review.googlesource.com/c/go/+/315610 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-29cmd/link: test trampolines with cgoCherry Zhang
Updates #40492, #30949. Change-Id: I6d7923ac83275c5ab08958f7a501f7975aea151a Reviewed-on: https://go-review.googlesource.com/c/go/+/314456 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-29cmd/link: support trampoline insertion for PLT calls on ARMCherry Zhang
This is CL 314452, for ARM. Fixes #30949. Change-Id: Ib4e46a5bd11c698c4f8ea3bc4e7a605d7a538efc Reviewed-on: https://go-review.googlesource.com/c/go/+/314455 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-29cmd/link: support trampoline insertion for PLT calls on ARM64Cherry Zhang
When internal linking with C objects, some C object relocations may be turned into a CALL via PLT. For very large programs, the PLT stub may be laid too far. PLT stubs are generated late in the linker, and laid out after the end of the text section. So if the text section is big, the PLT stubs are likely too far. To avoid this situation, add trampolines for PLT calls in the trampoline pass. Only do this when the program is known too large (i.e. the second pass of the two-pass algorithm). Updates #40492. Change-Id: I21f65d6cbc6bde84e3cf9c2ae05f5233df6cfa72 Reviewed-on: https://go-review.googlesource.com/c/go/+/314452 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-29cmd/link: support trampoline insertion on ARM64Cherry Zhang
Compared to ARM32 or PPC64, ARM64 has larger range for direct jumps. But for very large programs it can still go over the limit. Add trampoline insertion for ARM64. Updates #40492. Change-Id: Id97301dbc35fb577ba3f8d5f3316a8424d4f53c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/314451 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-29cmd/link: use a two-pass approach for trampoline insertionCherry Zhang
Currently in the linker, for trampoline insertion it does a one-pass approach, where it assigns addresses for each function and inserts trampolines on the go. For this to work and not to emit too many unnecessary trampolines, the functions need to be laid out in dependency order, so a direct call's target is always as a known address (or known to be not too far). This mostly works, but there are a few exceptions: - linkname can break dependency tree and cause cycles. - in internal linking mode, on some platforms, some calls are turned into calls via PLT, but the PLT stubs are inserted rather late. Also, this is expensive in that it has to investigate all CALL relocations. This CL changes it to use a two-pass approach. The first pass is just to assign addresses without inserting any trampolines, assuming the program is not too big. If this succeeds, no extra work needs to be done. If this fails, start over and insert trampolines for too- far targets as well as targets with unknown addresses. This should make it faster for small programs (most cases) and generate fewer conservative trampolines. Change-Id: Ib13e01f38ec6dfbef1cd446b06da33ee17bded5d Reviewed-on: https://go-review.googlesource.com/c/go/+/314450 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>