David Crawshaw [Mon, 20 Apr 2015 15:32:11 +0000 (11:32 -0400)]
cmd/dist: enable c-archive test on darwin/arm64
Turns out all the necessary pieces have already been submitted.
Change-Id: I19c8d614cd756821ce400ca7a338029002780b18
Reviewed-on: https://go-review.googlesource.com/9076 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
David Crawshaw [Mon, 20 Apr 2015 13:33:25 +0000 (09:33 -0400)]
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>
Michael Hudson-Doyle [Sun, 5 Apr 2015 02:48:42 +0000 (14:48 +1200)]
cmd/internal/gc, cmd/go: fix value of importpath symbol
In https://golang.org/cl/7797 I attempted to use myimportpath to set the value
of the go.importpath.$foo. symbol for the module being compiled, but I messed
it up and only set the name (which the linker rewrites anyway). This lead to
the importpath for the module being compiled being "". This was hard to notice,
because all modules that import another define the importpath for their
imported modules correctly -- but main is not imported, and this meant that the
reflect module saw all fields of all types defined in the main module as
exported.
The fix is to do what I meant to do the first time, add a test and change the
go tool to compile main packages with -p main and not -p
command-line-arguments.
Change-Id: Ic965b48bdc0e0ffba9bed5ff6b3d28ff742f8b2d
Reviewed-on: https://go-review.googlesource.com/9100 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change fixes inconsistent error values on Accept{,TCP,Unix}.
Updates #4856.
Change-Id: Ie3bb534c19a724cacb3ea3f3656e46c810b2123f
Reviewed-on: https://go-review.googlesource.com/8996 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change fixes inconsistent error values on Close, CloseRead and
CloseWrite.
Updates #4856.
Change-Id: I3c4d46ccd7d6e1a2f52d8e75b512f62c533a368d
Reviewed-on: https://go-review.googlesource.com/8994 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change fixes inconsistent error values on Write,
WriteTo{,UDP,IP,Unix} and WriteMsg{UDP,IP,Unix}.
Updates #4856.
Change-Id: I4208ab6a0650455ad7d70a80a2d6169351d6055f
Reviewed-on: https://go-review.googlesource.com/8993 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change fixes inconsistent error values on Read,
ReadFrom{,UDP,IP,Unix} and ReadMsg{UDP,IP,Unix}.
Updates #4856.
Change-Id: I7de5663094e09be2d78cdb18ce6f1e7ec260888d
Reviewed-on: https://go-review.googlesource.com/8992 Reviewed-by: Ian Lance Taylor <iant@golang.org>
net: break up TestErrorNil into Test{Dial,Listen,ListenPacket}Error
Change-Id: I7c6c91a0551aacb49e1beb4a39215b93c8c7fcfa
Reviewed-on: https://go-review.googlesource.com/8997 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Matthew Dempsky [Sat, 18 Apr 2015 00:05:47 +0000 (17:05 -0700)]
cmd/cgo: more robust detection of clang
Fixes #10453.
Change-Id: I77470279865d4c954df615d6594c69edf68c28ca
Reviewed-on: https://go-review.googlesource.com/9090 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change adds a type addrinfoErrno to represent getaddrinfo,
getnameinfo-specific errors, and uses it in cgo-based lookup functions.
Also retags cgo files for clarification and does minor cleanup.
Change-Id: I6db7130ad7bf35bbd4e8839a97759e1364c43828
Reviewed-on: https://go-review.googlesource.com/9020 Reviewed-by: Ian Lance Taylor <iant@golang.org>
David Crawshaw [Thu, 9 Apr 2015 11:37:17 +0000 (07:37 -0400)]
cmd/internal/ld: replace Diag;Errorexit with Exitf
I have left the Diag calls in place where I believe Ctxt.Cursym != nil
which means this CL is not the improvement I had hoped for. However
it is now safe to call Exitf whereever you are in the linker, which
makes it easier to reason about some code.
Change-Id: I8261e761ca9719f7d216e2747314adfe464e3337
Reviewed-on: https://go-review.googlesource.com/8668 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
cmd/internal/gc, cmd/6g: generate boolean values without jumps
Use SETcc instructions instead of Jcc to generate boolean values.
This generates shorter, jump-free code, which may in turn enable other
peephole optimizations.
Ian Lance Taylor [Fri, 17 Apr 2015 18:38:58 +0000 (11:38 -0700)]
runtime: add -buildmode=c-archive/c-shared support for linux/386
Change-Id: I87147ca6bb53e3121cc4245449c519509f107638
Reviewed-on: https://go-review.googlesource.com/9009
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Ian Lance Taylor [Thu, 16 Apr 2015 17:08:20 +0000 (10:08 -0700)]
cmd/internal/ld, cmd/dist: support -buildmode=c-archive on linux
Change-Id: I8c97751a79b57197428b0f0b66fc9575708a2eb0
Reviewed-on: https://go-review.googlesource.com/8979
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
readyExecute passes a closure to mcall that captures an argument to
readyExecute. Since mcall is marked noescape, this closure lives on
the stack of the calling goroutine. However, the closure puts the
calling goroutine on the run queue (and switches to a new
goroutine). If the calling goroutine gets scheduled before the mcall
returns, this stack-allocated closure will become invalid while it's
still executing. One consequence of this we've observed is that the
captured gp variable can get overwritten before the call to
execute(gp), causing execute(gp) to segfault.
Fix this by passing the currently captured gp variable through a field
in the calling goroutine's g struct so that the func is no longer a
closure.
To prevent problems like this in the future, this change also removes
the go:noescape annotation from mcall. Due to a compiler bug, this
will currently cause a func closure passed to mcall to be implicitly
allocated rather than refusing the implicit allocation. However, this
is okay because there are no other closures passed to mcall right now
and the compiler bug will be fixed shortly.
Rob Pike [Fri, 17 Apr 2015 17:27:05 +0000 (10:27 -0700)]
cmd/go: implement the long-promised -run flag for go generate
Trivial to do, but overlooked for 1.4, which is good because I prefer
the new design, which is just to match against the source code of
the line rather than the command word alone.
Hyang-Ah Hana Kim [Thu, 16 Apr 2015 17:46:58 +0000 (13:46 -0400)]
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>
David Crawshaw [Fri, 17 Apr 2015 02:01:20 +0000 (22:01 -0400)]
runtime: export main.main for android
Previously we started the Go runtime from a JNI function call, which
eventually called the program's main function. Now the runtime is
initialized by an ELF initialization function as a c-shared library,
and the program's main function is not called. So now we export main
so it can be called from JNI.
This is necessary for all-Go apps because unlike a normal shared
library, the program loading the library is not written by or known
to the programmer. As far as they are concerned, the .so is
everything. In fact the same code is compiled for iOS as a normal Go
program.
Change-Id: I61c6a92243240ed229342362231b1bfc7ca526ba
Reviewed-on: https://go-review.googlesource.com/9015 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
David Crawshaw [Thu, 16 Apr 2015 20:05:52 +0000 (16:05 -0400)]
runtime: do not run main when buildmode=c-shared
Change-Id: Ie7f85873978adf3fd5c739176f501ca219592824
Reviewed-on: https://go-review.googlesource.com/9011 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Matthew Dempsky [Thu, 16 Apr 2015 19:03:10 +0000 (12:03 -0700)]
go/build: deps check all std packages
Instead of only checking packages that are already listed in pkgDeps,
apply deps checks to all standard library packages.
To avoid slowing testing down too much, instead of running "go list
std" in a subprocess like cmd/api or cmd/dist, this test manually
walks the GOROOT src directory to enumerate packages.
Timings on an HP Z620 using linux/amd64:
short full
before 0.092s 4.880s
after 0.137s 5.104s
Additionally, a handful of packages that were previously unchecked are
now listed, along with their current dependencies. These should
probably eventually be moved elsewhere and assigned appropriate
allowable-dependency sets. For now, they've been grandfathered in by
simply assigning them their current dependencies, so that followup CLs
can review them individually as appropriate.
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>
net: fix inconsistent error values on Dial, Listen partially
This change makes TestDialError, TestListenError work without any
external dependency, enables them by default, and removes unnecessary
-run_error_test flag for fixing #4856.
Also fixes inconsistent error values on Dial, Listen partially as a
first stab.
Updates #4856.
Change-Id: Ie10c151ae06759085f352c7db2ca45107a81914f
Reviewed-on: https://go-review.googlesource.com/8903 Reviewed-by: Ian Lance Taylor <iant@golang.org>
In followup changes, we'll move OpError around from the netFD layer to
the Conn layer for fixing #4856. Before doing that, this change makes
netFD of Plan 9 match netFD for POSIX platforms to avoid conflict.
Change-Id: Iea7632716d48722a1758e52effefec964a3a9442
Reviewed-on: https://go-review.googlesource.com/8990 Reviewed-by: David du Colombier <0intro@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
David Crawshaw [Thu, 16 Apr 2015 19:53:05 +0000 (15:53 -0400)]
cmd/internal/ld: use usual flooding for c-archive
I said I removed this from cl/8711 in response to your comment, but
apparently I did not.
misc/cgo/testcarchive continues to pass on darwin/amd64.
Change-Id: I6410782f2a78bf117741628fb71cac56e289b590
Reviewed-on: https://go-review.googlesource.com/9010 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Hudson-Doyle [Wed, 1 Apr 2015 02:53:52 +0000 (15:53 +1300)]
cmd/go: have go run, go list respect -buildmode/-linkshared
Change-Id: I749fd91cd3c7581cdcc97a15e8eeee0c20f0b259
Reviewed-on: https://go-review.googlesource.com/8805 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
David Crawshaw [Thu, 16 Apr 2015 17:49:36 +0000 (13:49 -0400)]
runtime: darwin/arm64 c-archive entry point
Change-Id: Ib227aa3e14d01a0ab1ad9e53d107858e045d1c42
Reviewed-on: https://go-review.googlesource.com/8984 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Jonathan Rudenberg [Wed, 15 Apr 2015 19:00:53 +0000 (15:00 -0400)]
crypto/tls: fix test data generation
- Multiple GetCertificate tests shared the same name and were
overwriting each other, each test now has a unique name.
- expectAlert was not implemented in the data updater, the single
test that used it has been replaced with a ClientHello failure
test.
Fixes #10470
Change-Id: I500738f6302ffa863d7ee45d85fa8773155e0614
Reviewed-on: https://go-review.googlesource.com/8959 Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
David Crawshaw [Thu, 16 Apr 2015 17:39:16 +0000 (13:39 -0400)]
runtime/cgo: enable arm64 EXC_BAD_ACCESS handler
Change-Id: I8e912ff9327a4163b63b8c628aa3546e86ddcc02
Reviewed-on: https://go-review.googlesource.com/8983 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Michael Hudson-Doyle [Sun, 29 Mar 2015 23:11:47 +0000 (23:11 +0000)]
reflect, cmd/internal/gc: look for pointer types by string before synthesizing
The ptrto field of the type data cannot be relied on when dynamic linking: a
type T may be defined in a module that makes no use of pointers to that type,
but another module can contain a package that imports the first one and does use
*T pointers. The second module will end up defining type data for *T and a
type.*T symbol pointing at it. It's important that calling .PtrTo() on the
refect.Type for T returns this type data and not some synthesized object, so we
need reflect to be able to find it!
Fortunately, the reflect package already has a mechanism for doing this sort of
thing: ChanOf/MapOf/etc look for pre-existing type data by name. So this change
just extends PtrTo() to consult this too, and changes the compiler to include
pointer types in the data consulted when compiling for dynamic linking.
Change-Id: I3773c066fd0679a62e9fc52a84bf64f1d67662b7
Reviewed-on: https://go-review.googlesource.com/8232 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
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>
David Crawshaw [Wed, 15 Apr 2015 18:59:46 +0000 (14:59 -0400)]
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.
Matthew Dempsky [Mon, 13 Apr 2015 22:31:28 +0000 (15:31 -0700)]
compress/flate: reject invalid Huffman bit sizes
If the requested coding bit sizes don't result in a full binary tree,
then reject the input as invalid.
Exception: We still need to allow degenerate Huffman codings with a
single 1-bit code to be compatible with zlib and files compressed with
Go's compress/flate package.
Update #10426.
Change-Id: I171b98d12e65b4deb9f4031cd802407ebb5e266c
Reviewed-on: https://go-review.googlesource.com/8922 Reviewed-by: Nigel Tao <nigeltao@golang.org>
Shenghou Ma [Sat, 11 Apr 2015 00:08:22 +0000 (20:08 -0400)]
cmd/7g: disable duff's device on darwin
ld64 cannot handle BR26 reloc with non-zero addend. It incorrectly
thinks that non-zero addend for BR26 means the code is not PIC, but
those BR26 relocs should be fully resolved at link time.
Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f01 Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8780 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This code's test coverage is ad hoc at best, and it's easy to make
changes that accidentally regress invariants. This CL adds a "sanity"
constant that can be changed to "true" during development to add extra
runtime checking that the Huffman decoder tables are sane.
Change-Id: I0d0ca53ad7c9566be18046d9b255e1a30059f28b
Reviewed-on: https://go-review.googlesource.com/8974 Reviewed-by: Nigel Tao <nigeltao@golang.org>
Dave Day [Tue, 23 Dec 2014 04:19:30 +0000 (15:19 +1100)]
reflect: add FuncOf function
This also involves adding functions to typelinks along with a minor
change to ensure they are sorted correctly.
Change-Id: I054a79b6498a634cbccce17579f52c299733c2cf
Reviewed-on: https://go-review.googlesource.com/1996 Reviewed-by: Ian Lance Taylor <iant@golang.org>
net: fix TestDialGoogle with -ipv6 when CGO_ENABLED=0
Under some dial tests that require external network connectivity, we
must prevent application traffic but must not interfere with control
plane traffic such as DNS message exchange. But test helper function
disableSocketConnect prevents both application and control plane traffic
unconditionally and makes some dial tests with -ipv6 fail when
CGO_ENABLED=0.
This change makes disableSocketConnect take a look at not only address
family but socket type for fixing some dial tests with -ipv6 when
CGO_ENBALED=0.
Change-Id: I32241d9592d31483424bb5e69cb4d56f3fc20312
Reviewed-on: https://go-review.googlesource.com/8743 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Hudson-Doyle [Wed, 1 Apr 2015 01:17:43 +0000 (14:17 +1300)]
cmd/6l: call runtime.addmoduledata from .init_array
Change-Id: I09e84161d106960a69972f5fc845a1e40c28e58f
Reviewed-on: https://go-review.googlesource.com/8331
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Hudson-Doyle [Sun, 22 Mar 2015 23:30:18 +0000 (12:30 +1300)]
cmd/go: support -buildmode=shared
You can now do 'go install -buildmode=shared std' and get yourself
a nice (33 meg) libstd.so (which is not useful until there is -linkshared
support as well, of course).
Change-Id: Ie9b7e7f72abc7d369a6e3ecc98903a9d197bd6e6
Reviewed-on: https://go-review.googlesource.com/8300
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
David Crawshaw [Wed, 15 Apr 2015 18:47:08 +0000 (14:47 -0400)]
cmd/test: require external linking for c-archive
Change-Id: I9ceceb29291ea9f5d7b675dfabd665c5e3618471
Reviewed-on: https://go-review.googlesource.com/8955 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Hudson-Doyle [Tue, 14 Apr 2015 08:22:23 +0000 (10:22 +0200)]
go/build: support -installsuffix with gccgo
Fixes #10449
Change-Id: I1dc2d0213e6a46f3609222d5460c1a54081e2471
Reviewed-on: https://go-review.googlesource.com/8931 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Hudson-Doyle [Tue, 14 Apr 2015 08:20:18 +0000 (10:20 +0200)]
cmd/go, go/build: add build.Package.PkgTargetRoot
This is $GOPATH/pkg/linux_amd64 or similar. cmd/go already had a grotty calculation
of this and I need to add another one for -buildmode=shared.
Change-Id: Ied28c9b7cce671da8d45920e124a3e0c2501258a
Reviewed-on: https://go-review.googlesource.com/8930 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Michael Hudson-Doyle [Sun, 12 Apr 2015 00:31:28 +0000 (02:31 +0200)]
cmd/internal/ld: allow -r to override rpath when -linkshared
Including having -r "" preventing rpath from being set at all.
Change-Id: Ib40d7bf93a6e9ef21985c4a05b5703e4fbd1cd1b
Reviewed-on: https://go-review.googlesource.com/8806 Reviewed-by: Ian Lance Taylor <iant@golang.org>
However, in order to be able to jump into
the middle of a block of MOVQs, the call
site needs to pre-adjust DI.
If we're clearing a small area, the cost
of that DI pre-adjustment isn't repaid.
This CL switches the DUFFZERO implementation
to use a hybrid strategy, in which small
clears use STOSQ as before, but large clears
use mostly MOVQ/ADDQ blocks.
Michael Hudson-Doyle [Fri, 10 Apr 2015 22:01:54 +0000 (10:01 +1200)]
runtime: merge slice and sliceStruct
By removing type slice, renaming type sliceStruct to type slice and
whacking until it compiles.
Has a pleasing net reduction of conversions.
Fixes #10188
Change-Id: I77202b8df637185b632fd7875a1fdd8d52c7a83c
Reviewed-on: https://go-review.googlesource.com/8770 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Michael Hudson-Doyle [Wed, 15 Apr 2015 13:18:00 +0000 (15:18 +0200)]
cmd/dist: fix bootstrapping with gccgo on 386
We forgot to add the !gccgo tag to cpuid_386.s.
Change-Id: I2de2ed92ac9686c9365cb37cd29121fa98c2bf37
Reviewed-on: https://go-review.googlesource.com/8960 Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Rob Pike [Thu, 9 Apr 2015 23:30:48 +0000 (16:30 -0700)]
fmt: treat reflect.Value specially - as the value it holds
When a reflect.Value is passed to Printf (etc.), fmt called the
String method, which does not disclose its contents. To get the
contents, one could call Value.Interface(), but that is illegal
if the Value is not exported or otherwise forbidden.
This CL improves the situation with a trivial change to the
fmt package: when we see a reflect.Value as an argument,
we treat it exactly as we treat a reflect.Value we make inside
the package. This means that we always print the
contents of the Value as if _that_ was the argument to Printf.
This is arguably a breaking change but I think it is a genuine
improvement and no greater a break than many other tweaks
we have made to formatted output from this package.
net/internal/socktest: add hook for Listen, failed system call counters
Change-Id: Icaac9a48a3b9a3c5542235162e21ab8303592965
Reviewed-on: https://go-review.googlesource.com/8641 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Dave Cheney [Wed, 15 Apr 2015 09:11:47 +0000 (19:11 +1000)]
runtime: mark all runtime.cputicks implementations NOSPLIT
Fixes #10450
runtime.cputicks is called from runtime.exitsyscall and must not
split the stack. cputicks is implemented in several ways and the
NOSPLIT annotation was missing from a few of these.
Alex Brainman [Tue, 14 Apr 2015 00:48:05 +0000 (10:48 +1000)]
runtime: really pass return value to Windows in externalthreadhandler
When Windows calls externalthreadhandler it expects to receive
return value in AX. We don't set AX anywhere. Change that.
Store ctrlhandler1 and profileloop1 return values into AX before
returning from externalthreadhandler.
Fixes #10215.
Change-Id: Ied04542cc3ebe7d4a26660e970f9f78098143591
Reviewed-on: https://go-review.googlesource.com/8901 Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>