Commit Graph

1218 Commits

Author SHA1 Message Date
Ian Lance Taylor
38fab7369d runtime: correct counters in sweep
In the sweep code we can sometimes see incorrect counts when
    conservative stack scanning causes us to grey an object that we
    earlier decided could be freed.  We already ignored this check, but
    adjust this case to maintain correct span counts when it happens.
    This gives us slightly more correct numbers in MemStats, and helps
    avoid a rare failure in TestReadMemStats.
    
    Also fix the free index, and cope with finding a full span when
    allocating a new one.
    
    Reviewed-on: https://go-review.googlesource.com/134216

From-SVN: r264294
2018-09-13 22:06:16 +00:00
Ian Lance Taylor
84cdf51de4 compiler, runtime: open code select
This is the gofrontend version of https://golang.org/cl/37933,
    https://golang.org/cl/37934, and https://golang.org/cl/37935.
    Open code the initialization of select cases.
    
    This is a step toward updating libgo to the 1.11 release.
    
    Reviewed-on: https://go-review.googlesource.com/135000

From-SVN: r264290
2018-09-13 21:32:24 +00:00
Ian Lance Taylor
f0d89c7759 runtime: avoid write barriers with traceback info
Unlike the gc runtime, libgo stores traceback information in location
    structs, which contain strings.  Therefore, copying location structs
    around appears to require write barriers, although in fact write
    barriers are never important because the strings are never allocated
    in Go memory.  They come from libbacktrace.
    
    Some of the generated write barriers come at times when write barriers
    are not permitted.  For example, exitsyscall, marked
    nowritebarrierrec, calls exitsyscallfast which calls traceGoSysExit
    which calls traceEvent which calls traceStackID which calls
    trace.stackTab.put which copies location values into memory allocated
    by tab.newStack.  This write barrier can be invoked when there is no
    p, causing a crash.
    
    This change fixes the problem by ensuring that location values are
    copied around in the tracing code with no write barriers.
    
    This was found by fixing the compiler to fully implement
    //go:nowritebarrierrec; CL to follow.
    
    Reviewed-on: https://go-review.googlesource.com/134226

From-SVN: r264282
2018-09-13 17:30:00 +00:00
Ian Lance Taylor
2919ad1ee3 libgo: build roots index to speed up bulkBarrierPreWrite
To reduce the amount of time spent in write barrier processing
    (specifically runtime.bulkBarrierPreWrite), add support for building a
    'GC roots index', basically a sorted list of all roots, so as to
    allow more efficient lookups of gcdata structures for globals. The
    previous implementation worked on the raw (unsorted) roots list
    itself, which did not scale well.
    
    Reviewed-on: https://go-review.googlesource.com/132595

From-SVN: r264276
2018-09-13 16:44:43 +00:00
Ian Lance Taylor
347462bfee compiler, runtime: remove hmap field from maptypes
This is the gofrontend version of https://golang.org/cl/91796.
    
    This is part of that CL, just the compiler change and required runtime
    changes, in preparation for updating libgo to 1.11.
    
    Relevant part of original CL description:
    
        The hmap field in the maptype is only used by the runtime to check the sizes of
        the hmap structure created by the compiler and runtime agree.
    
        Comments are already present about the hmap structure definitions in the
        compiler and runtime needing to be in sync.
    
    Reviewed-on: https://go-review.googlesource.com/130976

From-SVN: r263941
2018-08-29 00:20:25 +00:00
Ian Lance Taylor
1d29bb0408 runtime: remove the dummy arg of getcallersp
This is a port of https://golang.org/cl/109596 to the gofrontend, in
    preparation for updating libgo to 1.11.
    
    Original CL description:
    
        getcallersp is intrinsified, and so the dummy arg is no longer
        needed. Remove it, as well as a few dummy args that are solely
        to feed getcallersp.
    
    Reviewed-on: https://go-review.googlesource.com/131116

From-SVN: r263840
2018-08-24 18:15:04 +00:00
Ian Lance Taylor
b7d7c92f24 runtime: use poll rather than pollset for netpoll on AIX
Updates golang/go#26634
    
    Reviewed-on: https://go-review.googlesource.com/126857

From-SVN: r263364
2018-08-07 17:29:50 +00:00
Ian Lance Taylor
9be4d77249 libgo: uncomment trace.Stop() call in testing package
Fix up the testing package to insure that execution traces
    work properly (e.g. "-test.trace=<XXX>" command line option). The
    call to stop tracing and emit the output file was stubbed out.
    
    Reviewed-on: https://go-review.googlesource.com/128275

From-SVN: r263363
2018-08-07 17:28:22 +00:00
Ian Lance Taylor
5ac2fd0d6e libgo: prune sighandler frames in runtime.sigprof
When writing stack frames to the pprof CPU profile machinery, it is
    very important to insure that the frames emitted do not contain any
    frames corresponding to artifacts of the profiling process itself
    (signal handlers, sigprof, etc). This patch changes runtime.sigprof to
    strip out those frames from the raw stack generated by
    "runtime.callers".
    
    Fixes golang/go#26595.
    
    Reviewed-on: https://go-review.googlesource.com/126175

From-SVN: r263035
2018-07-27 18:43:34 +00:00
Ian Lance Taylor
867b003fd7 runtime: skip zero-sized fields in structs when converting to FFI
The libffi library doesn't understand zero-sized objects.
    When we see a zero-sized field in a struct, just skip it when
    converting to the FFI data structures. There is no value to pass in
    any case, so not telling libffi about the field doesn't affect
    anything.
    
    The test case for this is https://golang.org/cl/123316.
    
    Fixes golang/go#26335
    
    Reviewed-on: https://go-review.googlesource.com/123335

From-SVN: r262651
2018-07-13 20:39:02 +00:00
Ian Lance Taylor
7edd4c1885 re PR go/86331 (the gccgo's "go" tool looks like failing to invoke any sub go command)
PR go/86331
    os: check return value as well as error from waitid
    
    https://gcc.gnu.org/PR86331 indicates that if a signal handler runs it
    is possible for syscall.Syscall6 to return a non-zero errno value even
    if no error occurs. That is a problem in general, but this fix will
    let us work around the general problem for the specific case of
    calling waitid.
    
    Reviewed-on: https://go-review.googlesource.com/121595

From-SVN: r262313
2018-07-02 16:28:43 +00:00
Ian Lance Taylor
94e12bd4d9 runtime: don't stat a NULL filename
Noticed in https://gcc.gnu.org/PR86331.
    
    Reviewed-on: https://go-review.googlesource.com/121417

From-SVN: r262234
2018-06-28 20:54:04 +00:00
Ian Lance Taylor
88d51f7996 runtime: use #ifdef instead of #if for USING_SPLIT_STACK
USING_SPLIT_STACK is configured as defined/undefined, not 0/1.
    Most of the places test USING_SPLIT_STACK with #ifdef, with a
    few exceptions. This CL fixes the exceptions.
    
    Reviewed-on: https://go-review.googlesource.com/120596

From-SVN: r261980
2018-06-23 02:44:36 +00:00
Ian Lance Taylor
38a4d6da17 syscall: remove Ustat
glibc 2.28 removes ustat.h and the ustat function entirely, which
    breaks syscall.Ustat.
    
    Updates golang/go#25990
    
    Reviewed-on: https://go-review.googlesource.com/120535

From-SVN: r261896
2018-06-22 14:25:52 +00:00
Ian Lance Taylor
27fbc519e0 cmd/go: re-enable a couple of tests of gccgo
Port https://golang.org/cl/120375 over to the gofrontend repo so that
    it gets more reliable testing.
    
    Updates golang/go#22472
    
    Reviewed-on: https://go-review.googlesource.com/120395

From-SVN: r261871
2018-06-21 23:02:25 +00:00
Ian Lance Taylor
c949264918 libgo: update to Go 1.10.3 release
Reviewed-on: https://go-review.googlesource.com/118495

From-SVN: r261549
2018-06-13 13:51:23 +00:00
Ian Lance Taylor
87cbbc45a9 libgo: add riscv and js/wasm as known targets
Incorporates cut down versions of https://golang.org/cl/102835 and
    https://golang.org/cl/106256 from the master sources.
    
    This will tell go/build to skip files with those tags.
    
    Reviewed-on: https://go-review.googlesource.com/117996

From-SVN: r261451
2018-06-11 19:16:34 +00:00
Ian Lance Taylor
1d6ccc5f29 reflect: fix StructOf hash and string
Adjust the hash and string fields computed by StructOf to match the
    values that the compiler computes for a struct type with the same
    field names and types.  This makes the reflect code match the
    compiler's Type::hash_for_method and Type::reflection methods.
    
    Fixes golang/go#25284
    
    Reviewed-on: https://go-review.googlesource.com/116515

From-SVN: r261235
2018-06-06 14:50:16 +00:00
Ian Lance Taylor
e0b195b58a reflect: canonicalize types returned by StructOf() and friends
Background: since gccgo does not currently merge identical types at link time,
    the reflect function canonicalize() exists to choose a canonical specimen
    for each set of identical types.
    In this way, user code has the guarantee that identical types
    will always compare as ==
    
    Change: arrange reflect functions MapOf(), SliceOf(), StructOf() etc.
    to call canonicalize() on the types they create, before storing the types
    in internal lookup caches and returning them.
    
    This fixes known cases where canonicalize() is needed but was missing.
    Supersedes https://golang.org/cl/112575 and mostly fixes issue 25284.
    
    Updates golang/go#25284
    
    Reviewed-on: https://go-review.googlesource.com/115577

From-SVN: r261216
2018-06-05 20:23:40 +00:00
Ian Lance Taylor
11309337c4 libgo: update to Go 1.10.2 release
Reviewed-on: https://go-review.googlesource.com/115196

From-SVN: r261041
2018-05-31 21:42:53 +00:00
Ian Lance Taylor
bb3976df48 cmd/go, cmd/vet: make vet work with gccgo
Backport https://golang.org/cl/113715 and https://golang.org/cl/113716:
    
    cmd/go: don't pass -compiler flag to vet
    
    Without this running go vet -compiler=gccgo causes vet to fail.
    The vet tool does need to know the compiler, but it is passed in
    vetConfig.Compiler.
    
    cmd/go, cmd/vet, go/internal/gccgoimport: make vet work with gccgo
    
    When using gccgo/GoLLVM, there is no package file for a standard
    library package. Since it is impossible for the go tool to rebuild the
    package, and since the package file exists only in the form of a .gox
    file, this seems like the best choice. Unfortunately it was confusing
    vet, which wanted to see a real file. This caused vet to report errors
    about missing package files for standard library packages. The
    gccgoimporter knows how to correctly handle this case. Fix this by
    
    1) telling vet which packages are standard;
    2) letting vet skip those packages;
    3) letting the gccgoimporter handle this case.
    
    As a separate required fix, gccgo/GoLLVM has no runtime/cgo package,
    so don't try to depend on it (as it happens, this fixes golang/go#25324).
    
    The result is that the cmd/go vet tests pass when using -compiler=gccgo.
    
    Reviewed-on: https://go-review.googlesource.com/114516

From-SVN: r260913
2018-05-30 00:16:58 +00:00
Ian Lance Taylor
4ec2cf3bd0 crypto/x509: specify path to AIX certificate file
Reviewed-on: https://go-review.googlesource.com/113179

From-SVN: r260908
2018-05-30 00:16:02 +00:00
Ian Lance Taylor
2f55f4aa6c go/build, cmd/go: update to match recent changes to gc
Several recent changes to the gc version of cmd/go improve the
    gofrontend support. These changes are partially copies of existing
    gofrontend differences, and partially new code. This CL makes the
    gofrontend match the upstream code.
    
    The changes included here come from:
        https://golang.org/cl/111575
        https://golang.org/cl/111595
        https://golang.org/cl/111635
        https://golang.org/cl/111636
    
    For the record, the following recent gc changes are based on code
    already present in the gofrontend repo:
        https://golang.org/cl/110915
        https://golang.org/cl/111615
    
    For the record, a gc change, partially based on earlier gofrontend
    work, also with new gc code, was already copied to gofrontend repo in
    CL 111099:
        https://golang.org/cl/111097
    
    This moves the generated list of standard library packages from
    cmd/go/internal/load to go/build.
    
    Reviewed-on: https://go-review.googlesource.com/112475

gotools/:
	* Makefile.am (check-go-tool): Don't copy zstdpkglist.go.
	* Makefile.in: Rebuild.

From-SVN: r260097
2018-05-09 21:49:47 +00:00
Ian Lance Taylor
1c72513315 cmd/go: on AIX, pass -X64 first when invoking ar
Reviewed-on: https://go-review.googlesource.com/111535

From-SVN: r259946
2018-05-04 17:51:46 +00:00
Ian Lance Taylor
772455c964 libgo: fix for unaligned read in go-unwind.c's read_encoded_value()
Change code to work properly reading unaligned data on architectures
    that don't support unaliged reads. This fixes a regression (broke
    Solaris/sparc) introduced in https://golang.org/cl/90235.
    
    Reviewed-on: https://go-review.googlesource.com/111296

From-SVN: r259935
2018-05-04 14:29:05 +00:00
Ian Lance Taylor
105073e1cc cmd/go: update mkalldocs.sh
Update mkalldocs.sh from the current master sources, replacing the old
    mkdoc.sh.
    
    Reviewed-on: https://go-review.googlesource.com/111096

From-SVN: r259920
2018-05-04 01:43:39 +00:00
Ian Lance Taylor
28fc5502cf cmd/go: enable tests of vet tool
Since gofrontend does have the vet tool now, we can test it.
    
    Reviewed-on: https://go-review.googlesource.com/111095

From-SVN: r259919
2018-05-04 01:41:22 +00:00
Ian Lance Taylor
6522932843 cmd/go: update to match recent changes to gc
In https://golang.org/cl/111097 the gc version of cmd/go was updated
    to include some gofrontend-specific changes. The gofrontend code
    already has different versions of those changes; this CL makes the
    gofrontend match the upstream code.
    
    Reviewed-on: https://go-review.googlesource.com/111099

From-SVN: r259918
2018-05-04 01:34:30 +00:00
Ian Lance Taylor
5cf052826f cmd/go: run tests that require package build IDs
These tests used to be disabled in the gofrontend since the go tool
    didn't support build IDs for the gofrontend. It does now, so enable
    the tests again.
    
    Reviewed-on: https://go-review.googlesource.com/111098

From-SVN: r259875
2018-05-03 03:19:28 +00:00
Ian Lance Taylor
fbf2f198ce libgo: add type/const references to sysinfo.c
This patch adds explicit references to various types and constants
    defined by the header files included by sysinfo.c (used to drive the
    generation of gen-sysinfo.go as part of the libgo build via the GCC
    "-fdump-go-spec" option).
    
    The intent is to enable clients to gather the same info generated by
    "-fdump-go-spec" by instead reading the generated DWARF from a
    sysinfo.o object file compiled with "-g". Some compilers (notably
    clang) try to omit DWARF records for a given type unless there is an
    explicit use of it in the translation unit; the additional references
    are to insure that everything we want to see in the DWARF shows up.
    
    Reviewed-on: https://go-review.googlesource.com/99063

From-SVN: r259868
2018-05-02 22:32:23 +00:00
Ian Lance Taylor
746d6ed4ad libgo: add support for the Nios II architecture
Reviewed-on: https://go-review.googlesource.com/90775

From-SVN: r259866
2018-05-02 22:28:46 +00:00
Ian Lance Taylor
e1aeb9bc9e runtime: remove unused stack.go
We're never going to use stack.go for gccgo.  Although a build tag
    keeps it from being built, even having it around can be confusing.
    Remove it.
    
    Reviewed-on: https://go-review.googlesource.com/40774

From-SVN: r259865
2018-05-02 22:01:22 +00:00
Ian Lance Taylor
cec9701b51 libgo: refactor code to enumerate stdlib packages
Move the list of libgo, gotool, and check-target packages into
    separate files, then read the file contents as part of the build
    process on the fly. This is intended to enable other build tooling to
    share the canonical list of target packages (avoid duplication).
    
    Reviewed-on: https://go-review.googlesource.com/89515

    libgo: revise rules for runtime.inc generation
    
    Refactor code for generating runtime.inc: extract out the relevant
    commands and place them in a separate shell script ("mkruntimeinc.sh").
    Update rules to avoid generating macros whose names begin with "$",
    such as "#define $sinkconst0 0".
    
    Reviewed-on: https://go-review.googlesource.com/85955

From-SVN: r259863
2018-05-02 21:57:35 +00:00
Ian Lance Taylor
019808c95c libgo: break dependence on libgcc unwind-pe.h
The C portion of the Go runtime includes the header "unwind-pe.h" from
    libgcc, which contains some constants and a few small routines for
    decoding pointer values within unwind info. This patch gets rid of
    that include and instead adds a re-implementation of that
    functionality in the single file that uses it. The intent is to allow
    the C runtime portion of libgo to be built without a companion GCC
    installation.
    
    Reviewed-on: https://go-review.googlesource.com/90235

From-SVN: r259861
2018-05-02 21:53:30 +00:00
Ian Lance Taylor
8c2e1d6ca5 re PR go/85429 (Several gotools tests FAIL with Solaris as)
PR go/85429
    cmd/go: support more Solaris assembler syntaxes
    
    Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/110563

From-SVN: r259797
2018-05-01 14:08:44 +00:00
Ian Lance Taylor
2885a4939a re PR go/85429 (Several gotools tests FAIL with Solaris as)
PR go/85429
    cmd/go: add Solaris assembler syntax for gccgo buildid file
    
    The Solaris assembler uses a different syntax for section directives.
    
    This is https://golang.org/cl/109140 ported over to gccgo.
    
    Reviewed-on: https://go-review.googlesource.com/109141

From-SVN: r259719
2018-04-27 18:01:00 +00:00
Ian Lance Taylor
447638d2c4 gotest: only use [TD] on big-endian PPC64 non-AIX systems
Reviewed-on: https://go-review.googlesource.com/108457

From-SVN: r259531
2018-04-20 20:40:27 +00:00
Ian Lance Taylor
4ba0105019 os/signal: disable loading of history during test
Bring in https://golang.org/cl/98616 from gc tip.
    
    Original CL description:
    
        This change modifies Go to disable loading of users' shell history for
        TestTerminalSignal tests. TestTerminalSignal, as part of its workload,
        will execute a new interactive bash shell. Bash will attempt to load the
        user's history from the file pointed to by the HISTFILE environment
        variable. For users with large histories that may take up to several
        seconds, pushing the whole test past the 5 second timeout and causing
        it to fail.
    
    Reviewed-on: https://go-review.googlesource.com/107624

From-SVN: r259452
2018-04-17 23:55:17 +00:00
Ian Lance Taylor
aa4ec2cdff gccgo: suppress "ar rcD" and "-zdefs" on AIX
Reviewed-on: https://go-review.googlesource.com/100955

From-SVN: r259445
2018-04-17 20:10:49 +00:00
Ian Lance Taylor
a8ebf991f3 runtime: don't check for stale runtime
The gccgo runtime is never stale, and on a system with gc sources in
    ~/go the test may wind up checking whether the gc runtime is stale.
    
    Reviewed-on: https://go-review.googlesource.com/102282

From-SVN: r258865
2018-03-26 19:29:27 +00:00
Ian Lance Taylor
534d990b35 libgo: add runtime/pprof/internal/profile.gox to noinst_DATA
Also add noinst_DATA to CHECK_DEPS; it's not needed in practice since
    `make` will build noinst_DATA, but it's logically required and will
    make a difference if any of the noinst_DATA sources change between
    `make` and `make check`.
    
    Tony Reix figured out why omitting packages from noinst_DATA didn't
    seem to matter: because if gccgo can't find foo.gox, it will fall back
    to reading the export data in foo.o, and foo.o will exist because
    these packages go into libgo.a.
    
    Reviewed-on: https://go-review.googlesource.com/101077

From-SVN: r258606
2018-03-16 19:01:40 +00:00
Ian Lance Taylor
8bb2726d08 cmd/go: force LANG=C when looking for compiler version
Tested by installing the gcc-locales package and running
        LANG=de_DE.utf8 go build hello.go
    Without this change, that fails, as described at
    https://gcc.gnu.org/PR84765.
    
    Reviewed-on: https://go-review.googlesource.com/100737

From-SVN: r258565
2018-03-15 16:56:24 +00:00
Ian Lance Taylor
300e61fa15 commit ce28919112dbb234366816ab39ce060ad45e8ca9
Makefile: add internal/trace to noinst_DATA
    
    The internal/trace package is only imported by tests (specifically the
    tests in runtime/trace) so it must be in noinst_DATA to ensure that it
    is built before running the tests.
    
    This was mostly working because internal/trace has tests itself, and
    is listed in check-packages.txt before runtime/trace, so typical
    invocations of make would build internal/trace for checking purposes
    before checking runtime/trace.  But we need this change to make that
    reliable.
    
    Reviewed-on: https://go-review.googlesource.com/99836

From-SVN: r258392
2018-03-09 18:21:42 +00:00
Ian Lance Taylor
123ba0918c runtime: push arena on AIX higher due to clashes
Reviewed-on: https://go-review.googlesource.com/99117

From-SVN: r258337
2018-03-07 15:22:46 +00:00
Ian Lance Taylor
2dab5d909f runtime: use a fence instruction before rdtsc
This implements the same choices made in the gc runtime, except that
    for 32-bit x86 we only use the fence instruction if the processor
    supports SSE2.
    
    The code here is hacked up for speed; the gc runtime uses straight
    assembler.
    
    Reviewed-on: https://go-review.googlesource.com/97715

From-SVN: r258336
2018-03-07 14:31:03 +00:00
Ian Lance Taylor
14710257c1 libgo: fix typo in mksysinfo.sh script
Fix a small typo in the mksysinfo.sh script (incorrect input
    file for a grep command).
    
    Reviewed-on: https://go-review.googlesource.com/98635

From-SVN: r258259
2018-03-05 18:44:44 +00:00
Ian Lance Taylor
8cda97ab52 runtime: update AIX memory allocation for new versions
Reviewed-on: https://go-review.googlesource.com/97357

From-SVN: r258052
2018-02-28 01:39:03 +00:00
Ian Lance Taylor
930540ca89 libgo: update to final Go 1.10 release
Reviewed-on: https://go-review.googlesource.com/97517

From-SVN: r258051
2018-02-28 01:19:07 +00:00
Andreas Schwab
b613cc2e91 re PR go/84484 (libgo configure tests fail to find -latomic)
PR go/84484
    libgo: add support for riscv64
    
    Patch by Andreas Schwab.
    
    Reviewed-on: https://go-review.googlesource.com/96377

	* go.test/go-test.exp (go-set-goarch): Recognize riscv64-*-*.

From-SVN: r257914
2018-02-22 19:49:04 +00:00
Ian Lance Taylor
afedc99bd2 runtime: funcfileline: get missing function name from symbol table
Copy the idea of https://golang.org/cl/92756 to funcfileline, which is
    used by runtime.FuncForPC, runtime.(*Frames).Next, and others.
    
    Reviewed-on: https://go-review.googlesource.com/96175

From-SVN: r257913
2018-02-22 18:52:33 +00:00
Ian Lance Taylor
35e7db41ca libgo: add -L option for libatomic when using -pthread
Fixes https://gcc.gnu.org/PR84484
    
    Reviewed-on: https://go-review.googlesource.com/95436

From-SVN: r257911
2018-02-22 18:49:33 +00:00
Ian Lance Taylor
911cef2e3b runtime: allow preemption in fast syscall return
Let a fast syscall return be a preemption point.  This helps with
    tight loops that make system calls, as in BenchmarkSyscallExcessWork.
    
    Reviewed-on: https://go-review.googlesource.com/94895

From-SVN: r257848
2018-02-20 15:30:31 +00:00
Ian Lance Taylor
c3ab26e8bb runtime: add some more preemption checks
In particular this lets BenchmarkPingPongHog in runtime/proc_test.go
    complete.
    
    Reviewed-on: https://go-review.googlesource.com/94735

From-SVN: r257743
2018-02-16 16:42:53 +00:00
Ian Lance Taylor
52eb4ab409 compiler: error on func declaration/definition
Long long long ago Go permitted writing
        func F()
    in one file and writing
        func F() {}
    in another file.  This was removed from the language, and that is now
    considered to be a multiple definition error.  Gccgo never caught up
    to that, and it has been permitting this invalid code for some time.
    
    Stop permitting it, so that we give correct errors.  Since we've
    supported it for a long time, the compiler uses it in a couple of
    cases: it predeclares the hash/equal methods if it decides to create
    them while compiling another function, and it predeclares main.main as
    a mechanism for getting the right warning if a program uses the wrong
    signature for main.  For simplicity, keep those existing uses.
    
    This required a few minor changes in libgo which were relying,
    unnecessarily, on the current behavior.
    
    Reviewed-on: https://go-review.googlesource.com/93083

From-SVN: r257600
2018-02-12 19:29:52 +00:00
Ian Lance Taylor
86ff185365 re PR go/84215 (Random results in go/libgo tests)
PR go/84215
    runtime, sync/atomic: use write barrier for atomic pointer functions
    
    This copies atomic_pointer.go from 1.10rc2.  It was omitted during the
    transition of the runtime from C to Go, and I forgot about it.
    
    This may help with https://gcc.gnu.org/PR84215.
    
    Reviewed-on: https://go-review.googlesource.com/93197

From-SVN: r257599
2018-02-12 18:50:16 +00:00
Ian Lance Taylor
74e6f14adb runtime: get missing function name from symbol table
If we trace back through code that has no debug info, as when calling
    through C code compiled with -g0, we won't have a function name.
    Try to fetch the function name using the symbol table.
    
    Adding the test case revealed that gotest failed to use the gccgo tag
    when matching files, so add that.
    
    Reviewed-on: https://go-review.googlesource.com/92756

From-SVN: r257495
2018-02-08 15:37:43 +00:00
Ian Lance Taylor
9adab5dd16 libgo: update to Go1.10rc2
Reviewed-on: https://go-review.googlesource.com/92736

From-SVN: r257493
2018-02-08 15:30:22 +00:00
Ian Lance Taylor
f1a2d8b1b5 runtime: don't call funcPC from a function
The escape analysis support is not yet good enough to avoid escaping
    the argument to funcPC.  This causes unnecessary and often harmful
    memory allocation.  E.g., (*cpuProfile).addExtra can be called from a
    signal handler, and it must not allocate memory.
    
    Move the calls to funcPC to use variables instead.  This was done in
    the original migration to using funcPC, but was not done for newer code.
    
    In one case, in signal handling code, use getSigtramp.
    
    Reviewed-on: https://go-review.googlesource.com/92735

From-SVN: r257463
2018-02-07 22:04:55 +00:00
Ian Lance Taylor
c88893a0da runtime: correct runtime structfield type to match reflect
The offset field in structfield has changed to offsetAnon, and now
    requires a shift to get the actual offset value.
    
    Fixes golang/go#23391
    
    Reviewed-on: https://go-review.googlesource.com/92275

From-SVN: r257413
2018-02-06 15:18:50 +00:00
Ian Lance Taylor
59597e3735 cmd/go: don't lose last flag from _cgo_flags
The quoting code that read _cgo_flags, currently only in the gccgo
    version of cmd/go, was losing the last flag read from the file.
    
    Fixes golang/go#23666
    
    Reviewed-on: https://go-review.googlesource.com/91655

From-SVN: r257373
2018-02-05 01:38:34 +00:00
Ian Lance Taylor
60a57222fe reflect: enable allocation tests
They were disabled due to the lack of escape analysis. Now that
    we have escape analysis, unskip these tests.
    
    Reviewed-on: https://go-review.googlesource.com/86248

From-SVN: r257324
2018-02-02 00:33:03 +00:00
Ian Lance Taylor
38f08ec0bd runtime: scan register backing store on ia64
On ia64, a separate stack is used for saving/restoring register frames,
    occupying the other end of the stack mapping. This must also be scanned
    for pointers into the heap.
    
    Reviewed-on: https://go-review.googlesource.com/85276

From-SVN: r257323
2018-02-02 00:16:43 +00:00
Ian Lance Taylor
28f3c8143b math: adjust compilation flags, use them when testing
We were using special compilation flags for the math package, but we
    weren't using them when testing.  That meant that our tests were not
    checking the real code we were providing.  Fix that.
    
    Fixing that revealed that we were not using a good set of flags, or at
    least were not using flags that let the tests pass.  Adjust the flags
    to stop using -funsafe-math-optimizations on x86.  Instead always use
    -ffp-contract=off -fno-math-errno -fno-trapping-math for all targets.
    
    Fixes golang/go#23647
    
    Reviewed-on: https://go-review.googlesource.com/91355

From-SVN: r257312
2018-02-01 21:05:20 +00:00
Ian Lance Taylor
4d0bf3e1e1 compiler: omit field name for embedded fields in reflection string
This matches the gc compiler.
    
    The test case was sent for the master repo as
    https://golang.org/cl/91138.
    
    Fixes golang/go#23620
    
    Reviewed-on: https://go-review.googlesource.com/91139

From-SVN: r257300
2018-02-01 15:54:04 +00:00
Ian Lance Taylor
fc876f22b3 net: declare lib_getaddrinfo as returning int32
Otherwise on a 64-bit system we will read the 32-bit value as a 64-bit
    value.  Since getaddrinfo returns negative numbers as error values,
    these will be interpreted as numbers like 0xfffffffe rather than -2,
    and the comparisons with values like syscall.EAI_NONAME will fail.
    
    Fixes golang/go#23645
    
    Reviewed-on: https://go-review.googlesource.com/91296

From-SVN: r257299
2018-02-01 15:49:53 +00:00
Ian Lance Taylor
9734500e9b runtime: fix type descriptor name in C code
I forgot to update the name of the map[string]bool type descriptor
    used in go-fieldtrack.c.  This didn't cause any errors because it's a
    weak symbol, and the current testsuite has no field tracking tests.
    
    Reviewed-on: https://go-review.googlesource.com/91096

From-SVN: r257249
2018-01-31 18:25:17 +00:00
Ian Lance Taylor
382ce98374 gotest: accept symbols with leading dot
On AIX nm displays symbols with a leading dot; don't discard such
    symbols.
    
    While we're here stop doing fgrep -v '$', symbol names no longer
    contain '$' anyhow.
    
    Reviewed-on: https://go-review.googlesource.com/91095

From-SVN: r257247
2018-01-31 18:21:47 +00:00
Ian Lance Taylor
cb6a6b25e4 net: rename TestAddr6 to avoid gotest confusion
On ppc64 gotest treats data variables whose names begin with "Test" as
    tests to run.  This is to support the function descriptors used for
    ppc64 ELF ABI v1.  This causes gotest to think that TestAddr6 is a
    test, when it is actually a variable.  For a simple fix until we can
    figure out how to write gotest properly, rename the variable.
    
    Fixes golang/go#23623
    
    Reviewed-on: https://go-review.googlesource.com/90995

From-SVN: r257235
2018-01-31 14:43:37 +00:00
Ian Lance Taylor
111c8b4ce9 internal/syscall/unix: add randomTrap for sh/shbe
CL 84555 added support for the SuperH architecture, but didn't add the
    randomTrap definition to be used for the getrandom syscall on Linux.
    Add it now.
    
    Reviewed-on: https://go-review.googlesource.com/90535

From-SVN: r257171
2018-01-30 04:48:55 +00:00
Ian Lance Taylor
f6acbd0805 libgo: update to Go1.10rc1
Reviewed-on: https://go-review.googlesource.com/90295

From-SVN: r257127
2018-01-27 23:45:46 +00:00
Ian Lance Taylor
d779dffc4b libgo: update to Go1.10rc1
Reviewed-on: https://go-review.googlesource.com/90295

From-SVN: r257126
2018-01-27 23:44:29 +00:00
Ian Lance Taylor
a14e122ae2 compiler: deref receiver types in mangled names
This was the original intent, as reflected in the long comment at the
    start of names.cc, but I forgot to implement it.
    
    Also, remove a leading ".0" from the final name.  That could occur for
    a method whose receiver type starts with 'u', as in that case we
    prepend a space to the mangled name, to avoid confusion with the
    Unicode mangling, and the space turns into ".0".
    
    Also, if the Unicode encoding would cause the final to start with
    "..u" or "..U", add a leading underscore.
    
    Patch gotest to not get fooled by some names.
    
    The result of these changes is that all symbols start with a letter or
    an underscore.
    
    Reviewed-on: https://go-review.googlesource.com/90015

From-SVN: r257068
2018-01-25 23:10:35 +00:00
Ian Lance Taylor
a88d1f8bb2 runtime: fix lfstackUnpack on ia64
The top three region number bits must be masked out before
    right-shifting the address bits into place, otherwise they will be
    copied down into the lower always-zero address bits.
    
    Reviewed-on: https://go-review.googlesource.com/84535

From-SVN: r257061
2018-01-25 17:44:19 +00:00
Ian Lance Taylor
4880b994d6 compiler: rationalize external symbol names
Encode all external symbol names using only ASCII alphanumeric
    characters, underscore, and dot.  Use a scheme that can be reliably
    demangled to a somewhat readable version as described in the long
    comment in names.cc.
    
    A minor cleanup discovered during this was that we were treating
    function types as different if one had a NULL parameters_ field and
    another has a non-NULL parameters_ field that has no parameters.  This
    worked because we mangled them slightly differently.  We now mangle
    them the same, so we treat them as equal, as we should anyhow.
    
    Reviewed-on: https://go-review.googlesource.com/89555

	* go.go-torture/execute/names-1.go: New test.

From-SVN: r257033
2018-01-24 23:50:09 +00:00
Ian Lance Taylor
38ad6f8a44 cmd/go: buildid support for AIX archives.
Reviewed-on: https://go-review.googlesource.com/88935

From-SVN: r256971
2018-01-23 04:44:12 +00:00
Ian Lance Taylor
2a3abc862a mksysinfo: use rlimit64 if available when we use getrlimit64
This makes no difference on most systems, because <sys/resource.h>
    renames the type appropriately anyhow, but apparently it makes a
    difference on AIX.
    
    Reviewed-on: https://go-review.googlesource.com/88076

From-SVN: r256877
2018-01-19 05:09:43 +00:00
Ian Lance Taylor
ddc606cef7 mksysinfo: force Passwd.Pw_[ug]id from int32 to uint32
Solaris 10 uses int32 for the Pw_uid and Pw_gid fields of Passwd,
    but most systems, including Solaris 11, use uint32.  Force uint32
    for consistency and to fix the build.
    
    Reviewed-on: https://go-review.googlesource.com/88195

From-SVN: r256875
2018-01-19 04:52:12 +00:00
Ian Lance Taylor
674dddfe2d runtime: no escape for some functions on AIX
Reviewed-on: https://go-review.googlesource.com/88236

From-SVN: r256874
2018-01-19 04:48:51 +00:00
Ian Lance Taylor
219f9bad83 cmd/go: recognize AIX objects and archives
Reviewed-on: https://go-review.googlesource.com/88275

From-SVN: r256873
2018-01-19 04:27:38 +00:00
Ian Lance Taylor
549e4febc3 runtime: add go:noescape declaration for Solaris
Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/88376

From-SVN: r256872
2018-01-19 04:09:55 +00:00
Ian Lance Taylor
a9411cce01 re PR go/83787 (Many 32-bit Solaris/SPARC Go tests FAIL after Go1.10beta1 update)
PR go/83787
    compiler: pass int to makechan, call makechan64 when appropriate
    
    The update to 1.10beta1 changed makechan to take int instead of int64,
    and added a makechan64 call for large values.  Since the size is the
    last argument to makechan, the old compiler which always passed a
    64-bit int worked fine on 64-bit systems and little-endian 32-bit
    systems, but broke on big-endian 32-bit systems.  This CL fixes the
    compiler to use the appropriate types.
    
    This fixes GCC PR 83787.
    
    Reviewed-on: https://go-review.googlesource.com/88077

From-SVN: r256835
2018-01-18 04:24:48 +00:00
Ian Lance Taylor
c1fa27707a archive/tar: support stat and device numbers on AIX
Reviewed-on: https://go-review.googlesource.com/87198

From-SVN: r256810
2018-01-17 18:33:50 +00:00
Ian Lance Taylor
c6d6367f84 libgo: update to Go1.10beta2 release
Reviewed-on: https://go-review.googlesource.com/87897

From-SVN: r256794
2018-01-17 14:20:29 +00:00
Ian Lance Taylor
ffad1c54d2 go/types: implement SizesFor for gccgo
Move the architecture-specific settings out of configure.ac into a new
    shell script goarch.sh.  Use the new script to collect the values for
    all architectures to make them available in go/types.
    
    Also fix cmd/vet to pass the right compiler when it calls SizesFor.
    
    This fixes cmd/vet for systems that are not implemented in the gc
    toolchain, such as alpha and ia64.
    
    Reviewed-on: https://go-review.googlesource.com/87635

From-SVN: r256655
2018-01-14 04:59:01 +00:00
Ian Lance Taylor
fbea3c33e8 re PR go/83794 (misc/cgo/test uses gigabytes of memory)
PR go/83794
    misc/cgo/test: avoid endless loop when we can't parse notes
    
    Reviewed-on: https://go-review.googlesource.com/87416

From-SVN: r256553
2018-01-11 19:58:55 +00:00
Ian Lance Taylor
840573729e debug/dwarf: formStrp uses a 64-bit value for 64-bit DWARF
No test as the only system I know that uses 64-bit DWARF is AIX.
    
    Backport of https://golang.org/cl/84379, which will be in Go 1.11.
    Backporting now for AIX support in gccgo.
    
    Reviewed-on: https://go-review.googlesource.com/87296

From-SVN: r256474
2018-01-11 01:51:16 +00:00
Ian Lance Taylor
bbb31a1d5c os, syscall: handle _st_timespec for AIX stat
Reviewed-on: https://go-review.googlesource.com/87197

From-SVN: r256450
2018-01-10 19:51:24 +00:00
Ian Lance Taylor
fd0c1dd167 libgo: add platform support for SuperH
Reviewed-on: https://go-review.googlesource.com/84555

From-SVN: r256446
2018-01-10 19:19:02 +00:00
Ian Lance Taylor
7074b41bdc Add missing .a files.
Add missing .a files.  These should have been committed with the
update to go1.10beta1, but were skipped because by default Subversion
ignores all files matching *.a.

From-SVN: r256442
2018-01-10 18:02:33 +00:00
Ian Lance Taylor
389578d7a6 re PR c/82922 (Request: add -Wstrict-prototypes to -Wextra as K&R style is obsolescent)
PR c/82922

    runtime, syscall: use full prototypes in C code
    
    Based on patch by Martin Sebor.
    
    Reviewed-on: https://go-review.googlesource.com/86815

From-SVN: r256437
2018-01-10 15:42:23 +00:00
Ian Lance Taylor
447fb74d97 exp: remove exp/proxy and exp/terminal packages
The exp/proxy package was removed from the master library in
    https://golang.org/cl/6461056 (August, 2012).
    
    The exp/terminal package was removed from the master library in
    https://golang.org/cl/5970044 (March, 2012).
    
    I'm not sure why they lingered in the gofrontend copy, but let's
    finally remove them now.
    
    Reviewed-on: https://go-review.googlesource.com/87138

From-SVN: r256435
2018-01-10 15:37:45 +00:00
Ian Lance Taylor
d0ac0d52e9 cmd/go: check for another GCC error message
GCC always recognizes the -fsplit-stack option, but then tests whether
    it is supported by the selected target. If not, it reports
        cc1: error: ‘-fsplit-stack’ is not supported by this compiler configuration
    Check for that error message when deciding whether a compiler option works.
    
    Reviewed-on: https://go-review.googlesource.com/87137

From-SVN: r256433
2018-01-10 15:18:55 +00:00
Ian Lance Taylor
c9edeca8b8 runtime: fix makemap calls in __go_construct_map
The signature of makemap changed with the update to 1.10beta1,
    but I forgot to update the call from C code.
    
    Reviewed-on: https://go-review.googlesource.com/87135

From-SVN: r256431
2018-01-10 15:04:21 +00:00
Ian Lance Taylor
692aefcd56 runtime: work around escaping closure in export_test.go
When compiling runtime, it is not allowed for local variables
    and closures to be heap allocated. In one test, there is a go
    statement with a closure. In the gc compiler, it distinguishes
    capturing variable by value vs. by address, and rewrites it to
    passing the captured values as arguments. Currently we don't
    have this, and the escape analysis decides to heap allocate the
    closure and also the captured variables, which is not allowed.
    Work around it by passing the variables explicitly.
    
    This is in preparation of turning on escape analysis for the
    runtime.
    
    Reviewed-on: https://go-review.googlesource.com/86245

From-SVN: r256419
2018-01-10 05:26:29 +00:00
Ian Lance Taylor
e4876be5f5 runtime: noescape some functions/variables
This is in preparation of turning on escape analysis for the
    runtime.
    
    - In gccgo, systemstack is implemented with mcall, which is not
      go:noescape. Wrap the closure in noescape so the escape analysis
      does not think it escapes.
    
    - Mark some C functions go:noescape. They do not leak arguments.
    
    - Use noescape function to make a few local variables' addresses
      not escape. The escape analysis cannot figure out because they
      are assigned to pointer indirections.
    
    Reviewed-on: https://go-review.googlesource.com/86244

From-SVN: r256418
2018-01-10 05:15:52 +00:00
Ian Lance Taylor
fe9e170268 cmd/go: add AIX support
For gccgo code avoid --whole-archive and -(.  Use -blibpath instead of
    -rpath.
    
    Reviewed-on: https://go-review.googlesource.com/86956

From-SVN: r256417
2018-01-10 05:12:39 +00:00
Ian Lance Taylor
76e723a313 libgo: add aix build tags
Reviewed-on: https://go-review.googlesource.com/86936

From-SVN: r256416
2018-01-10 04:53:55 +00:00
Ian Lance Taylor
ee6019ce5d os/signal/internal/pty: build on Solaris
Patch from Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/87037

From-SVN: r256399
2018-01-09 21:42:59 +00:00
Ian Lance Taylor
1a2f01efa6 libgo: update to Go1.10beta1
Update the Go library to the 1.10beta1 release.
    
    Requires a few changes to the compiler for modifications to the map
    runtime code, and to handle some nowritebarrier cases in the runtime.
    
    Reviewed-on: https://go-review.googlesource.com/86455

gotools/:
	* Makefile.am (go_cmd_vet_files): New variable.
	(go_cmd_buildid_files, go_cmd_test2json_files): New variables.
	(s-zdefaultcc): Change from constants to functions.
	(noinst_PROGRAMS): Add vet, buildid, and test2json.
	(cgo$(EXEEXT)): Link against $(LIBGOTOOL).
	(vet$(EXEEXT)): New target.
	(buildid$(EXEEXT)): New target.
	(test2json$(EXEEXT)): New target.
	(install-exec-local): Install all $(noinst_PROGRAMS).
	(uninstall-local): Uninstasll all $(noinst_PROGRAMS).
	(check-go-tool): Depend on $(noinst_PROGRAMS).  Copy down
	objabi.go.
	(check-runtime): Depend on $(noinst_PROGRAMS).
	(check-cgo-test, check-carchive-test): Likewise.
	(check-vet): New target.
	(check): Depend on check-vet.  Look at cmd_vet-testlog.
	(.PHONY): Add check-vet.
	* Makefile.in: Rebuild.

From-SVN: r256365
2018-01-09 01:23:08 +00:00
Ian Lance Taylor
319e41dc77 libgo: fix GOARCH_CACHELINESIZE on ia64
Reviewed-on: https://go-review.googlesource.com/85256

From-SVN: r256306
2018-01-06 01:17:29 +00:00
Ian Lance Taylor
be528ae9aa os: pass -s to hostname on AIX
Reviewed-on: https://go-review.googlesource.com/79375

From-SVN: r255738
2017-12-16 01:49:54 +00:00
Ian Lance Taylor
fe6272cc44 syscall: emulate Flock on AIX
Reviewed-on: https://go-review.googlesource.com/79095

From-SVN: r255737
2017-12-16 01:45:45 +00:00
Ian Lance Taylor
4c413747a3 libgo: remove -fplan9-extensions from CFLAGS
Remove -fplan9-extensions from the CFLAGS used for libgo (no
    longer needed since the runtime was converted from C to Go).
    
    Reviewed-on: https://go-review.googlesource.com/82177

From-SVN: r255445
2017-12-06 17:43:29 +00:00
Ian Lance Taylor
79c9f76563 runtime: export cgoCheck functions
The functions cgoCheckPointer and cgoCheckResult are called by code
    generated by cgo. That means that we need to export them using
    go:linkname, as otherwise they are local symbols. The cgo code
    currently uses weak references to only call the symbols if they are
    defined, which is why it has been working--the cgo code has not been
    doing any checks.
    
    Reviewed-on: https://go-review.googlesource.com/80295

From-SVN: r255347
2017-12-02 00:46:00 +00:00
Ian Lance Taylor
02dc624e21 cmd/go, go/internal/gccgoimporter: pass -X to ar on AIX
Reviewed-on: https://go-review.googlesource.com/72930

From-SVN: r255090
2017-11-23 00:24:21 +00:00
Ian Lance Taylor
ce143aa6e3 libgo: don't use grep -q in mksigtab.sh
Solaris grep does not support the -q option.
    
    Reviewed-on: https://go-review.googlesource.com/79239

From-SVN: r255042
2017-11-22 00:27:29 +00:00
Ian Lance Taylor
c9548fa4f1 libgo: fix makefile buglet
Fix a small bug in the libgo Makefile recipe that constructs the
    directory from which to pick up libgcc_s.so ; the gccgo invocation
    with -print-libgcc-file-name was missing the flags, which meant that
    for -m32 builds we'd see the 64-bit libgcc dir.
    
    Reviewed-on: https://go-review.googlesource.com/78836

From-SVN: r254984
2017-11-21 06:19:10 +00:00
Rainer Orth
f021f1d3a6 Adapt Solaris 12 references
libgcc:
	* config.host (*-*-solaris2*): Adapt comment for Solaris 12
	renaming.
	* config/sol2/crtpg.c (__start_crt_compiler): Likewise.
	* configure.ac (libgcc_cv_solaris_crts): Likewise.
	* configure: Regenerate.

	gcc:
	* config.gcc (*-*-solaris2*): Enable default_use_cxa_atexit since
	Solaris 11.  Update comment.
	* configure.ac (gcc_cv_ld_pid): Adapt comment for Solaris 12
	renaming.
	* config/sol2.h (STARTFILE_SPEC): Likewise.
	* configure: Regenerate.

	gcc/testsuite:
	* lib/target-supports.exp (check_effective_target_pie): Adapt
	comment for Solaris 12 renaming.

	* gcc.dg/torture/pr60092.c: Remove *-*-solaris2.11* dg-xfail-run-if.

From-SVN: r254737
2017-11-14 18:31:01 +00:00
Ian Lance Taylor
082fc7e884 libgo: adapt Solaris 12 references
With the change in the Solaris release model (no more major releases
    like Solaris 12 but only minor ones like 11.4), the Solaris 12
    references in GCC need to be adapted.
    
    Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/77490

From-SVN: r254729
2017-11-14 14:26:04 +00:00
Ian Lance Taylor
5ac29058f0 sync/atomic, runtime/internal/atomic: don't assume reads from 0 fail
For a misaligned address force a panic rather than assuming that reading
    from the address 0 will cause one.
    
    Reviewed-on: https://go-review.googlesource.com/69850

From-SVN: r254610
2017-11-09 21:56:59 +00:00
Ian Lance Taylor
ce995d1cc2 libgo: pass flags to recursive make
"make check" runs make recursively to check each package. Pass
    the flags through. So it is possible to run "make check" with
    different settings easily.
    
    Reviewed-on: https://go-review.googlesource.com/76029

From-SVN: r254475
2017-11-06 20:59:32 +00:00
Ian Lance Taylor
001cbba0ef debug/dwarf: support 64-bit DWARF in byte order check
Also fix 64-bit DWARF to read a 64-bit abbrev offset in the
    compilation unit.
    
    This is a backport of https://golang.org/cl/71171, which will be in
    the Go 1.10 release, to the gofrontend copy. Doing it now because AIX
    is pretty much the only system that uses 64-bit DWARF.
    
    Reviewed-on: https://go-review.googlesource.com/72250

From-SVN: r253955
2017-10-20 18:34:36 +00:00
Ian Lance Taylor
3ff1b2b0a9 runtime: fix issues on AIX about uintptr(_t)
Reviewed-on: https://go-review.googlesource.com/69891

From-SVN: r253664
2017-10-11 21:16:49 +00:00
Ian Lance Taylor
eafa7a907b debug/elf: support 32-bit SPARC relocs
Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/67111

From-SVN: r253292
2017-09-29 14:35:58 +00:00
Ian Lance Taylor
039073944d mksysinfo: strip locale structs
We don't need them, and this fixes the build when using uClibc-ng
    1.0.26 as originally reported at
    https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01930.html
    
    Reviewed-on: https://go-review.googlesource.com/67110

From-SVN: r253291
2017-09-29 14:14:40 +00:00
Ian Lance Taylor
509b9b7ae0 net: check Getsockname error return
Reviewed-on: https://go-review.googlesource.com/64550

From-SVN: r253231
2017-09-27 14:22:36 +00:00
Ian Lance Taylor
c90df0d293 debug/xcoff,cmd: add XCOFF support
Reviewed-on: https://go-review.googlesource.com/64592

From-SVN: r253105
2017-09-22 18:49:52 +00:00
Ian Lance Taylor
7399e345be libgo: fix build when using -enable-static=no
With -enable-static=no we don't build non-pic objects, but libgotool.a
    is built from non-pic objects.  Build the packages that go into
    libgotool.a in static mode in all cases.
    
    Also ensure that internal test packages are built, since nothing
    explicitly depended on them.
    
    Reviewed-on: https://go-review.googlesource.com/65050

From-SVN: r253042
2017-09-20 23:31:00 +00:00
Ian Lance Taylor
836cccc71d syscall: enable ParseDirent for AIX
Reviewed-on: https://go-review.googlesource.com/64990

From-SVN: r253022
2017-09-20 17:49:11 +00:00
Ian Lance Taylor
5e525857e9 syscall: workaround for getsockname bug in AIX
Reviewed-on: https://go-review.googlesource.com/64552

From-SVN: r253021
2017-09-20 17:40:11 +00:00
Ian Lance Taylor
7ba0b15a7e internal,net,os,runtime,syscall: fixes for AIX following update to go1.9
Reviewed-on: https://go-review.googlesource.com/64551

From-SVN: r253016
2017-09-20 14:59:39 +00:00
Ian Lance Taylor
8fca13953b runtime: restore "goroutine in C code" message
In the 1.9 upgrade I took out the word "goroutine" from a traceback
    showing a goroutine running in C code, to let TestCgoNumGoroutine
    pass.  However, it turns out that some code is actually checking for
    that string; for example,
    https://github.com/grpc/grpc-go/blob/master/test/leakcheck/leakcheck.go#L44
    So keep the message the same, and change the test.
    
    Reviewed-on: https://go-review.googlesource.com/64850

From-SVN: r252991
2017-09-20 00:33:29 +00:00
Ian Lance Taylor
4d034b5259 runtime: always initialize str field in __go_string_slice result
Reviewed-on: https://go-review.googlesource.com/64110

From-SVN: r252953
2017-09-18 22:29:45 +00:00
Ian Lance Taylor
d00f9deb02 syscall: fixes for Solaris
Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/64170

From-SVN: r252866
2017-09-15 22:57:23 +00:00
Ian Lance Taylor
bc998d034f libgo: update to go1.9
Reviewed-on: https://go-review.googlesource.com/63753

From-SVN: r252767
2017-09-14 17:11:35 +00:00
Ian Lance Taylor
022aa0ce5e compiler, runtime: simplify select and channel operations
In preparation for upgrading libgo to the 1.9 release, this
    approximately incorporates https://golang.org/cl/37661 and
    https://golang.org/cl/38351.
    
    CL 37661 changed the gc compiler such that the select statement simply
    returns an integer which is then used as the argument for a switch.
    Since gccgo already worked that way, this just adjusts the switch code
    to look like the gc switch code by removing the explicit case index
    expression and calculating it from the order of calls to selectsend,
    selectrecv, and selectdefault.
    
    CL 38351 simplifies the channel code by not passing the unused channel
    type descriptor pointer.
    
    Reviewed-on: https://go-review.googlesource.com/62730

From-SVN: r252749
2017-09-14 03:57:18 +00:00
Ian Lance Taylor
ce64a8b4a2 compiler, reflect: fix struct field names for embedded aliases
This adds much of https://golang.org/cl/35731 and
    https://golang.org/cl/35732 to the gofrontend code.
    
    This is a step toward updating libgo to the 1.9 release.  The
    gofrontend already supports type aliases, and this is required for
    correct support of type aliases when used as embedded fields.
    
    The change to expressions.cc is to handle the << 1, used for the
    newly renamed offsetAnon field, in the constant context used for type
    descriptor initialization.
    
    Reviewed-on: https://go-review.googlesource.com/62710

From-SVN: r252746
2017-09-14 03:48:51 +00:00
Ian Lance Taylor
f522b07d8d mksysinfo: fix in6_addr in mld_hdr_t for Solaris
Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/60732

From-SVN: r251574
2017-08-31 20:07:55 +00:00
Ian Lance Taylor
53a36c2652 net/internal/socktest: build sys_unix.go on AIX
Reviewed-on: https://go-review.googlesource.com/59913

From-SVN: r251440
2017-08-29 21:56:31 +00:00
Ian Lance Taylor
6222bddc8e libgo: netinet/icmp6.h require netinet/in.h on AIX
Reviewed-on: https://go-review.googlesource.com/59912

From-SVN: r251439
2017-08-29 21:51:49 +00:00
Ian Lance Taylor
888a985425 libgo: fix Stat_t on AIX
Reviewed-on: https://go-review.googlesource.com/59911

From-SVN: r251436
2017-08-29 21:00:46 +00:00
Ian Lance Taylor
6fa7df983e runtime: make go-nosys.c compile with !HAVE_SYSCALL
Reviewed-on: https://go-review.googlesource.com/59910

From-SVN: r251435
2017-08-29 20:57:20 +00:00
Ian Lance Taylor
a2aa807ef9 runtime: fix lfstack for 64-bit AIX
Reviewed-on: https://go-review.googlesource.com/57550

From-SVN: r251420
2017-08-29 18:59:04 +00:00
Ian Lance Taylor
b66d36128f re PR go/81893 (compilation error in libgo starting with r251127)
PR go/81893
    runtime: only use PPC GNU/Linux register code on little endian
    
    Reportedly the current code builds on little endian but not big endian.
    
    Fixes https://gcc.gnu.org/PR81893.
    
    Reviewed-on: https://go-review.googlesource.com/57110

From-SVN: r251188
2017-08-18 20:17:26 +00:00
Ian Lance Taylor
419d55e8df misc/cgo/test: make cgo tests run on AIX
Reviewed-on: https://go-review.googlesource.com/56910

From-SVN: r251182
2017-08-18 14:05:52 +00:00
Ian Lance Taylor
c32bd276c6 cmd/go: pass -funwind-tables when compiling C code
Using -funwind-tables is necessary to permit Go code to correctly
    throw a panic through C code.  This hasn't been necessary in the past
    as -funwind-tables is the default on x86.  However, it is not the
    default for PPC AIX.
    
    Reviewed-on: https://go-review.googlesource.com/56650

From-SVN: r251179
2017-08-18 04:40:42 +00:00
Ian Lance Taylor
098c217267 runtime: better implementation of netpoll for AIX
Reviewed-on: https://go-review.googlesource.com/54170

From-SVN: r251133
2017-08-16 20:58:26 +00:00
Ian Lance Taylor
450f20a899 runtime: improvements for signal registers
Fix dumpregs on i386, implement dumpregs for PPC Linux/AIX, get PC on AIX.
    
    Reviewed-on: https://go-review.googlesource.com/56170

From-SVN: r251127
2017-08-16 19:04:00 +00:00
Ian Lance Taylor
a171ac0380 compiler: handle >32bit exponent in Ldexp
Libgo's implementation of math.Ldexp declared the libc "ldexp" as
    taking an 'int' exponent argument, which is not quite right for 64-bit
    platforms (exp arg is always int32); this could yield incorrect
    results for exponent values outside the range of Minint32/Maxint32.
    Fix by upating the type for the libc version of ldexp, and adding
    guards to screen for out-of-range exponents.
    
    Fixes #21323.
    
    Reviewed-on: https://go-review.googlesource.com/54250

From-SVN: r250992
2017-08-09 17:15:02 +00:00
Ian Lance Taylor
8ffe2be85e runtime: dump registers for Alpha
Patch from Uros Bizjak.
    
    Reviewed-on: https://go-review.googlesource.com/53350

From-SVN: r250873
2017-08-04 13:46:39 +00:00
Ian Lance Taylor
194f08aeae re PR go/81617 (mksigtab.sh fails to resolve NSIG with glibc 2.26)
PR go/81617
    libgo: change mksigtab to recognize glibc 2.26 NSIG expression
    
    Fixes golang/go#21147
    Fixes GCC PR 81617
    
    Reviewed-on: https://go-review.googlesource.com/52611

From-SVN: r250858
2017-08-03 18:09:12 +00:00
Ian Lance Taylor
993323a14f runtime: handle Alpha GNU/Linux in getSiginfo
Patch by Uros Bizjak.
    
    Reviewed-on: https://go-review.googlesource.com/51370

From-SVN: r250588
2017-07-26 20:20:22 +00:00
Ian Lance Taylor
0901429d47 syscall: call f?statfs64 on GNU/Linux
We unconditionally set _FILE_OFFSET_BITS to 64 in configure.ac, so we
    should unconditionally call the statfs64 and fstatfs64 functions.
    These functions should be available on all versions of GNU/Linux since 2.6.
    On 64-bit systems they are aliased to statfs/fstatfs, and on 32-bit
    systems they use the 64-bit data structures.
    
    Fixes golang/go#20922
    
    Reviewed-on: https://go-review.googlesource.com/50635

From-SVN: r250443
2017-07-21 20:25:13 +00:00
Ian Lance Taylor
df206c6e77 runtime: don't use runtime_lock in __go_get_backtrace_state
If getSiginfo does not know how to determine the PC, it will call
    runtime_callers. That can happen in a thread that was started by
    non-Go code, in which case the TLS variable g will not be set, in
    which case runtime_lock will crash.
    
    Avoid the problem by using atomic operations for the lock. This is OK
    since creating a backtrace state is fast and never blocks.
    
    The test case is TestCgoExternalThreadSIGPROF in the runtime package
    on a system that getSiginfo doesn't handle specially.
    
    Updates golang/go#20931
    
    Reviewed-on: https://go-review.googlesource.com/50650

From-SVN: r250439
2017-07-21 18:27:35 +00:00
Ian Lance Taylor
0ab7176094 runtime: handle PPC/PPC64 GNU/Linux in getSiginfo
Updates golang/go#20931
    
    Reviewed-on: https://go-review.googlesource.com/50631

From-SVN: r250436
2017-07-21 18:08:01 +00:00
Ian Lance Taylor
048f0471d2 runtime: allocate more stack space in CgoCallbackGC test
Allocate enough stack space so that the test will work on a system
    that does not support split stacks.
    
    This test is actually not very meaningful for gccgo at present, but it
    doesn't hurt to keep running it.
    
    Updates golang/go#20931
    
    Reviewed-on: https://go-review.googlesource.com/50630

From-SVN: r250433
2017-07-21 17:50:14 +00:00
Ian Lance Taylor
9e45ca5f83 re PR go/81451 (missing futex check - libgo/runtime/thread-linux.c:12:0 futex.h:13:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘long’)
PR go/81451
    runtime: inline runtime_osinit
    
    We had two identical copies of runtime_osinit. They set runtime_ncpu,
    a variable that is no longer used. Removing that leaves us with two lines.
    Inline those two lines in the two places the function was called.
    
    This fixes GCC PR 81451.
    
    Reviewed-on: https://go-review.googlesource.com/48862

From-SVN: r250326
2017-07-18 23:14:29 +00:00
Ian Lance Taylor
eb80664a39 re PR go/81324 (libgo does not build with glibc 2.18)
PR go/81324
    sysinfo.c: ignore ptrace_peeksiginfo_args from <linux/ptrace.h>
    
    With some versions of glibc and GNU/Linux ptrace_pseeksiginfo_args is
    defined in both <sys/ptrace.h> and <linux/ptrace.h>. We don't actually
    care about the struct, so use a #define to avoid a redefinition error.
    
    This fixes https://gcc.gnu.org/PR81324.
    
    Reviewed-on: https://go-review.googlesource.com/49290

From-SVN: r250324
2017-07-18 22:06:31 +00:00
Ian Lance Taylor
f30d20915d libgo: don't copy semt into runtime.inc
https://gcc.gnu.org/PR81449 reports a problem with the definition semt
    in runtime.inc on some systems. Since the C code in libgo/runtime
    doesn't need semt, just don't copy it into runtime.inc.
    
    Reviewed-on: https://go-review.googlesource.com/48593

From-SVN: r250217
2017-07-14 22:25:26 +00:00
Ian Lance Taylor
b9d36a8daf cmd/go: use gccSupportsFlag for -fsplit-stack
Don't assume that all (or only) 386/amd64 compilers support
    -fsplit-stack.
    
    Reviewed-on: https://go-review.googlesource.com/48592

From-SVN: r250216
2017-07-14 22:21:37 +00:00
Ian Lance Taylor
6eecb29326 re PR go/81393 (Bootstrap failure on s390x-linux while building libgo against recent glibc)
PR go/81393
    syscall: don't use GETREGS/SETREGS on s390
    
    They were removed in recent glibc.
    
    Patch by Andreas Krebbel for GCC PR 81393.
    
    Reviewed-on: https://go-review.googlesource.com/48231

From-SVN: r250174
2017-07-13 03:44:14 +00:00
Ian Lance Taylor
8ff22ea5a8 misc/cgo/testcarchive: fix test to work for gccgo
This test is not yet run, but it will be soon.
    
    Reviewed-on: https://go-review.googlesource.com/47038

From-SVN: r249795
2017-06-29 15:17:20 +00:00
Ian Lance Taylor
1a7ad6ad66 cmd/go: fix -buildmode={c-archive,c-shared,pie} for gccgo
The tests are misc/cgo tests that are not currently run but will be
    run soon.
    
    Reviewed-on: https://go-review.googlesource.com/47037

From-SVN: r249794
2017-06-29 15:14:05 +00:00
Ian Lance Taylor
7fd19291a5 runtime: adapt memory management to AIX mmap
On AIX:
    * mmap does not allow to map an already mapped range,
    * mmap range start at 0x30000000 for 32 bits processes,
    * mmap range start at 0x70000000_00000000 for 64 bits processes
    
    This is adapted from change 37845.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/46772

From-SVN: r249713
2017-06-27 22:36:48 +00:00
Ian Lance Taylor
f9dedc3f21 syscall: ptrace fixes for s390
Fixes required now that we #include <linux/ptrace.h> in sysinfo.c.
    
    Patch by Andreas Krebbel.
    
    Reviewed-on: https://go-review.googlesource.com/46839

From-SVN: r249712
2017-06-27 21:51:50 +00:00
Ian Lance Taylor
936615752a libgo: add misc/cgo files
Copy all the misc/cgo files from the gc toolchain into libgo/misc.
    
    These will be used for testing purposes by later changes to the
    gotools directory.
    
    Reviewed-on: https://go-review.googlesource.com/46721

From-SVN: r249674
2017-06-27 04:21:40 +00:00
Ian Lance Taylor
b5df99f741 syscall: don't define PtraceRegs for Alpha
It's now defined by mksysinfo.sh.
    
    Patch by Uros Bizjak.
    
    Reviewed-on: https://go-review.googlesource.com/46712

From-SVN: r249663
2017-06-26 17:59:12 +00:00
Ian Lance Taylor
0bcce674a7 libgo: redefine ia64 struct names around linux/ptrace.h
Avoid https://sourceware.org/bugzilla/show_bug.cgi?id=762.
    
    Patch by Andreas Schwab.
    
    Reviewed-on: https://go-review.googlesource.com/46711

From-SVN: r249662
2017-06-26 17:56:14 +00:00
Ian Lance Taylor
f1857c6369 runtime: complete defer handling in CgocallBackDone
When C code calls a Go function, it actually calls a function
    generated by cgo. That function is written in Go, and, among other
    things, it calls the real Go function like this:
            CgocallBack()
            defer CgocallBackDone()
            RealGoFunction()
    The deferred CgocallBackDone function enters syscall mode as we return
    to C. Typically the C function will then eventually return to Go.
    
    However, in the case where the C function is running on a thread
    created in C, it will not return to Go. For that case we will have
    allocated an m struct, with an associated g struct, for the duration
    of the Go code, and when the Go is complete we will return the m and g
    to a free list.
    
    That all works, but we are running in a deferred function, which means
    that we have been invoked by deferreturn, and deferreturn expects to
    do a bit of cleanup to record that the defer has been completed. Doing
    that cleanup while using an m and g that have already been returned to
    the free list is clearly a bad idea. It was kind of working because
    deferreturn was holding the g pointer in a local variable, but there
    were races with some other thread picking up and using the newly freed g.
    It was also kind of working because of a special check in freedefer;
    that check is no longer necessary.
    
    This patch changes the special case of releasing the m and g to do the
    defer cleanup in CgocallBackDone itself.
    
    This patch also checks for the special case of a panic through
    CgocallBackDone. In that special case, we don't want to release the m
    and g. Since we are returning to C code that was not called by Go
    code, we know that the panic is not going to be caught and we are
    going to exit the program. So for that special case we keep the m and
    g structs so that the rest of the panic code can use them.
    
    Reviewed-on: https://go-review.googlesource.com/46530

From-SVN: r249611
2017-06-23 20:19:40 +00:00
Ian Lance Taylor
0f0d0eaae5 cmd/go: don't require GOROOT to exist for gccgo
Reviewed-on: https://go-review.googlesource.com/46590

From-SVN: r249609
2017-06-23 20:11:27 +00:00
Ian Lance Taylor
3c76bd9257 os: align siginfo argument to waitid
Backport https://golang.org/cl/46511 from gc trunk, as it may fix a
    bug reported for gccgo running on MIPS
    (https://groups.google.com/d/msg/golang-dev/sDg-t1_DPw0/-AJmLxgPBQAJ).
    
    Reviewed-on: https://go-review.googlesource.com/46571

From-SVN: r249599
2017-06-23 17:10:18 +00:00
Ian Lance Taylor
bb96aa6726 runtime: don't crash if no p in kickoff
The kickoff function for g0 can be invoked without a p, for example
    from mcall(exitsyscall0) in exitsyscall after exitsyscall has cleared
    the p field. The assignment gp.param = nil will invoke a write barrier.
    If gp.param is not already nil, this will require a p. Avoid the problem
    for a specific case that is known to be OK: when the value in gp.param
    is a *g.
    
    Reviewed-on: https://go-review.googlesource.com/46512

From-SVN: r249595
2017-06-23 16:05:44 +00:00
Ian Lance Taylor
54357b3b84 runtime: improve handling of panic during deferred function
When a panic occurs while processing a deferred function that
    recovered an earlier panic, we shouldn't report the recovered panic
    in the panic stack trace. Stop doing so by keeping track of the panic
    that triggered a defer, marking it as aborted if we see the defer again,
    and discarding aborted panics when a panic is recovered. This is what
    the gc runtime does.
    
    The test for this is TestRecursivePanic in runtime/crash_test.go.
    We don't run that test yet, but we will soon.
    
    Reviewed-on: https://go-review.googlesource.com/46461

From-SVN: r249590
2017-06-23 13:45:36 +00:00
Ian Lance Taylor
c8a0d1c344 runtime: uncomment check for gchelper on g0 stack
Now that systemstack changes to the g0 stack, this check passes.
    
    Reviewed-on: https://go-review.googlesource.com/46460

From-SVN: r249578
2017-06-22 22:12:50 +00:00
Ian Lance Taylor
b34391e08e runtime: mark dropm and callees nowritebarrierrec
The CgocallbackDone function calls dropm after it calls entersyscall,
    which means that dropm must not have any write barriers. Mark it
    accordingly.
    
    Reviewed-on: https://go-review.googlesource.com/46464

From-SVN: r249577
2017-06-22 22:11:01 +00:00
Ian Lance Taylor
f384e12acc runtime: export getm function
Use go:linkname to export the getm function. This makes it visible to
    runtime/testdata/testprogcgo/dropm_stub.go, which uses it as part of
    the TestEnsureDropM test in runtime/crash_cgo_test.go. That test is
    not run today, but it will be soon.
    
    Reviewed-on: https://go-review.googlesource.com/46462

From-SVN: r249576
2017-06-22 22:08:50 +00:00
Ian Lance Taylor
61fbdfbe1b runtime: fix type cast in assignment to gcnextsp in C code
Patch from Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/46459

From-SVN: r249575
2017-06-22 19:52:11 +00:00
Ian Lance Taylor
47f68dc231 runtime: make NumGoroutine wait for system goroutines to register
In libgo system goroutines register themselves after they start.
    That means that there is a small race between the goroutine being
    seen by the scheduler and the scheduler knowing that the goroutine
    is a system goroutine. That in turn means that runtime.NumGoroutines
    can overestimate the number of goroutines at times.
    
    This patch fixes the overestimate by counting the number of system
    goroutines waiting to start, and pausing NumGoroutines until those
    goroutines have all registered.
    
    This is kind of a lot of mechanism for this not very important
    problem, but I couldn't think of a better approach.
    
    The test for this is TestNumGoroutine in runtime/proc_test.go.
    The test is not currently run, but it will be soon.
    
    Reviewed-on: https://go-review.googlesource.com/46457

From-SVN: r249565
2017-06-22 15:46:47 +00:00
Ian Lance Taylor
c016fd32fe runtime: don't assume that _ = *s will panic if s is nil
With the gc toolchain apparently
            var s *string
            _ = *s
    is enough to panic with a nil pointer dereference. The gccgo compiler
    will simply discard the dereference, which I think is a reasonable and
    acceptable optimization. Change the tests to use an exported variable
    instead. The tests are not currently run, but they will be with a
    later patch to gotools.
    
    Reviewed-on: https://go-review.googlesource.com/46450

From-SVN: r249562
2017-06-22 14:46:12 +00:00
Ian Lance Taylor
3b0ddadf74 runtime: change some stack fields to uintptr
Because of how gccgo implements cgo calls, the code in dropm may not
    have any write barriers.  As a step toward implementing that, change
    the gcstack, gcnextsegment, and gcnextsp fields of the g struct to
    uintptr, so that assignments to them do not require write barriers.
    The gcinitialsp field remains unsafe.Pointer, as on 32-bit systems
    that do not support split stack it points to a heap allocated space
    used for the goroutine stack.
    
    The test for this is runtime tests like TestCgoCallbackGC, which are
    not run today but will be run with a future gotools patch.
    
    Reviewed-on: https://go-review.googlesource.com/46396

From-SVN: r249561
2017-06-22 14:44:30 +00:00
Ian Lance Taylor
c8a47c4877 runtime: avoid write barriers when calling deferred function
Calling a deferred function currently requires changing from a uintptr
    to the function code to a Go function value. That is done by setting
    the value of a func local variable using unsafe.Pointer. The local
    variable will always be on the stack. Adjust the code that sets the
    local variable to avoid generating a write barrier.
    
    A write barrier is never needed here. Also, for deferreturn, we must
    avoid write barriers entirely when called from a cgo function; that
    requires more than just this, but this is a start.
    
    The test for this is runtime tests that use the go tool; these are not
    currently run, but they will be in the future.
    
    Reviewed-on: https://go-review.googlesource.com/46455

From-SVN: r249559
2017-06-22 14:33:13 +00:00
Ian Lance Taylor
b92e4dff0a runtime: rename _defer struct _panic field to panicStack
The gc version of the _defer struct has a _panic field that has a
    completely different meaning. We are going to want that bring that new
    meaning into the gofrontend to improve panic reports with nested
    panic calls. Simplify that by first renaming the existing _panic field.
    
    Reviewed-on: https://go-review.googlesource.com/46454

From-SVN: r249558
2017-06-22 14:31:16 +00:00
Ian Lance Taylor
ed99905e1d runtime: adjust tests for gofrontend
- don't run tests that depend on SetCgoTraceback
    - don't expect a '(' after the function name in a traceback
    - change the expected name of nested functions in a traceback
    
    These tests are not currently run, but they will be soon.
    
    Reviewed-on: https://go-review.googlesource.com/46453

From-SVN: r249557
2017-06-22 14:28:57 +00:00
Ian Lance Taylor
2a208bc257 runtime: don't build test files that use SetCgoTraceback for gccgo
The gofrontend doesn't support the runtime.SetCgoTraceback function,
    which is specifically for handling mixed Go and C tracebacks.
    Use a build tag to avoid compiling the runtime/testdata/testprogcgo
    files that refer to SetCgoTraceback. These files are not currently
    compiled anyhow, but they will be with a future gotools patch.
    
    Reviewed-on: https://go-review.googlesource.com/46452

From-SVN: r249556
2017-06-22 14:27:09 +00:00
Ian Lance Taylor
7d8c7b26c8 runtime: build testprogcgo with -pthread
Building this test with gccgo requires an explicit -pthread option to
    be passed to the C compiler, so that it links against -lpthread.
    This test is not built today, but it will be soon with a future patch.
    
    Reviewed-on: https://go-review.googlesource.com/46451

From-SVN: r249555
2017-06-22 14:23:54 +00:00
Ian Lance Taylor
c83c219a63 runtime: in traceback, print panic rather than runtime.gopanic
The gc toolchain does the same thing, in gentraceback in
    runtime/traceback.go.
    
    The test for this is TestPanicTraceback in runtime/crash_test.go.  We
    don't yet run that test, but we will in a future change.
    
    Reviewed-on: https://go-review.googlesource.com/46397

From-SVN: r249495
2017-06-22 04:16:23 +00:00
Ian Lance Taylor
55ea0ea07d compiler, runtime: better stack trace for go f() where f is nil
The test for this is TestGoNil in the runtime package, which we don't
    run yet but will run with a subsequent gotools patch.
    
    Updates golang/go#8045
    
    Reviewed-on: https://go-review.googlesource.com/46392

From-SVN: r249494
2017-06-22 04:13:36 +00:00
Ian Lance Taylor
fbe457feb7 debug/elf: handle Alpha relocs
Patch by Uros Bizjak.
    
    Reviewed-on: https://go-review.googlesource.com/46391

From-SVN: r249487
2017-06-21 22:39:36 +00:00
Ian Lance Taylor
3f741f1b60 Forgot to remove this file in the last libgo commit.
libgo: remove old MIPS architecture names
    
    This removes the old names for the 3 main MIPS ABIs: mipso32, mipsn32
    and mipsn64. It also removes the mipso64 ABI which has no equivalent
    architecture name in go. This ABI has been dead for sometime and I doubt
    anyone will miss it.
    
    Change-Id: I087b243784edf6705fdaf9c32e3233da5e387283

From-SVN: r249485
2017-06-21 22:29:36 +00:00
Ian Lance Taylor
b95cd48b01 libgo: remove old MIPS architecture names
This removes the old names for the 3 main MIPS ABIs: mipso32, mipsn32
    and mipsn64. It also removes the mipso64 ABI which has no equivalent
    architecture name in go. This ABI has been dead for sometime and I doubt
    anyone will miss it.
    
    Reviewed-on: https://go-review.googlesource.com/46154

From-SVN: r249477
2017-06-21 22:11:04 +00:00
Ian Lance Taylor
1701a9d8f0 libgo: use gc's arch names as the default GOARCHs on MIPS
This means that the gc tools and gofrontend agree on the architecture names
    for the 3 MIPS ABIs which should allow a gofrontend compiler to build go.
    
    Reviewed-on: https://go-review.googlesource.com/46153

From-SVN: r249476
2017-06-21 21:55:34 +00:00
Ian Lance Taylor
95eebd21db cmd/cgo: add mips64p32* to ptrSizeMap and intSizeMap
Reviewed-on: https://go-review.googlesource.com/46152

From-SVN: r249475
2017-06-21 21:50:52 +00:00
Ian Lance Taylor
4c0478b338 internal/syscall/unix: implement randomTrap on mips64p32*
Rename getrandom_linux_mipsn32.go to use the new architecture name for
    the n32 ABI and enable building it on mips64p32 and mips64p32le.
    
    Reviewed-on: https://go-review.googlesource.com/46151

From-SVN: r249474
2017-06-21 21:47:35 +00:00
Ian Lance Taylor
a8bc65cd00 libgo, syscall: fix ptrace implementation on MIPS
On MIPS, the correct structure for PtraceRegs is 'struct pt_regs' which
    is declared in linux/ptrace.h. Previously no PtraceRegs structure was
    created on MIPS because 'struct user_regs_struct' doesn't exist there.
    
    Fallback to using pt_regs when the PtraceRegs structure is generated in
    mksysinfo.sh, then adjust syscall_linux_mipsx.go to read the program
    counter from the correct field.
    
    In addition, implement PtraceGetRegs and PtraceSetRegs on all 3 ABI
    variants.
    
    syscall_linux_mips64x.go can now be removed since the ptrace code on
    all 3 ABIs is identical.
    
    Reviewed-on: https://go-review.googlesource.com/46150

From-SVN: r249473
2017-06-21 21:46:03 +00:00
Ian Lance Taylor
8d4b68a7c4 libgo, syscall: fix ptrace implementation on MIPS
On MIPS, the correct structure for PtraceRegs is 'struct pt_regs' which
    is declared in linux/ptrace.h. Previously no PtraceRegs structure was
    created on MIPS because 'struct user_regs_struct' doesn't exist there.
    
    Fallback to using pt_regs when the PtraceRegs structure is generated in
    mksysinfo.sh, then adjust syscall_linux_mipsx.go to read the program
    counter from the correct field.
    
    In addition, implement PtraceGetRegs and PtraceSetRegs on all 3 ABI
    variants.
    
    syscall_linux_mips64x.go can now be removed since the ptrace code on
    all 3 ABIs is identical.
    
    Reviewed-on: https://go-review.googlesource.com/46150

From-SVN: r249472
2017-06-21 21:42:41 +00:00
Ian Lance Taylor
ea9a08f5df cmd/cgo: make _cgo_flags consistent across runs
The go tool will pass -I objdir as one of the flags, where objdir is
    the temporary build directory. Remove that from _cgo_flags: we don't
    need it, and it will be different each time.
    
    Sort the flags to avoid the unpredictable map iteration order.
    
    This matters for gccgo because for a package that uses cgo, the go
    tool when building for gccgo will store the _cgo_flags file in the
    archive. That means that we want to generate identical _cgo_flags for
    every run.
    
    The test for this is the cmd/go testsuite, to follow in a future CL.
    
    Reviewed-on: https://go-review.googlesource.com/45692

From-SVN: r249199
2017-06-14 13:59:02 +00:00
Ian Lance Taylor
1279f21fc5 cmd/go: gccgo: consistent results, fix vendoring
Pass the -fdebug-prefix-map and -gno-record-gcc-switches compiler
    options to gccgo to generate consistent results.
    
    Fix the vendoring code to look for /vendor/, not just /vendor, to
    avoid being confused by something like vendor/vendor.org.
    
    Tested by the cmd/go tests in a followup CL.
    
    Reviewed-on: https://go-review.googlesource.com/45695

From-SVN: r249198
2017-06-14 13:56:04 +00:00
Ian Lance Taylor
8ba20d7eb8 cmd/go: skip tests that do not work with gccgo
These tests fail for various reasons, most commonly because gccgo
    doesn't really have GOROOT, so things like `go build errors` fail.
    
    Reviewed-on: https://go-review.googlesource.com/45696

From-SVN: r249197
2017-06-14 13:53:43 +00:00
Ian Lance Taylor
b205ec303f go/build: use GCCGOTOOLDIR to find gccgo tools
Add the environment variable GCCGOTOOLDIR to permit overriding the default
    directory where tools like cgo are found when building with gccgo.
    
    This will be used by the cmd/go tests in a future CL.
    
    Reviewed-on: https://go-review.googlesource.com/45694

From-SVN: r249196
2017-06-14 13:50:53 +00:00
Ian Lance Taylor
0818233f80 internal/testenv: support testing gccgo
If GO_TESTING_GOTOOLS is set in the environment, permit tests using
    gccgo to run the go tool. Like GO_BUILDER_NAME, this should not be set
    normally. But it is needed when testing the go tool itself, and will
    be set by the gotools Makefile in a future CL.
    
    Reviewed-on: https://go-review.googlesource.com/45693

From-SVN: r249195
2017-06-14 13:47:28 +00:00
Ian Lance Taylor
09a871c466 runtime: don't always show frames with no function in traceback
If there is no function name, the traceback is generally
    uninformative.  In earlier versions we did not show such frames.
    Restore that behavior.  These frames can be seen with GOTRACEBACK=system.
    
    Reviewed-on: https://go-review.googlesource.com/45431

From-SVN: r249156
2017-06-13 13:29:26 +00:00
Ian Lance Taylor
cd34e54306 runtime: clear isSystemGoroutine in goexit
Otherwise it may be set when the g struct is reused via gfput/gfget.
    
    Test is golang.org/x/net/http2 with GOMAXPROCS=12.
    
    Reviewed-on: https://go-review.googlesource.com/45430

From-SVN: r249143
2017-06-13 00:43:56 +00:00
Ian Lance Taylor
a282a875c8 runtime: ignore _Gscan bit when checking status in CgocallDone
Also always access the atomicstatus field atomically.
    
    The effect of not checking the _Gscan bit is that if the GC decides to
    scan the stack just as the goroutine is leaving the system call, the
    goroutine might fail to call exitsyscall.  Then then typically causes
    a runtime assertion failure later on.  If we do call exitsyscall as we
    should, it will stall (in casgstatus) until the _Gscan bit is cleared.
    
    No separate test.  I've observed causing sporadic failures running the
    misc/cgo tests, but we don't currently have a way to run those
    routinely for gccgo.  I should fix that.
    
    Reviewed-on: https://go-review.googlesource.com/45392

From-SVN: r249138
2017-06-12 23:14:05 +00:00
Ian Lance Taylor
20e96b489e libgo: update to 1.8.3 release
Reviewed-on: https://go-review.googlesource.com/45150

From-SVN: r249033
2017-06-08 19:02:12 +00:00
Ian Lance Taylor
aa5493116b runtime: support ia64 in lfstack
Patch by Andreas Schwab.
    
    Reviewed-on: https://go-review.googlesource.com/45071

From-SVN: r248994
2017-06-07 18:12:58 +00:00
Ian Lance Taylor
30bc05cfcb libgo: support for sparc64 GNU/Linux
Fix lfstack code to work with sparc64 GNU/Linux address map.
    
    Force alignment of epollevent.  To make this work reliably, pass
    GOARCH explicitly to mkrsysinfo.sh.
    
    Patch by Vladimir Mezentsev.
    
    Reviewed-on: https://go-review.googlesource.com/44494

From-SVN: r248765
2017-05-31 21:36:42 +00:00
Ian Lance Taylor
7ded3472ae libgo: add "vendor" to pkgpath for vendored standard packages
Ensure that the packages vendored into the standard library do not
    have the same pkgpath as the actual packages.  If we don't, attempts
    to build and test the actual packages will get confused.  The specific
    error I was seeing was import loops, causing some of the packages to
    fail to get initialized, causing an obscure run time crash.
    
    Reviewed-on: https://go-review.googlesource.com/43610

From-SVN: r248168
2017-05-17 20:16:13 +00:00
Ian Lance Taylor
06ace75d4b runtime: fix build for non-split-stack systems
Change memory allocation accounting for stacks to use stacks_sys,
    since that seems to be what it is for.
    
    Reviewed-on: https://go-review.googlesource.com/43297

From-SVN: r247967
2017-05-12 12:49:34 +00:00
Ian Lance Taylor
fa846918fc mksigtab.sh: recurse once when adding signals to SIGLIST
On MIPS, SIGABRT is defined like this:
     #define SIGIOT   6
     #define SIGABRT  SIGIOT
    
    This breaks addsig which tries to append __SIGIOT_ to SIGLIST. Signal
    number 6 is later added to the output and go complains about a
    duplicate signal number.
    
    Fix by recursing once when obtaining the signal number from
    gen-sysinfo.go if the signal is defined as an alias of another signal.
    Also modify the sed expression to 's/.* = //' which is equivalent to
    the original expression but is less misleading given that it might not
    match a number.
    
    Reviewed-on: https://go-review.googlesource.com/43252

From-SVN: r247948
2017-05-12 01:09:42 +00:00
Ian Lance Taylor
b3a7fdc3ea os: use opendir64 and closedir64 on AIX
When using readdir64 on AIX, we must also use
    opendir64 and closedir64.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/43251

From-SVN: r247947
2017-05-12 00:59:15 +00:00
Ian Lance Taylor
3619ab8bd4 runtime: fix isSystemGoroutine for gccgo
The gc toolchain decides whether a goroutine is a system goroutine by
    comparing startpc to a list of saved special PCs.  In gccgo that
    approach does not work as startpc is often a thunk that invokes the
    real function with arguments, so the thunk address never matches the
    saved special PCs.
    
    This patch fixes gccgo's understanding of system goroutines.  Since
    there are only a limited number of them, we simply change each one to
    mark itself as special.
    
    This fixes stack dumps and functions like runtime.NumGoroutine to
    behave more like gc.  It also fixes the goprint test in the gc
    testsuite.
    
    Reviewed-on: https://go-review.googlesource.com/43156

From-SVN: r247931
2017-05-11 20:55:41 +00:00
Ian Lance Taylor
f163907e0a Big merge of changes to gofrontend repo that were postponed due to the
GCC release freeze.

	* go-backend.c: Include "go-c.h".
	* go-gcc.cc (Gcc_backend::write_export_data): New method.

	* go-gcc.cc (Gcc_backend::Gcc_backend): Declare
	__builtin_prefetch.
	* Make-lang.in (GO_OBJS): Add go/wb.o.

commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889
Author: Than McIntosh <thanm@google.com>
Date:   Mon Jan 23 15:07:07 2017 -0500

    compiler: insert additional conversion for type desc ptr expr
    
    Change the method Type::type_descriptor_pointer to apply an additional
    type conversion to its result Bexpression, to avoid type clashes in
    the back end. The backend expression for a given type descriptor var
    is given a type of "_type", however the virtual calls that create the
    variable use types derived from _type, hence the need to force a
    conversion.
    
    Reviewed-on: https://go-review.googlesource.com/35506


commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd
Author: Than McIntosh <thanm@google.com>
Date:   Mon Jan 23 15:22:26 2017 -0500

    compiler: insure tree integrity in Call_expression::set_result
    
    Depending on the back end, it can be problematic to reuse Bexpressions
    (passing the same Bexpression to more than one Backend call to create
    additional Bexpressions or Bstatements). The Call_expression::set_result
    method was reusing its Bexpression input in more than one tree
    context; the fix is to pass in an Expression instead and generate
    multiple Bexpression references to it within the method.
    
    Reviewed-on: https://go-review.googlesource.com/35505


commit 7a8e49870885af898c3c790275e513d1764a2828
Author: Ian Lance Taylor <iant@golang.org>
Date:   Tue Jan 24 21:19:06 2017 -0800

    runtime: copy more of the scheduler from the Go 1.8 runtime
    
    Copies mstart, newm, m0, g0, and friends.
    
    Reviewed-on: https://go-review.googlesource.com/35645


commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Jan 26 19:47:37 2017 -0800

    runtime: remove a few C functions that are no longer used
    
    Reviewed-on: https://go-review.googlesource.com/35849


commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Jan 26 16:51:16 2017 -0800

    runtime: copy over more of the Go 1.8 scheduler
    
    In particular __go_go (aka newproc) and goexit[01].
    
    Reviewed-on: https://go-review.googlesource.com/35847


commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Jan 27 16:58:20 2017 -0800

    runtime: copy syscall handling from Go 1.8 runtime
    
    Entering a syscall still has to start in C, to save the registers.
    Fix entersyscallblock to save them more reliably.
    
    This copies over the tracing code for syscalls, which we previously
    weren't doing, and lets us turn on runtime/trace/check.
    
    Reviewed-on: https://go-review.googlesource.com/35912


commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Jan 27 18:34:11 2017 -0800

    runtime: copy SIGPROF handling from Go 1.8 runtime
    
    Also copy over Breakpoint.
    
    Fix Func.Name and Func.Entry to not crash on a nil Func.
    
    Reviewed-on: https://go-review.googlesource.com/35913


commit cc60235e55aef14b15c3d2114030245beb3adfef
Author: Than McIntosh <thanm@google.com>
Date:   Mon Feb 6 11:12:12 2017 -0500

    compiler: convert go_write_export_data to Backend method.
    
    Convert the helper function 'go_write_export_data' into a Backend
    class method, to allow for an implementation of this function that
    needs to access backend state.
    
    Reviewed-on: https://go-review.googlesource.com/36357


commit e387439bfd24d5e142874b8e68e7039f74c744d7
Author: Than McIntosh <thanm@google.com>
Date:   Wed Feb 8 11:13:46 2017 -0500

    compiler: insert backend conversion in temporary statement init
    
    Insert an additional type conversion in Temporary_statement::do_get_backend
    when assigning a Bexpression initializer to the temporary variable, to
    avoid potential clashes in the back end. This can come up when assigning
    something of concrete pointer-to-function type to a variable of generic
    pointer-to-function type.
    
    Reviewed-on: https://go-review.googlesource.com/36591


commit c5acf0ce09e61ff623847a35a99da465b8571609
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 1 17:57:53 2017 +0100

    libgo: build tags for aix
    
    Build tags for the libgo source files required to build
    libgo on AIX.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37633


commit 67ed19616898ea18a101ec9325b82d028cd395d9
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 2 15:41:31 2017 +0100

    libgo: handle AIX tag in match.sh and gotest
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37638


commit 83ea2d694c10b2dd83fc8620c43da13d20db754e
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 1 17:48:16 2017 +0100

    libgo: add AIX support in configure and Makefile
    
    - support for GOOS=aix
    - CFLAGS/GOCFLAGS/LDFLAGS for AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37632


commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Mon Mar 6 15:00:15 2017 +0100

    runtime: adapt memory management to AIX mmap
    
    On AIX:
    * mmap does not allow to map an already mapped range,
    * mmap range start at 0x30000000 for 32 bits processes,
    * mmap range start at 0x70000000_00000000 for 64 bits processes
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37845


commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Mon Mar 6 13:42:26 2017 +0100

    runtime: add getproccount implementation for AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37844


commit ff626470294237ac664127894826614edc46a3d0
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Mon Mar 6 17:31:21 2017 +0100

    runtime: handle ERESTART errno with AIX's wait4
    
    On AIX, wait4 may return with errno set to ERESTART, which causes unexepected
    behavior (for instance, go build may exit with the message "wait: restart
    system call" after running a command, even if it was successfull).
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37846


commit 37daabbfc83d533b826ef9ab10e2dee7406e7198
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Mon Mar 6 11:02:58 2017 +0100

    runtime: support for AIX's procfs tree
    
    On AIX, the process executable file is available under /proc/<pid>/object/a.out
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37842


commit a0275c039d56acf4bf48151978c1a4ec5758cc2c
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Mar 8 07:00:05 2017 -0800

    libgo/Makefile.am: don't use nonportable \n or \t in sed expression
    
    The resulting zstdpktlist.go is less pretty, but it works.
    
    Reviewed-on: https://go-review.googlesource.com/37940


commit 29b190f76105aafa2b50b48249afdafecc97a4be
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 9 16:02:34 2017 +0100

    runtime: netpoll and semaphores for AIX
    
    semaphore implementation based on Solaris implementation in
    libgo/go/runtime/os_solaris.go
    
    netpoll is just a stub to avoid build failure on AIX.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37966


commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 9 15:38:30 2017 +0100

    libmain: ensure initfn is called when loading a go library
    
    AIX does not support .init_array.
    The alterative is to export the __go_init function and tell the linker
    it is an init function with the -Wl,-binitfini:__go_init option.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37965


commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Mar 10 11:15:08 2017 +0100

    libgo: use an import list for missing symbols
    
    libgo depends on symbols provided by Go programs at runtime. On AIX,
    this requires either to build libgo with -Wl,-berok linker option and
    the programs with -Wl,-brtl, or to provide a list of imported symbols
    when building libgo. The second options seems preferable, to avoid
    requiring an additional option for every Go program.
    
    There are also some symbols that are specific to GNU ld and do not
    exist when linking with AIX ld (__data_start, __edata, __etext and
    __bss_start).
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37969


commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 8 15:34:45 2017 +0100

    crypto/x509: add certificate files locations for AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/37952


commit 92e521c854e91709b949548c47e267377850f26a
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Mar 10 14:10:11 2017 -0800

    compiler: fix check for pointer in Temporary_reference_expression
    
    The check for an unrepresentable pointer in
    Temporary_reference_expression::do_get_backend was incorrectly
    translated from C to Go in https://golang.org/cl/14346043.  Fix the
    check to use points_to rather than has_pointer and deref.  This should
    not make any difference in practice as either way the condition will
    only be true for a pointer to void, but points_to is correct and more
    efficient.
    
    Reviewed-on: https://go-review.googlesource.com/38009


commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 16 16:51:53 2017 +0100

    libgo: add missing _arpcom struct to *sysinfo.go
    
    This struct is filtered due to having a field of type _in6_addr,
    but other types exported to *sysinfo.go are depending on it.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38251


commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 16 18:27:46 2017 +0100

    syscall: raw_ptrace stub for AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38253


commit 8029632b50880fd9b5e39299c738b38e3386595f
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 15 16:58:37 2017 +0100

    libgo: adapt runtime.inc to AIX
    
    * Two AIX types are wrongfully exported to runtime.inc as their names
      make them look like a Go type.
    * The sigset go type conflicts with a system sigset type.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38192


commit 25f3a90d14bc268479369ecc0eada72791612f86
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 15 16:58:37 2017 +0100

    libgo: update Makefile.in, accidentally omitted from last change
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38310


commit d52b4895616b66f93b460366527e74336829aaa5
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 16 18:39:26 2017 +0100

    syscall: TIOCSCTTY does not exist on AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38254


commit ff1ec3847a4472008e5d53a98b6694b1e54ca322
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 16 18:07:34 2017 +0100

    syscall: syscall does not exist on AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38252


commit c1ee60dabf0b243a0b0286215481a5d326c34596
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Mar 17 17:18:18 2017 +0100

    net: EAI_OVERFLOW does not exist on AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38266


commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Mar 17 17:23:56 2017 +0100

    net: sockopt/sockoptip stubs for AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38267


commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Mar 17 16:35:05 2017 +0100

    os/user: add listgroups stub for AIX
    
    This is required to build os/user.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38263


commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 22 11:11:30 2017 +0100

    os: fix readdirnames for AIX
    
    Largefile implementation should be used on AIX.
    
    readdir64_r function returns 9 and sets result to NULL when
    reaching end of directory, so this return code should not
    always be considered as an error.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38359


commit b34036967d1ec57b25e3debe077439b4210a1d4a
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Mar 17 17:39:31 2017 +0100

    libgo: adapt sigtab.go to AIX
    
    On AIX, _NSIG is not directly defined to its integer value in
    gen-sysinfo.go.
    The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are
    building a 32bit ligbo or a 64bit libgo, so we need to read one of
    those constants to set nsig value in mksigtab.sh
    
    This change also ensures that all signal numbers from 0 to nsig-1
    are referenced in sigtable.
    
    Reviewed-on: https://go-review.googlesource.com/38268


commit 20991c32671a183ec859b4f285df37fdd4634247
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 23 17:28:09 2017 +0100

    syscall: missing import in socket_bsd.go
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38369


commit c34754bd9adf5496c4c26257eaa50793553c11e8
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 22 17:57:01 2017 +0100

    sycall: WCOREDUMP macro is not defined on AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38363


commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 23 17:44:43 2017 +0100

    libgo: additional build tags for AIX
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38510


commit d117ede6ff5a7083e9c40eba28a0f94f3535d773
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 23 17:48:46 2017 +0100

    go/build: add AIX to "go build" command known OS
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38511


commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Mar 23 09:57:01 2017 -0700

    compiler: don't crash if imported package imports this one
    
    When building a test it's OK if test code imports a package that
    imports this one. The go tool is supposed to catch cases where this
    creates an impossible initialization order. The compiler already has
    code to permit this in Gogo::add_import_init_fn. This CL avoids a
    compiler crash on a similar case when writing out the export data.
    
    I have no test case for this. Basically it pushes a compiler crash
    into an error reported elsewhere.
    
    Problem was reported by Tony Reix.
    
    Reviewed-on: https://go-review.googlesource.com/38462


commit 925636975d075e3e3353823b09db3f933f23cb03
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Mar 29 14:14:18 2017 -0700

    runtime: copy finalizer support from Go 1.8 runtime
    
    Reviewed-on: https://go-review.googlesource.com/38794


commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Mar 30 15:21:06 2017 +0200

    runtime: initcontext and setcontext stubs for AIX
    
    Further investigations are required to understand the clobbering
    issue and implement a proper fix. Until then, those stubs are
    required to allow the build to complete.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38930


commit 27db481f369b54256063c72b911d22390c59199c
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 29 18:07:25 2017 +0200

    os: fix Readlink failure on AIX
    
    AIX readlink routine returns an error if the link is longer
    than the buffer, instead of truncating the link.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38700


commit c93babbf48eddd0bc34d4179ffb302dc60087299
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 29 17:26:35 2017 +0200

    compiler: implement support for reading AIX big archives
    
    This is required to read go export from a Go library.
    
    Code courtesy of Damien Bergamini from Atos Infogérance.
    
    Issue golang/go#19200
    Reviewed-on: https://go-review.googlesource.com/38698


commit 930dd53482bdee3a9074850d168d0b9d7819c135
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 6 18:50:11 2017 -0700

    compiler: fix whether conversions are static initializers
    
    The compiler was incorrectly treating type conversions from string to
    int or vice-versa as static initializers.  That doesn't work, as those
    conversions are implemented via a function call.
    
    This case may never actually arise but it seems like the right thing to do.
    
    Reviewed-on: https://go-review.googlesource.com/39872


commit f02691e4195728dbf06f4dde0853c6bccc922183
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 6 17:24:08 2017 -0700

    compiler, runtime: don't let slices point past end of memory block
    
    When Go code uses a slice expression like [:len(str)] or [:cap(slice)],
    it's natural for the resulting pointer to point just past the end of
    the memory block.  If the next memory block is not live, we now have a
    live pointer to a dead block, which will unnecessarily keep the block
    alive.  That wastes space, and with the new Go 1.8 GC (not yet
    committed) will trigger an error when using GODEBUG=gccheckmark=1.
    
    This changes the implementation of slice expressions to not move the
    pointer if the resulting string length or slice capacity is 0.  When
    the length/capacity is zero, the pointer is never used anyhow.
    
    Reviewed-on: https://go-review.googlesource.com/39870


commit 17527c35b027e1afcc318faf5563909e1e9d44a6
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 6 15:30:11 2017 -0700

    compiler: emit write barriers
    
    The Go 1.8 concurrent GC requires optional write barriers for all
    assignments that may change pointer values in the heap or in a global
    variable.  For details see https://blog.golang.org/go15gc.
    
    This changes the gofrontend code to emit write barriers as needed.
    This is in preparation for future changes.  At the moment the write
    barriers will do nothing.  They test runtime.writeBarrier.enabled,
    which will never be non-zero.  They call simple functions which just
    do a move without doing any of the other operations required by the
    write barrier.
    
    Reviewed-on: https://go-review.googlesource.com/39852


commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Tue Apr 11 17:47:29 2017 +0200

    libgo: allow building gox files from PIC objects
    
    libtool builds non-PIC objects in the same directory as .lo files
    and PIC objects in a .libs subdirectory.
    BUILDGOX rule uses the non-PIC objects to build the gox files,
    but on AIX only the PIC objects are built.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/40355


commit ea0f3da174c5503a209043f14ddda34871cfec52
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 6 19:06:14 2017 -0700

    compiler: add code to generate a ptrmask for a type
    
    The Go 1.8 garbage collector uses a ptrmask for all types below a
    certain size.  A ptrmask is simply a bit vector with a single bit for
    each pointer-sized word in the value.  The bit is 1 if the type has a
    pointer in that position, 0 if it does not.
    
    This change adds code to the compiler to generate a ptrmask.  The code
    is not used by anything yet, it is just compiled.  It will be used
    when we switch over to the Go 1.8 garbage collector.
    
    The new Array_type::int_length method, and the new memory_size
    methods, will also be used by other patches coming later.
    
    Reviewed-on: https://go-review.googlesource.com/39873


commit 3029e1df3be3614d196a03c15e50e68ff850aa4c
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 7 10:31:39 2017 -0700

    compiler: add code to generate a gcprog for a type
    
    The Go 1.8 garbage collector uses a gcprog for all types above a
    certain size.  A gcprog describes where the pointers are in the type,
    using a simple bytecode machine that supports repeating bits.  The
    effect is to permit using much less space to describe arrays.  The
    format is described in runtime/mbitmap.go in the docs for runGCProg.
    This is not yet added to the gofrontend, but can be seen in the gc sources.
    
    This change adds code to the compiler to generate a gcprog.  The code
    is not used by anything yet, it is just compiled.  It will be used
    when we switch over to the Go 1.8 garbage collector.
    
    Reviewed-on: https://go-review.googlesource.com/39923


commit 8b01ef1e9176d20f4c9e667972fe031069a4d057
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 13 07:00:35 2017 -0700

    compiler: add ptrdata computations and expressions
    
    For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type:
    the number of bytes in the type that can contain pointers.  For types
    that do not contain pointers this number is zero.  For many types it
    is a number larger than zero but smaller than the total size of the
    type.  The Go 1.8 GC uses this number to make loops looking for
    pointers run faster by not scanning the suffix of a value that can not
    contain a pointer.
    
    Unfortunately there are two subtly different definitions of ptrdata,
    and we need both.  The first is the simple one: the prefix that can
    contain pointers.  The second is the number of bytes described by the
    gcprog for the type.  Recall that we describe the exact position of
    pointers in a type using either a ptrmask or a gcprog.  The ptrmask is
    simpler, the gcprog uses less space.  We use the gcprog for large
    types, currently defined as types that are more than 2048 bytes.  When
    the Go 1.8 runtime expands a gcprog, it verifies that the gcprog
    describes exactly the same number of bytes as the ptrdata field in the
    type descriptor.  If the last pointer-containing portion of a type is
    an array, and if the elements of the array have a ptrdata that is less
    than the size of the element type, then the simple definition of the
    ptrdata will not include the final non-pointer-containing bytes of the
    last element of the array.  However, the gcprog will define the array
    using a repeat count, and will therefore include the full size of the
    last element of the array.  So for a type that needs a gcprog, the
    ptrdata field in the type descriptor must be the size of the data
    described by the gcprog, and that is not necessarily the same as the
    simple ptrdata.
    
    It might seem that we can always use the gcprog version of the ptrdata
    calculation, since that is what will appear in a type descriptor, but
    it turns out that for global variables we always use a ptrmask, not a
    gcprog, even if the global variable is large.  This is because gcprogs
    are handled by expanding them into a ptrmask at runtime, and for a
    global variable there is no natural place to put the ptrmask.  Simpler
    to always use the ptrmask.  That means that we need to describe the
    size of the ptrmask, and that means that we need an expression for the
    simple form of the ptrdata.
    
    This CL implements the ptrdata calculation.  This code is not actually
    used yet.  It will be used later when the Go 1.8 GC is committed.
    
    Reviewed-on: https://go-review.googlesource.com/40573


commit 7a37331303b572412179a08141f1dd35339d40c8
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 06:55:48 2017 -0700

    compiler: zero length arrays never contain pointers
    
    Reviewed-on: https://go-review.googlesource.com/40696


commit c242f0508a64d3d74a28d498cbaeda785ff76258
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 07:26:54 2017 -0700

    bytes: disable allocations test on gccgo
    
    It turns out that testing.AllocsPerRun has not been producing correct
    results with the current gccgo memory allocator.  When we update to
    the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and
    this test will fail due to lack of escape analysis.
    
    Reviewed-on: https://go-review.googlesource.com/40700


commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Tue Apr 11 16:22:38 2017 +0200

    os: alternative way to find executable path, using Args[0]
    
    AIX does not provide a proper way to find the original
    executable path from procfs, which contains just an
    hardlink.
    Executable path can be found using Args[0], Getcwd and
    $PATH.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/40353


commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 08:01:19 2017 -0700

    compiler: don't write struct with multiple sink fields to C header file
    
    When writing a struct to the C header file used by the C runtime code,
    a single sink field is fine: it will be called "_", which is valid C.
    There are structs with single sink fields that we want to write out,
    such as finblock.  As it happens, though, the Go 1.8 runtime has a
    struct with two sink fields, gcControllerState, which will produce a C
    definition with two fields named "_", which will fail.  Since we don't
    need to know that struct in C, rather than fix the general case, just
    punt if the struct has multiple sink fields.
    
    After the conversion to the Go 1.8 GC, we may be able to get rid of
    the C header file anyhow.  I'm not sure yet.
    
    Reviewed-on: https://go-review.googlesource.com/40701


commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 10:07:23 2017 -0700

    runtime: disable allocations test on gccgo
    
    It turns out that testing.AllocsPerRun has not been producing correct
    results with the current gccgo memory allocator.  When we update to
    the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and
    these tests will fail due to lack of escape analysis.
    
    Reviewed-on: https://go-review.googlesource.com/40703


commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 10:47:06 2017 -0700

    runtime: remove unused size argument from hash/equal fns
    
    The size argument was removed from hash and equal functions in CL
    34983.  Somehow I missed removing them from three of the predefined
    functions.
    
    Reviewed-on: https://go-review.googlesource.com/40770


commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 13:23:05 2017 -0700

    runtime: remove unused stack.go
    
    We're never going to use stack.go for gccgo.  Although a build tag
    keeps it from being built, even having it around can be confusing.
    Remove it.
    
    Reviewed-on: https://go-review.googlesource.com/40774


commit befa71603fc66a214e01ac219f2bba36e19f136f
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 13:18:34 2017 -0700

    runtime: build fastlog
    
    Take out the build tags which were preventing fastlog2 from being
    built.  It's used by the upcoming Go 1.8 GC.
    
    Reviewed-on: https://go-review.googlesource.com/40773


commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 14 10:04:23 2017 -0700

    runtime: add tests from Go 1.8
    
    Some runtime package tests never made it into the gofrontend repo for
    some reason.  Add them now.
    Reviewed-on: https://go-review.googlesource.com/40869


commit 1feef185aebd71bc2a09b9a04287461806096610
Author: Ian Lance Taylor <iant@golang.org>
Date:   Mon Apr 17 16:26:11 2017 -0700

    runtime: change mcall to take a Go function value
    
    For future work in bringing in the Go 1.8 GC, change the mcall
    function to take a Go function value, which means that mcall can take
    a closure rather than just a straight C function pointer.
    
    As part of this change move kickoff from C to Go, which we want to do
    anyhow so that we run the write barriers that it generates.
    
    Reviewed-on: https://go-review.googlesource.com/40935


commit c3db34f4efc2d610f74a01dd2ad7775f48889b29
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Tue Apr 11 16:11:26 2017 +0200

    runtime: netpoll implementation for AIX
    
    Code courtesy of Damien Bergamini from Atos Infogérance.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/40352


commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f
Author: Ian Lance Taylor <iant@golang.org>
Date:   Tue Apr 18 22:06:07 2017 -0700

    runtime: move mstart from Go to C
    
    The assignments done in mstart must be done without write barriers, as
    mstart is running without an m or p.  In the gc toolchain the
    equivalent code to intialize g and g->m is written in assembler;
    on GNU/Linux, it's in the clone function.
    
    Reviewed-on: https://go-review.googlesource.com/40989


commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d
Author: Ian Lance Taylor <iant@golang.org>
Date:   Tue Apr 18 17:47:28 2017 -0700

    compiler: varargs slices do not escape in runtime
    
    Also, don't try to allocate an empty slice on the stack, as it will
    confuse the GCC backend.
    
    Also add a few trivial style, code formatting, and debug output fixes.
    
    Updates golang/go#17431
    
    Reviewed-on: https://go-review.googlesource.com/40983


commit 94699d25f31353bf03419eda56b15993a39f3275
Author: Ian Lance Taylor <iant@golang.org>
Date:   Tue Apr 18 17:30:09 2017 -0700

    compiler: add Ptrmask_symbol_expression
    
    Add an expression to evaluate to the ptrmask for a type.  This will be
    used for global variables, which always use a ptrmask no matter how
    large they are.
    
    Reviewed-on: https://go-review.googlesource.com/40981


commit bfff1654eac5b9288fa6c431e66cba8c9da6a660
Author: Ian Lance Taylor <iant@golang.org>
Date:   Mon Apr 17 10:51:16 2017 -0700

    runtime: change g's in systemstack
    
    The systemstack function in the gc toolchain changes to a different g.
    This is often used to get more stack space; the gofrontend uses a
    different stack growth mechanism that does not require changing g's,
    so we've been running with a version of systemstack that keeps the
    same g.  However, the garbage collector has various tests to verify
    that it is running on g0 rather than on a normal g.  For simplicity,
    change the gofrontend version of systemstack to change to a different
    g just as the gc toolchain does.
    
    This permits us to uncomment some sanity checks in notetsleep.
    Doing that requires us to fix up a couple of places where C code calls
    {start,stop}TheWorldWithSema while not on g0.
    
    Note that this does slow down some code in the runtime package unnecessarily.
    It may be useful to find some places where the runtime calls
    systemstack only to get more stack space and change it to use some
    other function.  That other function would act like systemstack in the
    gc toolchain but simply call the argument in the gofrontend.
    
    Reviewed-on: https://go-review.googlesource.com/40973


commit b2ccc7601ce71a7c5732154cf9b2eeea64681469
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 10:36:12 2017 -0700

    compiler, runtime: include ptrmask in GC roots
    
    Change the list of registered GC roots to include a ptrmask,
    and change the data structures to be easily used from Go code.
    The new ptrmask will be used by the Go 1.8 GC to only scan pointers.
    Tweak the current GC to use the new structures, but ignore the new
    ptrmask information for now.
    
    The new GC root data includes the size of the variable.  The size is
    not currently used, but will be used later by the cgo checking code.
    
    Reviewed-on: https://go-review.googlesource.com/41075


commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 12:23:16 2017 -0700

    compiler, runtime: don't pass size to __go_new
    
    There is no reason to pass the size to __go_new, as the type
    descriptor includes the size anyhow.  This makes the function
    correspond to the Go 1.8 function runtime.newobject, which is what we
    will use when we update to the Go 1.8 memory allocator.
    
    Reviewed-on: https://go-review.googlesource.com/41080


commit c321de7b738c4a3387c1842919c9305acfa04c57
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 13:13:56 2017 -0700

    compiler, runtime, reflect: make type descriptors more like Go 1.8
    
    Change the type descriptor structure to be more like the one in the Go
    1.8 runtime.  Specifically we add the ptrdata field, rename the gc
    field to gcdata and change the type to *byte, and rearrange a few of
    the fields.  The structure is still not identical to the Go 1.8
    structure--we don't use any of the tricks to reduce overall executable
    size--but it is more similar.
    
    For now we don't use the new ptrdata field, and the gcdata field is
    still the old format rather than the new Go 1.8 ptrmask/gcprog format.
    
    Reviewed-on: https://go-review.googlesource.com/41081


commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 14:54:29 2017 -0700

    reflect: make sure to clear unusable hash/equal function
    
    Otherwise we wind up copying the one from the prototype, which is wrong.
    
    Also rewrite the hash/equal functions to look like the ones in Go 1.8,
    mainly a matter of changing names and using arrayAt.
    
    Reviewed-on: https://go-review.googlesource.com/41133


commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 14:59:13 2017 -0700

    runtime: remove duplicate declarations of SetFinalizer/KeepAlive
    
    These should have been removed in CL 38794.  It's a bug that the
    compiler even permits these duplicate declarations.
    
    Reviewed-on: https://go-review.googlesource.com/41134


commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 15:56:32 2017 -0700

    runtime: don't crash if panicstring called with no m
    
    It's possible for runtime_panicstring to be called with no m if a
    signal handler, or scheduler innards, do something wrong.  If that
    happens carry on with the panic rather than crashing.
    
    Reviewed-on: https://go-review.googlesource.com/41137


commit 5b362b04f642afb8b20715930416fc3b7d91bb12
Author: Than McIntosh <thanm@google.com>
Date:   Fri Mar 31 14:35:48 2017 -0400

    compiler: fix for expr sharing introduced by Order_eval::statement.
    
    When processing an expression statement with a top-level call
    that returns multiple results, Order_eval::statement can wind up
    creating a tree that has multiple references to the same call,
    which results in a confusing AST dump. Change the implementation
    to avoid introducing this unwanted sharing.
    
    Reviewed-on: https://go-review.googlesource.com/39210


commit b05b4260a68695bf9c9cc29e14ae86ca2699458a
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 16:00:28 2017 -0700

    runtime: restore correct m in gtraceback
    
    If gtraceback is used to get a stack trace of a g running in the same m,
    as can happen if we collect a stack trace from a g0, then restore the
    old m value, don't clear it.
    
    Reviewed-on: https://go-review.googlesource.com/41138


commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 16:03:24 2017 -0700

    runtime: set startpc field when starting a new goroutine
    
    This puts the right value in a trace--previously it was always zero.
    
    Reviewed-on: https://go-review.googlesource.com/41139


commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 16:03:24 2017 -0700

    runtime: set startpc field when starting a new goroutine
    
    This puts the right value in a trace--previously it was always zero.
    
    Reviewed-on: https://go-review.googlesource.com/41139


commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 17:06:11 2017 -0700

    runtime: add prefetch functions
    
    The Go 1.8 GC uses prefetch functions.  Add versions for gccgo that
    call __builtin_prefetch.  Uncomment the test for them in testAtomic64.
    Don't force the check function to return early, as now taking the
    address of a local variable in the runtime package does not force it
    onto the heap.
    
    Reviewed-on: https://go-review.googlesource.com/41144


commit 4269db69f9184e5a45c54aaee7352425a1f88bff
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 17:55:21 2017 -0700

    runtime: split up ticks to get correct alignment
    
    On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary.
    A uint64 field in a struct is aligned to a 4-byte boundary.
    The runtime.ticks variable has a uint64 field that must be aligned
    to an 8-byte boundary.  Rather than rely on luck, split up the struct
    into separate vars so that the required alignment happens reliably.
    
    It would be much nicer if issue golang/go#19057 were fixed somehow,
    but that is for another day.
    
    Reviewed-on: https://go-review.googlesource.com/41143


commit 66926cabdbdbf3431b4f172f7756e195c1c6c513
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Apr 20 17:15:38 2017 +0200

    libgo: fix bad value for O_CLOEXEC on AIX 7.1
    
    On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which
    creates an integer constant overflow error when building libgo.
    
    This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and
    defaults to O in sysinfo.go) and is defined as 0x00800000 on
    AIX 7.2.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/41214


commit af288ff10aeafc47651f5def327ed56425d5be19
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 20 17:15:02 2017 -0700

    runtime: preserve stack context in tracebackothers
    
    The tracebackothers function works by saving the current stack context
    in the goroutine's context field and then calling gogo to switch to a
    new goroutine.  The new goroutine will collect its own stack trace and
    then call gogo to switch back to the original goroutine.  This works
    fine, but if the original goroutine was called by mcall then the
    contents of its context field are needed to return from the mcall.
    Fix this by saving the stack context across the calls to the other
    goroutines.
    
    Reviewed-on: https://go-review.googlesource.com/41293


commit 43101e5956e793f1b4de05c15d7738c785e927df
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Apr 21 10:58:52 2017 +0200

    os/user: use _posix_* libc functions
    
    libc getpwnam_r function has a different signature, we must use
    _posix_getpwnam_r instead (by default, the pwd.h system include
     file defines getpwnam_r as a static function calling
    _posix_getpwnam_r, so a C program calling getpwnam_r will indeed
    reference the _posix_getpwnam_r symbol).
    
    Idem for getpwuid_r, getgrnam_r and getgrgid_r.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/41334


commit 71e1fec4d2a536591ea6657a06916a17b5127071
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 19 21:24:48 2017 -0700

    runtime: don't use pointers in g_ucontext_t or stackcontext
    
    The g_ucontext_t type holds registers saved for a goroutine.  We have
    to scan it for pointers, but since registers don't necessarily hold
    pointers we have to scan it conservatively.  That means that it should
    not have a pointer type, since the GC will always scan pointers.
    Instead it needs special treatment to be scanned conservatively.
    The current GC doesn't care when a pointer type holds a non-pointer,
    but the Go 1.8 GC does.
    
    For the current GC this means we have to explicitly scan the
    g_ucontext_t values in a G.
    
    While we're at it change stackcontext to be uintptr too.  The entries
    in stackcontext never hold pointers that the Go GC cares about.
    
    Reviewed-on: https://go-review.googlesource.com/41270


commit eab2960aee91d3e3a6baa5b1bce01262d24c714f
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Apr 20 17:08:19 2017 -0700

    runtime/internal/sys: define Goexperiment
    
    The gc toolchain defines Goexperiment based on the environment
    variable GOEXPERIMENT when the toolchain is built.  We just always set
    Goexperiment to the empty string.
    
    Reviewed-on: https://go-review.googlesource.com/41292


commit be4a751943265c0637da859d15a4faf162f5c478
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Thu Apr 20 14:04:35 2017 +0200

    net: sockopt implementation for AIX
    
    This is a copy of the Linux implementation, it allows to
    run some simple client/server applications on AIX, while
    the current sockopt stubs don't.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/41213


commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Mar 29 17:55:06 2017 +0200

    math: fix sign for atan/expm1/log1p(-0)
    
    AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0),
    while matching Go functions must return -0.
    
    Code courtesy of Tony Reix.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/38699


commit 53b0e809130038a46f0a3d2870e3905f44ab888d
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Apr 26 17:29:22 2017 +0200

    runtime: fix context clobbering on AIX
    
    On AIX 64-bits, r13 is a pointer to thread data.
    setcontext() overwrites r13 with the value saved by getcontext().
    So, when a goroutine is scheduled on a new thread, r13 will point
    to the old thread data after calling setcontext().
    
    Code courtesy of Damien Bergamini.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/41854


commit f8d5ebd71c71e6e777200530d8204b92619157f8
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Wed Apr 26 18:01:19 2017 +0200

    runtime: fix wrong time calculation in semasleep
    
    tv_nsec is added twice when calculating the sleep end time.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/41855


commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3
Author: Matthieu Sarter <matthieu.sarter.external@atos.net>
Date:   Fri Apr 28 10:27:32 2017 +0200

    libgo: pass $(NM) value when running benchmarks
    
    On AIX, we need to use "nm -B" instead of "nm", to have the
    epxected output format, so the configured $(NM) value from
    the Makefile should be exported before running gotest, which
    defaults to "nm" if $NM is not set.
    
    Issue golang/go#19200
    
    Reviewed-on: https://go-review.googlesource.com/42051


commit 0fb550083ae474fb964435927b899ec8e4b62771
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Nov 16 21:12:53 2016 -0800

    runtime: copy garbage collector from Go 1.8 runtime
    
    This giant patch replaces the old Go 1.4 memory allocator and garbage
    collector with the new Go 1.8 code.  The memory allocator is fairly
    similar, though now written in Go rather than C.  The garbage
    collector is completely different.  It now uses ptrmask and gcprog
    information, which requires changes in the compiler and the reflect
    package as well as the runtime.  And, of course, the garbage collector
    now runs concurrently with program execution.
    
    In the gc toolchain the garbage collector is strict and precise at all
    levels.  In the gofrontend we do not have stack maps, so stacks, and
    register values, are collected conservatively.  That means that an
    old, no longer used, pointer on a stack or in a register can cause a
    memory object to live longer than it should.  That in turns means that
    we must disable some checks for invalid pointers in the garbage
    collection code.  Not only can we get an invalid pointer on the stack;
    the concurrent nature of the collector means that we can in effect
    resurrect a block that was already unmarked but that the collector had
    not yet gotten around to freeing, and that block can in turn point to
    other blocks that the collector had managed to already free.  So we
    must disable pointer checks in general.  In effect we are relying on
    the fact that the strict pointer checks in the gc toolchain ensure
    that the garbage collector is correct, and we just assume that it is
    correct for the gofrontend since we are using the same code.
    
    Reviewed-on: https://go-review.googlesource.com/41307


commit a95078d501175240d095500a8c5fbfb21bec65cb
Author: Ian Lance Taylor <iant@golang.org>
Date:   Mon Apr 24 16:33:47 2017 -0700

    libgo/Makefile: clean more files
    
    Fix up the mostlyclean, clean, and distclean targets to better follow
    https://www.gnu.org/prep/standards/html_node/Standard-Targets.html.
    
    Reviewed-on: https://go-review.googlesource.com/41625


commit 5956bf1055451cf4239cdfeca259c23b1ded54d8
Author: Ian Lance Taylor <iant@golang.org>
Date:   Mon May 8 13:35:11 2017 -0700

    libgo: delete goc2c
    
    The last .goc file has been removed, so remove goc2c.
    
    The goc2c program was my first contribution to the gc repository that
    was more than 100 lines:
    2b57a1124e
    The program was used in gc for a few years under various guises but
    was finally removed in https://golang.org/cl/132680043.  Now we can
    remove it from gofrontend as well.
    
    Reviewed-on: https://go-review.googlesource.com/42911


commit a222e35d041de0cd42506b61c93b8209e07702b9
Author: Than McIntosh <thanm@google.com>
Date:   Tue May 9 10:33:10 2017 -0400

    compiler: set "need_init_fn" when adding gc root
    
    Variables that back slice initializers in certain cases have to be
    added to the gc roots list, since they can be modified at runtime. The
    code that was doing this addition did not update the flag that tracks
    whether the package being compiled needs an initializer function,
    which resulted in the call in question being left out of the final
    generated code in certain cases. Fix is to change Gogo::add_gc_root()
    to update the "needs init" flag.
    
    Reviewed-on: https://go-review.googlesource.com/43030


commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e
Author: Than McIntosh <thanm@google.com>
Date:   Tue May 9 11:36:51 2017 -0400

    compiler: fix variable context nit in write barrier generation
    
    Update the write barrier generation code to insure that the "lvalue
    context" tag on the space var expression is set only in the case where
    the expr feeds directly into an assignment. This is somewhat
    counter-intuitive, but needed in the case where the backend looks at
    context tags.
    
    Reviewed-on: https://go-review.googlesource.com/43031

From-SVN: r247848
2017-05-10 17:26:09 +00:00
Ian Lance Taylor
ea250f5612 libgo: update to Go 1.8.1 release
Reviewed-on: https://go-review.googlesource.com/40775

From-SVN: r246957
2017-04-17 22:10:58 +00:00
Ian Lance Taylor
31d61ac600 re PR go/77857 (gccgo: vendoring doesn't work in gcc 6/7)
PR go/77857
    cmd/go: generate vendor paths for -I arg on compile
    
    This change generates the vendor path to be used with -I
    on a gccgo compile to find imports from the vendor directories.
    
    Fixes golang/go#15628
    
    Reviewed-on: https://go-review.googlesource.com/39590

From-SVN: r246864
2017-04-12 04:26:15 +00:00
Ian Lance Taylor
cf26173d18 re PR go/80302 (FAIL: time on systems with tzdata2017b installed)
PR go/80302
    time: make the ParseInLocation test more robust
    
    This is a backport of https://golang.org/cl/37964 from the gc toolchain.
    
    Original description:
    
        The tzdata 2017a update (2017-02-28) changed the abbreviation of the
        Asia/Baghdad time zone (used in TestParseInLocation) from 'AST' to the
        numeric '+03'.
    
        Update the test so that it skips the checks if we're using a recent
        tzdata release.
    
    Updates golang/go#19457
    Fixes GCC PR 80302.
    
    Reviewed-on: https://go-review.googlesource.com/39470

From-SVN: r246695
2017-04-04 19:37:22 +00:00
Ian Lance Taylor
58dc29b0b5 internal/syscall/unix: add randomTrap for m68k
Patch by Andrwas Schwab.
    
    Reviewed-on: https://go-review.googlesource.com/38456

From-SVN: r246410
2017-03-22 23:51:35 +00:00
Ian Lance Taylor
c85ac396f1 cmd/go: add testdata/timeoutbench_test.go
This file was accidentally omitted from the update to the final Go 1.8.

From-SVN: r245814
2017-03-01 18:41:15 +00:00
Ian Lance Taylor
7efb3707f2 mksigtab.sh: skip signals defined as other signals
Fixes Solaris build.
    
    Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/37587

From-SVN: r245794
2017-02-28 22:30:57 +00:00
Ian Lance Taylor
c5c78a527d runtime: fix sigfwd to not allocate memory
The use of &[1]uintptr{fn} was causing sigfwd to allocate memory, even
    though it is being compiled for the runtime package.  That is a bad
    idea for this function, which is invoked by a signal handler.  Rewrite
    it to use only constructs that do not allocate memory when compiled
    for the runtime package.
    
    The test for this is misc/cgo/testcarchive in the main repo, which we
    don't yet test.
    
    Reviewed-on: https://go-review.googlesource.com/37454

From-SVN: r245777
2017-02-28 15:13:16 +00:00
Ian Lance Taylor
5d805ca622 libgo: fix quoting in mksigtab.sh
The quoting was causing us to never add the system-specific signals.
    
    The test for this is misc/cgo/testcarchive in the master repo, which
    we don't yet run for gccgo.
    
    Reviewed-on: https://go-review.googlesource.com/37453

From-SVN: r245776
2017-02-28 15:09:43 +00:00
Ian Lance Taylor
00b2a30fd4 libgo: update to final Go 1.8 release
Along with the update this fixes a problem that was always present but
    only showed up with the new reflect test.  When a program used a
    **unsafe.Pointer and stored the value in an interface type, the
    generated type descriptor pointed to the GC data for *unsafe.Pointer.
    It did that by name, but we were not generating a variable with the
    right name.
    
    Reviewed-on: https://go-review.googlesource.com/37144

From-SVN: r245535
2017-02-17 15:43:39 +00:00
Ian Lance Taylor
7953a24c60 re PR go/79443 (libgo/math test fails on s390x (undefined symbols cosh, sinh, tanh, hasVX))
PR go/79443
    libgo: fix some s390x tests
    
    Add `+build ignore` to ignore tests that rely on s390x assembly code
    not yet implemented for gccgo.
    
    Fixes GCC PR 79443.
    
    Reviewed-on: https://go-review.googlesource.com/36909

From-SVN: r245397
2017-02-13 17:37:02 +00:00
Ian Lance Taylor
42f20102ef libgo: update to go1.8rc3
Reviewed-on: https://go-review.googlesource.com/35844

From-SVN: r244981
2017-01-27 15:01:57 +00:00
Ian Lance Taylor
41d3d0ac40 runtime: fix setting of isarchive
When I updated to Go 1.8, the initsig function moved from
    signal1_unix.go to signal_unix.go, and lost a gccgo-specific change in
    the move.  Add it back.
    
    This would have been caught by the misc/cgo/testcarchive tests in the
    gc repository, but we don't run those in the gccgo repository.  We
    should fix that, somehow.
    
    Reviewed-on: https://go-review.googlesource.com/35839

From-SVN: r244947
2017-01-26 19:07:54 +00:00
Ian Lance Taylor
fda6ee7033 runtime: fix context used by getTraceback
I typoed the argument passed to getcontext in getTraceback, and the
    error was hidden by ucontext_arg.  This would have been caught by some
    of the runtime package tests, but we don't run most of them because
    they rely on `go build`, and the go tool is not available while
    running the libgo testsuite.  We should fix the libgo testsuite,
    somehow, so that they run.
    
    Reviewed-on: https://go-review.googlesource.com/35837

From-SVN: r244946
2017-01-26 19:05:16 +00:00
Ian Lance Taylor
c25edd44a0 libgo: update to go1.8rc2
Fix a bug in the generation of the hash value in reflect.FuncOf.
    
    The merge script missed a bunch of testdata files over the years.
    Copy them over.
    
    Reviewed-on: https://go-review.googlesource.com/35570

From-SVN: r244835
2017-01-23 22:18:42 +00:00
Ian Lance Taylor
b0147ac2e6 re PR go/79037 (gccgo: Binaries crash with parforsetup: pos is not aligned on m68k)
PR go/79037
    compiler, runtime: align gc data for m68k
    
    The current GC requires that the gc data be aligned to at least a 4
    byte boundary, because it uses the lower two bits of the address for
    flags (see LOOP and PRECISE in runtime/mgc0.c).  As the gc data is
    stored as a [...]uintptr, that is normally always true.  However, on
    m68k, that only guarantees 2 byte alignment.  Fix it by forcing the
    alignment.
    
    The parfor code used by the current GC requires that the parfor data
    be aligned to at least an 8 byte boundary.  The code in parfor.c
    verifies this.  This is normally true, as the data uses uint64_t
    values, but, again, this must be enforced explicitly on m68k.
    
    Fixes GCC PR 79037.
    
    Reviewed-on: https://go-review.googlesource.com/35478

From-SVN: r244824
2017-01-23 18:15:22 +00:00
Ian Lance Taylor
a0488df436 libgo: bump library version to 11
As usual I forgot to bump the library version when I updated the
    library to 1.8rc1.
    
    Reviewed-on: https://go-review.googlesource.com/35568

From-SVN: r244823
2017-01-23 18:10:13 +00:00
Ian Lance Taylor
4a5b806048 runtime, testing/internal/testdeps: fixes for cgo
Some fixes that permit misc/cgo/test in the master gc repository to
    pass using the current gccgo.
    
    Install testing/internal/testdeps.gox; it is needed by `go test`.
    
    Export runtime.lockedOSThread to enable calling via go:linkname; it is
    used by misc/cgo/test.
    
    Loop on EAGAIN when creating a new thread; this is what the gc code
    does, and misc/cgo/test tests that it works.
    
    Reviewed-on: https://go-review.googlesource.com/35479

From-SVN: r244733
2017-01-20 21:18:37 +00:00
Ian Lance Taylor
5dc8f5d9e6 re PR go/79146 (Bootstrapping go on s390x fails; redefined symbols)
PR go/79146
    math/big: fix build on s390x
    
    Don't build arith_decl_s390x.go for gccgo; it is only for assembly
    code that has not yet been ported to gccgo.
    
    For GCC PR 79146.

From-SVN: r244731
2017-01-20 20:39:10 +00:00
Ian Lance Taylor
198766b648 re PR go/79146 (Bootstrapping go on s390x fails; redefined symbols)
PR go/79146
    crypto/elliptic: explicitly ignore p256_s390x.go
    
    The file only works if used in conjunction with assembly code not
    (yet) written for gccgo.
    
    Fixes GCC PR 79146.

    Reviewed-on: https://go-review.googlesource.com/35477

From-SVN: r244679
2017-01-20 02:27:46 +00:00
Ian Lance Taylor
49947b33ff syscall, golang_org/x/net/lif: fixes for gccgo on Solaris
Reviewed-on: https://go-review.googlesource.com/35390

From-SVN: r244563
2017-01-18 03:37:52 +00:00
Ian Lance Taylor
a2a7ea4834 runtime: rename siginfo to _siginfo_t
Since the name siginfo winds up in runtime.inc, this avoids a name
    collision on systems that define "struct siginfo" in the system header
    files.
    
    Reviewed-on: https://go-review.googlesource.com/35239

From-SVN: r244484
2017-01-16 01:21:42 +00:00
Ian Lance Taylor
58a3a26bbd libgo: correct golang_org Makefile variables not used on all systems
Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/35238

From-SVN: r244483
2017-01-16 01:05:10 +00:00
Ian Lance Taylor
c2047754c3 libgo: update to Go 1.8 release candidate 1
Compiler changes:
      * Change map assignment to use mapassign and assign value directly.
      * Change string iteration to use decoderune, faster for ASCII strings.
      * Change makeslice to take int, and use makeslice64 for larger values.
      * Add new noverflow field to hmap struct used for maps.
    
    Unresolved problems, to be fixed later:
      * Commented out test in go/types/sizes_test.go that doesn't compile.
      * Commented out reflect.TestStructOf test for padding after zero-sized field.
    
    Reviewed-on: https://go-review.googlesource.com/35231

gotools/:
	Updates for Go 1.8rc1.
	* Makefile.am (go_cmd_go_files): Add bug.go.
	(s-zdefaultcc): Write defaultPkgConfig.
	* Makefile.in: Rebuild.

From-SVN: r244456
2017-01-14 00:05:42 +00:00
Ian Lance Taylor
6fcb740ac4 runtime: copy more scheduler code from Go 1.7 runtime
I looked at a diff of proc.go between Go 1.7 and gccgo, and copied
    over all the easy stuff.
    
    Reviewed-on: https://go-review.googlesource.com/35090

From-SVN: r244291
2017-01-10 21:09:00 +00:00
Ian Lance Taylor
0c22e4415f compiler, runtime: drop size arguments to hash/equal functions
Drop the size arguments for the hash/equal functions stored in type
    descriptors.  Types know what size they are.  To make this work,
    generate hash/equal functions for types that can use an identity
    comparison but are not a standard size and alignment.
    
    Drop the multiplications by 33 in the generated hash code and the
    reflect package hash code.  They are not necessary since we started
    passing a seed value around, as the seed includes the hash of the
    earlier values.
    
    Copy the algorithms for standard types from the Go 1.7 runtime,
    replacing the C functions.
    
    Reviewed-on: https://go-review.googlesource.com/34983

From-SVN: r244256
2017-01-10 03:59:20 +00:00
Ian Lance Taylor
2193ad7fbf runtime: copy more of scheduler from Go 1.7 runtime
This started by moving procresize from C to Go so that we can pass the
    right type to the memory allocator when allocating a p, which forced
    the gomaxprocs variable to move from C to Go, and everything else
    followed from that.
    
    Reviewed-on: https://go-review.googlesource.com/34916

From-SVN: r244236
2017-01-09 19:37:19 +00:00
Ian Lance Taylor
12e917fff2 runtime: actually remove go-alloc.h
Accidentally omitted from the commit of CL 34797 (SVN revision 244036).

From-SVN: r244166
2017-01-06 16:06:42 +00:00
Ian Lance Taylor
08934aed39 re PR go/78978 (runtime/pprof FAILs on Solaris 2/x86)
PR go/78978
    libgo: build with -Wa,-nH if possible on Solaris
    
    By default the Solaris assembler records the required hardware
    capability in the object file.  This means that the AES hashing code
    breaks on systems that do not support AES, even though the code uses a
    runtime check to only actually invoke the AES instructions on systems
    that support it.  An earlier fix for the problem only fixed the shared
    library, not the static libgo.a.  Fix the problem for real by using an
    assembler option to not record the hardware capability.
    
    For GCC PR 78978.
    
    Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/34910

From-SVN: r244165
2017-01-06 16:04:01 +00:00
Ian Lance Taylor
0f2a6e84c6 runtime: remove __go_alloc and __go_free
Move allocg and handling of allgs slice from C to Go.
    
    Reviewed-on: https://go-review.googlesource.com/34797

From-SVN: r244036
2017-01-03 22:58:48 +00:00
Ian Lance Taylor
b379f8d81f re PR go/78789 (Error: no such instruction: `aesenc %xmm0,%xmm2' when compiling libgo/runtime/aeshash.c)
PR go/78789
    runtime: don't build aeshash.c if the assembler doesn't support it
    
    This is for CentOS 5, whose assembler does not know the aesinc
    instruction.
    
    Fixes GCC PR 78789.
    
    Patch by Uros Bizjak.
    
    Reviewed-on: https://go-review.googlesource.com/34796

From-SVN: r244031
2017-01-03 20:41:54 +00:00
Ian Lance Taylor
0d3dd8fb65 runtime: copy cgo support from Go 1.7 runtime
Remove support for _cgo_allocate.  It was removed from the gc
    toolchain in Go 1.5, so it is unlikely that anybody is trying to use it.
    
    Reviewed-on: https://go-review.googlesource.com/34557

From-SVN: r243805
2016-12-19 18:00:35 +00:00
Ian Lance Taylor
c3c54e0f07 libgo: fixes for Solaris build
Don't put m[0-4] in runtime.inc.
    
    Pass -mclear-hwcap to the linker if supported.
    
    From Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/34331

From-SVN: r243619
2016-12-13 18:03:45 +00:00
Ian Lance Taylor
560bcfdcfd runtime: mark non-x86 aeshashbody parameters as unused
Avoids warnings during the build.
    
    Reviewed-on: https://go-review.googlesource.com/34142

From-SVN: r243459
2016-12-08 20:43:19 +00:00
Ian Lance Taylor
453060a906 runtime: copy memory hash code from Go 1.7
Rewrite the AES hashing code from gc assembler to C code using
    intrinsics.  The resulting code generates the same hash code for the
    same input as the gc code--that doesn't matter as such, but testing it
    ensures that the C code does something useful.
    
    Also change mips64pe32le to mips64p32le in configure script--noticed
    during CL review.
    
    Reviewed-on: https://go-review.googlesource.com/34022

From-SVN: r243445
2016-12-08 16:37:54 +00:00
Ian Lance Taylor
b2264b0964 runtime: allocate _panic struct on heap
The gc library allocates a _panic struct on the stack. This does not
    work for gccgo, because when a deferred function recovers the panic we
    unwind the stack up to that point so that returning from the function
    will work correctly.
    
    Allocating on the stack fine if the panic is not recovered, and it
    works fine if the panic is recovered by a function that
    returns. However, it fails if the panic is recovered by a function
    that itself panics, and if that second panic is then recovered by a
    function higher up on the stack. When we unwind the stack to that
    second panic, the g will wind up pointing at a panic farther down on
    the stack. Even then everything will often work fine, except when the
    deferred function catching the second panic makes a bunch of calls
    that use stack space before returning. In that case the code can
    overwrite the panic struct, which will then cause disaster when we
    remove the struct from the linked list, as the link field will be
    garbage. This case is rare enough that all the x86 tests were passing,
    but there was a failure on ppc64le.
    
    Before https://golang.org/cl/33414 we allocated the panic struct on
    the heap, so go back to doing that again.
    
    Fixes golang/go#18228.
    
    Reviewed-on: https://go-review.googlesource.com/34027

From-SVN: r243444
2016-12-08 15:54:30 +00:00
Ian Lance Taylor
776a8a927e runtime: remove some unused variables/declarations from runtime.h
Small patch from Eric Botcazou.
    
    Reviewed-on: https://go-review.googlesource.com/34029

From-SVN: r243424
2016-12-08 00:38:03 +00:00
Ian Lance Taylor
6e7f1be7ae runtime: set isarchive in initsig
The library initialization code in go-libmain.c sets the C variable
    runtime_isarchive but failed to set the Go variable runtime.isarchive.
    We don't currently have a way to let C code access an unexported Go
    variable, but fortunately the only time the Go function initsig is
    called with an argument of true is exactly where we want to set
    isarchive.  So let initsig do it.
    
    Reviewed-on: https://go-review.googlesource.com/33753

From-SVN: r243094
2016-12-01 05:47:58 +00:00
Ian Lance Taylor
24f1d7f80e runtime: print C functions in traceback
Since gccgo can trace back through C code as easily as Go code, we
    should print C functions in the traceback.
    
    This worked before https://golang.org/cl/31230 for a dumb reason.  The
    default value for runtime.traceback_cache was, and is, 2 << 2, meaning
    to print all functions.  The old C code for runtime_parsedebugvars
    would return immediately and do nothing if the environment variable
    GODEBUG was not set (if GODEBUG was set it would later call
    setTraceback.  The new Go code for runtime.parsedebugvars does not
    return immediately if GODEBUG is not set, and always calls
    setTraceback.  Either way, if GOTRACEBACK is not set, setTraceback
    would set traceback_cache to 1 << 2, meaning to only print non-runtime
    functions and having the effect of not printing plain C functions.
    
    Keep the current handling of GODEBUG/GOTRACEBACK, which matches the gc
    library, but add an extra check to print C functions by default.
    
    Reviewed-on: https://go-review.googlesource.com/33717

From-SVN: r243083
2016-11-30 20:28:28 +00:00
Ian Lance Taylor
fbe9724cc3 runtime: fixes for -buildmode=c-archive
With -buildmode=c-archive, initsig is called before the memory
    allocator has been initialized.  The code was doing a memory
    allocation because of the call to funcPC(sigtramp).  When escape
    analysis is fully implemented, that call should not allocate.  For
    now, finesse the issue by calling a C function to get the C function
    pointer value of sigtramp.
    
    When returning from a call from C to a Go function, a deferred
    function is run to go back to syscall mode.  When the call occurs on a
    non-Go thread, that call sets g to nil, making it impossible to add
    the _defer struct back to the pool.  Just drop it and let the garbage
    collector clean it up.
    
    Reviewed-on: https://go-review.googlesource.com/33675

From-SVN: r242992
2016-11-30 02:09:24 +00:00
Ian Lance Taylor
7239bf746a re PR go/77910 (go: open zversion.go: no such file or directory)
PR go/77910
    cmd/go: don't check standard packages when using gccgo
    
    This copies https://golang.org/cl/33295 to libgo.
    
    This fixes GCC PR 77910.
    
    Reviewed-on: https://go-review.googlesource.com/33471

From-SVN: r242724
2016-11-22 21:04:27 +00:00
Ian Lance Taylor
9d1e3afb54 runtime: rewrite panic/defer code from C to Go
The actual stack unwind code is still in C, but the rest of the code,
    notably all the memory allocation, is now in Go.  The names are changed
    to the names used in the Go 1.7 runtime, but the code is necessarily
    somewhat different.
    
    The __go_makefunc_can_recover function is dropped, as the uses of it
    were removed in https://golang.org/cl/198770044.
    
    Reviewed-on: https://go-review.googlesource.com/33414

From-SVN: r242715
2016-11-22 17:58:04 +00:00
Ian Lance Taylor
092dd2bc33 runtime: move schedt type and sched var from C to Go
This doesn't change any actual code, it just starts using the Go
    definition of the schedt type and the sched variable rather than the C
    definitions.
    
    The schedt type is tweaked slightly for gccgo.  We aren't going to
    release goroutine stacks, so we don't need separate gfreeStack and
    gfreeNostack lists.  We only have one size of defer function, so we
    don't need a list of 5 different pools.
    
    Reviewed-on: https://go-review.googlesource.com/33364

From-SVN: r242600
2016-11-18 17:48:29 +00:00
Ian Lance Taylor
d6255159e8 runtime: don't call __go_alloc/__go_free in environment functions
Reviewed-on: https://go-review.googlesource.com/33363

From-SVN: r242594
2016-11-18 16:03:13 +00:00
Ian Lance Taylor
d519aeda8b libgo: remove old/regexp and old/template
They were removed from the master Go library in 2012
    (https://golang.org/cl/5979046) but somehow that was not reflected here.
    
    Reviewed-on: https://go-review.googlesource.com/33391

From-SVN: r242592
2016-11-18 14:51:13 +00:00
Ian Lance Taylor
9bd0f0bc6b Correct gcc/go/gofrontend/lex.cc and libgo/aclocal.m4 to the versions in the gofrontend repo...
Correct gcc/go/gofrontend/lex.cc and libgo/aclocal.m4 to the versions
in the gofrontend repo, which is supposed to be the master copy.

Remove a few files in libgo that somehow were not deleted in the past.

From-SVN: r242583
2016-11-18 04:15:46 +00:00
Ian Lance Taylor
54f0deb00f Update libgo/configure to restore it to the master version.
Update a few binary files that were changed in the master gc repo,
copied into the gofrontend repo, but not correctly copied into the GCC
repo.  The changes are all minor and do not affect any actual tests.
Two instances of "http" changed to "https", and two timestamps were
zeroed out.

From-SVN: r242582
2016-11-18 04:05:10 +00:00
Ian Lance Taylor
5302cd0250 runtime, reflect: rewrite Go to FFI type conversion in Go
As we move toward the Go 1.7 garbage collector, it's essential that all
    allocation of values that can contain Go pointers be done using the
    correct type descriptor.  That is simplest if we do all such allocation
    in Go code.  This rewrites the code that converts from a Go type to a
    libffi CIF into Go.
    
    Reviewed-on: https://go-review.googlesource.com/33353

From-SVN: r242578
2016-11-18 00:15:38 +00:00
Ian Lance Taylor
350767bf22 runtime: replace runtime1.goc with Go and C code
A step toward eliminating goc2c.
    
    Drop the exported parfor code; it was needed for tests in the past, but
    no longer is. The Go 1.7 runtime no longer uses parfor.
    
    Reviewed-on: https://go-review.googlesource.com/33324

From-SVN: r242509
2016-11-16 18:33:11 +00:00