summaryrefslogtreecommitdiff
path: root/misc
Commit message (Collapse)AuthorAgeFilesLines
* misc/cgo/testsanitizers: add regression test for change 50251Bryan C. Mills2017-07-202-0/+36
| | | | | | | | | | | http://golang.org/cl/50251 fixed a regression under TSAN. This change adds a minimal reproducer for the observed symptom. Change-Id: Ib9ad01b458b7fdec14d6c2fe3c243f9c64b3dcf2 Reviewed-on: https://go-review.googlesource.com/50371 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/cgo: unwrap typedef-chains before type checkingHiroshi Ioka2017-06-272-0/+34
| | | | | | | | | | | | | clang can emit some dwarf.VoidType which are wrapped by multiple dwarf.TypedefType. We need to unwrap those before further processing. Fixes #20129 Change-Id: I671ce6aef2dc7b55f1a02aec5f9789ac1b369643 Reviewed-on: https://go-review.googlesource.com/44772 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/cgo: match note following error in compiler errorsIan Lance Taylor2017-06-141-0/+9
| | | | | | | | | | | | | | | | | With current GCC a macro that refers to another macro can report an error on the macro definition line, with a note on the use. When cgo is trying to decide which line an error refers to, it is looking at the uses. So if we see an error on a line that we don't recognize followed by a note on a line that we do recognize, treat the note as an error. Fixes #20125. Change-Id: I389cd0eb7d56ad2d54bef70e278d9f76c4d36448 Reviewed-on: https://go-review.googlesource.com/44290 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* go/build: make -I/-L options in cgo flags absoluteIan Lance Taylor2017-06-133-0/+31
| | | | | | | | | | Fixes #20266. Change-Id: I51383820880e3d3566ef3d70650a0863756003ba Reviewed-on: https://go-review.googlesource.com/44291 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* cmd/cgo: show pos info in undefined name errorsAlberto Donizetti2017-06-032-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For test.go: package main import ( "C" "fmt" ) func main() { fmt.Println("Hello, world!") C.no_such_f() } Before: could not determine kind of name for C.no_such_f After: ./test.go:10:2: could not determine kind of name for C.no_such_f Fixes #18452 Change-Id: I49c136b7fa60fab25d2d5b905d440fe4d106e565 Reviewed-on: https://go-review.googlesource.com/34783 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/testcarchive: fix `go env` error messageIan Lance Taylor2017-05-241-2/+4
| | | | | | | | | | Add a missing newline. Don't panic on an unexpected error type. Change-Id: I82a4b12c498fbfdf4972737329631c0c02540005 Reviewed-on: https://go-review.googlesource.com/44092 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/cgo: support indirect macro expansion for stringHiroshi Ioka2017-05-232-0/+20
| | | | | | | | | | | | | Current code cannot handle string #define macros if those macros are defined via other macros. This CL solve the issue. Updates #18720 Change-Id: Ibed0773d10db3d545bb246b97e81c0d19e3af3d5 Reviewed-on: https://go-review.googlesource.com/41312 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/cgo: support large unsigned macrosHiroshi Ioka2017-05-172-0/+21
| | | | | | | | | | | | | | | | | | | | Currently, cgo converts integer macros into int64 if it's possible. As a result, some macros which satisfy math.MaxInt64 < x <= math.MaxUint64 will lose their original values. This CL introduces the new probe to check signs, so we can handle signed ints and unsigned ints separately. Fixes #20369 Change-Id: I002ba452a82514b3a87440960473676f842cc9ee Reviewed-on: https://go-review.googlesource.com/43476 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj, cmd/link: fix st_other field on PPC64Ian Lance Taylor2017-05-091-54/+80
| | | | | | | | | | | | | | | | | | | | | | | | In PPC64 ELF files, the st_other field indicates the number of prologue instructions between the global and local entry points. We add the instructions in the compiler and assembler if -shared is used. We were assuming that the instructions were present when building a c-archive or PIE or doing dynamic linking, on the assumption that those are the cases where the go tool would be building with -shared. That assumption fails when using some other tool, such as Bazel, that does not necessarily use -shared in exactly the same way. This CL records in the object file whether a symbol was compiled with -shared (this will be the same for all symbols in a given compilation) and uses that information when setting the st_other field. Fixes #20290. Change-Id: Ib2b77e16aef38824871102e3c244fcf04a86c6ea Reviewed-on: https://go-review.googlesource.com/43051 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* misc/android: don't let the Android exec wrapper hang indefinitelyElias Naur2017-05-011-1/+10
| | | | | | | | | | | | | | | | | | | | On Android, the exec wrapper passes on output from adb to its parent process by passing on os.Stderr and os.Stdout to adb. If the adb process somehow hangs, it will keep stderr and stdout will open, in turn blocking go test from ever returning from its cmd.Wait() even though it has killed the exec wrapper process. Break the short circuit by introducing a wrapper between adb and the exec wrapper, preventing os/exec.Run from passing along the raw file descriptors for os.Stdout and os.Stderr. (Hopefully) fixes occasional indefinite hangs on the Android builder. Change-Id: I1188211fbde79b4a66bf93ff8e9d0091abf34560 Reviewed-on: https://go-review.googlesource.com/42271 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* misc/ios: increase iOS test harness timeoutElias Naur2017-04-271-1/+1
| | | | | | | | | | | The "lldb start" phase often times out on the iOS builder. Increase the timeout and see if that helps. Change-Id: I92fd67cbfa90659600e713198d6b2c5c78dde20f Reviewed-on: https://go-review.googlesource.com/41863 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* plugin: resolve plugin import path issueTodd Neal2017-04-263-1/+39
| | | | | | | | | | | | Resolve import paths to get plugin symbol prefixes. Fixes #19534 Change-Id: Ic25d83e72465ba8f6be0337218a1627b5dc702dc Reviewed-on: https://go-review.googlesource.com/40994 Run-TryBot: Todd Neal <todd@tneal.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* cmd/cgo: reject references to builtin functions other than callsAlexander Menzhinsky2017-04-182-0/+8
| | | | | | | | | | | | | Here we restrict using cgo builtin references because internally they're go functions as opposed to C usafe.Pointer values. Fixes #18889 Change-Id: I1e4332e4884063ccbaf9772c172d4462ec8f3d13 Reviewed-on: https://go-review.googlesource.com/40934 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: only include the version info and export data in ABI hashMichael Hudson-Doyle2017-04-171-2/+10
| | | | | | | | | | | | | | | | Previously the "ABI hash" for a package (used to determine if a loaded shared library has the ABI expected by its loader) was the hash of the entire __.PKGDEF file. But that means it depends on the build ID generated by the go tool for the package, which means that if a file is added (even a .c or .h file!) to the package, the ABI changes, perhaps uncessarily. Fixes #19920 Change-Id: If919481e1a03afb350c8a9c7a0666bb90ee90270 Reviewed-on: https://go-review.googlesource.com/40401 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/ios: fix the Test386EndToEnd test on iOSElias Naur2017-04-171-6/+19
| | | | | | | | | | | Some tests need the src/runtime/textflag.h file. Make sure it is included in iOS test runs. Change-Id: I5e0e7ebe85679686ef15a7d336f28ac9b68a587a Reviewed-on: https://go-review.googlesource.com/40915 Run-TryBot: Elias Naur <elias.naur@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj: stop storing Text flags in From3Josh Bleecher Snyder2017-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this CL, flags such as NOSPLIT on ATEXT Progs were stored in From3.Offset. Some but not all of those flags were also duplicated into From.Sym.Attribute. This CL migrates all of those flags into From.Sym.Attribute and stops creating a From3. A side-effect of this is that printing an ATEXT Prog can no longer simply dump From3.Offset. That's kind of good, since the raw flag value wasn't very informative anyway, but it did necessitate a bunch of updates to the cmd/asm tests. The reason I'm doing this work now is that avoiding storing flags in both From.Sym and From3.Offset simplifies some other changes to fix the data race first described in CL 40254. This CL almost passes toolstash-check -all. The only changes are in cases where the assembler has decided that a function's flags may be altered, e.g. to make a function with no calls in it NOSPLIT. Prior to this CL, that information was not printed. Sample before: "".Ctz64 t=1 size=63 args=0x10 locals=0x0 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) TEXT "".Ctz64(SB), $0-16 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) FUNCDATA $0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB) Sample after: "".Ctz64 t=1 nosplit size=63 args=0x10 locals=0x0 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) TEXT "".Ctz64(SB), NOSPLIT, $0-16 0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35) FUNCDATA $0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB) Observe the additional "nosplit" in the first line and the additional "NOSPLIT" in the second line. Updates #15756 Change-Id: I5c59bd8f3bdc7c780361f801d94a261f0aef3d13 Reviewed-on: https://go-review.googlesource.com/40495 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* plugin: properly handle recursively defined typesTodd Neal2017-04-122-0/+20
| | | | | | | | | | | | | | Prevent a crash if the same type in two plugins had a recursive definition, either by referring to a pointer to itself or a map existing with the type as a value type (which creates a recursive definition through the overflow bucket type). Fixes #19258 Change-Id: Iac1cbda4c5b6e8edd5e6859a4d5da3bad539a9c6 Reviewed-on: https://go-review.googlesource.com/40292 Run-TryBot: Todd Neal <todd@tneal.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* runtime: use hardware divider to improve performanceBen Shi2017-04-114-0/+31
| | | | | | | | | | | | | | | | | | | | | The hardware divider is an optional component of ARMv7. This patch detects whether it is available in runtime and use it or not. 1. The hardware divider is detected at startup and a flag is set/clear according to a perticular bit of runtime.hwcap. 2. Each call of runtime.udiv will check this flag and decide if use the hardware division instruction. A rough test shows the performance improves 40-50% for ARMv7. And the compatibility of ARMv5/v6 is not broken. fixes #19118 Change-Id: Ic586bc9659ebc169553ca2004d2bdb721df823ac Reviewed-on: https://go-review.googlesource.com/37496 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
* cmd/cgo: support floating point #define macrosHiroshi Ioka2017-04-071-10/+7
| | | | | | | | | | | | | | Current code doesn't support floating point #define macros. This CL compiles floats to a object file and retrive values from it. That approach is the same work as we've already done for integers. Updates #18720 Change-Id: I88b7ab174d0f73bda975cf90c5aeb797961fe034 Reviewed-on: https://go-review.googlesource.com/35511 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: make mach-o dwarf segment properly alignedRuss Cox2017-03-301-0/+7
| | | | | | | | | | | | | | | | | | | | | Without this, the load fails during kernel exec, which results in the mysterious and completely uninformative "Killed: 9" error. It appears that the stars (or at least the inputs) were properly aligned with earlier versions of Xcode so that this happened accidentally. Make it happen on purpose. Gregory Man bisected the breakage to this change in LLVM, which fits the theory nicely: https://github.com/llvm-mirror/llvm/commit/9a41e59c Fixes #19734. Change-Id: Ice67a09af2de29d3c0d5e3fcde6a769580897c95 Reviewed-on: https://go-review.googlesource.com/38854 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/testcshared: use the gold linker on android/arm64Elias Naur2017-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The gold linker is used by default in the Android NDK, except on arm64: https://github.com/android-ndk/ndk/issues/148 The Go linker already forces the use of the gold linker on arm and arm64 (CL 22141) for other reasons. However, the test.bash script in testcshared doesn't, resulting in linker errors on android/arm64: warning: liblog.so, needed by ./libgo.so, not found (try using -rpath or -rpath-link) Add -fuse-ld=gold when running testcshared on Android. Fixes the android/arm64 builder. Change-Id: I35ca96f01f136bae72bec56d71b7ca3f344df1ed Reviewed-on: https://go-review.googlesource.com/38832 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* *.bash: always use the same string equality operatorDaniel Martí2017-03-143-12/+12
| | | | | | | | | | | | | POSIX Shell only supports = to compare variables inside '[' tests. But this is Bash, where == is an alias for =. In practice they're the same, but the current form is inconsisnent and breaks POSIX for no good reason. Change-Id: I38fa7a5a90658dc51acc2acd143049e510424ed8 Reviewed-on: https://go-review.googlesource.com/38031 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: print columns (not just lines) in error messagesRobert Griesemer2017-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compiler errors now show the exact line and line byte offset (sometimes called "column") of where an error occured. For `go tool compile x.go`: package p const c int = false //line foo.go:123 type t intg reports x.go:2:7: cannot convert false to type int foo.go:123[x.go:4:8]: undefined: intg (Some errors use the "wrong" position for the error message; arguably the byte offset for the first error should be 15, the position of 'false', rathen than 7, the position of 'c'. But that is an indepedent issue.) The byte offset (column) values are measured in bytes; they start at 1, matching the convention used by editors and IDEs. Positions modified by //line directives show the line offset only for the actual source location (in square brackets), not for the "virtual" file and line number because that code is likely generated and the //line directive only provides line information. Because the new format might break existing tools or scripts, printing of line offsets can be disabled with the new compiler flag -C. We plan to remove this flag eventually. Fixes #10324. Change-Id: I493f5ee6e78457cf7b00025aba6b6e28e50bb740 Reviewed-on: https://go-review.googlesource.com/37970 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* runtime/cgo: return correct sa_flagsBryan C. Mills2017-03-092-1/+85
| | | | | | | | | | | | | | | | | A typo in the previous revision ("act" instead of "oldact") caused us to return the sa_flags from the new (or zeroed) sigaction rather than the old one. In the presence of a signal handler registered before runtime.libpreinit, this caused setsigstack to erroneously zero out important sa_flags (such as SA_SIGINFO) in its attempt to re-register the existing handler with SA_ONSTACK. Change-Id: I3cd5152a38ec0d44ae611f183bc1651d65b8a115 Reviewed-on: https://go-review.googlesource.com/37852 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* runtime: fix _cgo_yield usage with sysmon and on BSDBryan C. Mills2017-03-092-7/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | There are a few problems from change 35494, discovered during testing of change 37852. 1. I was confused about the usage of n.key in the sema variant, so we were looping on the wrong condition. The error was not caught by the TryBots (presumably due to missing TSAN coverage in the BSD and darwin builders?). 2. The sysmon goroutine sometimes skips notetsleep entirely, using direct usleep syscalls instead. In that case, we were not calling _cgo_yield, leading to missed signals under TSAN. 3. Some notetsleep calls have long finite timeouts. They should be broken up into smaller chunks with a yield at the end of each chunk. updates #18717 Change-Id: I91175af5dea3857deebc686f51a8a40f9d690bcc Reviewed-on: https://go-review.googlesource.com/37867 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/testcarchive: add missing headerElias Naur2017-03-091-0/+1
| | | | | | | | | | | | write(2) is defined in unistd.h. For the iOS builder. Change-Id: I411ffe81988d8fbafffde89e4732a20af1a63325 Reviewed-on: https://go-review.googlesource.com/37962 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime: poll libc to deliver signals under TSANBryan C. Mills2017-03-082-0/+34
| | | | | | | | | | fixes #18717 Change-Id: I7244463d2e7489e0b0fe3b74c4b782e71210beb2 Reviewed-on: https://go-review.googlesource.com/35494 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/ios,cmd/go, runtime/cgo: fix iOS test harness (again)Elias Naur2017-03-041-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The iOS test harness was recently changed in response to lldb bugs to replace breakpoints with the SIGUSR2 signal (CL 34926), and to pass the current directory in the test binary arguments (CL 35152). Both the signal sending and working directory setup is done from the go test driver. However, the new method doesn't work with tests where a C program is the test driver instead of go test: the current working directory will not be changed and SIGUSR2 is not raised. Instead of copying that logic into any C test program, rework the test harness (again) to move the setup logic to the early runtime cgo setup code. That way, the harness will run even in the library build modes. Then, use the app Info.plist file to pass the working directory, removing the need to alter the arguments after running. Finally, use the SIGINT signal instead of SIGUSR2 to avoid manipulating the signal masks or handlers. Fixes the testcarchive tests on iOS. With this CL, both darwin/arm and darwin/arm64 passes all.bash. This CL replaces CL 34926, CL 35152 as well as the fixup CL 35123 and CL 35255. They are reverted in CLs earlier in the relation chain. Change-Id: I8485c7db1404fbd8daa261efd1ea89e905121a3e Reviewed-on: https://go-review.googlesource.com/36090 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* Revert "cmd/go, misc: switch from breakpoint to SIGUSR2"Elias Naur2017-03-041-3/+4
| | | | | | | | | | | | This reverts commit 333f764df3d78930a5a3097fc34ac1374b7c3187. Replaced by a improved strategy later in the CL relation chain. Change-Id: I70a1d2f0aa5aa0d3d0ec85b5a956c6fb60d88908 Reviewed-on: https://go-review.googlesource.com/36069 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* Revert "cmd/go, misc: rework cwd handling for iOS tests"Elias Naur2017-03-041-5/+9
| | | | | | | | | | | This reverts commit 593ea3b3606a16da39e38406e22e373eeb944287. Replaced by a improved strategy later in the CL relation chain. Change-Id: I6963e4d1bf38e7028cf545a953e28054d83548 Change-Id: I6963e4d1bf38e7028cf545a953e28054d8354870 Reviewed-on: https://go-review.googlesource.com/36067 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* Revert "all: test adjustments for the iOS builder"Elias Naur2017-03-041-2/+4
| | | | | | | | | | | | This reverts commit 467109bf56fb560d1fd8a27c6184dbfe4f64ffef. Replaced by a improved strategy later in the CL relation chain. Change-Id: Ib90813b5a6c4716b563c8496013d2d57f9c022b8 Reviewed-on: https://go-review.googlesource.com/36066 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/pprof: vendor pprof from github.com/google/pprofRaul Silvera2017-02-241-0/+20
| | | | | | | | | | | | | | | | | | | | Import the github.com/google/pprof and github.com/ianlancetaylor/demangle packages, without modification. Build the golang version of pprof from cmd/pprof/pprof.go by importing the packages from src/cmd/vendot/github.com/google/pprof The versions upstreamed are: github.com/ianlancetaylor/demangle 4883227f66371e02c4948937d3e2be1664d9be38 github.com/google/pprof 7eb5ba977f28f2ad8dd5f6bb82cc9b454e123cdc Update misc/nacl/testzip.proto for new tests. Change-Id: I076584856491353607a3b98b67d0ca6838be50d6 Reviewed-on: https://go-review.googlesource.com/36798 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* runtime: enable/disable SIGPROF if needed when profilingIan Lance Taylor2017-02-093-0/+94
| | | | | | | | | | | | | | | | This ensures that SIGPROF is handled correctly when using runtime/pprof in a c-archive or c-shared library. Separate profiler handling into pre-process changes and per-thread changes. Simplify the Windows code slightly accordingly. Fixes #18220. Change-Id: I5060f7084c91ef0bbe797848978bdc527c312777 Reviewed-on: https://go-review.googlesource.com/34018 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com>
* runtime: handle SIGPIPE in c-archive and c-shared programsElias Naur2017-02-036-1/+146
| | | | | | | | | | | | | | | | | | | | Before this CL, Go programs in c-archive or c-shared buildmodes would not handle SIGPIPE. That leads to surprising behaviour where writes on a closed pipe or socket would raise SIGPIPE and terminate the program. This CL changes the Go runtime to handle SIGPIPE regardless of buildmode. In addition, SIGPIPE from non-Go code is forwarded. This is a refinement of CL 32796 that fixes the case where a non-default handler for SIGPIPE is installed by the host C program. Fixes #17393 Change-Id: Ia41186e52c1ac209d0a594bae9904166ae7df7de Reviewed-on: https://go-review.googlesource.com/35960 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/testshared: remove unused flag.Parse()Daniel Martí2017-02-021-2/+0
| | | | | | | | | | TestMain doesn't make use of any flags. Change-Id: I98ec582fb004045a5067618f605ccfeb1f9f4bbb Reviewed-on: https://go-review.googlesource.com/33613 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/ios: allow exit code 0 to mean test successElias Naur2017-02-021-1/+3
| | | | | | | | | | | | | | | Tests that use TestMain might never call m.Run(), and simply return from TestMain. In that case, the iOS test harness never sees the PASS from the testing framework and assumes the test failed. Allow an exit with exit code 0 to also mean test success, thereby fixing the objdump test on iOS. Change-Id: I1fe9077b05931aa0905e41b88945cd153c5b35b6 Reviewed-on: https://go-review.googlesource.com/36065 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/ios: use the default go test timeoutElias Naur2017-02-011-1/+1
| | | | | | | | | | | | | | | | | | If -test.timeout is not specified to go test, it will time out after a default 10 minutes. The iOS exec wrapper also contains a fail safe timeout mechanism for a stuck device. However, if no explicit -test.timeout is specified, it will use a timeout of 0, plus some constant amount. Use the same default timeout in the exec wrapper as for go test, 10 minutes. Change-Id: I6465ccd9f7b9ce08fa302e6697f7938a0ea9af34 Reviewed-on: https://go-review.googlesource.com/36062 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/ios: include the bundle id in the GOIOS_APP_ID env variableElias Naur2017-02-012-31/+50
| | | | | | | | | | | | | | | | | | | | | | | The iOS exec wrapper use the constant bundle id "golang.gotest" for running Go programs on iOS. However, that only happens to work on the old iOS builders where their provisioning profile covers that bundle id. Expand the detection script to list all available provisioning profiles for the attached device and include the bundle id in the GOIOS_APP_ID environment variable. To allow the old builders to continue, the "golang.gotest" bundle id is used as a fallback if only the app id prefix is specified in GOIOS_APP_ID. For the new builders. Change-Id: I8baa1d4d57f845de851c3fad3f178e05e9a01b17 Reviewed-on: https://go-review.googlesource.com/36060 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/ios: ignore stderr from iOS toolsElias Naur2017-02-011-4/+4
| | | | | | | | | | | | | | | | | On (at least) macOS 10.12, the `security cms` subcommand used by the iOS detection script will output an error to stderr. The command otherwise succeeds, but the extra line confuses a later parsing step. To fix it, use only stdout and ignore stderr from every command run by detect.go. For the new iOS builders. Change-Id: Iee426da7926d7f987ba1be061fa92ebb853ef53d Reviewed-on: https://go-review.googlesource.com/36059 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: reorder modules so main.main comes firstDavid Crawshaw2017-01-252-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Modules appear in the moduledata linked list in the order they are loaded by the dynamic loader, with one exception: the firstmoduledata itself the module that contains the runtime. This is not always the first module (when using -buildmode=shared, it is typically libstd.so, the second module). The order matters for typelinksinit, so we swap the first module with whatever module contains the main function. Updates #18729 This fixes the test case extracted with -linkshared, and now go test -linkshared encoding/... passes. However the original issue about a plugin failure is not yet fixed. Change-Id: I9f399ecc3518e22e6b0a350358e90b0baa44ac96 Reviewed-on: https://go-review.googlesource.com/35644 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/test: pass current environment to syscall.ExecIan Lance Taylor2017-01-201-1/+1
| | | | | | | | | | | This is needed for typical tests with gccgo, as it passes the LD_LIBRARY_PATH environment variable to the new program. Change-Id: I9bf4b0dbdff63f5449c7fcb8124eaeab10ed7f34 Reviewed-on: https://go-review.googlesource.com/35481 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* misc/cgo/test: fix test when using GCC 7Ian Lance Taylor2017-01-201-3/+3
| | | | | | | | | | | | | | | With GCC 7 (not yet released), cgo fails with errors like ./sigaltstack.go:65:8: call of non-function C.restoreSignalStack I do not know precisely why. Explicitly declaring that there are no arguments to the static function is a simple fix for the debug info. Change-Id: Id96e1cb1e55ee37a9f1f5ad243d7ee33e71584ac Reviewed-on: https://go-review.googlesource.com/35480 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime: check for nil g and m in msanreadBryan C. Mills2017-01-192-0/+33
| | | | | | | | | | | fixes #18707. Change-Id: Ibc4efef01197799f66d10bfead22faf8ac00473c Reviewed-on: https://go-review.googlesource.com/35452 Run-TryBot: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* runtime: for plugins, don't add duplicate itabsKeith Randall2017-01-174-1/+62
| | | | | | | | | | | | | | | | We already do this for shared libraries. Do it for plugins also. Suggestions on how to test this would be welcome. I'd like to get this in for 1.8. It could lead to mysterious hangs when using plugins. Fixes #18676 Change-Id: I03209b096149090b9ba171c834c5e59087ed0f92 Reviewed-on: https://go-review.googlesource.com/35117 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
* all: test adjustments for the iOS builderDavid Crawshaw2017-01-141-4/+2
| | | | | | | | | | | | | | | | | | | | The working directory is now adjusted to match the typical Go test working directory in main, as the old trick for adjusting earlier stopped working with the latest version of LLDB bugs. That means the small number of places where testdata files are read before main is called no longer work. This CL adjusts those reads to happen after main is called. (This has the bonus effect of not reading some benchmark testdata files in all.bash.) Fixes compress/bzip2, go/doc, go/parser, os, and time package tests on the iOS builder. Change-Id: If60f026aa7848b37511c36ac5e3985469ec25209 Reviewed-on: https://go-review.googlesource.com/35255 Run-TryBot: David Crawshaw <crawshaw@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go, misc: rework cwd handling for iOS testsDavid Crawshaw2017-01-131-9/+5
| | | | | | | | | | | | | | | | | | | Another change in behvaior (bug) in LLDB. Despite the fact that LLDB can dump the symtab of our test binaries and show the function addresses, it can no longer call the functions. This means the chdir trick on signal is failing. This CL uses a new trick. For iOS, the exec script passes the change in directory as an argument, and it is processed early by the test harness generated by cmd/go. For the iOS builders. Change-Id: I8f5d0f831fe18de99f097761f89c5184d5bf2afb Reviewed-on: https://go-review.googlesource.com/35152 Reviewed-by: Elias Naur <elias.naur@gmail.com> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/testplugin: test that types and itabs are uniqueKeith Randall2017-01-135-2/+105
| | | | | | | | | | | | | Make sure that the same type and itab generated in two different plugins are actually the same thing. See also CL 35115 Change-Id: I0c1ecb039d7e2bf5a601d58dfa162a435ae4ef76 Reviewed-on: https://go-review.googlesource.com/35116 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* cmd/go, misc: switch from breakpoint to SIGUSR2David Crawshaw2017-01-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | The iOS test harness has set a breakpoint early in the life of Go programs so that it can change the current working directory using information only available from the host debugger. Somewhere in the upgrade to iOS 10 / XCode 8.2, breakpoints stopped working. This may be an LLDB bug, or a bug in the ios-deploy LLDB scripts, it's not clear. Work around the problem by giving up on breakpoints. Instead, early in the life of every test binary built for iOS, send (and ignore) a SIGUSR2 signal. The debugger will catch this, giving the script go_darwin_arm_exec a chance to change the working directory. For the iOS builders. Change-Id: I7476531985217d0c76bc176904c48379210576c2 Reviewed-on: https://go-review.googlesource.com/34926 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/testshared: test that types and itabs are uniqueKeith Randall2017-01-125-0/+79
| | | | | | | | | | | Make sure that the same type and itab generated in two different shared library are actually the same thing. Change-Id: Ica45862d65ff8bc7ad04d59a41f57223f71224cd Reviewed-on: https://go-review.googlesource.com/35115 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/test: limit issue18146 attempts based on RLIMIT_NPROCIan Lance Taylor2016-12-211-0/+25
| | | | | | | | | | Fixes #18381. Change-Id: I0a476cd7f6182c8d4646628477c56c133d5671ee Reviewed-on: https://go-review.googlesource.com/34667 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>