aboutsummaryrefslogtreecommitdiff
path: root/misc
AgeCommit message (Collapse)Author
2023-01-30misc/wasm: use NodeJS crypto libraryJohan Brandhorst-Satzkorn
The move to NodeJS 18 allows us to replace the custom crypto functions with the expanded crypto primitives of the NodeJS crypto library. Fixes #56860 Change-Id: I8726b4003150f31521f246f613b6976641b9fa69 Reviewed-on: https://go-review.googlesource.com/c/go/+/463975 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Evan Phoenix <evan@phx.io> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-01-30misc/wasm: extend executable compatibilityJohan Brandhorst-Satzkorn
The path /bin/bash is not available on all operating systems. Use /usr/bin/env bash to find the system bash interpreter. Change-Id: I493e462a8e261b7fbbd3f3c0b1d10e55c5ed783b Reviewed-on: https://go-review.googlesource.com/c/go/+/463977 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Evan Phoenix <evan@phx.io>
2023-01-30misc/wasm: use NodeJS performance libraryJohan Brandhorst-Satzkorn
The upgrade to NodeJS 18 introduces various library updates that mean we can no longer override the global performance package. Instead, rely on the performance library provided by the NodeJS runtime. Fixes #57516 Change-Id: Ic8ed902c696ad154f676e0b74b42efb84f02f8db Reviewed-on: https://go-review.googlesource.com/c/go/+/463234 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Evan Phoenix <evan@phx.io> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-01-26misc: update go.mod to 1.21David Chase
Doing this allows updates to swig so it can access slices and strings in a somewhat less-unsafe way. Change-Id: If2af8f8cf58d2287569dcd7c7ce09728e20b5ff0 Reviewed-on: https://go-review.googlesource.com/c/go/+/463396 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-20all: fix typos in go file commentsMarcel Meyer
This is the second round to look for spelling mistakes. This time the manual sifting of the result list was made easier by filtering out capitalized and camelcase words. grep -r --include '*.go' -E '^// .*$' . | aspell list | grep -E -x '[A-Za-z]{1}[a-z]*' | sort | uniq This PR will be imported into Gerrit with the title and first comment (this text) used to generate the subject and body of the Gerrit change. Change-Id: Ie8a2092aaa7e1f051aa90f03dbaf2b9aaf5664a9 GitHub-Last-Rev: fc2bd6e0c51652f13a7588980f1408af8e6080f5 GitHub-Pull-Request: golang/go#57737 Reviewed-on: https://go-review.googlesource.com/c/go/+/461595 Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2023-01-20misc/cgo/testsanitizers: use fmt.Printf instead fmt.PrintlnAlice
Change-Id: Ie46bc3cbfb2622b5eb70618557ff5398866f5607 GitHub-Last-Rev: a665ef84dd9c11c6c274ad7f1cb51733d8253f6d GitHub-Pull-Request: golang/go#57813 Reviewed-on: https://go-review.googlesource.com/c/go/+/462044 Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-01-18misc/reboot: overlay $GOROOT/lib in temporary gorootIan Lance Taylor
This fixes the test after CL 455357, which builds the time/tzdata file from $GOROOT/lib/time/zoneinfo.zip. Change-Id: I0c5afa6521b58dd3b57c3b4c3c704a622b846382 Reviewed-on: https://go-review.googlesource.com/c/go/+/462279 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Bypass: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2022-12-28misc/cgo/testsanitizers: run libfuzzer tests in temp directoryCherry Mui
The libFuzzer generated binary by default writes failure input into the current directory. Set cmd.Dir to the temporary directory so it won't write to GOROOT when running the test. Change-Id: I3e4ce7e3f845be5c9f09511c36e7a9a396eafad2 Reviewed-on: https://go-review.googlesource.com/c/go/+/459556 Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-12-27misc/cgo/testsanitizers: add libfuzzer testsCherry Mui
Apparently we don't have tests for libfuzzer mode. Add some tests. Updates #57449. Change-Id: I813da3e71c6d6f15db31914b248db220b0b7041e Reviewed-on: https://go-review.googlesource.com/c/go/+/459555 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-12-22misc/cgo/testshared: test build std in shared modeCherry Mui
Test that "go install -buildmode=shared std" works. For #57334. Change-Id: I465a07cf2e9035995916ef9940b4c1eeba998099 Reviewed-on: https://go-review.googlesource.com/c/go/+/459056 Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Tim Scharfenort <timscharfenort89@googlemail.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-11-30cmd/cgo: walk {FuncType,TypeSpec}.TypeParams fieldsMatthew Dempsky
This CL updates the cgo tool to walk the TypeParams fields for function types and type declarations, so that C.xxx identifiers can appear within type parameter lists. Fixes #52542. Change-Id: Id02a88d529d50fe59b0a834f415c2575204ffd1f Reviewed-on: https://go-review.googlesource.com/c/go/+/453977 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-22misc/cgo/testcshared: reapply CL 451816Bryan C. Mills
I accidentally reverted its edits with a bad cherry-pick in CL 452457. This should re-fix the windows-.*-newcc builders that regressed at that change. Updates #47257. Updates #35006. Updates #53540. Change-Id: I5818416af7c4c8c1593c36aa0198331b42b6c7d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/452675 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-21cmd/go: do not install .a files for packages in stdBryan C. Mills
As of CL 450739, we do not need install targets for cgo files when a C compiler is not present because cgo is not enabled by default. (Without a C compiler, builds will proceed with cgo disabled.) Fixes #47257. Fixes #56888. Change-Id: I274c50a60b5b1382e291df86a5464da8ad3695a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/452457 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-19misc/cgo/testcshared: handle unsuffixed dlltool pathThan McIntosh
Adapt the testcshared tests to handle the case where the path output by invoking gcc -print-prog-name=dlltool is a path lacking the final ".exe" suffix (this seems to be what clang is doing); tack it on before using if this is the case. Updates #35006. Updates #53540. Change-Id: I04fb7b9fc90677880b1ced4a4ad2a8867a3f5f86 Reviewed-on: https://go-review.googlesource.com/c/go/+/451816 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-07misc/cgo/test: skip Test9400 on AlpineAustin Clements
Alpine has a known issue where setgid clobbers the Go stack (#39857). misc/cgo/test skips other tests that use setgid on Alpine, but not this one. It's not clear to me why this test *used to* pass, but when I refactored misc/cgo/test in CL 447355 it started failing. Disable this test on Alpine, like the other setgid tests. Change-Id: I2e646ef55e2201a4f0b377319d719a011ec847f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/448355 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-04misc/cgo/test: simplify for module modeAustin Clements
When we were first introducing module mode, CL 163418 moved many of the tests in misc/cgo/test into their own test binary under testdata so misc/cgo/test continued to work in both GOPATH mode and module mode. This introduce a somewhat complicated test driver into misc/cgo/test. Since the misc/cgo/test test had to invoke "go test" as a subprocess, this required care to thread any build flags down into the subprocess. The output from any failures of the sub-process was also less than ideal. Now that we don't have to worry about running these in GOPATH mode any more, this CL moves all of the tests back into misc/cgo/test and drops the test driver. There are two slight complications: - Test41761 was added after this split and has a C type "S" that's also present in misc/cgo/test itself. We rename that to keep that test working. - TestCgo in go/internal/srcimporter now fails to import misc/cgo/test because misc/cgo/test now contains imports of other "misc" module packages and the importer it sets up isn't configured to allow that. We fix this by setting up a build context that's configured for this. Preparation for #37486. Change-Id: I3c4f73540e0482bbd493823cca44b0ce7fac01f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/447355 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-28cmd/go: don't install most GOROOT .a files in pkgMichael Matloob
Packages in GOROOT that don't use cgo will not be installed in GOROOT/pkg, and will instead be cached as usual like other Go packages. - add a internal/buildinternal package to hold the identities of the five packages that use cgo - update dist's test code to do a go build std cmd before checking staleness on builders. Because most of those packages no longer have install locations, and have dependencies that don't either, the packages need to be cached to not be stale. - fix index_test to import packages with the path "." when preparing the "want" values to compare the indexed data to. (the module index matches the behavior of build.ImportDir, which always passes in "." as the path. - In both the index and go/build Importers, don't set PkgObj for GOROOT packages which will no longer have install targets. PkgTargetRoot will still be set to compute target paths, which will still be needed in buildmode=shared. - "downgrade" all install actions that don't have a target to build actions. (The target should already not be set for packages that shouldn't be installed). For #47257 Change-Id: Ia5aee6b3b20b58e028119cf0352a4c4a2f10f6b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/432535 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-17misc/cgo/fortran: convert to Go testAustin Clements
Currently, the entry-point to this test is a Bash script that smoke tests the FORTRAN compiler and then runs a FORTRAN-containing Go test. This CL rearranges things so a pure Go Go test smoke tests the FORTRAN compiler and then runs a non-test FORTRAN-containing Go binary. While we're here, we fix a discrepancy when the host is GOARCH=amd64, but the target is GOARCH=386. Previously, we would pick the wrong libgfortran path because we didn't account for the cross-compilation, causing the link to fail. Except for some reason this was ignored and the test nevertheless "passed". In the new test we're a little more strict, so this build failure will cause the test to fail, so we add a little logic to account for cross-compilation with the host toolchain. For #37486. Change-Id: Ie6f70066885d6fbb4e1b5a2b1e13b85dee5b359b Reviewed-on: https://go-review.googlesource.com/c/go/+/443069 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com>
2022-10-17misc/cgo/testsigfwd: move to runtime/testprog/testprogcgoAustin Clements
This migrates testsigfwd, which uses some one-off build infrastructure, to be part of the runtime's testprogcgo. The test is largely unchanged. Because it's part of a larger binary, this CL renames a few things and gates the constructor-time signal handler registration on an environment variable. This CL also replaces an errant fmt.Errorf with fmt.Fprintf. For #37486, since it eliminates a non-go-test from dist. Change-Id: I0efd146ea0a0a3f0b361431349a419af0f0ecc61 Reviewed-on: https://go-review.googlesource.com/c/go/+/443068 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17misc/cgo/testsigfwd: delete unused codeAustin Clements
This code was introduced in CL 17903 but has never executed. It's also fundamentally non-deterministic. Delete it. Simplification for #37486. Change-Id: I049564123fb4fba401154e2ea0fc429e552d4749 Reviewed-on: https://go-review.googlesource.com/c/go/+/431258 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-14misc/cgo/testasan: drop testAustin Clements
The testasan test was added back in 2013 (CL 10126044), many years before Go added ASAN support in 2021 (CL 298611). So, in fact, testasan does not test Go ASAN support at all, as you might expect (misc/cgo/testsanitizers does that). It's intended to test whether the Go memory allocator works in a mixed C/Go binary where the C code is compiled with ASAN. The test doesn't actually use ASAN in any way; it just simulates where ASAN of 2013 put its shadow mappings. This made sense to test at the time because Go was picky about where its heap landed and ASAN happened to put its mappings exactly where Go wanted to put its heap. These days, Go is totally flexible about its heap placement, and I wouldn't be surprised if ASAN also works differently. Given all of this, this test adds almost no value today. Drop it. For #37486, since it eliminates a non-go-test from dist. Change-Id: I0292f8efbdc0e1e39650715604535c445fbaa87f Reviewed-on: https://go-review.googlesource.com/c/go/+/443067 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-14cmd/dist, misc/cgo/testsanitizers: enable msan tests on freebsd/amd64Dmitri Goutnik
Adjust os/arch checks to enable msan tests on freebsd/amd64. R=go1.20 For #53298 Change-Id: I3d0f5259db73d526d006a12de5ba6284528cf819 Reviewed-on: https://go-review.googlesource.com/c/go/+/411276 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-13cmd/link: don't reset variable size when handling -X flagCherry Mui
The linker's -X flag allows setting/changing a string variable's content at link time. Currently it resets its size then write a new string header pointing to the new content. This mostly works. But under ASAN build the string variable can have larger size than the usual 2 words, due to the red zone. Resetting the size can cause the variable to "overlap" (in ASAN's view) with other variables. Don't reset the size. Fixes #56175. Change-Id: Ib364208201a7a2fd7f44f9b1797834198736a405 Reviewed-on: https://go-review.googlesource.com/c/go/+/442635 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-10-12misc/cgo/test: add asan and msan arena testsMichael Anthony Knyszek
While we're here, replace a couple uses of os.Environ with cmd.Environ. For #51317. Change-Id: Ic5cf4a887a7975a8281223eec0f94df230b6f095 Reviewed-on: https://go-review.googlesource.com/c/go/+/431955 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-27misc/wasm: update deprecated substr usageMarko Kungla
String.prototype.substr is deprecated and usage is no longer recommended so using String.prototype.substring instead. Change-Id: I9eb49a8c065890df73301e3a04af59f550bc3ae1 Reviewed-on: https://go-review.googlesource.com/c/go/+/406094 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-22cmd/go: omit VCS stamping during bootstrapBryan C. Mills
cmd/dist can't easily hard-code -buildvcs=false because not all versions of cmd/go supported for bootstrapping recognize that flag. However, we don't want to stamp the bootstrap binaries: the stamping is redundant with the VERSION file writted during bootstrapping (which is why it is normally omitted for standard-library packages and commands), and it may also interfere with building the Go repo from a source tarball or zip file. Fixes #54852. Change-Id: If223f094af137c4c202d6bf622619bd2da397ec4 Reviewed-on: https://go-review.googlesource.com/c/go/+/432435 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-19misc/cgo: replace ioutil.ReadFile with os.ReadFilehopehook
For #45557 Change-Id: I25be5b437fa1c9b0e0c46802a9b37efc2d47bca0 Reviewed-on: https://go-review.googlesource.com/c/go/+/431097 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-19misc/cgo: replace os.SEEK_SET with io.SeekStarthopehook
Since os.SEEK_SET was deprecated, use io.SeekStart instead. Change-Id: I11ae496b071ab35412403ff73e52f3da73d5b120 Reviewed-on: https://go-review.googlesource.com/c/go/+/431096 Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: hopehook <hopehook@golangcn.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-06misc: use strings.Buildercuiweixie
Change-Id: Icb53d32f2de13287b1b4f4f67dab90fe5ee7a3df Reviewed-on: https://go-review.googlesource.com/c/go/+/428254 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-26runtime: add address sanitizer support for ppc64leArchana R
updates #44853 Change-Id: I71905ee1bcb99ce7300bbed2daad3617d2643c53 Reviewed-on: https://go-review.googlesource.com/c/go/+/408814 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
2022-08-25misc/cgo/testsanitizers: determine compiler version for tsan tests on ppc64leLynn Boger
Some tests in misc/cgo/testsanitizers had been disabled on ppc64le until recently, due to an intermittent error in the tsan tests, with the goal of trying to understand the failure. After further investigation, I found that the code for tsan within gcc does not work consistently when ASLR is enabled on ppc64le. A fix for that problem was integrated in gcc 9. This adds a check to testsanitizers to determine the gcc compiler version on ppc64le and skip the test if the version is too old. A similar check is needed for asan too. Updates #54645 Change-Id: I70717d1aa9e967cf1e871566e72b3862b91fea3f Reviewed-on: https://go-review.googlesource.com/c/go/+/425355 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Archana Ravindar <aravind5@in.ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
2022-08-22misc/cgo/test: disable setgid tests with muslMichael Pratt
We don't have a good musl detection mechanism, so we detect Alpine (the most common user of musl) instead. For #39857. For #19938. Change-Id: I2fa39248682aed75884476374fe2212be4427347 Reviewed-on: https://go-review.googlesource.com/c/go/+/425001 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-19misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternalIan Lance Taylor
Occasionally the signal will be sent to a Go thread, which will cause the program to exit with SIGQUIT rather than SIGSEGV. Add TestSignalForwardingGo to test the case where the signal is expected to be delivered to a Go thread. This is a roll forward of CL 419014 which was rolled back in CL 424954. This CL differs from 419014 in that it skips TestSignalForwardingGo on darwin-amd64. Fixes #53907 Change-Id: I5df3fd610c068df3bd48d9b3d7a9379248b97999 Reviewed-on: https://go-review.googlesource.com/c/go/+/425002 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-19Revert "misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal"Cuong Manh Le
This reverts CL 419014. Reason for revert: broke darwin-amd64 builders Change-Id: I77838e696a55c415d322ebb9846503de25b546d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/424954 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-19misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternalIan Lance Taylor
Occasionally the signal will be sent to a Go thread, which will cause the program to exit with SIGQUIT rather than SIGSEGV. Add TestSignalForwardingGo to test the case where the signal is expected to be delivered to a Go thread. Fixes #53907 Change-Id: Iaefb964c2be4a815c11c507fa89648f8a7740ba9 Reviewed-on: https://go-review.googlesource.com/c/go/+/419014 Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-11misc/cgo/testsanitizers: fix code to detect gcc version correctlyArchana R
The current implementation of compilerVersion incorrectly gives an error message that the compiler version is too old even though the system has a recent compiler. This happens for specifically for the gcc compiler and causes ASAN tests to be skipped. Replacing -v with gcc dump version options seems to fix it. Running ./testsanitizers.test -test.v now shows the ASAN tests being run. --- PASS: TestASAN (16.81s) --- PASS: TestASAN/asan_useAfterReturn (0.60s) --- PASS: TestASAN/asan_global5 (0.61s) --- PASS: TestASAN/asan_unsafe_fail1 (0.73s) --- PASS: TestASAN/asan_unsafe_fail3 (0.73s) --- PASS: TestASAN/asan_unsafe_fail2 (0.74s) --- PASS: TestASAN/asan_global4_fail (0.74s) --- PASS: TestASAN/asan5_fail (0.74s) --- PASS: TestASAN/asan3_fail (0.88s) --- PASS: TestASAN/asan4_fail (0.89s) --- PASS: TestASAN/asan2_fail (0.99s) --- PASS: TestASAN/asan_global3_fail (1.00s) --- PASS: TestASAN/asan_global1_fail (1.01s) --- PASS: TestASAN/asan1_fail (1.01s) --- PASS: TestASAN/asan_global2_fail (1.02s) PASS Fixes #54370 Change-Id: Iac13a1cf37de54432a6e49555f61e9ec1d781ab8 Reviewed-on: https://go-review.googlesource.com/c/go/+/422574 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Archana Ravindar <aravind5@in.ibm.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09test: skip -buildmode=pie tests on alpineThan McIntosh
Skip a collection of -buildmode=pie tests on alpine, which are currently failing on the linux-amd64-alpine builder. Once #54354 has been investigated and resolved we can turn these tests back on. Updates #54354. Change-Id: I99d4016a40873ee6bb4eda571a64eddbe719c76a Reviewed-on: https://go-review.googlesource.com/c/go/+/422295 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-09all: use ":" for compiler generated symbolsCuong Manh Le
As it can't appear in user package paths. There is a hack for handling "go:buildid" and "type:*" on windows/386. Previously, windows/386 requires underscore prefix on external symbols, but that's only applied for SHOSTOBJ/SUNDEFEXT or cgo export symbols. "go.buildid" is STEXT, "type.*" is STYPE, thus they are not prefixed with underscore. In external linking mode, the external linker can't resolve them as external symbols. But we are lucky that they have "." in their name, so the external linker see them as Forwarder RVA exports. See: - https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-address-table - https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/pe-dll.c;h=e7b82ba6ffadf74dc1b9ee71dc13d48336941e51;hb=HEAD#l972) This CL changes "." to ":" in symbols name, so theses symbols can not be found by external linker anymore. So a hacky way is adding the underscore prefix for these 2 symbols. I don't have enough knowledge to verify whether adding the underscore for all STEXT/STYPE symbols are fine, even if it could be, that would be done in future CL. Fixes #37762 Change-Id: I92eaaf24c0820926a36e0530fdb07b07af1fcc35 Reviewed-on: https://go-review.googlesource.com/c/go/+/317917 Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-02all: disable tests that fail on AlpineRuss Cox
These changes are enough to pass all.bash using the disabled linux-amd64-alpine builder via debugnewvm. For #19938. For #39857. Change-Id: I7d160612259c77764b70d429ad94f0864689cdce Reviewed-on: https://go-review.googlesource.com/c/go/+/419995 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-07-27misc/cgo/test: use fewer threads in TestSetgidStress in long modeCherry Mui
TestSetgidStress originally spawns 1000 threads for stress testing. It caused timeout on some builders so CL 415677 reduced to 50 in short mode. But it still causes flaky timeouts in longtest builders, so reduce the number of threads in long mode as well. Should fix #53641. Change-Id: I02f4ef8a143bb1faafe3d11ad223f36f5cc245c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/419453 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-22cmd/compile: make jump table symbol localCherry Mui
When using plugins, if the plugin and the main executable both have the same function, and if it uses jump table, currently the jump table symbol have the same name so it will be deduplicated by the dynamic linker. This causes a function in the plugin may (in the middle of the function) jump to the function with the same name in the main executable (or vice versa). But the function may be compiled slightly differently, because the plugin needs to be PIC. Jumping from the middle of one function to the other will not work. Avoid this problem by marking the jump table symbol local to a DSO. Fixes #53989. Change-Id: I2b573b9dfc22401c8a09ffe9b9ea8bb83d3700ca Reviewed-on: https://go-review.googlesource.com/c/go/+/418960 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-13misc/cgo/testshared: run tests only in GOPATH modeBryan C. Mills
-buildmode=shared installs shared libraries into GOROOT and expects to reuse them across builds. Builds in module mode, however, each have their own set of dependencies (determined by the module's requirements), so in general cannot share dependencies with a single GOROOT. Ideally in the long term we would like to eliminate -buildmode=shared entirely (see #47788), but first we need a replacement for the subset of use-cases where it still works today. In the meantime, we should run these tests only in GOPATH mode. Non-main packages in module mode should not be installed to GOPATH/pkg, but due to #37015 they were installed there anyway, and this test heavily relies on installing non-main packages. For #37015. Change-Id: I7c5d90b4075d6f33e3505d6a8f12752309ae5c03 Reviewed-on: https://go-review.googlesource.com/c/go/+/417194 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
2022-07-13misc/cgo/testcshared: don't rely on an erroneous install target in testsBryan C. Mills
Non-main packages in module mode should not be installed to GOPATH/pkg, but due to #37015 they were installed there anyway. This change switches the 'go install' command in createHeaders to instead use 'go build' (with an extension determined by the install target for 'runtime/cgo', which is well-defined at least for the moment), and switches TestCachedInstall (which appears to be explicitly testing 'go install') to explicitly request GOPATH mode (which provides a well-defined install target for the library). This change follows a similar structure to CL 416954. For #37015. Change-Id: I22ae4af0f0d4c50adc9e0f0dc279859d1f258cc8 Reviewed-on: https://go-review.googlesource.com/c/go/+/417096 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-07-11misc/cgo/testcarchive: don't rely on an erroneous install target in testsBryan C. Mills
Non-main packages in module mode should not be installed to GOPATH/pkg, but due to #37015 they were installed there anyway. This change switches the 'go install' command in TestPIE to instead use 'go build', and switches TestInstall and TestCachedInstall (which appear to be explicitly testing 'go install') to explicitly request GOPATH mode (which does have a well-defined install target). For #37015. Change-Id: Ifb24657d2781d1e35cf40078e8e3ebf56aab9cc8 Reviewed-on: https://go-review.googlesource.com/c/go/+/416954 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-07-06misc/cgo/test: make TestSetgidStress cheaperCherry Mui
TestSetgidStress spawns 1000 threads, which can be expensive on some platforms or slow builders. Run with 50 threads in short mode instead. This makes the failure less reproducible even with buggy code. But one can manually stress test it (e.g. when a flaky failure appear on the builder). Fixes #53641. Change-Id: I33b5ea5ecaa8c7a56f59c16f9171657ee295db47 Reviewed-on: https://go-review.googlesource.com/c/go/+/415677 Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-06-29cmd/internal/obj/arm64: save LR and SP in one instruction for small framesCherry Mui
When we create a thread with signals blocked. But glibc's pthread_sigmask doesn't really allow us to block SIGSETXID. So we may get a signal early on before the signal stack is set. If we get a signal on the current stack, it will clobber anything below the SP. This CL makes it to save LR and decrement SP in a single MOVD.W instruction for small frames, so we don't write below the SP. We used to use a single MOVD.W instruction before CL 379075. CL 379075 changed to use an STP instruction to save the LR and FP, then decrementing the SP. This CL changes it back, just this part (epilogues and large frame prologues are unchanged). For small frames, it is the same number of instructions either way. This decreases the size of a "small" frame from 0x1f0 to 0xf0. For frame sizes in between, it could benefit from using an STP instruction instead of using the prologue for the "large" frame case. We don't bother it for now as this is a stop-gap solution anyway. This only addresses the issue with small frames. Luckily, all functions from thread entry to setting up the signal stack have samll frames. Other possible ideas: - Expand the unwind info metadata, separate SP delta and the location of the return address, so we can express "SP is decremented but the return address is in the LR register". Then we can always create the frame first then write the LR, without writing anything below the SP (except the frame pointer at SP-8, which is minor because it doesn't really affect program execution). - Set up the signal stack immediately in mstart in assembly. For Go 1.19 we do this simple fix. We plan to do the metadata fix in Go 1.20 ( #53609 ). Other LR architectures are addressed in CL 413428. Fix #53374. Change-Id: I9d6582ab14ccb06ac61ad43852943d9555e22ae5 Reviewed-on: https://go-review.googlesource.com/c/go/+/412474 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Eric Fang <eric.fang@arm.com>
2022-06-25cmd/go: prepend builtin prolog when checking for preamble errorsqmuntal
Fixes #50710 Change-Id: I62feddbe3eaae9605d196bec60d378614436603a Reviewed-on: https://go-review.googlesource.com/c/go/+/379754 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-22cmd/cgo: dont override declared struct typekkHAIKE
Fixes #52611 Change-Id: I835df8d6a98a37482446ec00af768c96fd8ee4fe GitHub-Last-Rev: ea54dd69eef90eaf1641889039344fff70158ece GitHub-Pull-Request: golang/go#52733 Reviewed-on: https://go-review.googlesource.com/c/go/+/404497 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dexter Ouyang <kkhaike@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Alex Rakoczy <alex@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-27misc/cgo/testsanitizers: buffer the signal channel in TestTSAN/tsan11Bryan C. Mills
This fix is analogous to the one in CL 407888. 'go vet' catches the error, but it is not run on this file because the file is (only) compiled when running testsanitizers/TestTSAN. Fixes #53113. Change-Id: I74f7b7390a9775ff00a06214c1019ba28846dd11 Reviewed-on: https://go-review.googlesource.com/c/go/+/409094 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
2022-05-24misc/cgo/testsanitizers: use buffered channel in tsan12.goCherry Mui
os/signal.Notify requires that "the caller must ensure that c has sufficient buffer space to keep up with the expected signal rate" as it does a nonblocking send when it receives a signal. The test currently using a unbuffered channel, which means it may miss the signal if the signal arrives before the channel receive operation. Fixes #52998. Change-Id: Icdcab9396d735506480ef880fb45a4669fa7cc8f Reviewed-on: https://go-review.googlesource.com/c/go/+/407888 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>