Commit graph

1046 commits

Author SHA1 Message Date
Rob Pike d0652e7f82 cmd/doc: add test
Refactor main a bit to make it possible to run tests without an exec every time.
(Makes a huge difference in run time.)

Add a silver test. Not quite golden, since it looks for pieces rather than the
full output, and also includes tests for what should not appear.

Fixes #10920.

Change-Id: I6a4951cc14e61763379754a10b0cc3484d30c267
Reviewed-on: https://go-review.googlesource.com/11272
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
2015-06-19 21:56:59 +00:00
Srdjan Petrovic cc6554f750 cmd/link/internal/ld, cmd/go: -buildmode=c-shared support for darwin/amd64
All of the heavy-lifting was done by minux@, with his external-linking support
for darwin/arm64: golang.org/cl/8781

Change-Id: I7c9fbc19246f418c065c92fb2c13c00026ff0f82
Reviewed-on: https://go-review.googlesource.com/11127
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 20:28:01 +00:00
Alex Brainman 9d968cb47b runtime: rename cgocall_errno and asmcgocall_errno into cgocall and asmcgocall
Change-Id: I5917bea8bb35b0e725dcc56a68f3a70137cfc180
Reviewed-on: https://go-review.googlesource.com/9387
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 01:47:11 +00:00
Ian Lance Taylor a2aaede366 misc/cgo/testshared: make sure rebuilds occur as expected
Adjust timestamps in TestABIChecking to make sure that the library and
executable are rebuilt when expected.

Change-Id: I3288c254ba8201b5b4255347b0cb056fa0908657
Reviewed-on: https://go-review.googlesource.com/11128
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Yves Junqueira <yves.junqueira@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-17 14:55:39 +00:00
Alex Brainman 6428a8b437 cmd/dist: add new misc/cgo/testsovar test
This change reintroduces CL 8523. CL 8523 was reverted because
it broke darwin and netbsd builds. Now that this test is part
of "go tool dist test" command we could skip OSes that fail.

Updates #10360

Change-Id: Iaaeb5b800126492f36415a439c333a218fe4ab67
Reviewed-on: https://go-review.googlesource.com/11119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-17 02:33:40 +00:00
Michael Hudson-Doyle a5f57d7950 cmd/link: when reading symbols from a shared library, allow duplicates when they are both in bss
This makes the behaviour match what happens when duplicate symbols are read
from regular object files and fixes errors about cgoAlwaysFalse when linking
an executable that uses cgo against a shared library.

Change-Id: Ibb8cd8fe3f7813cde504b7483f1e857868d7e063
Reviewed-on: https://go-review.googlesource.com/11117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 22:33:36 +00:00
Michael Hudson-Doyle 12b05bf8fd cmd/go: support -buildmode=shared with gccgo
Change-Id: Id93b8ab42fa311ce32209734ec9a0813f8736e25
Reviewed-on: https://go-review.googlesource.com/9914
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-06-16 01:43:29 +00:00
Russ Cox 2c2770c3d4 cmd/cgo: make sure pointers passed to C escape to heap
Fixes #10303.

Change-Id: Ia68d3566ba3ebeea6e18e388446bd9b8c431e156
Reviewed-on: https://go-review.googlesource.com/10814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 17:39:53 +00:00
Dmitry Vyukov 9a8750b276 misc/trace: update trace viewer
Update to tip to fix #11003 (not possible to select events in chromium).
Fixed #11003

Change-Id: Ibba5d39ca809cfd5cb79c9e6d152b00899d49e08
Reviewed-on: https://go-review.googlesource.com/11062
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 20:58:23 +00:00
Alex Brainman 202ef487fe cmd/dist: convert testso test into Go
I would like to re-apply reverted http://golang.org/cl/8523.
Reverted tests still fail in some environments (see issue #10360).
It is easier to run tests selectively when in Go.
This CL prepares for the changes.

Updates #10360

Change-Id: Iefeb1d71cb3d1cfa653a6ccd9f6e35686c0c5b24
Reviewed-on: https://go-review.googlesource.com/10608
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-12 04:33:50 +00:00
Burcu Dogan 032811e2ab misc/ios: document the external binary and the required env variables
Change-Id: I1ec2460758b19e5315be061033c1bb5ed9ead4a8
Reviewed-on: https://go-review.googlesource.com/9688
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-09 22:09:52 +00:00
Russ Cox 7e27625e25 cmd/go, cmd/link: use "Go" not "GO" as ELF note identifier
Change-Id: I038e892725836ab7718f7638e8ad5712953f2cb5
Reviewed-on: https://go-review.googlesource.com/10704
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 03:59:46 +00:00
Michael Hudson-Doyle c949cff6a7 cmd/internal/ld: do not depend on local symbols to read a type's gcdata
We already read the address of a gcmask/gcprog out of the type data, but I
didn't know how many bytes to read. But it turns out that it's easy to
calculate, so change to do that. This means that we no longer depend on the
local symbols being present, allowing me to strip the shared libraries for
distribution and make them a lot smaller.

As a bonus, this makes LSym another 24 bytes smaller, down to 296 bytes now.

Change-Id: I379d359e28d63afae6753efd23efdf1fbb716992
Reviewed-on: https://go-review.googlesource.com/10377
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-27 14:11:16 +00:00
Michael Hudson-Doyle bcc1870fcf cmd/internal/ld: store the libraries a shared library was linked against in a note
The motivation for this is the innocuous looking test case that is added. This
creates a stack exe -> libdep2.so -> libdep.so -> libruntime.so. The problem
comes from the fact that a function from libdep.so gets inlined all the way
into exe. This (unsurprisingly) means that the object file for exe references
symbols from libdep.so, which means that -ldep needs to be passed when linking
exe and it isn't. The fix is simply to pass it -- there is no harm in passing
it when it's not needed.

The thing is, it's not clear at all in the current code to see how the linker
can know that libdep2 is linked against libdep. It could look through the
DT_NEEDED entries in libdep2 and try to guess which are Go libraries, but it
feels better to be explicit. So this adds another SHT_NOTE section that lists
the shared libraries a shared library was linked against, and makes sure the
complete set of depended upon shared libraries is passed to the external
linker.

Change-Id: I79aa6f98b4db4721d657a7eb7b7f062269bf49e2
Reviewed-on: https://go-review.googlesource.com/10376
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-27 13:25:32 +00:00
Michael Hudson-Doyle 65518032b9 cmd/link/internal/ld: put abi hash into a note
This makes for a more stable API for tools (including cmd/link itself) to
extract the abi hash from a shared library and makes it possible at all for a
library that has had the local symbol table removed.

The existing note-writing code only supports writing notes into the very start
of the object file so they are easy to find in core dumps. This doesn't apply
to the "go" notes and means that all notes have to fit into a fixed size
budget. That's annoying now we have more notes (and the next CL will add
another one) so this does a little bit of work to make adding notes that do not
have to go at the start of the file easier and moves the writing of the package
list note over to that mechanism, which lets me revert a hack that increased
the size budget mentioned above for -buildmode=shared builds.

Change-Id: I6077a68d395c8a2bc43dec8506e73c71ef77d9b9
Reviewed-on: https://go-review.googlesource.com/10375
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-27 04:48:29 +00:00
Michael Hudson-Doyle 9262e2183b misc/cgo/testshared: do not capture output of go commands in verbose mode
Change-Id: I8694ee5e5642c31815ae63cd414a3b1fcd9c95b0
Reviewed-on: https://go-review.googlesource.com/10411
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-27 04:46:29 +00:00
David Crawshaw 9c37a23bcb misc/android: cleaner to remove stale GOROOT files
Updates #10806

Change-Id: I734d6db026cc7c2e3099a76dc8db8e42b2b90aa7
Reviewed-on: https://go-review.googlesource.com/10390
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-25 20:52:10 +00:00
Elias Naur 22e4b8167f misc/cgo/test: fix build for CC=clang
Fix build error when CL=clang introduced by CL 10173.

Change-Id: I8edf210787a9803280c0779ff710c7e634a820d6
Reviewed-on: https://go-review.googlesource.com/10341
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-22 22:54:24 +00:00
Elias Naur 84cfba17c2 runtime: don't always unblock all signals
Ian proposed an improved way of handling signals masks in Go, motivated
by a problem where the Android java runtime expects certain signals to
be blocked for all JVM threads. Discussion here

https://groups.google.com/forum/#!topic/golang-dev/_TSCkQHJt6g

Ian's text is used in the following:

A Go program always needs to have the synchronous signals enabled.
These are the signals for which _SigPanic is set in sigtable, namely
SIGSEGV, SIGBUS, SIGFPE.

A Go program that uses the os/signal package, and calls signal.Notify,
needs to have at least one thread which is not blocking that signal,
but it doesn't matter much which one.

Unix programs do not change signal mask across execve.  They inherit
signal masks across fork.  The shell uses this fact to some extent;
for example, the job control signals (SIGTTIN, SIGTTOU, SIGTSTP) are
blocked for commands run due to backquote quoting or $().

Our current position on signal masks was not thought out.  We wandered
into step by step, e.g., http://golang.org/cl/7323067 .

This CL does the following:

Introduce a new platform hook, msigsave, that saves the signal mask of
the current thread to m.sigsave.

Call msigsave from needm and newm.

In minit grab set up the signal mask from m.sigsave and unblock the
essential synchronous signals, and SIGILL, SIGTRAP, SIGPROF, SIGSTKFLT
(for systems that have it).

In unminit, restore the signal mask from m.sigsave.

The first time that os/signal.Notify is called, start a new thread whose
only purpose is to update its signal mask to make sure signals for
signal.Notify are unblocked on at least one thread.

The effect on Go programs will be that if they are invoked with some
non-synchronous signals blocked, those signals will normally be
ignored.  Previously, those signals would mostly be ignored.  A change
in behaviour will occur for programs started with any of these signals
blocked, if they receive the signal: SIGHUP, SIGINT, SIGQUIT, SIGABRT,
SIGTERM.  Previously those signals would always cause a crash (unless
using the os/signal package); with this change, they will be ignored
if the program is started with the signal blocked (and does not use
the os/signal package).

./all.bash completes successfully on linux/amd64.

OpenBSD is missing the implementation.

Change-Id: I188098ba7eb85eae4c14861269cc466f2aa40e8c
Reviewed-on: https://go-review.googlesource.com/10173
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-22 20:24:08 +00:00
Russ Cox 2a141dedc4 cmd/link: move to cmd/newlink
In preparation for making the current linker cmd/link.
If cmd/newlink is ever completed, it can be moved back.

See golang-dev thread titled "go tool compile, etc" for background.

Change-Id: I4029580f470038240c5181a37ea4202ba971f9ef
Reviewed-on: https://go-review.googlesource.com/10286
Reviewed-by: Rob Pike <r@golang.org>
2015-05-21 17:31:40 +00:00
Shenghou Ma c013417a45 misc/cgo/testshared: when checking for RPATHs also look for DT_RUNPATH
On my systems, ld -rpath sets DT_RUNPATH instead of DT_RPATH.

Change-Id: I5047e795fb7ef9336f5fa13ba24bb6245c0b0582
Reviewed-on: https://go-review.googlesource.com/10260
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-19 23:07:45 +00:00
Michael Hudson-Doyle 362a40e37d misc/cgo/testshared: rewrite in Go
And fix to work on filesystems with only 1s resolution.

Fixes #10724

Change-Id: Ia07463f090b4290fc27f5953fa94186463d7afc7
Reviewed-on: https://go-review.googlesource.com/9768
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-18 18:40:05 +00:00
Hyang-Ah (Hana) Kim 647026a16b misc/cgo/testcshared: remove use of 'env'.
'env' command is not available on some android devices.

Change-Id: I68b1152ef7ea248c8e80c7f71e97da76e3ec6394
Reviewed-on: https://go-review.googlesource.com/9999
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-13 21:31:03 +00:00
Hyang-Ah (Hana) Kim a4f4a46c28 misc/cgo/testcshared: fix test for android.
On android the generated header files are located in
pkg/$(go env GOOS)_$(go env GOARCH)_testcshared.
The test was broken since https://go-review.googlesource.com/9798.

The installation path differs based on codegenArgs
(around src/cmd/go/build.go line 389), and the codegenArgs
is platform dependent.

Change-Id: I01ae9cb957fb7676e399f3b8c067f24c5bd20b9d
Reviewed-on: https://go-review.googlesource.com/9980
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-12 23:46:33 +00:00
Michael Hudson-Doyle 77fc03f4cd cmd/internal/ld, runtime: abort on shared library ABI mismatch
This:

1) Defines the ABI hash of a package (as the SHA1 of the __.PKGDEF)
2) Defines the ABI hash of a shared library (sort the packages by import
   path, concatenate the hashes of the packages and SHA1 that)
3) When building a shared library, compute the above value and define a
   global symbol that points to a go string that has the hash as its value.
4) When linking against a shared library, read the abi hash from the
   library and put both the value seen at link time and a reference
   to the global symbol into the moduledata.
5) During runtime initialization, check that the hash seen at link time
   still matches the hash the global symbol points to.

Change-Id: Iaa54c783790e6dde3057a2feadc35473d49614a5
Reviewed-on: https://go-review.googlesource.com/8773
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
2015-05-12 01:30:40 +00:00
Michael Hudson-Doyle be0cb9224b runtime: fix addmoduledata to follow the platform ABI
addmoduledata is called from a .init_array function and need to follow the
platform ABI. It contains accesses to global data which are rewritten to use
R15 by the assembler, and as R15 is callee-save we need to save it.

Change-Id: I03893efb1576aed4f102f2465421f256f3bb0f30
Reviewed-on: https://go-review.googlesource.com/9941
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-12 00:50:32 +00:00
Shenghou Ma dce432b388 misc/trace: add license for the trace-viewer
The trace-viewer doesn't use the Go license, so it makes sense
to include the license text into the README.md file.

While we're at here, reformat existing text using real Markdown
syntax.

Change-Id: I13e42d3cc6a0ca7e64e3d46ad460dc0460f7ed09
Reviewed-on: https://go-review.googlesource.com/9882
Reviewed-by: Rob Pike <r@golang.org>
2015-05-11 06:09:10 +00:00
Ian Lance Taylor e45aebd6dd cmd/go: install headers for c-archive/c-shared cgo exports
When
  using -buildmode=c-archive or c-shared, and
  when installing packages that use cgo, and
  when those packages export some functions via //export comments,
then
  for each such package, install a pkg.h header file that declares the
  functions.

This permits C code to #include the header when calling the Go
functions.

This is a little awkward to use when there are multiple packages that
export functions, as you have to "go install" your c-archive/c-shared
object and then pull it out of the package directory.  When compiling
your C code you have to -I pkg/$GOOS_$GOARCH.  I haven't thought of
any more convenient approach.  It's simpler when only the main package
has exported functions.

When using c-shared you currently have to use a _shared suffix in the
-I option; it would be nice to fix that somehow.

Change-Id: I5d8cf08914b7d3c2b194120c77791d2732ffd26e
Reviewed-on: https://go-review.googlesource.com/9798
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-07 17:39:56 +00:00
Aram Hăvărneanu 2230e9d24b misc/cgo: add various solaris build lines
Change-Id: Ifd9ac7f5300232fb83c6350a787b5803adb96b48
Reviewed-on: https://go-review.googlesource.com/8263
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-06 11:38:08 +00:00
Michael Hudson-Doyle a1858e9cf0 cmd/go: rebuild stale shared objects before linking against them.
This changes the action graph when shared libraries are involved to always have
an action for the shared library (which does nothing when the shared library
is up to date).

Change-Id: Ibbc70fd01cbb3f4e8c0ef96e62a151002d446144
Reviewed-on: https://go-review.googlesource.com/8934
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-05 22:08:25 +00:00
Burcu Dogan 97fd7b07b6 misc/ios: fix plist indentation and whitespace
Change-Id: Ida727edb592e77918ca5511b41456786d57c97b2
Reviewed-on: https://go-review.googlesource.com/9634
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-05 21:04:05 +00:00
Dave Cheney ccaaf1f134 misc/cgo/testcshared, misc/cgo/testshared: fix clang warnings and errors
Fix several warnings generated on the linux-amd64-clang builder
and make it clear to clang that -znow is a linker only flag.

Tested with

    env CC=clang-3.5 ./all.bash
    env CC=gcc-4.8 ./all.bash

Change-Id: I5ca7366ba8bf6221a36d25a2157dda4b4f3e16fa
Reviewed-on: https://go-review.googlesource.com/9523
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-30 17:08:15 +00:00
Michael Hudson-Doyle 0774f6dbfd misc/cgo/testshared: add basic test for -buildmode=shared/-linkshared
Just a first basic test, I'll extend this to test more but want to get an
opinion on basic approach first.

Change-Id: Idab9ebd7d9960b000b81a01a1e53258bf4bce755
Reviewed-on: https://go-review.googlesource.com/9386
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-04-29 23:47:47 +00:00
Ian Lance Taylor e2b6cebcd6 misc/cgo/test/issue9400: fix to build with gccgo
This doesn't test much with gccgo, but at least it builds now, and the
test does, unsurprisingly, pass.  A proper test would require adding
assembly files in GCC syntax for all platforms that gccgo supports,
which would be infeasible.

Also added copyright headers to the asm files.

Change-Id: Icea5af29d7d521a0681506ddb617a79705b76d33
Reviewed-on: https://go-review.googlesource.com/9417
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-29 16:57:13 +00:00
Hyang-Ah Hana Kim e9a89b80b6 misc/cgo/testcshared: make test.bash resilient against noise.
Instead of comparing against the entire output that may include
verbose warning messages, use the last line of the output and check
it includes the expected success message (PASS).

Change-Id: Iafd583ee5529a8aef5439b9f1f6ce0185e4b1331
Reviewed-on: https://go-review.googlesource.com/9304
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-24 18:32:24 +00:00
Hyang-Ah Hana Kim 8566979972 misc/cgo/testcshared: add a c-shared test for android/arm.
- main3.c tests main.main is exported when compiled for GOOS=android.
- wait longer for main2.c (it's slow on android/arm)
- rearranged test.bash

Fixes #10070.

Change-Id: I6e5a98d1c5fae776afa54ecb5da633b59b269316
Reviewed-on: https://go-review.googlesource.com/9296
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-24 16:32:31 +00:00
Srdjan Petrovic 5c8fbc6f1e runtime: signal forwarding
Forward signals to signal handlers installed before Go installs its own,
under certain circumstances.  In particular, as iant@ suggests, signals are
forwarded iff:
   (1) a non-SIG_DFL signal handler existed before Go, and
   (2) signal is synchronous (i.e., one of SIGSEGV, SIGBUS, SIGFPE), and
   	(3a) signal occured on a non-Go thread, or
   	(3b) signal occurred on a Go thread but in CGo code.

Supported only on Linux, for now.

Change-Id: I403219ee47b26cf65da819fb86cf1ec04d3e25f5
Reviewed-on: https://go-review.googlesource.com/8712
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-24 05:19:39 +00:00
Ian Lance Taylor e589e08014 misc/cgo/testcshared: add c-shared test with no exports
The purpose of this test is to make sure that -buildmode=c-shared
works even when the shared library can be built without invoking cgo.

Change-Id: Id6f95af755992b209aff770440ca9819b74113ab
Reviewed-on: https://go-review.googlesource.com/9166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-21 20:50:23 +00:00
David Crawshaw 98f610fe09 misc/cgo/testcarchive: enable test on darwin/arm
Change-Id: I0d3f9841500e0a41f1c427244869bf3736a31e18
Reviewed-on: https://go-review.googlesource.com/9075
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-20 15:16:16 +00:00
David Crawshaw c5befcf0a7 misc/cgo/testcarchive: check that os.Args is set
Change-Id: I4278abca9d2a8f25149fa8935a93d32e7d04a43a
Reviewed-on: https://go-review.googlesource.com/9050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-17 22:29:51 +00:00
Hyang-Ah Hana Kim 92189a2be2 misc/cgo/testcshared: test -buildmode=c-shared
Followed the same test pattern in misc/cgo/testcarchive.

Change-Id: I2f863b5c24a28f0b38b0128ed3e8a92c17fb5b9f
Reviewed-on: https://go-review.googlesource.com/8985
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-17 16:16:44 +00:00
Russ Cox 6a2b0c0b6d runtime: delete cgo_allocate
This memory is untyped and can't be used anymore.
The next version of SWIG won't need it.

Change-Id: I592b287c5f5186975ee09a9b28d8efe3b57134e7
Reviewed-on: https://go-review.googlesource.com/8956
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-17 01:30:47 +00:00
Josh Bleecher Snyder 8fd1ec232f misc/ios: fix teamID and appID use in entitlements
This is a follow-up to CL 8910.
This is the version that I have tested and which works
when appID and teamID are not the same (which they appear
to be for the builder).

I am unsure how I submitted it with the wrong code.

Change-Id: I186e34e91953d082b507390c1cd2042e5419c4c9
Reviewed-on: https://go-review.googlesource.com/8943
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-16 15:58:45 +00:00
Shenghou Ma 110fa22c45 misc/cgo/test: skip issue3261 test on darwin/arm64
Because there is no libgcc.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f07
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8786
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-16 13:00:47 +00:00
David Crawshaw e6d5233cfe misc/ios: adjust exec script for iOS 8.3
We no longer need the EXC_BAD_ACCESS watcher as runtime/cgo contains
a mach exception handler that catches it. And now lldb only
intermittently reports process connection and exiting, so instead
just look for the PASS from Go.

Change-Id: I403266558f5a900e0b87ec1019d9baec88148d23
Reviewed-on: https://go-review.googlesource.com/8957
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-04-16 12:29:13 +00:00
Josh Bleecher Snyder 2d0c962b1c misc/ios: read codesign info from environment variables
Use environment variables to allow set-and-forget.

Add a script to attempt to autodetect codesign info.

Change-Id: Ic56b9c5f097b1a4117ebb89c408bc333d91f581d
Reviewed-on: https://go-review.googlesource.com/8910
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-15 00:00:10 +00:00
David Crawshaw 3b22ffc07e runtime: make cgocallback wait on package init
With the new buildmodes c-archive and c-shared, it is possible for a
cgo call to come in early in the lifecycle of a Go program. Calls
before the runtime has been initialized are caught by
_cgo_wait_runtime_init_done. However a call can come in after the
runtime has initialized, but before the program's package init
functions have finished running.

To avoid this cgocallback checks m.ncgo to see if we are on a thread
running Go. If not, we may be a foreign thread and it blocks until
main_init is complete.

Change-Id: I7a9f137fa2a40c322a0b93764261f9aa17fcf5b8
Reviewed-on: https://go-review.googlesource.com/8897
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-04-14 13:39:02 +00:00
David Crawshaw 8543cc5635 misc/cgo/testcarchive: avoid bad pointer passing
Change-Id: Ifbcc0eb24834f2f7d3b160d1dc911209723d9797
Reviewed-on: https://go-review.googlesource.com/8863
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-13 19:00:52 +00:00
David Crawshaw 4345a9fc5d misc/ios: support go run in go_darwin_arm_exec
The -lldb flag makes it easy to use go run and end up in a debugging
session on darwin/arm.

Change-Id: I556f93e950086a7dff4839f301b9c55f7579f87b
Reviewed-on: https://go-review.googlesource.com/8024
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-13 18:59:52 +00:00
David Crawshaw fdab2f92ea misc/cgo/testcarchive: test -buildmode=c-archive
Change-Id: I1668a6885c45180ff88fe673d04cec7eba395ee7
Reviewed-on: https://go-review.googlesource.com/8861
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-13 18:31:07 +00:00
David Crawshaw 684473d19b misc/ios: pick clang arch based on GOARCH
Change-Id: Ia49ab729747acb07bf392d90aea9e752471e152e
Reviewed-on: https://go-review.googlesource.com/8789
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-12 02:41:36 +00:00
Shenghou Ma 6508518849 misc/cgo/test/issue9400: add arm64 implementation
Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f4
Reviewed-on: https://go-review.googlesource.com/8451
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-04-08 09:08:40 +00:00
Shenghou Ma 84b690fee1 cmd/api: re-enable TestGolden on nacl
Fixes #10369.

Change-Id: If0a6d2b33c6862c9f7f862bdc997f2204072c6dc
Reviewed-on: https://go-review.googlesource.com/8620
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 06:36:36 +00:00
Alex Brainman f8bcebe47c Revert "misc/cgo/testso: add test for fixed issue 4339"
This reverts commit 9fa9f966e9.

The change has broken darwin and netbsd builders. It needs to be tested properly.

Change-Id: Id9e2d30caa8764c362c9f33890015dfc1aae0dab
Reviewed-on: https://go-review.googlesource.com/8527
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-04-07 11:50:28 +00:00
Alex Brainman 9fa9f966e9 misc/cgo/testso: add test for fixed issue 4339
Update #4339.

Change-Id: Ic1a7535562b8b824ba166777725f7ba5b9623d77
Reviewed-on: https://go-review.googlesource.com/8523
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-07 06:25:33 +00:00
David Crawshaw 00e0fe4b95 misc/ios: retry loop to handle builder flakiness
After moving the darwin/arm builder to new hardware several new flaky
error messages appeared. This provided enough information to Google
to make it clear that iOS build systems have been flaky for many
years, and that is unlikely to change any time soon.

However, all of the pain of lldb and using a breakpoint early in
program initialization gives us an advantage: all install and
initialization flakiness appears to happen before the Go program ever
gets going. So if we see an error or we timeout before we reach our
breakpoint (before any test code has executed), we can assume it is
the fault of the builder and restart without risking hiding a flaky
Go test.

This code has successfully processed the last 8 builds. I am hopeful.

Change-Id: Ide24aaae4fa7bdab9d8f4432bb85d8f2256c7606
Reviewed-on: https://go-review.googlesource.com/8241
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-30 18:11:07 +00:00
David Crawshaw 713451a097 misc/ios: simplify breakpoint timeout
The clever partial timer I added interacts badly with iOS app launch
timeout termination. A fixed timeout will be easier to debug.

Change-Id: I6eb4ee5f1431539f00fa707e8cde6f3cf86983fc
Reviewed-on: https://go-review.googlesource.com/8083
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-25 17:26:03 +00:00
David Crawshaw ed92862522 misc/ios: timeout and continue waiting for getwd
Split out from cl/8024 for clarity and improved approach.

Rarely, "stop reason = breakpoint" does not appear in the lldb stop
text. However the program is ready to proceed. To be a little more
robust about those cases, we wait for two seconds, and if that text
doesn't appear but a prompt does we continue and hope for the best.
Worst case, this results in a harder to read failure message.

Change-Id: Ib20aa92564cdccefd2b7260417c647cd44122b66
Reviewed-on: https://go-review.googlesource.com/8080
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-25 16:31:38 +00:00
Shenghou Ma 003dccfac4 runtime, syscall: use the new get_random_bytes syscall for NaCl
The SecureRandom named service was removed in
https://codereview.chromium.org/550523002. And the new syscall
was introduced in https://codereview.chromium.org/537543003.

Accepting this will remove the support for older version of
sel_ldr. I've confirmed that both pepper_40 and current
pepper_canary have this syscall.

After this change, we need sel_ldr from pepper_39 or above to
work.

Fixes #9261

Change-Id: I096973593aa302ade61f259a3a71ebc7c1a57913
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1755
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-25 02:07:09 +00:00
Ian Lance Taylor 4f97afcdf2 misc/swig/callback: fix test for SWIG -cgo support
The test used to import ../callback.  I forget why that ever worked,
but it probably had something to do with the shared libraries we used
to use with SWIG.  It doesn't work today.

Change-Id: Ib83d6c398aa46bf2fc66320b47b6e6d9897ee0b7
Reviewed-on: https://go-review.googlesource.com/7004
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-06 15:28:50 +00:00
Alex Brainman d2918cbcaa cmd/dist: execute misc/cgo/testso again on windows
Fixes #10072

Change-Id: I1f73c8829a89144d49433a36a4e64223c74af954
Reviewed-on: https://go-review.googlesource.com/6585
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-04 22:38:48 +00:00
Brad Fitzpatrick d5f690609f build: convert run.bash, run.bat, and run.rc into a Go program
This will enable test sharding over multiple VMs, to speed trybot answers.

Update #10029

Change-Id: Ie277c6459bc38005e4d6af14d22effeaa0a4667e
Reviewed-on: https://go-review.googlesource.com/6531
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-03-03 23:22:11 +00:00
David Crawshaw 7ff6254c50 misc/ios: run lldb commands much more carefully
We now wait until we see the completed prompt from a command before
proceeding. This seems to cut down on a spurious error I have seen
this afternoon.

Change-Id: Ic0a3481d8c265c3c3b4449ec7ac1c2752b85b0b6
Reviewed-on: https://go-review.googlesource.com/6691
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-03 23:06:45 +00:00
David Crawshaw 1fdeb6b58a misc/ios: extra stdout check before run
On one recent job I saw an unexpected SIGSTOP, which I suspect is
simply the job timeout. But the lack of other diagnostics suggests
lldb just didn't see the "run" command.

-----

process handle SIGHUP  --stop false --pass true --notify false
process handle SIGPIPE --stop false --pass true --notify false
process handle SIGUSR1 --stop false --pass true --notify false
process handle SIGSEGV --stop false --pass true --notify false
process handle SIGBUS  --stop false --pass true --notify false
breakpoint set -n getwd
run
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGHUP      true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGPIPE     true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGUSR1     true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGSEGV     true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGBUS      true   false  false
(lldb) Breakpoint 1: where = libsystem_c.dylib`getwd, address = 0x2f7f7294
(lldb) Process 23755 stopped
* thread #1: tid = 0x104c02, 0x1febb000 dyld`_dyld_start, stop reason = signal SIGSTOP
    frame #0: 0x1febb000 dyld`_dyld_start
dyld`_dyld_start:
-> 0x1febb000:  mov    r8, sp
   0x1febb004:  sub    sp, sp, #0x10
   0x1febb008:  bic    sp, sp, #0x7
   0x1febb00c:  ldr    r3, [pc, #112]            ; _dyld_start + 132
(lldb) go_darwin_arm_exec: timeout (stage br getwd)
FAIL	compress/gzip	359.226s

Change-Id: Ifc2123f5ceaa6d3f9b31bb5cb6e77a2c8ec23818
Reviewed-on: https://go-review.googlesource.com/6613
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-03 20:03:32 +00:00
David Crawshaw 66416c00eb misc/ios: more predictable zoneinfo.zip location
See golang.org/cl/6511.

Change-Id: I2145a42877ed6b78400f29c2ef18969870dab5c3
Reviewed-on: https://go-review.googlesource.com/6512
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-03 01:49:56 +00:00
David Crawshaw d460b6e5c6 misc/ios: add go_darwin_arm_exec script
This script is getting very close to complete, and is complex enough
that I'd like to get what's there so far reviewed. With it the builder
is left failing on eight packages. Two of those involve correcting
GOROOT which may need modifications to this script, the others are
either a unix sockets bug I have to hunt down or are caused by lldb
getting stuck on SIGSEGV, a TODO.

Change-Id: I5ff933800167b6764b51ad195da7dcda61d59ff8
Reviewed-on: https://go-review.googlesource.com/6404
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-02 19:42:30 +00:00
Russ Cox 20f9f544bf [dev.cc] misc/nacl: add testdata for cmd/internal/rsc.io/x86/x86asm
Should fix nacl build on dev.cc.

Change-Id: I166a03b5f6903bd8bbce65af4e5f2899807bb6cc
Reviewed-on: https://go-review.googlesource.com/5575
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-02-23 17:14:24 +00:00
Russ Cox de50bad121 [dev.cc] all: merge master (48469a2) into dev.cc
Change-Id: I10f7950d173b302151f2a31daebce297b4306ebe
2015-02-23 10:16:29 -05:00
Russ Cox 5944cb8d1a [dev.cc] cmd/asm/internal/asm: fix test on nacl
Need to add testdata to NaCl's testing file system.

Change-Id: Ie9703b5475c7f87e737a06de85d1f88e2062f090
Reviewed-on: https://go-review.googlesource.com/5541
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-21 18:11:28 +00:00
Dmitry Vyukov edadffa2f3 cmd/trace: add new command
Trace command allows to visualize and analyze traces.
Run as:
$ go tool trace binary trace.file
The commands opens web browser with the main page,
which contains links for trace visualization,
blocking profiler, network IO profiler and per-goroutine
traces.

Also move trace parser from runtime/pprof/trace_parser_test.go
to internal/trace/parser.go, so that it can be shared between
tests and the command.

Change-Id: Ic97ed59ad6e4c7e1dc9eca5e979701a2b4aed7cf
Reviewed-on: https://go-review.googlesource.com/3601
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-20 18:31:25 +00:00
Rob Pike e190e27143 [dev.cc] misc/cgo/test: fix PC reference in arm assembler
Use R15.
May fix build.

Change-Id: Ia25b0936c5aab2a427f8e6531688c3e537fbfdd0
Reviewed-on: https://go-review.googlesource.com/5070
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 21:42:27 +00:00
Péter Surányi 9b6ccb1323 all: don't refer to code.google.com/p/go{,-wiki}/
Only documentation / comment changes. Update references to
point to golang.org permalinks or go.googlesource.com/go.
References in historical release notes under doc are left as is.

Change-Id: Icfc14e4998723e2c2d48f9877a91c5abef6794ea
Reviewed-on: https://go-review.googlesource.com/4060
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 14:41:47 +00:00
Shenghou Ma f961a99a35 misc/ios: add README and wrapper script to ease cross-compiling for darwin/arm
Fixes #837.

Change-Id: I2d601504addbd220b304d32d587144d2a702f753
Reviewed-on: https://go-review.googlesource.com/2127
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-06 05:50:10 +00:00
Shenghou Ma 5b806e58e2 misc/cgo/test: skip test7978 when using unsupported compilers
On Darwin/ARM, because libSystem doesn't provide functions for
__sync_fetch_and_add, and only clang can inline that function,
skip the test when building with GCC.

Change-Id: Id5e9d8f9bbe1e6bcb2f381f0f66cf68aa95277c7
Reviewed-on: https://go-review.googlesource.com/2125
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 05:49:47 +00:00
Andrew Gerrand 5efcbba9ee misc/makerelease: send file size when uploading
Change-Id: I1a1ed1e23067268a2bac08fc4c99c594fb723837
Reviewed-on: https://go-review.googlesource.com/3050
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-20 04:09:23 +00:00
Andrew Gerrand 95864504d2 misc/dashboard/codereview: delete
This dashboard is no longer in use, and doesn't work with Gerrit.

Change-Id: Ib7c367dcad97322566610157b15e23db5bec58ff
Reviewed-on: https://go-review.googlesource.com/3028
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-01-19 22:18:03 +00:00
Shenghou Ma 30e910197a misc/makerelease: workaround the go install -a restriction on release branches
Fixes #9619.

Change-Id: I71931b0d546163e5451d7d72e552b08540e3c2a7
Reviewed-on: https://go-review.googlesource.com/2995
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-18 23:20:25 +00:00
Hyang-Ah Hana Kim d5d4e82fb2 misc/android: choose the right subdirectory for bin under GOPATH.
This change includes the cleanup of temporary files created during
the binary execution as well.

Change-Id: Ic01a0a537d1daafcaa3acda1ec344aff5dcddfc2
Reviewed-on: https://go-review.googlesource.com/2903
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-16 22:02:52 +00:00
Austin Clements 36f456c789 misc/cgo: skip testso on ppc64
This test requires external linking, but we don't yet implement
external linking on ppc64 (tracked in issue #8912).  Disable the test
on ppc64 until external linking is implemented.

This makes all.bash pass on ppc64le.

Change-Id: I741498d4d9321607e7a65792a33faf8187bd18e4
Reviewed-on: https://go-review.googlesource.com/2908
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-16 19:45:28 +00:00
Andrew Gerrand 2a87a8a5ec misc/makerelease: a couple of small fixes
Change-Id: Iec19d6152b95ba67daac366b32d42f69e1dba9a4
Reviewed-on: https://go-review.googlesource.com/2951
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-16 03:31:46 +00:00
Andrew Gerrand 1d890ac0b2 misc/makerelease: use built in "del" to remove files
Git marks some of its files read only, so os.RemoveAll isn't sufficient
to remove them from the ".git" directory.

Change-Id: I3150596931d1c77e7cf9fb8da1a999d2c6730121
Reviewed-on: https://go-review.googlesource.com/2930
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-15 22:24:06 +00:00
Andrew Gerrand 1a4c984bae misc/makerelease: check out core from git repo, use new oauth2 package
Change-Id: I072cf2b9149a05901cc19e7aeb0e9d0936a8dbe3
Reviewed-on: https://go-review.googlesource.com/2793
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-14 22:24:39 +00:00
Shenghou Ma 16993f2485 cmd/cgo: also rewrite C.var in selector expressions
While we're here, rename TestIssue7234 to Test7234 for consistency
with other tests.

Fixes #9557.

Change-Id: I22b0a212b31e7b4f199f6a70deb73374beb80f84
Reviewed-on: https://go-review.googlesource.com/2654
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-12 21:48:57 +00:00
Shenghou Ma 583293349b misc/swig/stdio: fix broken nil pointer test
SWIG has always returned a typed interface value for a C++ class,
so the interface value will never be nil even if the pointer itself
is NULL. ptr == NULL in C/C++ should be ptr.Swigcptr() == 0 in Go.

Fixes #9514.

Change-Id: I3778b91acf54d2ff22d7427fbf2b6ec9b9ce3b43
Reviewed-on: https://go-review.googlesource.com/2440
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-07 23:24:23 +00:00
Matthew Dempsky b2aab72d9a cmd/cgo: remove obsolete -cdefs flag
Now that there's no 6c compiler anymore, there's no need for cgo to
generate C headers that are compatible with it.

Fixes #9528

Change-Id: I43f53869719eb9a6065f1b39f66f060e604cbee0
Reviewed-on: https://go-review.googlesource.com/2482
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-07 22:49:59 +00:00
Russ Cox 949dd10222 misc/cgo: disable TestAllocateFromC in wbshadow mode
This test is doing pointer graph manipulation from C, and we
cannot support that with concurrent GC. The wbshadow mode
correctly diagnoses missing write barriers.

Disable the test in that mode for now. There is a bigger issue
behind it, namely SWIG, but for now we are focused on making
all.bash pass with wbshadow enabled.

Change-Id: I55891596d4c763e39b74082191d4a5fac7161642
Reviewed-on: https://go-review.googlesource.com/2346
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-01-06 22:22:59 +00:00
Russ Cox df027aceb9 reflect: add write barriers
Use typedmemmove, typedslicecopy, and adjust reflect.call
to execute the necessary write barriers.

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: Iec5b5b0c1be5589295e28e5228e37f1a92e07742
Reviewed-on: https://go-review.googlesource.com/2312
Reviewed-by: Keith Randall <khr@golang.org>
2015-01-06 00:28:31 +00:00
Shenghou Ma 04cf881fbe misc/cgo/test: get rid of the backdoor package
For Go 1.5, we can use go:linkname rather than assembly thunk for gc.
Gccgo already has support for //extern.

Change-Id: I5505aa247dd5b555112f7261ed2f192c81cf0bdf
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1888
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-24 00:18:21 +00:00
Austin Clements 200e7bf6b1 misc/cgo: fix issue 9400 test on 386
issue9400_linux.go did not build on 386 because it used a constant
that was larger than a 32-bit int in a ... argument.  Fix this by
casting the constant to uint64 (to match how the constant is being
used).

Change-Id: Ie8cb64c3910382a41c7852be7734a62f0b2d5a21
Reviewed-on: https://go-review.googlesource.com/2060
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-23 02:22:50 +00:00
Austin Clements 675eb72c28 runtime: run libc SIGSETXID and SIGCANCEL handlers on signal stack
These signals are used by glibc to broadcast setuid/setgid to all
threads and to send pthread cancellations.  Unlike other signals, the
Go runtime does not intercept these because they must invoke the libc
handlers (see issues #3871 and #6997).  However, because 1) these
signals may be issued asynchronously by a thread running C code to
another thread running Go code and 2) glibc does not set SA_ONSTACK
for its handlers, glibc's signal handler may be run on a Go stack.
Signal frames range from 1.5K on amd64 to many kilobytes on ppc64, so
this may overflow the Go stack and corrupt heap (or other stack) data.

Fix this by ensuring that these signal handlers have the SA_ONSTACK
flag (but not otherwise taking over the handler).

This has been a problem since Go 1.1, but it's likely that people
haven't encountered it because it only affects setuid/setgid and
pthread_cancel.

Fixes #9600.

Change-Id: I6cf5f5c2d3aa48998d632f61f1ddc2778dcfd300
Reviewed-on: https://go-review.googlesource.com/1887
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-23 01:33:36 +00:00
Ian Lance Taylor 421c01706f misc/cgo/test: skip test7978 when using gccgo
Gccgo can only get a backtrace for the currently running thread, which
means that it can only get a backtrace for goroutines currently running
Go code.  When a goroutine is running C code, gccgo has no way to stop
it and get the backtrace.  This test is all about getting a backtrace
of goroutines running C code, so it can't work for gccgo.

Change-Id: I2dff4403841fb544da7396562ab1193875fc14c3
Reviewed-on: https://go-review.googlesource.com/1904
Reviewed-by: Minux Ma <minux@golang.org>
2014-12-20 02:38:38 +00:00
Ian Lance Taylor 35dc312e72 misc/cgo/test/backdoor: add gc build tag for thunk.s
Change-Id: I6be5f610af5c56131a9d887569919372bab1d02c
Reviewed-on: https://go-review.googlesource.com/1903
Reviewed-by: Minux Ma <minux@golang.org>
2014-12-20 02:08:50 +00:00
Shenghou Ma fc71d7b8ca misc/chrome/gophertool: update for the git/gerrit transition
Change-Id: I7b9601ae6e1cfb18ef79a7b189aa7e689c0fe942
Reviewed-on: https://go-review.googlesource.com/1621
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-18 07:34:46 +00:00
Andrew Gerrand ab96371817 misc/makerelease: fix build
Fixes #9308

Change-Id: I0121adbbecc893eb93afc3321ecff97ea146d150
Reviewed-on: https://go-review.googlesource.com/1560
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-15 01:55:29 +00:00
Andrew Gerrand e5ee9a824d misc/makerelease: remove mercurial-specific special case
Change-Id: I2ae40e63bc78f3b6e4eb68ccbc928368db1e606f
Reviewed-on: https://go-review.googlesource.com/1535
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-14 23:54:15 +00:00
Brad Fitzpatrick 2d02ff278c misc/chrome/gophertool: update URLs from code.google.com to new homes
Change-Id: I46bf9f1b84a331cabce2d3417b2b59ccb83d00fa
Reviewed-on: https://go-review.googlesource.com/1532
Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-13 10:18:27 +00:00
Andrew Gerrand a56a3876e8 misc/makerelease: handle git sub-repositories
Also: checkout sub-repos from Mercurial manually
instead of using "go get". (for the 1.4 release)

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/190720043
2014-12-11 17:36:39 +11:00
Shenghou Ma 026b5bbc8b misc/cgo/test: skip test8694 on ARM.
LGTM=dave, bradfitz, rsc
R=golang-codereviews, dave, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/185130043
2014-12-11 17:34:10 +11:00
Andrew Gerrand 508a22d5bc misc/makerelease: use new storage api, handle git sub-repos
Change-Id: I8c5b77d861aafdc594714982503da7bee053c9fe
Reviewed-on: https://go-review.googlesource.com/1291
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-10 02:08:38 +00:00
David Symonds 44ab8d95d3 undo CL 176900044 / 561398621ba7
Turns out it *is* needed because the cmd/link tests expect to find their own files.

««« original CL description
misc/nacl: exclude cmd/link from the test zip.

It does not appear to be necessary, and cmd/link does not appear in release branches.

LGTM=rsc
R=adg, rsc
CC=golang-codereviews
https://golang.org/cl/176900044
»»»

TBR=rsc
R=adg, rsc
CC=golang-codereviews
https://golang.org/cl/175870045
2014-11-17 14:21:29 +11:00
David Symonds bc949b5c20 misc/nacl: exclude cmd/link from the test zip.
It does not appear to be necessary, and cmd/link does not appear in release branches.

LGTM=rsc
R=adg, rsc
CC=golang-codereviews
https://golang.org/cl/176900044
2014-11-17 14:04:43 +11:00
Andrew Gerrand f07ea227ee misc/makerelease: use release-branch.go1.4 for tools and tour
TBR=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/175870043
2014-11-17 11:27:53 +11:00
Russ Cox 9bc842ca18 cmd/dist: remove old misc/pprof
LGTM=dave, bradfitz, r, alex.brainman
R=r, dave, bradfitz, alex.brainman
CC=golang-codereviews
https://golang.org/cl/167350043
2014-11-09 20:20:26 -05:00
Andrew Gerrand 7f0be1f781 all: use golang.org/x/... import paths
LGTM=rsc, r
R=r, rsc
CC=golang-codereview, golang-codereviews
https://golang.org/cl/168050043
2014-11-10 09:15:57 +11:00
Alan Donovan 182ec4395e misc/cgo/test: fix freebsd test failure by moving test to its own package.
(The assertion depends on a per-package gensym counter whose
value varies based on what else is in the package.)

LGTM=khr
R=khr, rsc
CC=golang-codereviews
https://golang.org/cl/169930043
2014-11-03 13:41:03 -05:00
Benoit Sigoure 8e01fc7e9b misc: Increase issue 6997's test timeout to prevent spurious failures.
On heavily loaded build servers, a 5 second timeout is too aggressive,
which causes this test to fail spuriously.

LGTM=iant
R=iant
CC=golang-codereviews, sqweek
https://golang.org/cl/170850043
2014-11-01 08:28:09 -07:00
Alan Donovan a14ae44517 misc/cgo/test: fix bad C test code that fails on some configurations
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/169800043
2014-10-30 14:08:55 -04:00
Alan Donovan 09f6f05c1f cmd/cgo: avoid worklist nondeterminism.
+ Regression test.

Fixes #9026.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/162490043
2014-10-30 14:01:14 -04:00
Emil Hessman 78082dfa80 misc/makerelease/windows: fix 404 help URL in installer
ARPHELPLINK yields 404; update the URL.

While here, also prefix the ARPREADME and ARPURLINFOABOUT URL's with the HTTP scheme to make 'em clickable links in the Add or Remove Programs listing.

LGTM=adg
R=golang-codereviews
CC=adg, golang-codereviews
https://golang.org/cl/154580045
2014-10-27 12:43:14 +11:00
Jens Frederich 1e30bb027a misc/makerelease: set version number in Windows installer
Set correct version number at Windows installer based on
Go's Mercurial tag.

Name                                     | Version
------------------------------------------------
Go Programming Language amd64 go1.3.3    | 1.3.3
Go Programming Language amd64 go1.2rc3   | 1.2
Go Programming Language amd64 go1.2beta1 | 1.2

Fixes #8239.

LGTM=adg
R=adg, c.emil.hessman, alex.brainman
CC=golang-codereviews
https://golang.org/cl/160950044
2014-10-22 10:56:26 +11:00
Chris Manghane 343d113610 cmd/go: add '_go_' suffix to go files compiled by gccgo to avoid naming conflicts
Fixes #8828.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/154410043
2014-10-15 13:13:37 -07:00
Alex Brainman d704bb0dc9 cmd/ld: do not assume that only pe section names start with '.'
Our current pe object reader assumes that every symbol starting with
'.' is section. It appeared to be true, until now gcc 4.9.1 generates
some symbols with '.' at the front. Change that logic to check other
symbol fields in addition to checking for '.'. I am not an expert
here, but it seems reasonable to me.

Added test, but it is only good, if tested with gcc 4.9.1. Otherwise
the test PASSes regardless.

Fixes #8811.
Fixes #8856.

LGTM=jfrederich, iant, stephen.gutekanst
R=golang-codereviews, jfrederich, stephen.gutekanst, iant
CC=alex.brainman, golang-codereviews
https://golang.org/cl/152410043
2014-10-11 22:01:04 +11:00
Alex Brainman 9ca8368444 misc/cgo/test: add Test8517
CL 145890044 did not provide test. Rectify that.

Update #8517

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/148790043
2014-10-09 16:10:51 +11:00
Russ Cox 685204747d runtime: fix _cgo_allocate(0)
Fixes a SWIG bug reported off-list.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/155990043
2014-10-07 16:27:40 -04:00
Russ Cox 4630218538 misc/cgo/test: fail issue 7978 with clearer error when GOTRACEBACK != 2
The test doesn't work with GOTRACEBACK != 2.
Diagnose that failure mode.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/152970043
2014-10-03 16:42:18 -04:00
Mikio Hara 6587557660 misc/nacl/README: fix typo
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/151870043
2014-10-01 09:16:55 +09:00
Alan Donovan 74b8693c54 cmd/cgo: add missing ast.SliceExpr.Max case to AST traversal.
+ static test

NB: there's a preexisting (dynamic) failure of test issue7978.go.

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/144650045
2014-09-30 16:08:04 -04:00
Keith Randall 1b6807bb06 cgo: adjust return value location to account for stack copies.
During a cgo call, the stack can be copied.  This copy invalidates
the pointer that cgo has into the return value area.  To fix this
problem, pass the address of the location containing the stack
top value (which is in the G struct).  For cgo functions which
return values, read the stktop before and after the cgo call to
compute the adjustment necessary to write the return value.

Fixes #8771

LGTM=iant, rsc
R=iant, rsc, khr
CC=golang-codereviews
https://golang.org/cl/144130043
2014-09-25 07:59:01 -07:00
Russ Cox 5917692b98 debug/dwarf: correct name for clang-generated complex type
Fixes #8694.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/143570043
2014-09-24 16:53:47 -04:00
Russ Cox a0785a53ad cmd/go: prohibit C sources files unless using cgo
Those C files would have been compiled with 6c.
It's close to impossible to use C correctly anymore,
and the C compilers are going away eventually.
Make them unavailable now.

go1.4.txt change in CL 145890046

LGTM=iant
R=iant
CC=golang-codereviews, r
https://golang.org/cl/149720043
2014-09-24 15:10:38 -04:00
Hector Martin Cantero 7283e08cbf runtime: keep g->syscallsp consistent after cgo->Go callbacks
Normally, the caller to runtime.entersyscall() must not return before
calling runtime.exitsyscall(), lest g->syscallsp become a dangling
pointer. runtime.cgocallbackg() violates this constraint. To work around
this, save g->syscallsp and g->syscallpc around cgo->Go callbacks, then
restore them after calling runtime.entersyscall(), which restores the
syscall stack frame pointer saved by cgocall. This allows the GC to
correctly trace a goroutine that is currently returning from a
Go->cgo->Go chain.

This also adds a check to proc.c that panics if g->syscallsp is clearly
invalid. It is not 100% foolproof, as it will not catch a case where the
stack was popped then pushed back beyond g->syscallsp, but it does catch
the present cgo issue and makes existing tests fail without the bugfix.

Fixes #7978.

LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, minux, bradfitz, iant, gobot, rsc
CC=golang-codereviews, rsc
https://golang.org/cl/131910043
2014-09-24 13:20:25 -04:00
Russ Cox fc46931442 runtime: remove untyped allocation of ParFor
Now it's two allocations. I don't see much downside to that,
since the two pieces were in different cache lines anyway.

Rename 'conservative' to 'cgo_conservative_type' and make
clear that _cgo_allocate is the only allowed user.

This depends on CL 141490043, which removes the other
use of conservative (in defer).

LGTM=dvyukov, iant
R=khr, dvyukov, iant
CC=golang-codereviews, rlh
https://golang.org/cl/139610043
2014-09-16 11:03:11 -04:00
Russ Cox de4964a78c build: more adjustments for move from src/pkg to src
These were missed in CL 134570043.

Fixes nacl, solaris builds.

TBR=r
CC=golang-codereviews
https://golang.org/cl/136320043
2014-09-08 00:22:40 -04:00
Russ Cox 220a6de47e build: adjustments for move from src/pkg to src
This CL adjusts code referring to src/pkg to refer to src.

Immediately after submitting this CL, I will submit
a change doing 'hg mv src/pkg/* src'.
That change will be too large to review with Rietveld
but will contain only the 'hg mv'.

This CL will break the build.
The followup 'hg mv' will fix it.

For more about the move, see golang.org/s/go14nopkg.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/134570043
2014-09-08 00:06:45 -04:00
Russ Cox 7230db9ef8 misc/makerelease: make goimports-safe
LGTM=bradfitz
R=adg, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/140310045
2014-09-06 21:10:06 -04:00
Keith Randall dbed4e9b4f runtime: get rid of other Go->C calls in test exports.
testSchedLocal* tests need to malloc now because their
stack frames are too big to fit on the G0 stack.

LGTM=iant
R=golang-codereviews, iant, khr
CC=golang-codereviews
https://golang.org/cl/133660043
2014-09-06 10:07:23 -07:00
Russ Cox f8f630f5ec runtime: use reflect.call during panic instead of newstackcall
newstackcall creates a new stack segment, and we want to
be able to throw away all that code.

LGTM=khr
R=khr, iant
CC=dvyukov, golang-codereviews, r
https://golang.org/cl/139270043
2014-09-05 16:51:45 -04:00
Russ Cox fcbe51c9e3 misc/cgo/test: make issue5548 test pickier
If there is doubt about passing arguments correctly
(as there is in this test), there should be doubt about
getting the results back intact too. Using 0 and 1
(especially 0 for success) makes it easy to get a PASS
accidentally when the return value is not actually
being propagated. Use less common values.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/141110043
2014-09-05 14:59:09 -04:00
Russ Cox cb767247ca runtime: refactor/fix asmcgocall/asmcgocall_errno
Instead of making asmcgocall call asmcgocall_errno,
make both load args into registers and call a shared
assembly function.

On amd64, this costs 1 word in the asmcgocall_errno path
but saves 3 words in the asmcgocall path, and the latter
is what happens on critical nosplit paths on Windows.

On arm, this fixes build failures: asmcgocall was writing
the arguments for asmcgocall_errno into the wrong
place on the stack. Passing them in registers avoids the
decision entirely.

On 386, this isn't really needed, since the nosplit paths
have twice as many words to work with, but do it for consistency.

Update #8635
Fixes arm build (except GOARM=5).

TBR=iant
CC=golang-codereviews
https://golang.org/cl/134390043
2014-09-04 00:01:55 -04:00
Russ Cox 54138e1ac3 cmd/cgo, runtime: write cgo stub wrappers in Go, not C
LGTM=alex.brainman, iant
R=golang-codereviews, alex.brainman, iant
CC=dvyukov, golang-codereviews, khr, r
https://golang.org/cl/139070043
2014-09-03 11:36:14 -04:00
Ian Lance Taylor 709096f185 misc/cgo/testcdefs: comment out test of packed structs
The [568]c compilers no longer support packed structs, so
using them with -cdefs no longer works.  Just commenting out
the test, rather than removing it, in case this needs to be
handled.  It may be that -cdefs can go away entirely in the
future, in which case so can this directory.

LGTM=mdempsky
R=rsc, mdempsky
CC=golang-codereviews
https://golang.org/cl/136030043
2014-08-31 22:59:43 -04:00
Matthew Dempsky f2e7fa9d77 misc/cgo/test: disable issue 8428 regress test on darwin
Clang 3.2 and older (as shipped with OS X Mountain Lion and older)
outputs ambiguous DWARF debug info that makes it impossible for us to
reconstruct accurate type information as required for this test.

Fixes #8611.

LGTM=rsc
R=r, rsc, minux
CC=golang-codereviews
https://golang.org/cl/135990043
2014-08-28 22:40:57 -04:00
Matthew Dempsky 2c110a11e0 cmd/{ld,link,objdump}, runtime, debug/gosym: move linker-defined symbols into runtime package
Fixes #8092.

LGTM=rsc
R=iant, rsc
CC=golang-codereviews
https://golang.org/cl/126790043
2014-08-27 20:15:05 -04:00
Dave Cheney 84b70df44c misc/nacl: fix build
Add gofmt.go and gofmt_test.go as they are part of the test data set.

See CL 130440043.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/132820044
2014-08-22 18:36:01 +10:00
Dmitriy Vyukov fb0b923f67 misc/nacl: add debugging instructions
LGTM=dave, minux
R=golang-codereviews, dave, minux
CC=golang-codereviews, rsc
https://golang.org/cl/122570043
2014-08-15 20:51:44 +04:00
Matthew Dempsky ba30c082c0 cmd/cgo: check for compiler errors in the C preamble
E.g., here's the new "go build" output:

$ go build misc/cgo/errors/issue8442.go
# command-line-arguments
could not determine kind of name for C.issue8442foo

gcc errors for preamble:
misc/cgo/errors/issue8442.go:11:19: error: unknown type name 'UNDEF'

Fixes #8442.

LGTM=iant
R=iant, alex.brainman
CC=golang-codereviews
https://golang.org/cl/129160043
2014-08-14 09:21:58 -07:00
Matthew Dempsky 078a9cbc6c cmd/cgo, debug/dwarf: fix translation of zero-size arrays
In cgo, now that recursive calls to typeConv.Type() always work,
we can more robustly calculate the array sizes based on the size
of our element type.

Also, in debug/dwarf, the decision to call zeroType is made
based on a type's usage	within a particular struct, but dwarf.Type
values are cached in typeCache, so the modification might affect
uses of the type in other structs.  Current compilers don't appear
to share DWARF type entries for "[]foo" and "[0]foo", but they also
don't consistently share type entries in other cases.  Arguably
modifying the types is an improvement in some cases, but varying
translated types according to compiler whims seems like a bad idea.

Lastly, also in debug/dwarf, zeroType only needs to rewrite the
top-level dimension, and only if the rest of the array size is
non-zero.

Fixes #8428.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/127980043
2014-08-13 11:16:30 -07:00
Andrew Gerrand 00b75a237a misc/makerelease: exit with nonzero status code on error
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/129040043
2014-08-13 14:00:10 +10:00
Matthew Dempsky 11016f62d8 cmd/cgo: make C function pointers non-assignable
Fixes #7757.
Fixes #8488.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/118690044
2014-08-12 12:55:12 -07:00
Matthew Dempsky 31a996edb6 cmd/cgo: fix default alignment for empty structs
Fixes #5242.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/125120043
2014-08-11 22:10:17 -07:00
Shenghou Ma 2a37efbe1e misc/nacl/testzip.proto: add fewer files to the zip
LGTM=bradfitz, rsc
R=rsc, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/126940043
2014-08-11 16:56:36 -04:00
Shenghou Ma be96e52cce misc/nacl/testzip.proto: include cmd/internal/* to fix build
LGTM=adg, dave
R=golang-codereviews, adg, dave
CC=golang-codereviews
https://golang.org/cl/123050043
2014-08-07 21:48:34 -04:00
Ian Lance Taylor 7fdb0292a5 cmd/go: pass --build-id=none when generating a cgo .o
Some systems, like Ubuntu, pass --build-id when linking.  The
effect is to put a note in the output file.  This is not
useful when generating an object file with the -r option, as
it eventually causes multiple build ID notes in the final
executable, all but one of which are for tiny portions of the
file and are therefore useless.

Disable that by passing an explicit --build-id=none when
linking with -r on systems that might do this.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119460043
2014-08-07 12:38:39 -07:00
Andrew Gerrand cfed26c7ce misc/nacl: wrap lines in README file
LGTM=dan.kortschak, dave
R=dave, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/121350043
2014-08-07 11:50:27 +10:00
Matthew Dempsky 2b9f3fcead cmd/cgo: consistently map void* to *byte under -{c,go}defs
Fixes #8478.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/122150043
2014-08-06 10:28:19 -07:00
Matthew Dempsky 0da4b2dbc2 cmd/cgo: fix recursive type mapping
Instead of immediately completing pointer type mappings, add them to
a queue to allow them to be completed later.  This fixes issues	caused
by Type() returning arbitrary in-progress type mappings.

Fixes #8368.
Fixes #8441.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/122850043
2014-08-05 18:16:56 -07:00
Matthew Dempsky f7a8adbd51 cmd/cgo: fix handling of defs_linux.go
Instead of including <sys/types.h> to get size_t, instead include
the ISO C standard <stddef.h> header, which defines fewer additional
types at risk of colliding with the user code.  In particular, this
prevents collisions between <sys/types.h>'s userspace definitions with
the kernel definitions needed by defs_linux.go.

Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields.

Fixes #8477.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/120610043
2014-08-05 18:12:32 -07:00
Ian Lance Taylor f2f17c0ff2 cmd/cgo: for -godefs, promote first field of anonymous union
Update #6677

When a struct contains an anonymous union, use the type and
name of the first field in the union.

This should make the glibc <sys/resource.h> file work; in that
file struct rusage has fields like

__extension__ union
{
        long int ru_maxrss;
        __syscall_slong_t __ru_maxrss_word;
};

in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.

LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044
2014-08-05 17:10:15 -07:00
ChaiShushan 8cb040771b misc/pprof: support web profiles on windows/MinGW
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/117060043
2014-07-23 10:35:04 -07:00
Shenghou Ma 040eeff71c undo CL 109640045 / f97fb06525e5
Breaks build for FreeBSD. Probably clang related?

««« original CL description
cmd/cgo: disable inappropriate warnings when the gcc struct is empty

package main
//#cgo CFLAGS: -Wall
//void test() {}
import "C"
func main() {
    C.test()
}

This code will cause gcc issuing warnings about unused variable.

This commit use offset of the second return value of
Packages.structType to detect whether the gcc struct is empty,
and if it's directly invoke the C function instead of writing an
unused code.

LGTM=dave, minux
R=golang-codereviews, iant, minux, dave
CC=golang-codereviews
https://golang.org/cl/109640045

»»»

TBR=dfc
R=dave
CC=golang-codereviews
https://golang.org/cl/114990044
2014-07-18 02:59:54 -04:00
snyh 086df1dc77 cmd/cgo: disable inappropriate warnings when the gcc struct is empty
package main
//#cgo CFLAGS: -Wall
//void test() {}
import "C"
func main() {
    C.test()
}

This code will cause gcc issuing warnings about unused variable.

This commit use offset of the second return value of
Packages.structType to detect whether the gcc struct is empty,
and if it's directly invoke the C function instead of writing an
unused code.

LGTM=dave, minux
R=golang-codereviews, iant, minux, dave
CC=golang-codereviews
https://golang.org/cl/109640045
2014-07-18 02:47:21 -04:00
Shenghou Ma 0829533b6e misc/nacl: add go_nacl_arm_exec, update README
LGTM=dave, rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/109390043
2014-07-10 15:15:32 -04:00
David Crawshaw a5f8e8f99c androidtest.bash, misc/android: build scripts for android
LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/107640044
2014-07-09 06:56:49 -04:00
Shenghou Ma bbe5c93e93 misc/nacl, syscall: lazily initialize fs on nacl.
On amd64, the real time is reduced from 176.76s to 140.26s.
On ARM, the real time is reduced from 921.61s to 726.30s.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/101580043
2014-07-01 18:24:43 -04:00
Rob Pike ddbefae97e misc: delete editor and shell support
We are not the right people to support editor plugins, and the profusion
of editors in this CL demonstrates the unreality of pretending to do so.
People are free to create and advertise their own repos with support.

For discussion: https://groups.google.com/forum/#!topic/golang-dev/SA7fD470FxU

LGTM=rminnich, kamil.kisiel, gri, rsc, dave, josharian, ruiu
R=golang-codereviews, rminnich, kamil.kisiel, gri, rsc, dominik.honnef, dave, josharian, ruiu, ajstarks
CC=golang-codereviews
https://golang.org/cl/105470043
2014-07-01 09:21:25 -07:00
Dominik Honnef 933f272e71 misc/emacs: add new function godoc-at-point
LGTM=adonovan
R=adonovan, ruiu
CC=golang-codereviews
https://golang.org/cl/107160048
2014-06-17 15:52:29 -04:00
Dominik Honnef 2005bea7fd misc/emacs: replace hacky go--delete-whole-line with own implementation
Using flet to replace kill-region with delete-region was a hack,
flet is now (GNU Emacs 24.3) deprecated and at least two people
have reported an issue where using go--delete-whole-line would
permanently break their kill ring. While that issue is probably
caused by faulty third party code (possibly prelude), it's easier
to write a clean implementation than to tweak the hack.

LGTM=ruiu, adonovan
R=adonovan, ruiu
CC=adg, golang-codereviews
https://golang.org/cl/106010043
2014-06-17 14:43:35 -04:00
Andrew Gerrand 09576bc695 misc/makerelease: update default tag to release-branch.go1.3
TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/104090044
2014-06-12 13:29:22 +10:00
Shenghou Ma 3ad9df0422 nacltest.bash, misc/nacl/README: update NaCl docs.
LGTM=rsc
R=dave, rsc
CC=golang-codereviews
https://golang.org/cl/105030043
2014-06-10 20:20:49 -04:00
Ian Lance Taylor c22ed1290c cmd/cgo: for typedef of untagged struct, use typedef name in C code
Fixes #8148.

LGTM=cookieo9, rsc
R=rsc, cookieo9
CC=golang-codereviews
https://golang.org/cl/103080043
2014-06-05 10:42:03 -07:00
Ian Lance Taylor 4e65f18cae cmd/cgo: use same Go type for typedef to anonymous struct
If we see a typedef to an anonymous struct more than once,
presumably in two different Go files that import "C", use the
same Go type name.

Fixes #8133.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/102080043
2014-06-02 12:55:43 -07:00
Andrew Gerrand bb824b6a0f misc/makerelease: fix secret
Not sure how this snuck in undetected.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/106760043
2014-06-02 16:26:08 +10:00
Andrew Gerrand 865904f6d8 misc/makerelease: report uploads to the new downloads page
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102040047
2014-06-02 12:46:03 +10:00
Andrew Gerrand f836082566 misc/goplay: remove program
This program has barely been touched since it was first committed,
and in its current state it opens a code execution vector similar
to the one that was recently fixed in go.tools/playground/socket.

Rather than try to make it secure, remove it.

LGTM=minux, rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/102030047
2014-06-02 08:34:26 +10:00
Andrew Gerrand 0627fa84b7 misc/makerelease: upload files to Google Cloud Storage
LGTM=bradfitz
R=jasonhall, bradfitz
CC=golang-codereviews
https://golang.org/cl/91700047
2014-05-29 08:40:15 +10:00
Russ Cox 0782ee3ad5 cmd/cgo: given typedef struct S T, make C.T and C.struct_S interchangeable
For incomplete struct S, C.T and C.struct_S were interchangeable in Go 1.2
and earlier, because all incomplete types were interchangeable
(even C.struct_S1 and C.struct_S2).

CL 76450043, which fixed issue 7409, made different incomplete types
different from Go's point of view, so that they were no longer completely
interchangeable.

However, imprecision about C.T and C.struct_S - really the same
underlying C type - is the one behavior enabled by the bug that
is most likely to be depended on by existing cgo code.
Explicitly allow it, to keep that code working.

Fixes #7786.

LGTM=iant, r
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/98580046
2014-05-28 14:04:31 -04:00
Dmitriy Vyukov 0a8ce65c7a misc: properly spell Chrome in doc
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/99440046
2014-05-26 19:20:45 +04:00
Ian Lance Taylor f85600859d cmd/ld: really import runtime/cgo for external link
Fixes #8032.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/95580043
2014-05-20 21:36:50 -07:00
Russ Cox 0c2a727477 build: make nacl pass
Add nacl.bash, the NaCl version of all.bash.
It's a separate script because it builds a variant of package syscall
with a large zip file embedded in it, containing all the input files
needed for tests.

Disable various tests new since the last round, mostly the ones using os/exec.

Fixes #7945.

LGTM=dave
R=golang-codereviews, remyoudompheng, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/100590044
2014-05-20 12:10:19 -04:00
Andrew Gerrand 9cd759aecc misc/makerelease: handle update tour file layout
Fixes #7835.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/94670044
2014-05-20 15:52:08 +10:00
Alex Brainman fcfc17f1b8 misc/pprof: always use go tool objdump on windows
Fixes #7406.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/97440043
2014-05-15 15:54:42 +10:00
Russ Cox 2d1a9510ed cmd/cgo: omit misaligned struct fields, like we omit bitfields
Fixes #7560.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/96300045
2014-05-12 23:48:20 -04:00
Russ Cox e5c105033a cmd/gc: disable link-time copying of un-Go-initialized globals
If you write:

        var x = 3

then the compiler arranges for x to be initialized in the linker
with an actual 3 from the data segment, rather than putting
x in the bss and emitting init-time "x = 3" assignment code.

If you write:

        var y = x
        var x = 3

then the compiler is clever and treats this the same as if
the code said 'y = 3': they both end up in the data segment
with no init-time assignments.

If you write

        var y = x
        var x int

then the compiler was treating this the same as if the
code said 'x = 0', making both x and y zero and avoiding
any init-time assignment.

This copying optimization to avoid init-time assignment of y
is incorrect if 'var x int' doesn't mean 'x = 0' but instead means
'x is initialized in C or assembly code'. The program ends up
with 'y = 0' instead of 'y = the value specified for x in that other code'.

Disable the propagation if there is no initializer for x.

This comes up in some uses of cgo, because cgo generates
Go globals that are initialized in accompanying C files.

Fixes #7665.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/93200044
2014-05-09 16:03:44 -04:00
Shenghou Ma 6be21b9f02 misc/vim/readme.txt: workaround weird OS X vim bug.
The vi bundled with OS X has a weird bug in that if you turn off
filetype in .vimrc when it's not turned on, even a clean exit of
vi will return 1 which breaks almost everything.

While we're at it, add hint to change $GOROOT to its actual value
in .vimrc.

Fixes #7865.

LGTM=robert.hencke, dsymonds
R=golang-codereviews, robert.hencke, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/96800046
2014-04-28 14:24:14 -04:00
Ian Lance Taylor 9fc6c0598b misc/cgo/test/backdoor: add gccgo version of backdoor function
For the gc compiler the Go function Issue7695 is defined in
runtime.c, but there is no way to do that for gccgo, because
there is no way to get the correct pkgpath.  The test is not
important for gccgo in any case.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93870044
2014-04-26 22:31:32 -07:00
Russ Cox dc370995a8 test: demo for issue 7695
Cgo writes C function declarations pretending every arg is a pointer.
If the C function is deferred, it does not inhibit stack copying on split.
The stack copying code believes the C declaration, possibly misinterpreting
integers as pointers.

Probably the right fix for Go 1.3 is to make deferred C functions inhibit
stack copying.

For Go 1.4 and beyond we probably need to make cgo generate Go code
for 6g here, not C code for 6c.

Update #7695

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/83820043
2014-04-16 23:06:37 -04:00
Rui Ueyama 3d63ec240e misc/emacs: ignore backquote in comment or string
go-mode on Emacs 23 wrongly recognizes a backquote in a comment or
a string as a start of a raw string literal. Below is an example
that go-mode does not work well. This patch is to fix that issue.

  // `
  var x = 1
  // `

LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/84900043
2014-04-09 12:28:27 -04:00
Russ Cox f8c25b62b8 benchcmp: leave a forwarding script
People (like me!) will still try to run misc/benchcmp
and wonder where it went. Tell them.

LGTM=bradfitz
R=golang-codereviews, bradfitz, dave
CC=adg, golang-codereviews, r
https://golang.org/cl/82710043
2014-03-31 16:39:41 -04:00
Rui Ueyama 5f5e280e14 misc/emacs: do not highlight built-in function if not followed by '('
Name of built-in function is not reserved word in Go, and you can
use it as variable name. "new" is often used as local variable, for
instance.

This patch is to apply font-lock-builtin-face only when built-in
function name is followed by '(', so that it doesn't highlight
non-function variable that happen to have the same name as built-in
function.

LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/79260043
2014-03-27 17:35:07 -04:00
Daniel Morsing 0f82cfd3f0 cmd/cgo: enforce typing of 0-sized types
cgo represents all 0-sized and unsized types internally as [0]byte. This means that pointers to incomplete types would be interchangable, even if given a name by typedef.

Fixes #7409.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/76450043
2014-03-27 20:23:16 +00:00
Rui Ueyama 444dd26bf4 misc/emacs: handle backslash in raw string in Emacs 23
Go-mode in Emacs 23 does not recognize a backslash followed
by a backquote as end of raw string literal, as it does not
support syntax-propertize-function which Go-mode uses to
remove special meaning from backslashes in ``.

This patch provides a fallback mechanism to do the same thing
using font-lock-syntactic-keywords, which is supported by
Emacs 23.

LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef
CC=adonovan, golang-codereviews
https://golang.org/cl/78730048
2014-03-27 15:22:52 -04:00
Rui Ueyama 6119dc1b52 misc/bash, misc/zsh: fix completion rules
This patch includes fixes pointed out in CL 52140043, which was
originally written by john.gosset.

LGTM=minux.ma
R=golang-codereviews, minux.ma
CC=golang-codereviews
https://golang.org/cl/80320043
2014-03-27 00:29:55 -04:00
David Barnett 3eb591ff76 misc/vim: Disable automatic line wrapping by textwidth.
If someone configures a 'textwidth' in go files, vim will by default insert
newlines into long lines as you type, which breaks syntax and doesn't really
make sense for go code. This fixes the default.

LGTM=dsymonds
R=golang-codereviews, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/76890046
2014-03-26 13:51:16 +11:00
Dave Cheney 9cb4963d18 misc/nacl: add Native Client support scripts and documentation
LGTM=josharian, dan.kortschak
R=golang-codereviews, josharian, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/75080043
2014-03-24 12:34:09 +11:00
Rui Ueyama 50f1e1a6b9 misc/bash/go: remove "doc" subcommand autocompletion
"go doc" has been removed in CL 17799.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/77420045
2014-03-18 21:01:23 -07:00
Rui Ueyama 2940dd4bf4 misc/bash/go: Add a completion rule for "go env".
"env" is a valid go command. This patch is to make bash to autocomplete it.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/74660045
2014-03-17 11:58:02 -07:00
Dominik Honnef e9ba9470bc misc/emacs: correctly fontify methods when go-fontify-function-calls is nil
We were fontifying the wrong part of method declarations

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/66120043
2014-03-12 11:02:42 -04:00
Andrew Gerrand 9d1940bc74 misc/makerelease: use windows installer resources from local goroot
This broke when we renamed the tool, and I missed this fix when I
fixed darwin last week.

LGTM=minux.ma, bradfitz
R=golang-codereviews, minux.ma, bradfitz
CC=golang-codereviews
https://golang.org/cl/70670043
2014-03-03 12:50:29 +11:00
Andrew Gerrand 8d2465ab50 go/misc/makerelease: pin go-tour repo to a specific revision
We're about to commit some wide-sweeping changes to the go-tour and I
would rather not include them in Go 1.2.1, which is due in the next
week or so.

Also fix the makerelease tool; it has been broken since it was
renamed from bindist.

LGTM=campoy
R=campoy
CC=golang-codereviews
https://golang.org/cl/68780043
2014-02-28 11:09:26 +11:00
Shenghou Ma bcf3d55ed9 misc/cgo/testso: don't use TLS variables on Darwin and OpenBSD.
Fix build for 10.6 Darwin builders and OpenBSD builers.

LGTM=jsing
R=golang-codereviews, dave, jsing
CC=golang-codereviews
https://golang.org/cl/67710043
2014-02-23 20:37:43 -05:00
Shenghou Ma d4a9bbef51 cmd/ld: don't emit unreachable dynimport symbols in ELF symtab.
Fix build for Dragonfly BSD.
Fixes #7318.
Fixes #7367.

LGTM=jsing, iant
R=jsing, iant, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/64340043
2014-02-23 16:20:40 -05:00
Dominik Honnef cce25c88ce misc/emacs: add support for ff-find-other-file
c-mode classically uses ff-find-other-file to toggle between headers
and implementation. For Go it seemingly makes sense to jump between
implementation and test.

While there's no enforced mapping of file names for tests, the mapping
in this CL seems to be very common at least throughout the standard
library, and ff-find-other-file fails gracefully when the mapping
doesn't apply.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/65750044
2014-02-18 22:23:55 -05:00
Dominik Honnef 0d9b9aafd5 misc/emacs: actually use point argument that is passed to godef--call
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/62600043
2014-02-18 21:51:47 -05:00
Dmitriy Vyukov bf0d71af29 runtime: more precise mprof sampling
Better sampling of objects that are close in size to sampling rate.
See the comment for details.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/43830043
2014-02-12 22:36:45 +04:00
Dmitriy Vyukov fa3a2a84cc misc/pprof: support web profiles on windows
LGTM=bradfitz
R=golang-codereviews, bradfitz, alex.brainman
CC=golang-codereviews
https://golang.org/cl/61260044
2014-02-10 13:52:58 +04:00
Josh Bleecher Snyder 57bc80b5e8 cmd/go, doc/go1.3.txt: misc/benchcmp has been replaced by go tool benchcmp
Fixes #7016.

LGTM=r
R=r
CC=adg, bradfitz, dave, golang-codereviews
https://golang.org/cl/60100043
2014-02-04 11:53:13 -08:00
Ian Lance Taylor 1683dab725 cmd/ld: fix bug with "runtime/cgo" in external link mode
In external link mode the linker explicitly adds the string
constant "runtime/cgo".  It adds the string constant using the
same symbol name as the compiler, but a different format.  The
compiler assumes that the string data immediately follows the
string header, but the linker puts the two in different
sections.  The result is bad string data when the compiler
sees "runtime/cgo" used as a string constant.

The compiler assumption is in datastring in [568]g/gobj.c.
The linker layout is in addstrdata in ld/data.c.  The compiler
assumption is valid for string literals.  The linker is not
creating a string literal, so its assumption is also valid.

There are a few ways to avoid this problem.  This patch fixes
it by only doing the fake import of runtime/cgo if necessary,
and by only creating the string symbol if necessary.

Fixes #7234.

LGTM=dvyukov
R=golang-codereviews, dvyukov, bradfitz
CC=golang-codereviews
https://golang.org/cl/58410043
2014-01-30 09:25:47 -08:00
Russ Cox abd556ab70 misc/cgo/testtls: make test less flaky
Now it should always fail on ARM.
(The fix is on its way too.)

R=iant, r, dave
CC=golang-codereviews
https://golang.org/cl/55140043
2014-01-21 19:44:51 -05:00
Rowan Worth c4770b991b runtime: co-exist with NPTL's pthread_cancel.
NPTL uses SIGRTMIN (signal 32) to effect thread cancellation.
Go's runtime replaces NPTL's signal handler with its own, and
ends up aborting if a C library that ends up calling
pthread_cancel is used.

This patch prevents runtime from replacing NPTL's handler.

Fixes #6997.

R=golang-codereviews, iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/47540043
2014-01-09 09:34:04 -08:00
Dominik Honnef 79653e4121 misc/emacs: fontify type switch correctly
Require at least one space after "type" and do not fontify closing
parenthesis of type switch as a type.

R=adonovan
CC=golang-codereviews
https://golang.org/cl/37720050
2014-01-06 11:11:03 -05:00