aboutsummaryrefslogtreecommitdiff
path: root/misc
AgeCommit message (Collapse)Author
2020-11-11[release-branch.go1.15-security] cmd/go, cmd/cgo: don't let bogus symbol set ↵Ian Lance Taylor
cgo_ldflag A hand-edited object file can have a symbol name that uses newline and other normally invalid characters. The cgo tool will generate Go files containing symbol names, unquoted. That can permit those symbol names to inject Go code into a cgo-generated file. If that Go code uses the //go:cgo_ldflag pragma, it can cause the C linker to run arbitrary code when building a package. If you build an imported package we permit arbitrary code at run time, but we don't want to permit it at package build time. This CL prevents this in two ways. In cgo, reject invalid symbols that contain non-printable or space characters, or that contain anything that looks like a Go comment. In the go tool, double check all //go:cgo_ldflag directives in generated code, to make sure they follow the existing LDFLAG restrictions. Thanks to Chris Brown and Tempus Ex for reporting this. Fixes CVE-2020-28366 Change-Id: Ia1ad8f3791ea79612690fa7d26ac451d0f6df7c1 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/895832 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 6bc814dd2bbfeaafa41d314dd4cc591b575dfbf6) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/901056 Reviewed-by: Filippo Valsorda <valsorda@google.com> Reviewed-by: Roland Shoemaker <bracewell@google.com>
2020-10-12[release-branch.go1.15] cmd/compile: export notinheap annotation to object fileKeith Randall
In the rare case when a cgo type makes it into an object file, we need the go:notinheap annotation to go with it. Fixes #41432. Change-Id: Ie2ef241ee49661792e0d8c8c46c51b2fe5c6fa7c Reviewed-on: https://go-review.googlesource.com/c/go/+/259300 Trust: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-07-31cmd/cgo: fix mangling of enum and union typesMatthew Dempsky
Consider this test package: package p // enum E { E0 }; // union U { long x; }; // void f(enum E e, union U* up) {} import "C" func f() { C.f(C.enum_E(C.E0), (*C.union_U)(nil)) } In Go 1.14, cgo translated this to (omitting irrelevant details): type _Ctype_union_U [8]byte func f() { _Cfunc_f(uint32(_Ciconst_E0), (*[8]byte)(nil)) } func _Cfunc_f(p0 uint32, p1 *[8]byte) (r1 _Ctype_void) { ... } Notably, _Ctype_union_U was declared as a defined type, but uses were being rewritten into uses of the underlying type, which matched how _Cfunc_f was declared. After CL 230037, cgo started consistently rewriting "C.foo" type expressions as "_Ctype_foo", which caused it to start emitting: type _Ctype_enum_E uint32 type _Ctype_union_U [8]byte func f() { _Cfunc_f(_Ctype_enum_E(_Ciconst_E0), (*_Ctype_union_U)(nil)) } // _Cfunc_f unchanged Of course, this fails to type-check because _Ctype_enum_E and _Ctype_union_U are defined types. This CL changes cgo to emit: type _Ctype_enum_E = uint32 type _Ctype_union_U = [8]byte // f unchanged since CL 230037 // _Cfunc_f still unchanged It would probably be better to fix this in (*typeConv).loadType so that cgo generated code uses the _Ctype_foo aliases too. But as it wouldn't have any effect on actual compilation, it's not worth the risk of touching it at this point in the release cycle. Updates #39537. Fixes #40494. Change-Id: I88269660b40aeda80a9a9433777601a781b48ac0 Reviewed-on: https://go-review.googlesource.com/c/go/+/246057 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-07-27cmd/link: don't mark shared library symbols reachable unconditionallyCherry Zhang
During the transitioning period, we mark symbols from Go shared libraries reachable unconditionally. That might be useful when there was still a large portion of the linker using sym.Symbols, and only reachable symbols were converted to sym.Symbols. Marking them reachable brings them to the dynamic symbol table, even if they are not needed, increased the binary size unexpectedly. That time has passed. Now we largely operate on loader symbols, and it is not needed to mark them reachable anymore. Fixes #40416. Change-Id: I1e2bdb93a960ba7dc96575fabe15af93d8e95329 Reviewed-on: https://go-review.googlesource.com/c/go/+/244839 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-07-01cmd/link: fix GC data reading from shared library (attempt 2)Cherry Zhang
When linking against a Go shared library, when a global variable in the main module has a type defined in the shared library, the linker needs to pull the GC data from the shared library to build the GC program for the global variable. Currently, this fails silently, as the shared library file is closed too early and the read failed (with no error check), causing a zero GC map emitted for the variable, which in turn causes the runtime to treat the variable as pointerless. For now, fix this by keeping the file open. In the future we may want to use mmap to read from the shared library instead. Also add error checking. And fix a (mostly harmless) mistake in size caluculation. Also remove an erroneous condition for ARM64. ARM64 used to have a special case to get the addend from the relocation on the gcdata field. That was removed, but the new code accidentally returned 0 unconditionally. It's no longer necessary to have any special case, since the addend is now applied directly to the gcdata field on ARM64, like on all the other platforms. Fixes #39927. This is the second attempt of CL 240462. And this reverts CL 240616. Change-Id: I01c82422b9f67e872d833336885935bc509bc91b Reviewed-on: https://go-review.googlesource.com/c/go/+/240621 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-30Revert "cmd/link: fix GC data reading from shared library"Cherry Zhang
This reverts CL 240462. Reason for revert: test fails on PPC64LE. Updates #39927. Change-Id: I4f14fd0c36e604a80ae9f2f86d1e643e28945e93 Reviewed-on: https://go-review.googlesource.com/c/go/+/240616 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-30cmd/link: fix GC data reading from shared libraryCherry Zhang
When linking against a Go shared library, when a global variable in the main module has a type defined in the shared library, the linker needs to pull the GC data from the shared library to build the GC program for the global variable. Currently, this fails silently, as the shared library file is closed too early and the read failed (with no error check), causing a zero GC map emitted for the variable, which in turn causes the runtime to treat the variable as pointerless. For now, fix this by keeping the file open. In the future we may want to use mmap to read from the shared library instead. Also add error checking. And fix a (mostly harmless) mistake in size caluculation. Also remove an erroneous condition for ARM64. ARM64 used to have a special case to get the addend from the relocation on the gcdata field. That was removed, but the new code accidentally returned 0 unconditionally. It's no longer necessary to have any special case, since the addend is now applied directly to the gcdata field on ARM64, like on all the other platforms. Fixes #39927. Change-Id: Iecd32315b326c7059587fdc190e2fa99426e497e Reviewed-on: https://go-review.googlesource.com/c/go/+/240462 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Austin Clements <austin@google.com>
2020-06-26cmd/cgo: prevent redeclaration of _Ctype_void when C.void is usedMatthew Dempsky
CL 230037 changed cmd/cgo to emit "type _Ctype_foo = bar" aliases for all C.foo types mentioned in the original Go source files. However, cmd/cgo already emits an appropriate type definition for _Ctype_void. So if a source file explicitly mentions C.void, this resulted in _Ctype_void being declared multiple times. This CL fixes the issue by suppressing the "type _Ctype_void = _Ctype_void" alias before printing it. This should be safe because _Ctype_void is the only type that's specially emitted in out.go at the moment. A somewhat better fix might be to fix how _Ctype_void is declared in the cmd/cgo "frontend", but this is a less invasive fix. Fixes #39877. Change-Id: Ief264b3847c8ef8df1478a6333647ff2cf09b63d Reviewed-on: https://go-review.googlesource.com/c/go/+/240180 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-23cmd/link: skip zero values in fingerprint checkCherry Zhang
Normally, packages are loaded in dependency order, and if a Library object is not nil, it is already loaded with the actual fingerprint. In shared build mode, however, packages may be added not in dependency order (e.g. go install -buildmode=shared std adds all std packages before loading them), and it is possible that a Library's fingerprint is not yet loaded. Skip the check in this case (when the fingerprint is the zero value). Fixes #39777. Change-Id: I66208e92bf687c8778963ba8e33e9bd948f82f3a Reviewed-on: https://go-review.googlesource.com/c/go/+/239517 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-11cmd/cgo: in -godefs mode, don't change constant to typeIan Lance Taylor
Fixes #39534 Change-Id: Icbc1745935dd7098c09e2d35c61cd5bfbaa31c63 Reviewed-on: https://go-review.googlesource.com/c/go/+/237558 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-06-01misc/cgo/testplugin: fix typo in commentCherry Zhang
Change-Id: I7d1a5f6936505dff8f765541b5102dcbcd6ae835 Reviewed-on: https://go-review.googlesource.com/c/go/+/235924 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-05-31cmd/cgo,cmd/fix,misc/cgo: map the EGLConfig C type to uintptr in GoElias Naur
Similarly to EGLDisplay, EGLConfig is declared as a pointer but may contain non-pointer values. I believe this is the root cause of https://todo.sr.ht/~eliasnaur/gio/121. Change-Id: I412c4fbc2eef4aa028534d68bda95db98e3a365d Reviewed-on: https://go-review.googlesource.com/c/go/+/235817 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-05-12syscall/js: prepare IDs for the preset objectsHajime Hoshi
Fixes #38899 Change-Id: Ib8131c3078c60dc3fe2cf0eaac45b25a4f6e4649 Reviewed-on: https://go-review.googlesource.com/c/go/+/232518 Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Richard Musiol <neelance@gmail.com>
2020-05-01cmd/cgo: use type aliases for #define type macrosMatthew Dempsky
Cgo's initial design for handling "#define foo int*" involved rewriting "C.foo" to "*_Ctype_int" everywhere. But now that we have type aliases, we can declare "type _Ctype_foo = *_Ctype_int" once, and then rewrite "C.foo" to just "_Ctype_foo". This is important for go/types's UsesCgo mode, where go/types needs to be able to figure out a type for each C.foo identifier using only the information written into _cgo_gotypes.go. Fixes #38649. Change-Id: Ia0f8c2d82df81efb1be5bc26195ea9154c0af871 Reviewed-on: https://go-review.googlesource.com/c/go/+/230037 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-14cmd/cgo: use consistent tag for a particular structIan Lance Taylor
For #31891 Fixes #38408 Change-Id: Ie7498c2cab728ae798e66e7168425e16b063520e Reviewed-on: https://go-review.googlesource.com/c/go/+/228102 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-04-08all: remove scattered remnants of darwin/386Austin Clements
This removes all conditions and conditional code (that I could find) that depended on darwin/386. Fixes #37610. Change-Id: I630d9ea13613fb7c0bcdb981e8367facff250ba0 Reviewed-on: https://go-review.googlesource.com/c/go/+/227582 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-08all: remove scattered remnants of darwin/armAustin Clements
This removes all conditions and conditional code (that I could find) that depended on darwin/arm. Fixes #35439 (since that only happened on darwin/arm) Fixes #37611. Change-Id: Ia4c32a5a4368ed75231075832b0b5bfb1ad11986 Reviewed-on: https://go-review.googlesource.com/c/go/+/227198 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-30cmd/cgo, misc/cgo: only cache anonymous struct typedefs with parent nameTobias Klauser
CL 181857 broke the translation of certain C types using cmd/cgo -godefs because it stores each typedef, array and qualified type with their parent type name in the translation cache. Fix this by only considering the parent type for typedefs of anonymous structs which is the only case where types might become ambiguous. Updates #31891 Fixes #37479 Fixes #37621 Change-Id: I301a749ec89585789cb0d213593bb8b7341beb88 Reviewed-on: https://go-review.googlesource.com/c/go/+/226341 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-24syscall/js: make wasm_exec.js compatible with Webpacknao20010128nao
In Webpack, require("fs") will always be empty. This behavior throws an error: "fs.writeSync is not function". It happens when you did "fmt.Println". This PR avoids such problem and use polyfill in wasm_exec.js on Webpack. Change-Id: I55f2c75ce86b7f84d2d92e8e217b5decfbe3c8a1 GitHub-Last-Rev: aecc847e3f9d5617ea4b00196ef2810c2458f085 GitHub-Pull-Request: golang/go#35805 Reviewed-on: https://go-review.googlesource.com/c/go/+/208600 Reviewed-by: Richard Musiol <neelance@gmail.com>
2020-03-24syscall/js: allow copyBytesTo(Go|JS) to use Uint8ClampedArrayAurélio A. Heckert
closes #38011 Change-Id: Ic50f2f27456dccdc3fca1bda076871af1eb81705 Reviewed-on: https://go-review.googlesource.com/c/go/+/224638 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Richard Musiol <neelance@gmail.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-20test: fix -test.v trace output for cgo/testsharedThan McIntosh
Trace output showing how dummy GOROOT was being set up was incorrect (sense of the "cp -r" trace messages was inverted). This patch fixes the problem. Change-Id: Ib0ee649e305bfa1bc0c49e0d5ba2ea31e0a4f67e Reviewed-on: https://go-review.googlesource.com/c/go/+/224377 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-13Revert "misc/spectre: add spectre index test"Bryan C. Mills
This reverts CL 222978. Reason for revert: Test is failing frequently in TryBots and builders (https://build.golang.org/log/06a29585eaa9955cf33b50b5792b3bdc42e8fbe2) Change-Id: I53bcf789726a9cfe78b1d3c55af78873c5c61696 Reviewed-on: https://go-review.googlesource.com/c/go/+/223378 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-03-13misc/spectre: add spectre index testRuss Cox
Test for CL 222660. Change-Id: I1dae41a9746dfc4144a0d29c02201de8ecd216fd Reviewed-on: https://go-review.googlesource.com/c/go/+/222978 Reviewed-by: Keith Randall <khr@golang.org>
2020-03-04misc/cgo/test: fix sigaltstack test on AIXClément Chigot
Increase the size of the signal stack as the value given by SIGSTKSZ is too small for the Go signal handler. Fixes #37609 Change-Id: I56f1006bc69a2a9fb43f9e0da00061964290a690 Reviewed-on: https://go-review.googlesource.com/c/go/+/221804 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-02-25misc/wasm: avoid implicit boolean to number conversionBrad Fitzpatrick
Fixes #36561 Change-Id: I20cbf95ef4fd7c5c255a93ed3ec3e027a0ce2bc2 Reviewed-on: https://go-review.googlesource.com/c/go/+/214944 Reviewed-by: Richard Musiol <neelance@gmail.com>
2020-02-24misc/cgo/testshared: explicitly set GOBIN (instead of unsetting it)Bryan C. Mills
If GOBIN is set in the GOENV file, then merely unsetting it in the process environment is not sufficient. We can instead either set GOBIN explicitly, or disable GOENV explicitly. For now, we (semi-arbitrary) choose the former. Fixes #37390 Change-Id: Iec54532c804b70546d695105cd89e9169eac5dbb Reviewed-on: https://go-review.googlesource.com/c/go/+/220652 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-02-24misc/cgo: correct GOOS in skip messageTobias Klauser
Tests are skipped on linux/ppc64, not aix/ppc64. Change-Id: I6b91b89f24d76b0f9be3eaf816f81ad4246e418f Reviewed-on: https://go-review.googlesource.com/c/go/+/220423 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-02-23misc/cgo: enable testso and testsovar on mips64xTobias Klauser
External linking on mips64 was implemented in CL 19803 and CL 19809 Updates #12560 Updates #14126 Change-Id: I2cc127d71173aade56ad181bdd947355a76b3e46 Reviewed-on: https://go-review.googlesource.com/c/go/+/217017 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-20cmd/trace: update to use WebComponents V0 polyfillHana (Hyang-Ah) Kim
Old trace viewer stopped working with Chrome M80+ because the old trace viewer heavily depended on WebComponents V0 which are deprecated. Trace viewer recently migrated to use WebComponents V0 polyfill (crbug.com/1036492). This CL brings in the newly updated trace_viewer_full.html (sync'd @ 9508452e) and updates the javascript snippet included in the /trace endpoint to use the polyfill. This brings in webcomponents.min.js copied from https://chromium.googlesource.com/catapult/+/9508452e18f130c98499cb4c4f1e1efaedee8962/third_party/polymer/components/webcomponentsjs/webcomponents.min.js That is necessary because the /trace endpoint needs to import the vulcanized trace_viewer_full.html. It's possible that some features are not working correctly with this polyfill. In that case, report the issue to crbug.com/1036492. There will be a warning message in the UI (yellow banner above the timeline) which can be hidden by clicking the 'hide' button. This allows to render the trace in browsers other than chrome in theory, but I observed some buttons and functions still don't work outside chrome. Fixes #34374. Change-Id: Ib575f756f5e6b22ad904ede6e4d224a995ebe259 Reviewed-on: https://go-review.googlesource.com/c/go/+/219997 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2020-01-24cmd/go: fix cgo test when min macOS version is setJay Conrod
Regression tests for #24161 use a macro to conditionally compile some stub definitions. The macro tests that the minimum macOS version is less than 10.12. We get duplicate definitions when building this test with CGO_CFLAGS=-mmacosx-version-min=10.x where 10.x < 10.12. With this change, we use a different macro, __MAC_OS_X_VERSION_MAX_ALLOWED__, which tests the SDK version instead of the minimum macOS version. This checks whether these definitions are present in headers. After this change, 'go tool dist test cgo_test' should pass with CGO_FLAGS=-mmacosx-version-min=10.10. Updates #35459 Change-Id: I88d63601c94b0369c73c38d216a2d41ba7d4e579 Reviewed-on: https://go-review.googlesource.com/c/go/+/216243 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-10misc/cgo/test: re-enable darwin cgo tests in race modeTobias Klauser
Go 1.14 will drop support for macOS 10.10, see #23011 This reverts CL 125304 Updates #26475 Updates #26513 Change-Id: Ia13eef30f22d67103f7ae45424124fbb116e1261 Reviewed-on: https://go-review.googlesource.com/c/go/+/214057 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-20misc/cgo/test: tweak to pass with GCC 10Ian Lance Taylor
The test for issue 8945 was marked to only run on gccgo, but there was no reason for that. It broke for gccgo using GCC 10, because GCC 10 defaults to -fno-common. Make the test run on gc, and split it into test.go and testx.go to make it work with GCC 10. The test for issue 9026 used two identical structs which GCC 10 turns into the same type. The point of the test is not that the structs are identical, but that they are handled in a particular order. So make them different. Updates #8945 Updates #9026 Change-Id: I000fb02f88f346cfbbe5dbefedd944a2c64e8d8e Reviewed-on: https://go-review.googlesource.com/c/go/+/211217 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2019-11-25misc/cgo/testshared: do not write to GOROOTBryan C. Mills
Instead of installing shared libraries to GOROOT/pkg, clone the necessary files into a new GOROOT and run there. Given that we now have a build cache, ideally we should not need to install into GOROOT/pkg at all, but we can't fix that during the 1.14 code freeze. Updates #28387 Updates #28553 Updates #30316 Change-Id: I83084a8ca29a5dffcd586c7fccc3f172cac57cc6 Reviewed-on: https://go-review.googlesource.com/c/go/+/208482 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-11-25misc: log 'ok' from 'go run' tests on successBryan C. Mills
Otherwise, these tests produce no output, which can make the overall output of all.bash a bit tricky to decipher. Updates #30316 Updates #29062 Change-Id: I33b9e070fd28b9f21ece128e9e603a982c08b7cc Reviewed-on: https://go-review.googlesource.com/c/go/+/208483 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-11-25misc: remove use of relative directories in overlayDir functionsBryan C. Mills
It turns out that the relative-path support never worked in the first place. It had been masked by the fact that we ~never invoke overlayDir with an absolute path, which caused filepath.Rel to always return an error, and overlayDir to always fall back to absolute paths. Since the absolute paths seem to be working fine (and are simpler), let's stick with those. As far as I can recall, the relative paths were only a space optimization anyway. Updates #28387 Updates #30316 Change-Id: Ie8cd28f3c41ca6497ace2799f4193d7f5dde7a37 Reviewed-on: https://go-review.googlesource.com/c/go/+/208481 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-11-22misc/cgo/testshared: make -v output less verboseBryan C. Mills
Previously, 'go test -v' in this directory would result in a massive dump of go command output, because the test plumbed -v to 'build -x'. This change separates them into distinct flags, so that '-v' only implies the display of default 'go' command output. Updates #30316 Change-Id: Ifb125f35ec6a0bebe7e8286e7c546d132fb213df Reviewed-on: https://go-review.googlesource.com/c/go/+/208232 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-22misc/cgo/testcshared: avoid writing to GOROOT in testsBryan C. Mills
The tests in this package invoked 'go install -i -buildmode=c-shared' in order to generate an archive as well as multiple C header files. Unfortunately, the behavior of the '-i' flag is inappropriately broad for this use-case: it not only generates the library and header files (as desired), but also attempts to install a number of (unnecessary) archive files for transitive dependencies to GOROOT/pkg/$GOOS_$GOARCH_testcshared_shared, which may not be writable — for example, if GOROOT is owned by the root user but the test is being run by a non-root user. Instead, for now we generate the header files for transitive dependencies separately by running 'go tool cgo -exportheader'. In the future, we should consider how to improve the ergonomics for generating transitive header files without coupling that to unnecessary library installation. Updates #28387 Updates #30316 Updates #35715 Change-Id: I622426a860828020d98f7040636f374e5c766d28 Reviewed-on: https://go-review.googlesource.com/c/go/+/208119 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-22misc/cgo/testcarchive: avoid writing to GOROOT in testsBryan C. Mills
Also add a -testwork flag to facilitate debugging the test itself. Three of the tests of this package invoked 'go install -i -buildmode=c-archive' in order to generate an archive as well as multiple C header files. Unfortunately, the behavior of the '-i' flag is inappropriately broad for this use-case: it not only generates the library and header files (as desired), but also attempts to install a number of (unnecessary) archive files for transitive dependencies to GOROOT/pkg/$GOOS_$GOARCH_shared, which may not be writable — for example, if GOROOT is owned by the root user but the test is being run by a non-root user. Instead, for now we generate the header files for transitive dependencies separately by running 'go tool cgo -exportheader'. In the future, we should consider how to improve the ergonomics for generating transitive header files without coupling that to unnecessary library installation. Updates #28387 Updates #30316 Updates #35715 Change-Id: I3d483f84e22058561efe740aa4885fc3f26137b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/208117 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-20misc/cgo/testplugin: avoid writing to GOROOTBryan C. Mills
One of the 'go build' commands executed by this test passed the '-i' flag, which caused the 'go' command to attempt to install transitive standard-library dependencies to GOROOT/pkg/$GOOS_$GOARCH_dynlink. That failed if GOROOT/pkg was not writable (for example, if GOROOT was owned by the root user, but the user running the test was not root). As far as I can tell the '-i' flag is not necessary in this test. Prior to the introduction of the build cache it may have been an optimization, but now that the build cache is required the '-i' flag only adds extra work. Updates #30316 Change-Id: Ib60080a008c1941aa92b5bdd5a194d89fd6202aa Reviewed-on: https://go-review.googlesource.com/c/go/+/208120 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-20misc/cgo/fortran: avoid writing to $PWDBryan C. Mills
The bash script that drives this test needs to know whether the fortran compiler works, but it doesn't actually care about the generated binary. Write that binary to /dev/null. Updates #28387 Updates #30316 Change-Id: I4f86da1aeb939fc205f467511fc69235a6a9af26 Reviewed-on: https://go-review.googlesource.com/c/go/+/208124 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-18misc/chrome/gophertool: replace deprecated tabs.getSelected methodramenjuniti
tabs.getSelected has been deprecated since Chrome 33. Instead, use tabs.query. Fixes #35663 Change-Id: I4f7f17f948987aff8409ac8210f04eb1f7ebf908 Reviewed-on: https://go-review.googlesource.com/c/go/+/207402 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-11-15all: fix a bunch of misspellingsVille Skyttä
Change-Id: I5b909df0fd048cd66c5a27fca1b06466d3bcaac7 GitHub-Last-Rev: 778c5d21311abee09a5fbda2e4005a5fd4cc3f9f GitHub-Pull-Request: golang/go#35624 Reviewed-on: https://go-review.googlesource.com/c/go/+/207421 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-14cmd/link/internal/ld,misc/cgo/testcshared: don't -fuse-ld=gold on AndroidElias Naur
The NDK is switching to ldd, and will stop including the gold linker. Change-Id: If74168017c9874134b34010906ab1d94001528b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/206840 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-13misc/cgo/testgodefs: convert test from bash to GoBryan C. Mills
The bash version of the test wrote intermediate files to its testdata directory. Updates #28387 Updates #30316 Fixes #35536 Change-Id: Ib81b547d3c43e90df713a2172c8f399fefb53c68 Reviewed-on: https://go-review.googlesource.com/c/go/+/206901 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-11misc: ensure that test overlay directories are writableBryan C. Mills
Otherwise, the test cannot create new files in the directory. Updates #32407 Updates #30316 Change-Id: Ief0df94a202be92f57d458d4ab4e4daa9ec189b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/206458 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-11cmd/go: remove -w workaround for -buildmode=plugin on DarwinThan McIntosh
The problem causing the assert in #21647 are fixed at this point, along with various other linker issues with plugin + Darwin. With this in mind, remove the "-ldflags=-w" workaround for plugin mode on Darwin and re-enable the appropriate tests misc/cgo/testplugin Fixes #21647. Fixes #27502. Change-Id: I5b662987b138b06cfc9e1f9f6d804cf682bd501a Reviewed-on: https://go-review.googlesource.com/c/go/+/206198 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-11-05misc/ios: bump -mios-version-minElias Naur
Recent Xcode versions started to complain about the current min version: ld: warning: OS version (6.0.0) too small, changing to 7.0.0 Change-Id: Ieb525dd3e57429fe226b9d30d584b073c5e4768c Reviewed-on: https://go-review.googlesource.com/c/go/+/204663 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-04syscall/js: garbage collect references to JavaScript valuesRichard Musiol
The js.Value struct now contains a pointer, so a finalizer can determine if the value is not referenced by Go any more. Unfortunately this breaks Go's == operator with js.Value. This change adds a new Equal method to check for the equality of two Values. This is a breaking change. The == operator is now disallowed to not silently break code. Additionally the helper methods IsUndefined, IsNull and IsNaN got added. Fixes #35111 Change-Id: I58a50ca18f477bf51a259c668a8ba15bfa76c955 Reviewed-on: https://go-review.googlesource.com/c/go/+/203600 Run-TryBot: Richard Musiol <neelance@gmail.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-04misc/cgo/testcarchive: add missing exit(0) in main7.cIan Lance Taylor
Fixes #35327 Change-Id: I3726bfad24851a0bef8891014f7c5a7c48352307 Reviewed-on: https://go-review.googlesource.com/c/go/+/205077 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-02runtime: clear preemptStop in dropmIan Lance Taylor
Updates #10958 Updates #24543 Fixes #35294 Change-Id: I60f024d08451565df6d9751dab9832b50cbf637a Reviewed-on: https://go-review.googlesource.com/c/go/+/204957 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>