summaryrefslogtreecommitdiff
path: root/misc
Commit message (Collapse)AuthorAgeFilesLines
* misc/nacl: include parser.go for cmd/compile/internal/syntax testsdev.gcfeMatthew Dempsky2016-08-161-0/+4
| | | | | | | | | Fix suggested by Minux. Change-Id: Ia7aa8ccccc16535af4ec3ad23830ef0aa5d776ac Reviewed-on: https://go-review.googlesource.com/27193 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Minux Ma <minux@golang.org>
* misc/trace: disable trace resolution warningBrad Fitzpatrick2016-07-211-1/+1
| | | | | | | | | | | | | | | | | It was removed in upstream Chrome https://codereview.chromium.org/2016863004 Rather than update to the latest version, make the minimal change for Go 1.7 and change the "showToUser" boolean from true to false. Tested by hand that it goes away after this change. Updates #16247 Change-Id: I051f49da878e554b1a34a88e9abc70ab50e18780 Reviewed-on: https://go-review.googlesource.com/25117 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: error, not panic, if not enough arguments to functionqeed2016-06-212-0/+13
| | | | | | | | | | | Fixes #16116. Change-Id: Ic3cb0b95382bb683368743bda49b4eb5fdcc35c0 Reviewed-on: https://go-review.googlesource.com/24286 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> 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: use function arg type for _cgoCheckPointerN functionIan Lance Taylor2016-06-092-3/+30
| | | | | | | | | | | | | | When cgo writes a _cgoCheckPointerN function to handle unsafe.Pointer, use the function's argument type rather than interface{}. This permits type errors to be detected at build time rather than run time. Fixes #13830. Change-Id: Ic7090905e16b977e2379670e0f83640dc192b565 Reviewed-on: https://go-review.googlesource.com/23675 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* misc/android: make the exec wrapper exit code parsing more robustElias Naur2016-06-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, the Android exec wrapper expected the trailing exit code output on its own line, like this: PASS exitcode=0 However, some tests can sometimes squeeze in some output after the test harness outputs "PASS" and the newline. The TestWriteHeapDumpFinalizers test is particularly prone to this, since its finalizers println to standard out. When it happens, the output looks like this: PASS finalizedexitcode=0 Two recent failures caused by this race: https://build.golang.org/log/185605e1b936142c22350eef22d20e982be53c29 https://build.golang.org/log/e61cf6a050551d10360bd90be3c5f58c3eb07605 Since the "exitcode=" string is always echoed after the test output, the fix is simple: instead of looking for the last newline in the output, look for the last exitcode string instead. Change-Id: Icd6e53855eeba60b982ad3108289d92549328b86 Reviewed-on: https://go-review.googlesource.com/23750 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
* misc/cgo/testsanitizers: don't run some TSAN tests on GCC < 7Ian Lance Taylor2016-06-081-4/+21
| | | | | | | | | | | | | | Before GCC 7 defined __SANITIZE_THREAD__ when using TSAN, runtime/cgo/libcgo.h could not determine reliably whether TSAN was in use when using GCC. Fixes #15983. Change-Id: I5581c9f88e1cde1974c280008b2230fe5e971f44 Reviewed-on: https://go-review.googlesource.com/23833 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
* cmd/cgo: check pointers for deferred C calls at the right timeIan Lance Taylor2016-06-031-0/+8
| | | | | | | | | | | | | We used to check time at the point of the defer statement. This change fixes cgo to check them when the deferred function is executed. Fixes #15921. Change-Id: I72a10e26373cad6ad092773e9ebec4add29b9561 Reviewed-on: https://go-review.googlesource.com/23650 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* runtime/cgo: add TSAN locks around mmap callIan Lance Taylor2016-06-032-44/+67
| | | | | | | | Change-Id: I806cc5523b7b5e3278d01074bc89900d78700e0c Reviewed-on: https://go-review.googlesource.com/23736 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
* cmd/internal/obj, runtime: fixes for defer in 386 shared librariesMichael Hudson-Doyle2016-06-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | Any defer in a shared object crashed when GOARCH=386. This turns out to be two bugs: 1) Calls to morestack were not processed to be PIC safe (must have been possible to trigger this another way too) 2) jmpdefer needs to rewind the return address of the deferred function past the instructions that load the GOT pointer into BX, not just past the call Bug 2) requires re-introducing the a way for .s files to know when they are being compiled for dynamic linking but I've tried to do that in as minimal a way as possible. Fixes #15916 Change-Id: Ia0d09b69ec272a176934176b8eaef5f3bfcacf04 Reviewed-on: https://go-review.googlesource.com/23623 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/cgo/test: fix issue9400 test on android/386Elias Naur2016-06-021-2/+3
| | | | | | | | | | | | | | | | | | | The test for #9400 relies on an assembler function that manipulates the stack pointer. Meanwile, it uses a global variable for synchronization. However, position independent code on 386 use a function call to fetch the base address for global variables. That function call in turn overwrites the Go stack. Fix that by fetching the global variable address once before the stack register manipulation. Fixes the android/386 builder. Change-Id: Ib77bd80affaa12f09d582d09d8b84a73bd021b60 Reviewed-on: https://go-review.googlesource.com/23683 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* misc/cgo/test,cmd/dist: enable (more) Cgo tests on iOSElias Naur2016-06-022-1/+5
| | | | | | | | | | For #15919 Change-Id: I9fc38d9c8a9cc9406b551315e1599750fe212d0d Reviewed-on: https://go-review.googlesource.com/23635 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: do not generate tail calls when dynamic linking on ppc64leMichael Hudson-Doyle2016-06-022-1/+6
| | | | | | | | | | | | | | | When a wrapper method calls the real implementation, it's not possible to use a tail call when dynamic linking on ppc64le. The bad scenario is when a local call is made to the wrapper: the wrapper will call the implementation, which might be in a different module and so set the TOC to the appropriate value for that module. But if it returns directly to the wrapper's caller, nothing will reset it to the correct value for that function. Change-Id: Icebf24c9a2a0a9a7c2bce6bd6f1358657284fb10 Reviewed-on: https://go-review.googlesource.com/23468 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/test,cmd/dist: enable (most) Cgo tests on AndroidElias Naur2016-06-017-1/+25
| | | | | | | | | | | | | Some tests cannot build for Android; use build tags and stubs to skip them. For #15919 Change-Id: Ieedcb73d4cabe23c3775cfb1d44c1276982dccd9 Reviewed-on: https://go-review.googlesource.com/23634 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* runtime/cgo: add TSAN acquire/release callsIan Lance Taylor2016-05-312-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | Add TSAN acquire/release calls to runtime/cgo to match the ones generated by cgo. This avoids a false positive race around the malloc memory used in runtime/cgo when other goroutines are simultaneously calling malloc and free from cgo. These new calls will only be used when building with CGO_CFLAGS and CGO_LDFLAGS set to -fsanitize=thread, which becomes a requirement to avoid all false positives when using TSAN. These are needed not just for runtime/cgo, but also for any runtime package that uses cgo (such as net and os/user). Add an unused attribute to the _cgo_tsan_acquire and _cgo_tsan_release functions, in case there are no actual cgo function calls. Add a test that checks that setting CGO_CFLAGS/CGO_LDFLAGS avoids a false positive report when using os/user. Change-Id: I0905c644ff7f003b6718aac782393fa219514c48 Reviewed-on: https://go-review.googlesource.com/23492 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
* cmd/cgo: remove -O options when generating compiler errorsIan Lance Taylor2016-05-272-0/+30
| | | | | | | | | | | | | | The cgo tool generates compiler errors to find out what kind of name it is using. Turning on optimization can confuse that process by producing new unexpected messages. Fixes #14669. Change-Id: Idc8e35fd259711ecc9638566b691c11d17140325 Reviewed-on: https://go-review.googlesource.com/23231 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* cmd/cgo, runtime, runtime/cgo: TSAN support for mallocIan Lance Taylor2016-05-252-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | Acquire and release the TSAN synchronization point when calling malloc, just as we do when calling any other C function. If we don't do this, TSAN will report false positive errors about races calling malloc and free. We used to have a special code path for malloc and free, going through the runtime functions cmalloc and cfree. The special code path for cfree was no longer used even before this CL. This CL stops using the special code path for malloc, because there is no place along that path where we could conditionally insert the TSAN synchronization. This CL removes the support for the special code path for both functions. Instead, cgo now automatically generates the malloc function as though it were referenced as C.malloc. We need to automatically generate it even if C.malloc is not called, even if malloc and size_t are not declared, to support cgo-provided functions like C.CString. Change-Id: I829854ec0787a80f33fa0a8a0dc2ee1d617830e2 Reviewed-on: https://go-review.googlesource.com/23260 Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* cmd/cgo: mark stub functions as no_sanitize_threadIan Lance Taylor2016-05-192-0/+50
| | | | | | | | | | | | | | | | | | | | | When the generated stub functions write back the results to the stack, they can in some cases be writing to the same memory on the g0 stack. There is no race here (assuming there is no race in the Go code), but the thread sanitizer does not know that. Turn off the thread sanitizer for the stub functions to prevent false positive warnings. Current clang suggests the no_sanitize("thread") attribute, but that does not work with clang 3.6 or GCC. clang 3.6, GCC, and current clang all support the no_sanitize_thread attribute, so use that unconditionally. The test case and first version of the patch are from Dmitriy Vyukov. Change-Id: I80ce92824c6c8cf88ea0fe44f21cf50cf62474c9 Reviewed-on: https://go-review.googlesource.com/23252 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: check only up to ptrdata bytes for pointersIan Lance Taylor2016-05-181-0/+24
| | | | | | | | | | Fixes #14508. Change-Id: I237d0c5a79a73e6c97bdb2077d8ede613128b978 Reviewed-on: https://go-review.googlesource.com/23224 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* cmd/vendor: move cmd/internal/unvendor packages to cmd/vendorKonstantin Shaposhnikov2016-05-141-12/+12
| | | | | | | | | | Updates #14047 Change-Id: I4b150533393bfb90e840497095ac32bcca4f04c2 Reviewed-on: https://go-review.googlesource.com/23114 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: add -shared to darwin/arm{,64} default build modeElias Naur2016-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | Buildmode c-archive now supports position independent code for darwin/arm (in addition to darwin/arm64). Make PIC (-shared) the default for both platforms in the default buildmode. Without this change, gomobile will go install the standard library into its separate package directory without PIC support. Also add -shared to darwin/arm64 in buildmode c-archive, for symmetry (darwin/arm64 always generates position independent code). Fixes #15519 Change-Id: If27d2cbea8f40982e14df25da2703cbba572b5c6 Reviewed-on: https://go-review.googlesource.com/22920 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/testcarchive: avoid possible pthread_create raceIan Lance Taylor2016-05-061-8/+8
| | | | | | | | | | | | | | The old code assumed that the thread ID set by pthread_create would be available in the newly created thread. While that is clearly true eventually, it is not necessarily true immediately. Rather than try to pass down the thread ID, just call pthread_self in the created thread. Fixes #15576 (I hope). Change-Id: Ic07086b00e4fd5676c04719a299c583320da64a1 Reviewed-on: https://go-review.googlesource.com/22880 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* misc/cgo/testcarchive: don't force -no_pie on DarwinElias Naur2016-05-061-2/+0
| | | | | | | | | | | | Now that darwin/arm supports position independent code, allow the binaries generated by the c-archive tests be position independent (PIE) as well. Change-Id: If0517f06e92349ada29a4e3e0a951f08b0fcc710 Reviewed-on: https://go-review.googlesource.com/22841 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/test: add mips64x test case for issue9400Cherry Zhang2016-05-041-0/+33
| | | | | | Change-Id: If2b4abb6ff322c20e35de025298c8e5ab53edd42 Reviewed-on: https://go-review.googlesource.com/19808 Reviewed-by: Minux Ma <minux@golang.org>
* misc/cgo/fortran: fix gfortran compile testMartin Möhrmann2016-05-041-0/+16
| | | | | | | | | Fixes #14544 Change-Id: I58b0b164ebbfeafe4ab32039a063df53e3018a6d Reviewed-on: https://go-review.googlesource.com/22730 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Sean Lake <odysseus9672@gmail.com>
* cmd/link: always read type data for dynimport symbolsMichael Hudson-Doyle2016-05-049-43/+88
| | | | | | | | | | | | | | | | | | | | | | | | | Consider three shared libraries: libBase.so -- defines a type T lib2.so -- references type T lib3.so -- also references type T, and something from lib2 lib2.so will contain a type symbol for T in its symbol table, but no definition. If, when linking lib3.so the linker reads the symbols from lib2.so before libBase.so, the linker didn't read the type data and later crashed. The fix is trivial but the test change is a bit messy because the order the linker reads the shared libraries in ends up depending on the order of the import statements in the file so I had to rename one of the test packages so that gofmt doesn't fix the test by accident... Fixes #15516 Change-Id: I124b058f782c900a3a54c15ed66a0d91d0cde5ce Reviewed-on: https://go-review.googlesource.com/22744 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: make copyright headers consistent with one space after periodEmmanuel Odeke2016-05-02145-145/+145
| | | | | | | | | | | | | | | | | | Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 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, misc/cgo/test: make -Wdeclaration-after-statement cleanIan Lance Taylor2016-05-022-2/+3
| | | | | | | | | | | | | | | | I got a complaint that cgo output triggers warnings with -Wdeclaration-after-statement. I don't think it's worth testing for this--C has permitted declarations after statements since C99--but it is easy enough to fix. It may break again; so it goes. This CL also fixes errno handling to avoid getting confused if the tsan functions happen to change the global errno variable. Change-Id: I0ec7c63a6be5653ef44799d134c8d27cb5efa441 Reviewed-on: https://go-review.googlesource.com/22686 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/testcarchive: fix C include path for darwin/armCherry Zhang2016-04-291-6/+7
| | | | | | | | | | | | | | After CL 22461, c-archive build on darwin/arm is by default compiled with -shared and installed in pkg/darwin_arm_shared. Fix build (2nd time...) Change-Id: Ia2bb09bb6e1ebc9bc74f7570dd80c81d05eaf744 Reviewed-on: https://go-review.googlesource.com/22534 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/testcarchive: fix path of libgo.a for darwin/armCherry Zhang2016-04-271-1/+5
| | | | | | | | | | | | | After CL 22461, c-archive build on darwin/arm is by default compiled with -shared, so update the install path. Fix build. Change-Id: Ie93dbd226ed416b834da0234210f4b98bc0e3606 Reviewed-on: https://go-review.googlesource.com/22507 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: use gold when dynamic linking on arm64David Crawshaw2016-04-181-5/+5
| | | | | | | | | | | | | | | The GNU linker follows the letter of -znocopyreloc by refusing to generate COPY relocations on arm64. Unfortunately it generates an error instead of finding another way. The gold linker works, so switch to it. Fixes linux/arm64 build. Change-Id: I1f7119d999c8f9f1f2d0c1e06b6462cea9c02a71 Reviewed-on: https://go-review.googlesource.com/22185 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime: don't always unblock all signals on dragonfly, freebsd and openbsdMikio Hara2016-04-154-6/+10
| | | | | | | | | | | | | | | | https://golang.org/cl/10173 intrduced msigsave, ensureSigM and _SigUnblock but didn't enable the new signal save/restore mechanism for SIG{HUP,INT,QUIT,ABRT,TERM} on DragonFly BSD, FreeBSD and OpenBSD. At present, it looks like they have the implementation. This change enables the new mechanism on DragonFly BSD, FreeBSD and OpenBSD the same as Darwin, NetBSD. Change-Id: Ifb4b4743b3b4f50bfcdc7cf1fe1b59c377fa2a41 Reviewed-on: https://go-review.googlesource.com/18657 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/trace: update trace viewer htmlDmitry Vyukov2016-04-142-2467/+6186
| | | | | | | | | | | | | | | | | | | The old trace-viewer is broken since Chrome 49: https://bugs.chromium.org/p/chromium/issues/detail?id=569417 It was fixed in: https://github.com/catapult-project/catapult/commit/506457cbd726324f327b80ae11f46c1dfeb8710d This change updates trace-viewer to the latest version (now it is called catapult). This version has a bug in the lean config that we use, though: https://github.com/catapult-project/catapult/issues/2247 So use full config for now (it works, but leads to larger html). When the bug is fixed we need to switch back to lean config (issue #15302). Change-Id: Ifb8d782ced66e3292d81c5604039fe18eaf267c5 Reviewed-on: https://go-review.googlesource.com/22013 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* internal/trace: support parsing of 1.5 tracesDmitry Vyukov2016-04-111-0/+4
| | | | | | | | | | | | | | | 1. Parse out version from trace header. 2. Restore handling of 1.5 traces. 3. Restore optional symbolization of traces. 4. Add some canned 1.5 traces for regression testing (http benchmark trace, runtime/trace stress traces, plus one with broken timestamps). Change-Id: Idb18a001d03ded8e13c2730eeeb37c5836e31256 Reviewed-on: https://go-review.googlesource.com/21803 Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* runtime: revert "do not call timeBeginPeriod on windows"Dmitry Vyukov2016-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | This reverts commit ab4c9298b8185a056ff1152f2c7bd9b38d3d06f3. Sysmon critically depends on system timer resolution for retaking of Ps blocked in system calls. See #14790 for an example of a program where execution time goes from 2ms to 30ms if timeBeginPeriod(1) is not used. We can remove timeBeginPeriod(1) when we support UMS (#7876). Update #14790 Change-Id: I362b56154359b2c52d47f9f2468fe012b481cf6d Reviewed-on: https://go-review.googlesource.com/20834 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* cmd/go: fix -buildmode=c-archive should work on windowsChristopher Nelson2016-04-041-4/+3
| | | | | | | | | | | | | | | | | | Add supporting code for runtime initialization, including both 32- and 64-bit x86 architectures. Add .ctors section on Windows to PE .o files, and INITENTRY to .ctors section to plug in to the GCC C/C++ startup initialization mechanism. This allows the Go runtime to initialize itself. Add .text section symbol for .ctor relocations. Note: This is unlikely to be useful for MSVC-based toolchains. Fixes #13494 Change-Id: I4286a96f70e5f5228acae88eef46e2bed95813f3 Reviewed-on: https://go-review.googlesource.com/18057 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
* all: fix spelling mistakesEric Engestrom2016-04-032-2/+2
| | | | | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Change-Id: I91873aaebf79bdf1c00d38aacc1a1fb8d79656a7 Reviewed-on: https://go-review.googlesource.com/21433 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/testcarchive: more robust TestSignalForwardingExternalIan Lance Taylor2016-03-263-32/+74
| | | | | | | | | | | | | Try to avoid a race condition in the test. Passed 500 times on my laptop. Fixes #14956. Change-Id: I5de2e1e3623832f0ab4f180149f7c57ce7cd23c0 Reviewed-on: https://go-review.googlesource.com/21171 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* misc/cgo/testcarchive: split main.c into unix and non-unixChristopher Nelson2016-03-264-47/+97
| | | | | | | | | | | | | | | This is in support of https://golang.org/cl/18057 which adds support for c-archive to the Windows platform. The signal handling tests do not compile on Windows. This splits them out into a separate main_unix.c file, and conditionally includes them for non-Windows platforms. Change-Id: Ic79ce83da7656d6703505e514554748a482b81a1 Reviewed-on: https://go-review.googlesource.com/21086 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/ios: fix exec wrapper lockingElias Naur2016-03-251-1/+6
| | | | | | | | | | | | | | | | | The exec wrapper lock file was opened, locked and then never used again, assuming it would close and unlock at process exit. However, the garbage collector could collect and run the *os.File finalizer that closes the file prematurely, rendering the lock ineffective. Make the lock global so that the lock is live during the entire execution. (Hopefully) fix the iOS builders. Change-Id: I62429e92042a0a49c4f1ea553fdb32b6ea53a43e Reviewed-on: https://go-review.googlesource.com/21137 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* misc/cgo/testcarchive: fix buildElias Naur2016-03-251-6/+6
| | | | | | | | | | | | | | | | | | I failed to rebase (and re-test) CL 21102 before submit, which meant that two extra tests sneaked into testcarchive that still referenced runtime.GOOS and runtime.GOARCH. Convert the new tests. While we're here, make sure pending tasks are flushed before running the host tests. If not, the "##### misc/cgo/testcarchive" banner and "PASS" won't show up in the all.bash output. Change-Id: I41fc4ec9515f9a193fa052f7c31fac452153c897 Reviewed-on: https://go-review.googlesource.com/21106 Run-TryBot: Elias Naur <elias.naur@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/testcarchive: re-enable c-archive test on iOS and AndroidElias Naur2016-03-241-26/+29
| | | | | | | | | | | | | | | | | | The c-archive test were recently converted from shell script to Go. Unfortunately, it also lost the ability to target iOS and Android that lack C compilers and require exec wrappers. Compile the c-archive test for the host and run it with the target GOOS/GOARCH environment. Change the test to rely on go env GOOS and go env GOARCH instead of runtime.GOOS and runtime.GOARCH. Fixes #8345 Change-Id: I290ace2f7e96b87c55d99492feb7d660140dcb32 Reviewed-on: https://go-review.googlesource.com/21102 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: improve last ditch signal forwarding for Unix librariesJoe Sylve2016-03-242-0/+186
| | | | | | | | | | | | | | | | | | | The current runtime attempts to forward signals generated by non-Go code to the original signal handler. If it can't call the original handler directly, it currently attempts to re-raise the signal after resetting the handler. In this case, the original context is lost. This fix prevents that problem by simply returning from the go signal handler after resetting the original handler. It only does this when the original handler is the system default handler, which in all cases is known to not recover. The signal is not reset, so it is retriggered and the original handler takes over with the proper context. Fixes #14899 Change-Id: Ib1c19dfa4b50d9732d7a453de3784c8141e1cbb3 Reviewed-on: https://go-review.googlesource.com/21006 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/ios: serialize iOS executionElias Naur2016-03-241-0/+15
| | | | | | | | | | | | | | | | | The iOS exec wrapper use complicated machinery to run a iOS binary on a device. Running several binaries concurrently doesn't work (reliably), which can break tests running concurrently. For my setup, the runtime:cpu124 and sync_cpu tests can't run reliably without one of them crashing. Add a file lock to the exec wrapper to serialize execution. Fixes #14318 (for me) Change-Id: I023610e014b327f8d66f1d2fd2e54dd0e56f2be0 Reviewed-on: https://go-review.googlesource.com/21074 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* misc/ios: deflake tests on darwin/arm{,arm64}Elias Naur2016-03-241-5/+18
| | | | | | | | | | | | | | | | | | | | | | | A retry mechanism is in place to combat the inherent flakiness of launching iOS test binaries. Before it covered just the starting of lldb; expand it to cover the setup steps as well. Note that the running of the binary itself is (still) not retried, to avoid covering over genuine bugs. On my test device (iPhone 5S, iOS 9.3) starting lldb can take longer than 10 seconds, so increase the timeout for that. Furthermore, some basic steps such as setting breakpoints in lldb can take longer than the 1 second timeout. Increase that timeout as well, to 2 seconds. Finally, improve the error message for when ios-deploy is not installed. For #14318 Change-Id: Iba41d1bd9d023575b9454cb577b08f8cae081c2a Reviewed-on: https://go-review.googlesource.com/21072 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* misc/ios: pass through SIGCONT in the exec wrapperElias Naur2016-03-241-0/+1
| | | | | | | | | | | Instruct lldb to pass through SIGCONT unhindered when running iOS tests. Fixes the TestSIGCONT test in os/signal. For #14318 Change-Id: I669264208cc3d6ecae9fbc8790e0b753a93a5e04 Reviewed-on: https://go-review.googlesource.com/21071 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* misc/cgo/testcarchive: rewrite test from bash to GoIan Lance Taylor2016-03-232-106/+334
| | | | | | | | | | | | | | This is to support https://golang.org/cl/18057, which is going to add Windows support to this directory. Better to write the test in Go then to have both test.bash and test.bat. Update #13494. Change-Id: I4af7004416309e885049ee60b9470926282f210d Reviewed-on: https://go-review.googlesource.com/20892 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: add RewindAndSetgid implementation for s390xMichael Munday2016-03-221-0/+26
| | | | | | | | | | Required to pass the issue9400 test. Change-Id: I595223c403b12faade54e2e46510f8537150af39 Reviewed-on: https://go-review.googlesource.com/20940 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: do not add duplicate symbols to AllsymMichael Hudson-Doyle2016-03-171-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | When building shared libraries, all symbols on Allsym are marked reachable. What I didn't realize was that this includes the ".dup" symbols created when "dupok" symbols are read from multiple package files. This breaks now because deadcode makes some assumptions that fail for these ".dup" symbols, but in any case was a bad idea -- I suspect this change makes libstd.so a bunch smaller, but creating it was broken before this CL so I can't be sure. This change simply stops adding these symbols to Allsym, which might make some of the many iterations over Allsym the linker does a touch quicker, although that's not the motivation here. Add a test that no symbols called ".dup" makes it into the runtime shared library. Fixes #14841 Change-Id: I65dd6e88d150a770db2d01b75cfe5db5fd4f8d25 Reviewed-on: https://go-review.googlesource.com/20780 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/cgo: add C.CBytesJames Bardin2016-03-162-0/+38
| | | | | | | | | | | | Add a C.CBytes function to copy a Go byte slice into C memory. This returns an unsafe.Pointer, since that is what needs to be passed to C.free, and the data is often opaque bytes anyway. Fixes #14838 Change-Id: Ic7bc29637eb6f1f5ee409b3898c702a59833a85a Reviewed-on: https://go-review.googlesource.com/20762 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* compress/flate: optimize huffman bit encoderKlaus Post2016-03-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part 1 of optimizing the deflater. This optimizes the bitwriter by: * Removing allocations. * Storing compound values for bit codes instead of 2 separate tables. * Accumulate 48 bits between writes instead of 24. * Inline bit flushing. This also contains code that will be used in later CL's (writeBlockDynamic, writeBlockHuff). Tests for Huffman bit writer encoding regressions has been added. name old speed new speed delta EncodeDigitsSpeed1e4-4 19.3MB/s ± 1% 21.6MB/s ± 1% +11.77% EncodeDigitsSpeed1e5-4 25.0MB/s ± 6% 30.7MB/s ± 1% +22.70% EncodeDigitsSpeed1e6-4 28.2MB/s ± 1% 32.3MB/s ± 1% +14.64% EncodeDigitsDefault1e4-4 13.3MB/s ± 0% 14.2MB/s ± 1% +7.07% EncodeDigitsDefault1e5-4 6.43MB/s ± 1% 6.64MB/s ± 1% +3.27% EncodeDigitsDefault1e6-4 5.81MB/s ± 0% 5.85MB/s ± 1% +0.69% EncodeDigitsCompress1e4-4 13.2MB/s ± 0% 14.4MB/s ± 0% +9.10% EncodeDigitsCompress1e5-4 6.40MB/s ± 1% 6.61MB/s ± 0% +3.20% EncodeDigitsCompress1e6-4 5.80MB/s ± 1% 5.90MB/s ± 1% +1.64% EncodeTwainSpeed1e4-4 18.4MB/s ± 1% 20.7MB/s ± 1% +12.72% EncodeTwainSpeed1e5-4 27.7MB/s ± 1% 31.0MB/s ± 1% +11.78% EncodeTwainSpeed1e6-4 29.1MB/s ± 0% 32.9MB/s ± 2% +13.25% EncodeTwainDefault1e4-4 12.4MB/s ± 0% 13.1MB/s ± 1% +5.88% EncodeTwainDefault1e5-4 7.52MB/s ± 1% 7.83MB/s ± 0% +4.19% EncodeTwainDefault1e6-4 7.08MB/s ± 1% 7.26MB/s ± 0% +2.54% EncodeTwainCompress1e4-4 12.0MB/s ± 1% 12.8MB/s ± 1% +6.70% EncodeTwainCompress1e5-4 5.96MB/s ± 1% 6.16MB/s ± 0% +3.27% EncodeTwainCompress1e6-4 5.37MB/s ± 0% 5.39MB/s ± 1% +0.47% >Allocations: benchmark old allocs new allocs delta BenchmarkEncodeDigitsSpeed1e4-4 50 0 -100.00% BenchmarkEncodeDigitsSpeed1e5-4 110 0 -100.00% BenchmarkEncodeDigitsSpeed1e6-4 1032 0 -100.00% BenchmarkEncodeDigitsDefault1e4-4 56 0 -100.00% BenchmarkEncodeDigitsDefault1e5-4 120 0 -100.00% BenchmarkEncodeDigitsDefault1e6-4 966 0 -100.00% BenchmarkEncodeDigitsCompress1e4-4 56 0 -100.00% BenchmarkEncodeDigitsCompress1e5-4 120 0 -100.00% BenchmarkEncodeDigitsCompress1e6-4 966 0 -100.00% BenchmarkEncodeTwainSpeed1e4-4 58 0 -100.00% BenchmarkEncodeTwainSpeed1e5-4 132 0 -100.00% BenchmarkEncodeTwainSpeed1e6-4 1082 0 -100.00% BenchmarkEncodeTwainDefault1e4-4 52 0 -100.00% BenchmarkEncodeTwainDefault1e5-4 126 0 -100.00% BenchmarkEncodeTwainDefault1e6-4 886 0 -100.00% BenchmarkEncodeTwainCompress1e4-4 52 0 -100.00% BenchmarkEncodeTwainCompress1e5-4 120 0 -100.00% BenchmarkEncodeTwainCompress1e6-4 880 0 -100.00% benchmark old bytes new bytes delta BenchmarkEncodeDigitsSpeed1e4-4 4288 2 -99.95% BenchmarkEncodeDigitsSpeed1e5-4 8896 15 -99.83% BenchmarkEncodeDigitsSpeed1e6-4 84098 153 -99.82% BenchmarkEncodeDigitsDefault1e4-4 4480 3 -99.93% BenchmarkEncodeDigitsDefault1e5-4 9216 76 -99.18% BenchmarkEncodeDigitsDefault1e6-4 73920 768 -98.96% BenchmarkEncodeDigitsCompress1e4-4 4480 3 -99.93% BenchmarkEncodeDigitsCompress1e5-4 9216 76 -99.18% BenchmarkEncodeDigitsCompress1e6-4 73920 768 -98.96% BenchmarkEncodeTwainSpeed1e4-4 4544 2 -99.96% BenchmarkEncodeTwainSpeed1e5-4 9600 15 -99.84% BenchmarkEncodeTwainSpeed1e6-4 77633 153 -99.80% BenchmarkEncodeTwainDefault1e4-4 4352 3 -99.93% BenchmarkEncodeTwainDefault1e5-4 9408 76 -99.19% BenchmarkEncodeTwainDefault1e6-4 65984 768 -98.84% BenchmarkEncodeTwainCompress1e4-4 4352 3 -99.93% BenchmarkEncodeTwainCompress1e5-4 9216 76 -99.18% BenchmarkEncodeTwainCompress1e6-4 65792 768 -98.83% Updates #14258 Change-Id: Ibaa97b9619743ad623094727228eb2ada1ec7f1f Reviewed-on: https://go-review.googlesource.com/19336 Reviewed-by: Nigel Tao <nigeltao@golang.org> Reviewed-by: Joe Tsai <joetsai@digital-static.net> Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org>