1
0
mirror of https://github.com/golang/go synced 2024-11-08 04:56:16 -07:00
Commit Graph

12313 Commits

Author SHA1 Message Date
Russ Cox
d278f09333 cmd/go: skip TestScript/mod_* on Windows
I don't know why it's failing.
Filed #26457.

Change-Id: I84833293a572c5a1a25135bd01cb88518fc7441e
Reviewed-on: https://go-review.googlesource.com/124857
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-19 05:40:37 +00:00
Russ Cox
eec9a89560 cmd/go/internal/str: simplify HasPathPrefix by epsilon
Pointed out in CL 122396.
An empty prefix has already been handled above.

Change-Id: Ib94df0a9c8c0517f932b90126232111caa9ad289
Reviewed-on: https://go-review.googlesource.com/124797
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19 05:28:16 +00:00
Russ Cox
6140829edf cmd/go: convert still more module tests to scripts
Change-Id: I249bb848c9911948dbd84cd88ad043a61ed6ea6b
Reviewed-on: https://go-review.googlesource.com/124699
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19 05:28:09 +00:00
Russ Cox
e3f15e3b1d cmd/go: convert even more module tests to scripts
Change-Id: Iba185e00e9df2462e9089566053f6c64e24a6a92
Reviewed-on: https://go-review.googlesource.com/124698
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19 05:28:03 +00:00
Russ Cox
4d5bf3cca5 cmd/go: convert more module tests to scripts
Change-Id: I8a36fad061bdf9a19f40531511f3f5717db13b60
Reviewed-on: https://go-review.googlesource.com/124697
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19 05:27:55 +00:00
Russ Cox
d286d4b141 cmd/go: convert module tests to scripts
Change-Id: If0976d15027db795f1383ef709c49c838cbb6953
Reviewed-on: https://go-review.googlesource.com/124696
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19 05:27:53 +00:00
Daniel Martí
ba6974fdc3 cmd/compile: fix crash on invalid struct literal
If one tries to use promoted fields in a struct literal, the compiler
errors correctly. However, if the embedded fields are of struct pointer
type, the field.Type.Sym.Name expression below panics.

This is because field.Type.Sym is nil in that case. We can simply use
field.Sym.Name in this piece of code though, as it only concerns
embedded fields, in which case what we are after is the field name.

Added a test mirroring fixedbugs/issue23609.go, but with pointer types.

Fixes #26416.

Change-Id: Ia46ce62995c9e1653f315accb99d592aff2f285e
Reviewed-on: https://go-review.googlesource.com/124395
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-07-18 20:32:04 +00:00
Ben Shi
f6ce1e2aa5 cmd/compile: fix an arm64's comparison bug
The arm64 backend generates "TST" for "if uint32(a)&uint32(b) == 0",
which should be "TSTW".

fixes #26438

Change-Id: I7d64c30e3a840b43486bcd10eea2e3e75aaa4857
Reviewed-on: https://go-review.googlesource.com/124637
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-07-18 14:15:05 +00:00
Ian Lance Taylor
a371bc2dfd cmd/cgo: don't report inconsistency error for incomplete typedef
In CLs 122575 and 123177 the cgo tool started explicitly looking up
typedefs. When there are two Go files using import "C", and the first
one has an incomplete typedef and the second one has a complete
version of the same typedef, then we will now record a version of the
first typedef which will not match the recorded version of the second
typedef, producing an "inconsistent definitions" error. Fix this by
silently merging incomplete typedefs with complete ones.

Fixes #26430

Change-Id: I9e629228783b866dd29b5c3a31acd48f6e410a2d
Reviewed-on: https://go-review.googlesource.com/124575
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-18 04:17:51 +00:00
Russ Cox
e161b1e8ee cmd/go/internal/module: allow v0.0.0 pseudoversion for gopkg.in/check.v1
It worked once. It needs to keep working.

Change-Id: Iaa43726e1c78f0c4a20b5805c7c2bfa76fab2489
Reviewed-on: https://go-review.googlesource.com/124383
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-18 02:09:03 +00:00
Russ Cox
56deebb3e4 cmd/go: add clean -modcache
We need an easy way to remove $GOPATH/src/mod,
especially since all the directories are marked read-only.

Change-Id: Ib9e8e47e50048f55ecc4de0229b06c4a416ac114
Reviewed-on: https://go-review.googlesource.com/124382
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-18 02:09:01 +00:00
Russ Cox
30678788b2 cmd/go/internal/modfetch: make subdirectories unwritable too
The top-level directory in a module was marked unwritable
but not the subdirectories. Fix that.

Change-Id: Ia57e5343624753851d9fe1ddfe496b870b67f924
Reviewed-on: https://go-review.googlesource.com/124381
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-18 02:09:00 +00:00
Russ Cox
5c622a5bf3 cmd/go/internal/modfetch: restrict file names in zip files, avoid case-insensitive collisions
Within the zip file for a given module, disallow names that are invalid
on various operating systems (mostly Windows), and disallow
having two different paths that are case-fold-equivalent.
Disallowing different case-fold-equivalent paths means the
zip file content is safe for case-insensitive file systems.

There is more we could do to relax the rules later, but I think
this should be enough to avoid digging a hole in the early days
of modules that's hard to climb out of later.

In tests on my repo test corpus, the repos now rejected are:

github.com/vjeantet/goldap v0.0.0-20160521203625-ea702ca12a40
	"doc/RFC 4511 - LDAP: The Protocol.txt": invalid char ':'

github.com/ChimeraCoder/anaconda v0.0.0-20160509014622-91bfbf5de08d
	"json/statuses/show.json?id=404409873170841600": invalid char '?'

github.com/bmatcuk/doublestar
	"test/a☺b": invalid char '☺'

github.com/kubernetes-incubator/service-catalog v0.1.10
	"cmd/svcat/testdata/responses/clusterserviceclasses?fieldSelector=spec.externalName=user-provided-service.json": invalid char '?'

The : and ? are reserved on Windows,
and the : is half-reserved (and quite confusing) on macOS.
The ☺ is perhaps an overreach, but I am not convinced
that allowing all of category So is safe; certainly Sk is not.

Change-Id: I83b6ac47ce6c442f726f1036bccccdb15553c0af
Reviewed-on: https://go-review.googlesource.com/124380
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-18 02:08:59 +00:00
Russ Cox
5760ffc7ef cmd/go/internal/modfetch: do not rely on file system for case sensitivity
Over time there may exist two modules with names that differ only in case.
On systems with case-insensitive file systems, we need to make sure those
modules do not collide in the download cache.

Do this by using the new "safe encoding" for file system paths as well as
proxy paths.

Fixes #25992.

Change-Id: I717a9987a87ad5c6927d063bf30d10d9229498c9
Reviewed-on: https://go-review.googlesource.com/124379
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-18 02:08:58 +00:00
Russ Cox
203c16592b cmd/go/internal/module: define fs-safe module path encoding
Module paths, like import paths, are case-sensitive, for better or worse.
But not all file systems distinguish file paths with different cases.
If we are going to use module paths to construct file system paths,
we must apply an encoding that distinguishes case without relying
upon the file system to do it.

This CL defines that encoding, the "safe module path encoding".
Module paths today are ASCII-only with limited punctuation,
so the safe module path encoding is to convert the whole path
to lower case and insert an ! before every formerly upper-case letter:
github.com/Sirupsen/logrus is stored as github.com/!sirupsen/logrus.

Although this CL defines the encoding, it does not change the rest
of the go command to use the encoding. That will be done in
follow-up CLs.

Change-Id: I06e6188dcfcbbc1d88674f7c95e1cb45cb476238
Reviewed-on: https://go-review.googlesource.com/124378
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-18 02:08:57 +00:00
Ian Lance Taylor
f3cdc94154 cmd/go: search test imports when matching -coverpkg
Fixes #25093

Change-Id: If283275e2b73621ade56d014e60c2d18199b366c
Reviewed-on: https://go-review.googlesource.com/122555
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-17 22:22:37 +00:00
Frank Schroeder
b9a764ffdf cmd/go: run git log with --no-show-signature
Git timestamp parsing is broken when fetching modules if the
local git configuration has 'log.showsignature=true'.

Fixes #26388

Change-Id: I47f92381784072335a2a465de56092106c616108
GitHub-Last-Rev: 96f988c0a2
GitHub-Pull-Request: golang/go#26389
Reviewed-on: https://go-review.googlesource.com/123958
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-17 18:04:14 +00:00
Steeve Morin
5419e7a09d cmd/cgo: update JNI's jobject to uintptr check for newer Android NDKs
In Android's NDK16, jobject is now declared as:
    #ifdef __cplusplus
    class _jobject {};
    typedef _jobject*       jobject;
    #else /* not __cplusplus */
    typedef void*           jobject;
    #endif

This makes the jobject to uintptr check fail because it expects the
following definition:
    struct _jobject;
    typedef struct _jobject *jobject;

Update the type check to handle that new type definition in both C and
C++ modes.

Fixes #26213

Change-Id: Ic36d4a5176526998d2d5e4e404f8943961141f7a
GitHub-Last-Rev: 42037c3c58
GitHub-Pull-Request: golang/go#26221
Reviewed-on: https://go-review.googlesource.com/122217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-17 16:51:15 +00:00
Michael Munday
1546ab5a39 cmd/compile: keep autos if their address reaches a control value
Autos must be kept if their address reaches the control value of a
block. We didn't see this before because it is rare for an auto's
address to reach a control value without also reaching a phi or
being written to memory. We can probably optimize away the
comparisons that lead to this scenario since autos cannot alias
with pointers from elsewhere, however for now we take the
conservative approach and just ensure the auto is properly
initialised if its address reaches a control value.

Fixes #26407.

Change-Id: I02265793f010a9e001c3e1a5397c290c6769d4de
Reviewed-on: https://go-review.googlesource.com/124335
Reviewed-by: David Chase <drchase@google.com>
2018-07-17 14:58:54 +00:00
Russ Cox
5890e25b7c cmd/go: add new test script facility
The original cmd/go tests were tiny shell scripts
written against a library of shell functions.
They were okay to write but difficult to run:
you couldn't select individual tests (with -run)
they didn't run on Windows, they were slow, and so on.

CL 10464 introduced go_test.go's testgo framework
and later CLs translated the test shell script over to
individual go tests. This let us run tests selectively,
run tests on Windows, run tests in parallel, isolate
different tests, and so on. It was a big advance.

The tests had always been awkward to write.
Here was the first test in test.bash:

	TEST 'file:line in error messages'
	# Test that error messages have file:line information at beginning of
	# the line. Also test issue 4917: that the error is on stderr.
	d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX)
	fn=$d/err.go
	echo "package main" > $fn
	echo 'import "bar"' >> $fn
	./testgo run $fn 2>$d/err.out || true
	if ! grep -q "^$fn:" $d/err.out; then
		echo "missing file:line in error message"
		cat $d/err.out
		ok=false
	fi
	rm -r $d

The final Go version of this test was:

	func TestFileLineInErrorMessages(t *testing.T) {
		tg := testgo(t)
		defer tg.cleanup()
		tg.parallel()
		tg.tempFile("err.go", `package main; import "bar"`)
		path := tg.path("err.go")
		tg.runFail("run", path)
		shortPath := path
		if rel, err := filepath.Rel(tg.pwd(), path); err == nil && len(rel) < len(path) {
			shortPath = rel
		}
		tg.grepStderr("^"+regexp.QuoteMeta(shortPath)+":", "missing file:line in error message")
	}

It's better but still quite difficult to skim.

This CL introduces a new facility meant as a successor to the testgo
approach that brings back the style of writing tests as little scripts,
but they are now scripts in a built-for-purpose shell-like language,
not bash itself. In this new form, the test above is a single file,
testdata/script/fileline.txt:

	# look for short, relative file:line in error message
	! go run ../../gopath/x/y/z/err.go
	stderr ^..[\\/]x[\\/]y[\\/]z[\\/]err.go:

	-- ../x/y/z/err.go --
	package main; import "bar"

The file is a txtar text archive (see CL 123359) in which the leading comment
is the test script and the files are the initial state of the temporary file
system where the script runs.

Each script runs as a subtest, so that they can still be selected individually.

The scripts are kept isolated from each other by default,
so all script subtests are treated as parallel tests, for the
testing package to run in parallel. Even for the 15 tests in
this CL, that cuts the time for TestScript from 5.5s to 2.5s.

The scripts do not have access to the cmd/go source directory,
nor to cmd/go/testdata, so they are prevented from creating temporary
files in those places or modifying existing ones. (Many existing tests
scribble in testdata, unfortunately, especially testdata/pkg when
they run builds with GOPATH=testdata.)

This CL introduces the script facility and converts 15 tests.
The txtar archive form will allow us to delete the large trees of trivial
files in testdata; a few are deleted in this CL.

See testdata/script/README for details and a larger conversion example.

As part of converting testdata/script/test_badtest.txt,
I discovered that 'go test' was incorrectly printing a FAIL line
to stderr (not stdout) in one corner case. This CL fixes that
to keep the test passing.

Future CLs will convert more tests.

Change-Id: I11aa9e18dd2d4c7dcd8e310dbdc6a1ea5f7e54c1
Reviewed-on: https://go-review.googlesource.com/123577
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-17 14:17:23 +00:00
Ian Lance Taylor
f17220c208 cmd/go: fix handling of vet.cfg with buggyInstall
The vet action assumes that a.Deps[0] is the compilation action for
which vet information should be generated. However, when using
-linkshared, the action graph is built with a ModeBuggyInstall action
to install the shared library built from the compilation action.
Adjust the set up of the vet action accordingly. Also don't clean up
the working directory after completing the buggy install.

Updates #26400

Change-Id: Ia51f9f6b8cde5614a6f2e41b6207478951547770
Reviewed-on: https://go-review.googlesource.com/124275
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-17 05:41:06 +00:00
Zev Goldstein
0c319ee4fe cmd/go/internal/cache: squelch cache init warnings when $HOME is /
Docker sets $HOME to / when running with a UID that doesn't exist within
the container.  This not  uncommon on CI servers.

Fixes #26280

Change-Id: Ic7ff62b41403fe6e7c0cef12814667ef73f6c954
Reviewed-on: https://go-review.googlesource.com/122487
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-17 05:17:31 +00:00
Russ Cox
c2ba0ca804 cmd/go: handle relative temp dir
Most programs seem to accept a relative temp dir, as weird as that might be.

Also, the meaning of relative is a little more fluid on Windows:
TMP=\temp is relative (to the current drive) but will work well enough.

Also, Windows GetTempPath automatically converts a relative
%TMP% into an absolute path, so we'd be imposing different
behavior for GOTMPDIR vs TMP.

It seems easier and more consistent to just impose the obvious
meaning than to add an error we can only implement some of
the time.

Originally got here because "cmd/go:" should be"go:" in error message,
but the error message is gone now.

Fixes #23264.

Change-Id: I3c3fb801cbd5e652364f1f62bb3881e9317e3581
Reviewed-on: https://go-review.googlesource.com/123876
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-16 23:42:54 +00:00
Ian Lance Taylor
274fde9a36 cmd/internal/buildid: close ELF file after reading note
Updates #26400

Change-Id: I1747d1f1018521cdfa4b3ed13412a944829967cf
Reviewed-on: https://go-review.googlesource.com/124235
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-16 23:37:14 +00:00
Ian Lance Taylor
1177b089f5 cmd/cgo: add note about bug writing C pointers to uninitialized C memory
Describe the problem as a bug, since it is not implied by the rest of
the pointer passing rules, and it may be possible to fix it.

Updates #19928

Change-Id: I2d336e7336b2a215c0b8cf909a203201ef1b054e
Reviewed-on: https://go-review.googlesource.com/123658
Reviewed-by: Austin Clements <austin@google.com>
2018-07-16 17:27:35 +00:00
Ian Lance Taylor
b323709a5c cmd/go: make TestNewReleaseRebuildsStalePackagesInGOPATH pass again
The test TestNewReleaseRebuildsStalePackagesInGOPATH is not run in
short mode, so people tend to not notice when it fails. It was failing
due to the build cache. Make it pass again by 1) changing it to modify
the package in a way visible to the compiler, so that the change is
not hidden by caching; 2) accepting "not installed but available in
build cache" as always being a valid reason for a stale package, as go
list does not try to figure out an underlying reason for why a package
is stale when it finds it in the build cache but not installed.

Updates #24436

Change-Id: Iaeaa298f153451ec913a653dd4e6da79a33055bb
Reviewed-on: https://go-review.googlesource.com/123815
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-16 16:49:02 +00:00
Dan Kortschak
c2eba53e7f cmd/vet,sync: check lock values more precisely
Fixes #26165

Change-Id: I1f3bd193af9b6f8461c736330952b6e50d3e00d9
Reviewed-on: https://go-review.googlesource.com/121876
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-14 06:48:21 +00:00
Baokun Lee
00f32fbe7a cmd/go: fix module replace flag parsed bug
In CL 122404, we change -replace syntax from => to =.
And we also need to change this and the tests.

Fixes golang/go#26373.

Change-Id: I2d4e85e10c1578540cc7673b93d849270940d776
Reviewed-on: https://go-review.googlesource.com/123778
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
2018-07-13 22:06:20 +00:00
Brad Fitzpatrick
5e60479ba4 cmd/go: remove windows Skip in test that wasn't removed
Was supposed to be removed from CL 123757

Change-Id: I74405adab58be103f8e4a0c2405567f480a0e622
Reviewed-on: https://go-review.googlesource.com/123895
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-13 21:59:41 +00:00
Russ Cox
3239e9d3dc cmd/go: fix TestModFindModulePath on Windows
The os.RemoveAll(tg.tempdir) was not a good idea.

Change-Id: I6f78cff887044186649cbf3ee04a58abdbcb71e2
Reviewed-on: https://go-review.googlesource.com/123757
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-13 20:51:56 +00:00
Than McIntosh
204c618f0a cmd/link: eliminate a couple of unused DWARF attrs
The linker's DWARF generation occasionally computes and attaches an
attribute X to a type even though the type's abbrev doesn't have the
specified attr. For example, the DW_TAG_subroutine_type abbrev entry
has no type attribute, but a type attr is given to it (wasting
memory). Similarly there are some places where a byte size attr is
added to a DIE whose abbrev lacks that attr. This patch trims away a
few of these not-needed attrs, saving some very tiny amount of memory.

Updates #26186

Change-Id: I69e853df468ac54b07772a614b4106d7c4dae01d
Reviewed-on: https://go-review.googlesource.com/123296
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-13 18:37:29 +00:00
Jakub Čajka
86a0e67a03 cmd/go: call flag.Parse to properly initialize test environment variables
Executing tests in src/cmd/go/internal/modfetch/codehost/git_test.go in enviroment
witout outside connectivity in to the internet results in tests failure:

2018/07/13 14:31:14 git clone --mirror https://vcs-test.golang.org/git/gitrepo1 /tmp/gitrepo-test-996701800/gitrepo2 in : exit status 128:
        Cloning into bare repository '/tmp/gitrepo-test-996701800/gitrepo2'...
        fatal: unable to access 'https://vcs-test.golang.org/git/gitrepo1/': Could not resolve host: vcs-test.golang.org
FAIL    cmd/go/internal/modfetch/codehost       0.307s

Fixes #26007

Change-Id: Ia39d8b3215c920dad6c0c58ffabb0b2ab39bb55c
Reviewed-on: https://go-review.googlesource.com/123735
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-13 16:41:10 +00:00
Dmitry Doroginin
05e02d77c3 cmd/go/internal/modload: more aggressive symlink analysis in FindModulePath
Fixes golang/go#26217.

Change-Id: I0c456047ee31aa78b72acc413446651ca8c3882a
GitHub-Last-Rev: b700554d883b43b57c6619e31a5f8fcb22b1d71f
GitHub-Pull-Request: golang/vgo#5
Reviewed-on: https://go-review.googlesource.com/123755
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-13 14:16:27 +00:00
Russ Cox
24e5fae92e cmd/go: fix tests from x/vgo repo
This CL fixes up tests from the x/vgo repo that are failing
on some of the builders.
It will be submitted together with CL 123576.

Change-Id: I6bec81a93ad4f7116e8edc8c15beafa25747530c
Reviewed-on: https://go-review.googlesource.com/123580
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-12 20:46:52 +00:00
Russ Cox
f7248f0594 cmd/go: merge module support from x/vgo repo
This CL corresponds to CL 123361, the final manual CL in that repo,
making this the final manual sync.

All future commits will happen in this repo (the main Go repo),
and we'll update x/vgo automatically with a fixed patch+script.

Change-Id: I572243309c1809727604fd704705a23c30e85d1a
Reviewed-on: https://go-review.googlesource.com/123576
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-12 20:46:50 +00:00
Keith Randall
b888a6227f cmd/cgo: fix cgo bad typedefs
Two fixes:

1) Typedefs of the bad typedefs should also not be rewritten to the
   underlying type.  They shouldn't just be uintptr, though, they should
   retain the C naming structure.  For example, in C:

   typedef const __CFString * CFStringRef;
   typedef CFStringRef SecKeyAlgorithm;

   we want the Go:

   type _Ctype_CFStringRef uintptr
   type _Ctype_SecKeyAlgorithm = _Ctype_CFStringRef

2) We need more types than just function arguments/return values.
   At least we need types of global variables, so when we see a reference to:

   extern const SecKeyAlgorithm kSecKeyAlgorithmECDSASignatureDigestX962SHA1;

   we know that we need to investigate the type SecKeyAlgorithm.
   Might as well just find every typedef and check the badness of all of them.
   This requires looping until a fixed point of known types is reached.
   Usually it takes just 2 iterations, sometimes 3.

Fixes #24161

Change-Id: I32ca7e48eb4d4133c6242e91d1879636f5224ea9
Reviewed-on: https://go-review.googlesource.com/123177
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-12 19:15:12 +00:00
Keith Randall
85cfa4d55e cmd/compile: handle degenerate write barrier case
If both branches of a write barrier test go to the same block,
then there's no unsafe points.

This can only happen if the resulting memory state is somehow dead,
which can only occur in degenerate cases, like infinite loops. No
point in cleaning up the useless branch in these situations.

Fixes #26024.

Change-Id: I93a7df9fdf2fc94c6c4b1fe61180dc4fd4a0871f
Reviewed-on: https://go-review.googlesource.com/123655
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-12 19:06:09 +00:00
David Chase
0029cd479e cmd/compile: add LocalAddr that takes SP,mem operands
Lack of a well-defined order between VarDef and related
address operations sometimes causes problems with store order
and write barrier transformations; glitches in the order are
made irreparable (by later optimizations) if the two parts of
the glitch straddle a split in the original block caused by
insertion of a write barrier diamond.

Fix this by creating a LocalAddr for addresses of locals
(what VarDef matters for) that takes a memory input to
help make the order explicit.  Addr is modified to only
be legal for SB operand, so there is no overlap between
Addr and LocalAddr uses (there may be some downstream
cleanup from this).

Changes to generic.rules and rewrite.go ensure that codegen
tests continue to pass; CSE of LocalAddr is impaired, not
quite sure of the cost.

Fixes #26105.

Change-Id: Id4192b4440aa4e9d7ba54a465c456df9b530b515
Reviewed-on: https://go-review.googlesource.com/122483
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-12 18:45:31 +00:00
Russ Cox
bb364d49a9 cmd/go: delete TestGoBuildDashA*
The behavior of -a no longer changes depending on which kind
of branch of Go you are using (the new build cache fixed all that).
These tests are not doing anything useful (and failing).

Change-Id: I1c65120a3e05286e888951d61bca4a903e2c1158
Reviewed-on: https://go-review.googlesource.com/123575
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-12 17:30:14 +00:00
Xia Bin
3df1f00bfc doc: ArgsSizeUnknown it's defined in cmd/internal/objabi now
Change-Id: I877c82788f3edbcb0b334b42049c1a06f36a6477
Reviewed-on: https://go-review.googlesource.com/123517
Reviewed-by: Rob Pike <r@golang.org>
2018-07-12 08:22:37 +00:00
Matthew Dempsky
cc422e64d0 cmd/compile: fix ICE due to missing inline function body
For golang.org/cl/74110, I forgot that you can use range-based for
loops to extract key values from a map value.

This wasn't a problem for the binary format importer, because it was
more tolerant about missing inline function bodies. However, the
indexed importer is more particular about this.

We could potentially just make it more lenient like the binary
importer, but tweaking the logic here is easy enough and seems like
the preferable solution.

Fixes #26341.

Change-Id: I54564dcd0be60ea393f8a0f6954b7d3d61e96ee5
Reviewed-on: https://go-review.googlesource.com/123475
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-07-12 00:13:37 +00:00
Russ Cox
6b89194c28 cmd/dist: enable build cache always
GOCACHE=off is not a reliable signal of user intent.

At startup the go command fills in an empty GOCACHE with the effective setting.
If $HOME is set, then GOCACHE ends up somewhere in $HOME/.cache.
But if $HOME is unset, then the go command sets GOCACHE=off explicitly.

That environment is used for invoking "go tool dist".

So if the machine has no $HOME, then go tool dist ends up with the cache
disabled even though the user was not trying to disable the cache.
This affects the linux-ppc64le builder, which appears to be unique
among builders in not having $HOME set. So that builder is running
with no build cache.

Now that there is a cmd/go test that needs the cache to be on,
the linux-ppc64le builder is failing.

In the next release we intend to force the use of the build cache
always. This CL is not doing that: it's only forcing the use of the
build cache during all.bash, which won't affect the majority of
our users (they run pre-build binary releases).

If this is a problem we can roll it back and fix the linux-ppc64le
builders some other way.

While we're here, print a few more useful variables in 'go tool dist env'
and sort the output.

Change-Id: I66548aa8990d0794cbc0f2069b739ab1834898dd
Reviewed-on: https://go-review.googlesource.com/123297
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-12 00:10:07 +00:00
Austin Clements
12ed0ddec1 cmd/link: use BestSpeed for DWARF compression
DWARF compression accounts for roughly 30% of the linker's time. This
CL switches from DefaultCompression to BestSpeed, which virtually
eliminates this time. This roughly halves the overhead of handling
DWARF in the linker:

name \ time/op         nodwarf     dwarf        dwarf-speed
BuildCmdGoAll          10.0s ±11%   10.6s ± 5%   10.8s ± 5%
             nodwarf                  +6.41%       +8.03%
               dwarf                                 ~
LinkCmdGo              626ms ± 5%  1096ms ± 2%   860ms ± 2%
             nodwarf                 +75.17%      +37.36%
               dwarf                              -21.59%

Previously, enabling DWARF had a 75% overhead in link time for cmd/go.
This change reduces this overhead to 37% (a 22% reduction).

The effect on binary size is minimal compared to DefaultCompression,
and still substantially better than no compression:

             cmd/go bytes
nodwarf      10106953
dwarf        12159049 nodwarf+20%
dwarf-speed  12408905 nodwarf+23%
dwarf-nozlib 17766473 nodwarf+76%

Updates #26318.

Change-Id: I33bb7caa038a2753c29104501663daf4839e7054
Reviewed-on: https://go-review.googlesource.com/123356
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-07-11 20:23:02 +00:00
Hana (Hyang-Ah) Kim
5e70b132c2 cmd/pprof: disable readline UI support for TERM=dumb
In general, dumb terminal indicates terminal with limited capability.
It may provide no support for special character sequences, e.g., no
handling of ANSI escape sequences. Its input/output handling behavior
may deviate from what's described in termios or terminfo. E.g., in
the shell in emacs, even after successfully setting the terminal to
raw mode, the terminal behaves as if it's still operating in canonical
mode since emacs is doing input processing first.

Readline support can be broken in various ways in dumb terminal mode,
so we want to disable readline or advanced UI features. The easiest
way to detect dumb terminal is to check the environment variable "TERM".

Fixes #26254

Change-Id: I6b652eb555bc03b84405aae08b0b25d111fbb8b0
Reviewed-on: https://go-review.googlesource.com/122879
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-11 01:08:56 +00:00
Ian Lance Taylor
8d6fc84986 internal/poll: don't take read lock in SetBlocking
Taking a read lock in SetBlocking could cause SetBlocking to block
waiting for a Read in another goroutine to complete. Since SetBlocking
is called by os.(*File).Fd, that could lead to deadlock if the
goroutine calling Fd is going to use it to unblock the Read.
Use an atomic store instead.

Updates #24481

Change-Id: I79413328e06ddf28b6d5b8af7a0e29d5b4e1e6ff
Reviewed-on: https://go-review.googlesource.com/123176
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-11 00:34:18 +00:00
Kamil Rytarowski
f5921d48f1 runtime/cgo: Add initial NetBSD Thread Sanitizer support
Recognize NetBSD in:
 - go/internal/work/init.go
 - race.bash
 - runtime/race/race.go

Add __ps_strings symbol in runtime/cgo/netbsd.go as this is
used internally in the TSan library for NetBSD and used for
ReExec().

Tested on NetBSD/amd64 v. 8.99.12.

Around 98% tests are passing for the ./race.bash target.

Updates #19273

Change-Id: Ic0e48d2fb159a7868aab5e17156eeaca1225e513
GitHub-Last-Rev: d6e082707b
GitHub-Pull-Request: golang/go#24322
Reviewed-on: https://go-review.googlesource.com/99835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-10 23:14:31 +00:00
Than McIntosh
ec88f781c2 cmd/compile: call objabi.PathToPrefix when emitting abstract fn
When generating an abstract function DIE, call objabi.PathToPrefix on
the import path so as to be consistent with how the linker handles
import paths. This is intended to resolve another problem with DWARF
inline info generation in which there are multiple inconsistent
versions of an abstract function DIE for a function whose package path
is rewritten/canonicalized by objabi.PathToPrefix.

Fixes #26237

Change-Id: I4b64c090ae43a1ad87f47587a1a71f19bc5fc8e8
Reviewed-on: https://go-review.googlesource.com/123036
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-10 18:54:39 +00:00
Ian Lance Taylor
fa71076d24 cmd/go, cmd/cgo: only set TERM=dumb when running the compiler
The clang compiler on some terminals will issue colored error
messages, which can confuse tools like cgo. To avoid this we used to
set TERM=dumb for all programs started by the go tool. However, that
confuses the pprof tool, which doesn't know whether to support fancy
editing and colors itself.

Instead, change the go tool and the cgo tool to set TERM=dumb where it
matters--when invoking the C compiler--rather than in all cases.

Updates #26254

Change-Id: I95174f961ac269a50a83f5f9d268219043cba968
Reviewed-on: https://go-review.googlesource.com/122975
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-10 16:34:16 +00:00
Russ Cox
25c3bb377a cmd/go: add ImportMap to go list package struct
Also populate Imports for test main with go list -test.

Update comment in internal/load/test.go about
p.Imports, p.Internal.RawImports, and p.Imports
being perfectly aligned. The first two are,
but the third is not, as evidenced by CL 111175.

Since p.Imports is not aligned, don't assume that anymore.

Fixes #25949.

Change-Id: Icbfbc881bc01d1e195a759648fbd1c978ddbc161
Reviewed-on: https://go-review.googlesource.com/122878
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-07-10 14:59:43 +00:00
Russ Cox
fd263ccefe cmd/cover: invoke go command to find packages
cmd/cover has always assumed that package x/y/z can be
found in $GOPATH/src/x/y/z (roughly; by using go/build).
That won't be true for too much longer. Instead, run the
go command to find out where packages are.

This will make 'go tool cover' safe for use with Go modules
when they are in use in Go 1.11, and it continues to work
with the existing Go toolchains too.

An alternative would be to modify the cover profile format
to record file names directly, but that would require also
updating golang.org/x/tools/cover/profile and any tools
that use it, which seems not worth the trouble.
(That fork of the code does not contain any code to resolve
package names to directory locations, so it's unaffected.)

No new test here: cmd/go's TestCoverageFunc tests this code.

Fixes #25318 (when people use Go 1.11 instead of vgo).

Change-Id: I8769b15107aecf25f7aaf8692b724cf7d0f073d0
Reviewed-on: https://go-review.googlesource.com/122478
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-07-10 03:56:55 +00:00
Russ Cox
5a8b652c6e cmd/go: add test for tests with no tests
CL 122518 rolled back an earlier CL that made "go test"
start running test binaries for packages with no *_test.go files.
Add a test as another roadblock to reintroducing that behavior
in the future.

For #26462.

Change-Id: I898103064efee8d6ae65bcf74f4dffc830eae7e9
Reviewed-on: https://go-review.googlesource.com/122595
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-10 03:00:05 +00:00
Cherry Zhang
c801232525 cmd/compile: make sure alg functions are generated when we call them
When DWARF is disabled, some alg functions were not generated.
Make sure they are generated when we about to generate calls to
them.

Fixes #23546.

Change-Id: Iecfa0eea830e42ee92e55268167cefb1540980b2
Reviewed-on: https://go-review.googlesource.com/122403
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2018-07-10 01:20:45 +00:00
Ian Lance Taylor
5fbfda6a83 cmd/go: add LDFLAGS to cache ID when using cgo
The cgo tool records the value of the CGO_LDFLAGS environment variable
in the generated file, so that the linker can later read and use it.
Therefore, we must add CGO_LDFLAGS to the cache ID, as otherwise
changing CGO_LDFLAGS may cause a build result to be incorrectly read
from the cache, producing a different final program.

Change-Id: Ic89c1edc4069837451a36376710ca9b56fb87455
Reviewed-on: https://go-review.googlesource.com/122520
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 23:39:59 +00:00
Iskander Sharipov
7951d90bc6 cmd/compile/internal/ssa: fix partsByVarOffset.Less method
Fix duplicated index in LHS and RHS of the < operator.

Found using https://go-critic.github.io/overview#dupSubExpr-ref

Change-Id: I9a5a40bbd436b32e8117579a01bc50afe3608c97
Reviewed-on: https://go-review.googlesource.com/122776
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-09 22:44:34 +00:00
Keith Randall
94076feef5 cmd/cgo: check function argument/return types for bad C pointer types
We need to determine whether arguments to and return values from C
functions are "bad" typedef'd pointer types which need to be uintptr
on the Go side.

The type of those arguments are not specified explicitly. As a result,
we never look through the C declarations for the GetTypeID functions
associated with that type, and never realize that they are bad.
However, in another function in the same package there might be an
explicit reference. Then we end up with the declaration being uintptr
in one file and *struct{...} in another file. Badness ensues.

Fix this by doing a 2-pass algorithm. In the first pass, we run as
normal, but record all the argument and result types we see. In the
second pass, we include those argument types also when reading the C
types.

Fixes #24161

Change-Id: I8d727e73a2fbc88cb9d9899f8719ae405f59f753
Reviewed-on: https://go-review.googlesource.com/122575
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-09 22:19:21 +00:00
Josh Bleecher Snyder
a67c481f76 cmd/link/internal/sym: add sizeof tests
CL 121916 showed that sym.Symbol matters for linker performance.
Prevent accidental regression.

Change-Id: I5fd998c91fdeef9e721bc3f6e30f775b81103e95
Reviewed-on: https://go-review.googlesource.com/122716
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 19:59:32 +00:00
Keith Randall
58d287e5e8 cmd/compile: ensure that loop condition is detected correctly
We need to make sure that the terminating comparison has the right
sense given the increment direction. If the increment is positive,
the terminating comparsion must be < or <=. If the increment is
negative, the terminating comparison must be > or >=.

Do a few cleanups,  like constant-folding entry==0, adding comments,
removing unused "exported" fields.

Fixes #26116

Change-Id: I14230ee8126054b750e2a1f2b18eb8f09873dbd5
Reviewed-on: https://go-review.googlesource.com/121940
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-07-09 18:23:39 +00:00
Ian Lance Taylor
7254cfc37b cmd/go: revert "output coverage report even if there are no test files"
Original CL description:

    When using test -cover or -coverprofile the output for "no test files"
    is the same format as for "no tests to run".

Reverting because this CL changed cmd/go to build test binaries for
packages that have no tests, leading to extra work and confusion.

Updates #24570
Fixes #25789
Fixes #26157
Fixes #26242

Change-Id: Ibab1307d39dfaec0de9359d6d96706e3910c8efd
Reviewed-on: https://go-review.googlesource.com/122518
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-09 14:42:21 +00:00
Ben Shi
f5d4863130 cmd/compile: fix a bug in 386 backend
The ADDLmodify/SUBLmodify/ANDLmodify/ORLmodify/XORLmodify should
have clobberFlags set to true.

Change-Id: Ie447d536db51334eddc70c00a722647282186a69
Reviewed-on: https://go-review.googlesource.com/122556
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-07 00:05:34 +00:00
Matthew Dempsky
8d5fd871d7 cmd/compile: fix "width not calculated" ICE
Expanding interface method sets is handled during width calculation,
which can't be performed concurrently. Make sure that we eagerly
expand interfaces in the frontend when importing them, even if they're
not actually used by code, because we might need to generate a type
description of them.

Fixes #25055.

Change-Id: I6fd2756de2c7d5dbc33056f70b3028ca3aebab41
Reviewed-on: https://go-review.googlesource.com/122517
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-06 20:25:52 +00:00
David du Colombier
b0155e3424 cmd/go: skip gitrepo tests on Plan 9
CL 118095 added gitrepo tests. These tests are failing on Plan 9
since they expect a full-featured git command, while the git tool
has been emulated as a simple rc script on Plan 9.

Fixes #25938.

Change-Id: I262a89d0ce83168c550d9af3e832ed3a1e3c43f6
Reviewed-on: https://go-review.googlesource.com/122455
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-06 14:45:29 +00:00
Michael Munday
9fa988547a cmd/internal/obj/s390x: increase maximum number of loop iterations
The maximum number of 'spanz' iterations that the s390x assembler
performs to reach a fixed point for relative offsets was 10. This
turned out to be too aggressive for one example of auto-generated
fuzzing code. Increase the number of iterations by 10x to reduce
the likelihood that the limit will be hit again. This limit only
exists to help find bugs in the assembler.

master at tip does not fail with the example code in the issue, I
have therefore not submitted it as a test (it is also quite large).
I tested this change with the example code at the commit given and
it fixes the issue.

Fixes #25269.

Change-Id: I0e44948957a7faff51c7d27c0b7746ed6e2d47bb
Reviewed-on: https://go-review.googlesource.com/122235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-05 07:21:50 +00:00
Ian Lance Taylor
e2f8766c30 cmd/cgo: mark C result as written for msan
Otherwise it is possible that msan will consider the C result to be
partially initialized, which may cause msan to think that the Go stack
is partially uninitialized. The compiler will never mark the stack as
initialized, so without this CL it is possible for stack addresses to
be passed to msanread, which will cause a false positive error from msan.

Fixes #26209

Change-Id: I43a502beefd626eb810ffd8753e269a55dff8248
Reviewed-on: https://go-review.googlesource.com/122196
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-05 05:15:15 +00:00
Daniel Martí
7145f1c7c7 cmd/compile: minor updates to the README
Use an HTML comment with triple dashes for the copypright header, which
means that the paragraph will be ignored when rendering both HTML and
TeX.

While at it, quote "GC", and properly link to internal/ssa/README.md.

Change-Id: Ib18529d2fc777d836e74726ff1cfe685e08b063c
Reviewed-on: https://go-review.googlesource.com/109875
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-07-04 10:47:06 +00:00
Ian Lance Taylor
36c623046b cmd/go: don't pass both -static and -pie to cgo compiler
Along with CL 122135,
Fixes #26197

Change-Id: I61e8cfb0dcc39885acf8ffa1ffb34cbbe4dc1dc3
Reviewed-on: https://go-review.googlesource.com/122155
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-04 00:22:11 +00:00
Ian Lance Taylor
ad4e6370fe cmd/link: remove -rdynamic if -static appears in cgo LDFLAGS
We already remove -rdynamic if -static appears in -extldflags.
Extend that to apply to CGO_LDFLAGS and #cgo LDFLAGS as well.

Updates #26197

Change-Id: Ibb62d1b20726916a12fd889acb05c1c559a5ace2
Reviewed-on: https://go-review.googlesource.com/122135
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-04 00:15:55 +00:00
Agniva De Sarker
5d4f0474ec cmd/dist: skip building tools for js/wasm
Fixes #25911

Change-Id: Id3b5ea5494544e9e7f889831cefaf080cae8865d
Reviewed-on: https://go-review.googlesource.com/120655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-03 17:37:40 +00:00
Daniel Martí
aad71d3163 cmd/compile: reorganise and improve ssa/README.md
Since the initial version was written, I've gotten help writing
cmd/compile/README.md and I've also learned some more on my own, so it's
time to organise this document better and expand it.

First, split up the document in sections, starting from the simplest
ideas that can be explained on their own. From there, build all the way
up into SSA functions and how they are compiled.

Each of the sections also gets more detail now; most ideas that were a
paragraph are now a section with several paragraphs. No new major
sections have been added in this CL.

While at it, add a copyright notice and make better use of markdown,
just like in the other README.md.

Also fix a file path in value.go, which I noticed to be stale while
reading godocs to write the document.

Finally, leave a few TODO comments for areas that would benefit from
extra input from people familiar with the SSA package. They will be
taken care of in future CLs.

Change-Id: I85e7a69a0b3260e72139991a625d926099624f71
Reviewed-on: https://go-review.googlesource.com/110067
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-03 16:27:51 +00:00
Tobias Klauser
2ee6bfbd7e cmd/internal/obj: follow convention for generated code comment
Follow the convertion (https://golang.org/s/generatedcode) for generated
code in stringer.go.

Change-Id: I7b5fbb04ba03e8ac77a9a0a402088669469de858
Reviewed-on: https://go-review.googlesource.com/122015
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-03 16:14:43 +00:00
Ian Lance Taylor
9a97a2aae9 cmd/go: add ForceLibrary to build hash
When a command has a test that is not in package main, the main
package is built as a library, with ForceLibrary set. It can of course
also be built as an ordinary main package. If we don't record that fact
in the hash, then both variants of the command will use the same hash,
which causes a GODEBUG=gocacheverify=1 failure. It also seems unsafe
although it's not clear to me whether it can cause an actual failure.

Along with CL 121941,
Fixes #25666

Change-Id: I115ad249012f30fbe45cd0c41da86adc295fe4b2
Reviewed-on: https://go-review.googlesource.com/121942
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-03 15:12:48 +00:00
Than McIntosh
f00bfb385b cmd/link: split off 'Dynimp' string fields to reduce sym.Symbol size
The linker's sym.Symbol struct contains two string fields, "Dynimplib"
and "Dynimpvers" that are used only in very specific circumstances
(for many symbols, such as DWARF syms, they are wasted space). Split
these two off into a separate struct, then point to an instance of
that struct when needed. This reduces the size of sym.Symbol so as to
save space in the common case.

Updates #26186

Change-Id: Id9c74824e78423a215c8cbc105b72665525a1eff
Reviewed-on: https://go-review.googlesource.com/121916
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-03 14:48:40 +00:00
Than McIntosh
32bc0976f9 cmd/link: use side table instead of sym.Symbol 'Reachparent' field
The sym.Symbol 'Reachparent' field is used only when field tracking
is enabled. So as to use less memory for the common case where
field tracking is not enabled, remove this field and use a side
table stored in the context to achieve the same functionality.

Updates #26186

Change-Id: Idc5f8b0aa323689d4d51dddb5d1b0341a37bb7d2
Reviewed-on: https://go-review.googlesource.com/121915
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-03 14:48:30 +00:00
Ian Lance Taylor
4ba5527371 cmd/vet: make vetx output deterministic
The vetx output file is a build output, and as such should be
deterministic. This CL changes it to not depend on map iteration order.

This avoids a pointless GODEBUG=gocacheverify=1 failure.

Updates #25666

Change-Id: Ic132bad134cb10938275f883c2c68432cb7c4409
Reviewed-on: https://go-review.googlesource.com/121941
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-07-03 00:42:50 +00:00
Cherry Zhang
3f54e8537a cmd/compile: run generic deadcode in -N mode
Late opt pass may generate dead stores, which messes up store
chain calculation in later passes. Run generic deadcode even
in -N mode to remove them.

Fixes #26163.

Change-Id: I8276101717bb978d5980e6c7998f53fd8d0ae10f
Reviewed-on: https://go-review.googlesource.com/121856
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-02 20:53:23 +00:00
Keith Randall
398a8ed653 cmd/compile: remove broken rules
These rules don't even type check.  ADDQconstmodify returns memory,
and it is being rewritten to a value that returns an int64.

There should be a MOVQstore wrapped around the result.
These rules never fire during all.bash, so they aren't even tested.

I'm just going to remove them for now.

Change-Id: I76008eb51ae4e16c707fac73c05a8d67cac149ae
Reviewed-on: https://go-review.googlesource.com/121935
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-02 20:00:38 +00:00
Michael Munday
adfa8b8691 cmd/compile: keep autos whose address reaches a phi
If the address of an auto reaches a phi then any further stores to
the pointer represented by the phi probably need to be kept. This
is because stores to the other arguments to the phi may be visible
to the program.

Fixes #26153.

Change-Id: Ic506c6c543bf70d792e5b1a64bdde1e5fdf1126a
Reviewed-on: https://go-review.googlesource.com/121796
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-07-02 19:43:07 +00:00
Peter Gonda
23ce272bb1 cmd/cgo: permit missing dynamic symbol section
Allow static complication of cgo enabled libraries.

Fixes #16651

Change-Id: I0729ee4e6e5f9bd1cbdb1bc2dcbfe34463df547c
Reviewed-on: https://go-review.googlesource.com/89655
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-02 17:50:00 +00:00
Ian Lance Taylor
59934e7ebb cmd/go: add -flat_namespace to LDFLAGS whitelist
Fixes #26173

Change-Id: I032551f63b359c8cbb7296931e1957d2bff8f328
Reviewed-on: https://go-review.googlesource.com/121819
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2018-07-02 17:36:16 +00:00
Tobias Klauser
cc41c1e8e7 cmd/vendor/golang.org/x/sys/unix: pick up fixes for TestUtimesNanoAt
TestUtimesNanoAt in the vendored copy of golang.org/x/sys/unix currently
fails on the linux-arm-arm5spacemonkey builder. Update the vendored copy
to pick up the fix from CL 120816.

Updates #26034

Change-Id: I75c8875089f58a4c32e2e7aa75884b2bcba7bd68
Reviewed-on: https://go-review.googlesource.com/121800
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-02 15:39:44 +00:00
Austin Clements
99e9be8043 runtime: query thread stack size from OS on Windows
Currently, on Windows, the thread stack size is set or assumed in many
different places. In non-cgo binaries, both the Go linker and the
runtime have a copy of the stack size, the Go linker sets the size of
the main thread stack, and the runtime sets the size of other thread
stacks. In cgo binaries, the external linker sets the main thread
stack size, the runtime assumes the size of the main thread stack will
be the same as used by the Go linker, and the cgo entry code assumes
the same.

Furthermore, users can change the main thread stack size using
editbin, so the runtime doesn't even really know what size it is, and
user C code can create threads with unknown thread stack sizes, which
we also assume have the same default stack size.

This is all a mess.

Fix the corner cases of this and the duplication of knowledge between
the linker and the runtime by querying the OS for the stack bounds
during thread setup. Furthermore, we unify all of this into just
runtime.minit for both cgo and non-cgo binaries and for the main
thread, other runtime-created threads, and C-created threads.

Updates #20975.

Change-Id: I45dbee2b5ea2ae721a85a27680737ff046f9d464
Reviewed-on: https://go-review.googlesource.com/120336
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-02 15:18:26 +00:00
Austin Clements
52e782a2d6 runtime: initialize g0 stack bounds on Windows to full stack
Currently, we allocate 1MB or 2MB thread stacks on Windows, but in
non-cgo binaries still set the g0 stack bounds assuming only 64k is
available. While this is fine in pure Go binaries, a non-cgo Go binary
on Windows can use the syscall package to call arbitrary DLLs, which
may call back into Go. If a DLL function uses more than 64k of stack
and then calls back into Go, the Go runtime will believe that it's out
of stack space and crash.

Fix this by plumbing the correct stack size into the g0 stacks of
non-cgo binaries. Cgo binaries already use the correct size because
their g0 stack sizes are set by a different code path.

Fixes #20975.

Change-Id: Id6fb559cfe1e1ea0dfac56d4654865c20dccf68d
Reviewed-on: https://go-review.googlesource.com/120195
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-02 15:18:24 +00:00
Jakub Čajka
b55fe6a370 cmd/go: call flag.Parse to properly initialize test environment variables
Executing tests in cmd/go/internal/modfetch/gitrepo/fetch_test.go in enviroment
witout outside connectivity in to the internet results in tests failure:

2018/06/25 12:48:26 git clone --mirror https://vcs-test.golang.org/git/gitrepo1 /tmp/gitrepo-test-221822392/gitrepo2 in : exit status 128:
	Cloning into bare repository '/tmp/gitrepo-test-221822392/gitrepo2'...
	fatal: unable to access 'https://vcs-test.golang.org/git/gitrepo1/': Could not resolve host: vcs-test.golang.org
FAIL	cmd/go/internal/modfetch/gitrepo	0.144s

Call flag.Parse in TestMain to properly initialize test environment variables

Fixes #26007

Change-Id: I059e27db69c0ca0e01db724035a25d6fefb094b5
Reviewed-on: https://go-review.googlesource.com/120735
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-02 14:47:51 +00:00
Ian Lance Taylor
da769814b8 cmd/cgo: handle GCC 8 change in errors about constant initializers
Before GCC 8 C code like

const unsigned long long int neg = (const unsigned long long) -1;
void f(void) { static const double x = (neg); }

would get an error "initializer element is not constant". In GCC 8 and
later it does not.

Because a value like neg, above, can not be used as a general integer
constant, this causes cgo to conclude that it is a floating point
constant. The way that cgo handles floating point values then causes
it to get the wrong value for it: 18446744073709551615 rather than -1.
These are of course the same value when converted to int64, but Go
does not permit that kind of conversion for an out-of-range constant.

This CL side-steps the problem by treating floating point constants
with integer type as they would up being treated before GCC 8: as
variables rather than constants.

Fixes #26066

Change-Id: I6f2f9ac2fa8a4b8218481b474f0b539758eb3b79
Reviewed-on: https://go-review.googlesource.com/121035
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-29 23:22:48 +00:00
David Chase
d4d8237a5b Revert "cmd/compile: make OpAddr depend on VarDef in storeOrder"
This reverts commit 1a27f048ad.

Reason for revert: Broke the ssacheck and -N-l builders, and the -N-l fix looks like it will take some time and take a different route entirely.

Change-Id: Ie0ac5e86ab7d72a303dfbbc48dfdf1e092d4f61a
Reviewed-on: https://go-review.googlesource.com/121715
Reviewed-by: David Chase <drchase@google.com>
2018-06-29 19:48:48 +00:00
David Chase
1a27f048ad cmd/compile: make OpAddr depend on VarDef in storeOrder
Given a carefully constructed input, writebarrier would
split a block with the OpAddr in the first half and the
VarDef in the second half which ultimately leads to a
compiler crash because the scheduler is no longer able
to put them in the proper order.

To fix, recognize the implicit dependence of OpAddr on
the VarDef of the same symbol if any exists.

This fix was chosen over making OpAddr take a memory
operand to make the dependence explicit, because this
change is less invasive at this late part of the 1.11
release cycle.

Fixes #26105.

Change-Id: I9b65460673af3af41740ef877d2fca91acd336bc
Reviewed-on: https://go-review.googlesource.com/121436
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-06-29 15:20:52 +00:00
Cherry Zhang
d21bdf125c cmd/compile: check SSAability in handling of INDEX of 1-element array
SSA can handle 1-element array, but only when the element type
is SSAable. When building SSA for INDEX of 1-element array, we
did not check the element type is SSAable. And when it's not,
it resulted in an unhandled SSA op.

Fixes #26120.

Change-Id: Id709996b5d9d90212f6c56d3f27eed320a4d8360
Reviewed-on: https://go-review.googlesource.com/121496
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2018-06-29 12:05:05 +00:00
Daniel Martí
1d1e25fba8 cmd/vet: don't run buildtag check when in vetxonly mode
The check was running in the loop that read source files in, much before
any of the other checks ran. Vetxonly makes vet exit early, but after
all the source files have been read.

To fix this, simply run the buildtag check along with all the other
checks that get run on specific syntax tree nodes.

Add a cmd/go test with go test -a, to ensure that the issue as reported
is fixed.

Fixes #26102.

Change-Id: If6e3b9418ffa8166c0f982668b0d10872283776a
Reviewed-on: https://go-review.googlesource.com/121395
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-29 08:33:11 +00:00
Robert Griesemer
b410ce750e cmd/compile: don't crash in untyped expr to interface conversion
Fixes #24763.

Change-Id: Ibe534271d75b6961d00ebfd7d42c43a3ac650d79
Reviewed-on: https://go-review.googlesource.com/121335
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-06-28 23:01:22 +00:00
Russ Cox
0d52c144a2 cmd/vet: fix ironic misuse of fmt.Sprintf
Move badf helper into top-level function so that prints from buildtag.go
are once again themselves printf-format-checked by vet.
Also, fix implementation, which was missing a ... in the Sprintf call and
produced messages like:

/Users/rsc/x_test.go:1: +build comment must appear before package clause and be followed by a blank line%!(EXTRA []interface {}=[])

These were introduced in CL 111415.

Change-Id: I000af3a4e01dc99fc79c9146aa68a71dace1460f
Reviewed-on: https://go-review.googlesource.com/121300
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-06-28 22:17:10 +00:00
Ilya Tocar
b71ea0b7dd cmd/compile: mark CMOVLEQF, CMOVWEQF as cloberring AX
Code generation for OpAMD64CMOV[WLQ]EQF uses AX as a scratch register,
but only CMOVQEQF, correctly lets compiler know. Mark other 2 as
clobbering AX.

Fixes #26097

Change-Id: I2a65bd67bf18a540898b4a0ae6c8766e0b767b19
Reviewed-on: https://go-review.googlesource.com/121336
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
2018-06-28 18:39:56 +00:00
Cherry Zhang
1d303a0086 cmd/compile: fold offset into address on Wasm
On Wasm, the offset was not folded into LoweredAddr, so it was
not rematerializeable. This led to the address-taken operation
in some cases generated too early, before the local variable
becoming live. The liveness code thinks the variable live when
the address is taken, then backs it up to live at function
entry, then complains about it, because nothing other than
arguments should be live on entry.

This CL folds the offset into the address operation, so it is
rematerializeable and so generated right before use, after the
variable actually becomes live.

It might be possible to relax the liveness code not to think a
variable live when its address being taken, but until the address
actually being used. But it would be quite complicated. As we're
late in Go 1.11 freeze, it would be better not to do it. Also,
I think the address operation is rematerializeable now on all
architectures, so this is probably less necessary.

This may also be a slight optimization, as the address+offset is
now rematerializeable, which can be generated on the Wasm stack,
without using any "registers" which are emulated by local
variables on Wasm. I don't know how to do benchmarks on Wasm. At
least, cmd/go binary size shrinks 9K.

Fixes #25966.

Change-Id: I01e5869515d6a3942fccdcb857f924a866876e57
Reviewed-on: https://go-review.googlesource.com/120599
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
2018-06-27 14:30:00 +00:00
LE Manh Cuong
6dd789fdea cmd/link: document limitation of -X
Fixes #26042

Change-Id: Ica16f14a65c03659a19926852cca5e554c99baf1
Reviewed-on: https://go-review.googlesource.com/120935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-27 04:29:51 +00:00
David Chase
a12c1f26e4 cmd/compile: improve escape analysis explanation
No code changes, only revised comments in an attempt to make
escape analysis slightly less confusing.

Updates #23109.

Change-Id: I5ee6cea0946ced63f6210ac4484a088bcdd862fb
Reviewed-on: https://go-review.googlesource.com/121001
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-06-26 20:00:51 +00:00
Richard Musiol
8997ec1c4e syscall/js: use stable references to JavaScript values
This commit changes how JavaScript values are referenced by Go code.
After this change, a JavaScript value is always represented by the same
ref, even if passed multiple times from JavaScript to Go. This allows
Go's == operator to work as expected on js.Value (strict equality).
Additionally, the performance of some operations of the syscall/js
package got improved by saving additional roundtrips to JavaScript code.

Fixes #25802.

Change-Id: Ide6ffe66c6aa1caf5327a2d3ddbe48fe7c180461
Reviewed-on: https://go-review.googlesource.com/120561
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-26 16:40:09 +00:00
Ian Lance Taylor
5fad09016b cmd/cgo: mention character restrictions on #cgo lines
Fixes #26025

Change-Id: I43b3c9019ca8d2844e4d664c2090e506b2171077
Reviewed-on: https://go-review.googlesource.com/120975
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-26 14:39:02 +00:00
Andrew
3c586d4483 cmd/dist: increase timeout scale to 3 for windows
cmd/go can sometimes take up to 400s on windows due
to various issues (disk I/O on builders being the
latest cause). Increase the timeout scale to account
for this.

Change-Id: I1fd4964472a70fb0f33cf6ed73298c034b9c1fb0
Reviewed-on: https://go-review.googlesource.com/120762
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-25 20:52:59 +00:00
David Chase
7e9d55eeeb cmd/compile: avoid remainder in loopbce when increment=0
For non-unit increment, loopbce checks to see if the
increment evenly divides the difference between (constant)
loop start and end.  This test panics when the increment
is zero.

Fix: check for zero, if found, don't optimize the loop.

Also added missing copyright notice to loopbce.go.

Fixes #26043.

Change-Id: I5f460104879cacc94481949234c9ce8c519d6380
Reviewed-on: https://go-review.googlesource.com/120759
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-25 20:36:42 +00:00
Brad Fitzpatrick
6d70952897 cmd/dist: enable more tests on js/wasm
Fixes #26050

Change-Id: I21697ac30eb3bc423263cba885bce5fea8f81d94
Reviewed-on: https://go-review.googlesource.com/120796
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-06-25 20:01:45 +00:00
Richard Musiol
9c35c1a503 syscall.js: add Value.InstanceOf
Change-Id: Icf56188fdb2b8ce6789830a35608203fdb9a3df6
Reviewed-on: https://go-review.googlesource.com/120560
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-25 17:03:20 +00:00
Michael Hudson-Doyle
d6a27e8edc cmd/link: never coalesce type descriptors when dynamically linking Go
Add a test by making misc/cgo/testshared/src/trivial.go marginally less
trivial.

Fixes #25970.

Change-Id: I8815d0c56b8850fcdbf9b45f8406f37bd21b6865
Reviewed-on: https://go-review.googlesource.com/120235
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-23 00:16:14 +00:00