Commit Graph

749 Commits

Author SHA1 Message Date
Ian Lance Taylor 812ba636c7 runtime: copy netpoll code from Go 1.7 runtime
Reviewed-on: https://go-review.googlesource.com/31325

From-SVN: r241307
2016-10-18 14:38:29 +00:00
Ian Lance Taylor 421a8ed412 runtime: scan caller-saved registers for non-split-stack
While testing a patch on Solaris, which does not support split-stack, I
    ran across a bug in the handling of caller-saved registers for the
    garbage collector.  For non-split-stack systems, runtime_mcall is
    responsible for saving all caller-saved registers on the stack so that
    the GC stack scan will see them.  It does this by calling
    __builtin_unwind_init and setting the g's gcnextsp field to point to the
    current stack.  The garbage collector then scans the stack from gcnextsp
    to the top of stack.
    
    Unfortunately, the code was setting gcnextsp to point to runtime_mcall's
    argument, which meant that even though runtime_mcall was careful to
    store all caller-saved registers on the stack, the GC never saw them.
    This is, of course, only a problem if a value lives only in a
    caller-saved register, and not anywhere else on the stack or heap.  And
    it is only a problem if that caller-saved register manages to make it
    all the way down to runtime_mcall without being saved by any function on
    the way.  This is moderately unlikely but it turns out that the recent
    changes to keep values on the stack when compiling the runtime package
    caused it to happen for the local variable `s` in `notifyListWait` in
    runtime/sema.go.  That function calls goparkunlock which is simple
    enough to not require all registers, and itself calls runtime_mcall.  So
    it was possible for `s` to be released by the GC before the goroutine
    returned from goparkunlock, which eventually caused a dangling pointer
    to be passed to releaseSudog.
    
    This is not a problem on split-stack systems, which use
    __splitstack_get_context, which saves a stack pointer low enough on the
    stack to scan the registers saved by runtime_mcall.
    
    Reviewed-on: https://go-review.googlesource.com/31323

From-SVN: r241304
2016-10-18 13:29:37 +00:00
Ian Lance Taylor 8cce07d1dd runtime: copy rdebug code from Go 1.7 runtime
While we're at it, update the runtime/debug package, and start running
    its testsuite by default.  I'm not sure why runtime/debug was not
    previously updated to 1.7.  Doing that led me to fix some minor aspects
    of runtime.Stack and the C function runtime/debug.readGCStats.
    
    Reviewed-on: https://go-review.googlesource.com/31251

From-SVN: r241261
2016-10-17 16:54:25 +00:00
Ian Lance Taylor 35d9424444 runtime: copy runtime package time code from Go 1.7
Fix handling of function values for -fgo-c-header to generate FuncVal*,
    not simply FuncVal.
    
    While we're here change runtime.nanotime to use clock_gettime with
    CLOCK_MONOTONIC, rather than gettimeofday.  This is what the gc library
    does.  It provides nanosecond precision and a monotonic clock.
    
    Reviewed-on: https://go-review.googlesource.com/31232

From-SVN: r241197
2016-10-15 00:29:06 +00:00
Ian Lance Taylor 1f0be9ee86 runtime: copy mprof code from Go 1.7 runtime
Also create a gccgo version of some of the traceback code in
    traceback_gccgo.go, replacing some code currently in C.
    
    This required modifying the compiler so that when compiling the runtime
    package a slice expression does not cause a local array variable to
    escape to the heap.
    
    Reviewed-on: https://go-review.googlesource.com/31230

From-SVN: r241189
2016-10-14 22:51:46 +00:00
Ian Lance Taylor db2fb304fe runtime: just do file/line lookup in C, move Func to Go
In order to port stack backtraces to Go, we need the ability to look up
    file/line information for PC values without allocating memory.  This
    patch moves the handling of Func from C code to Go code, and simplifies
    the C code to just look up function/file/line/entry information for a PC.
    
    Reviewed-on: https://go-review.googlesource.com/31150

From-SVN: r241172
2016-10-14 17:20:40 +00:00
Ian Lance Taylor d2c4425e86 debug/elf: add sparc64 relocations
This is a backport of https://go-review.googlesource.com/30870.
    
    Reviewed-on: https://go-review.googlesource.com/30916

From-SVN: r241171
2016-10-14 17:16:55 +00:00
Ian Lance Taylor 238fc3441c runtime: copy cpuprof code from Go 1.7 runtime
This replaces runtime/cpuprof.goc with go/runtime/cpuprof.go and adjusts
    the supporting code in runtime/proc.c.
    
    This adds another case where the compiler needs to avoid heap allocation
    in the runtime package: when evaluating a method expression into a
    closure.  Implementing this required moving the relevant code from
    do_get_backend to do_flatten, so that I could easily add a temporary
    variable.  Doing that let me get rid of Bound_method_expression::do_lower.
    
    Reviewed-on: https://go-review.googlesource.com/31050

From-SVN: r241163
2016-10-14 13:36:35 +00:00
Ian Lance Taylor 58f7dab40d runtime: copy mstats code from Go 1.7 runtime
This replaces mem.go and the C runtime_ReadMemStats function with the Go
    1.7 mstats.go.
    
    The GCStats code is commented out for now.  The corresponding gccgo code
    is in runtime/mgc0.c.
    
    The variables memstats and worldsema are shared between the Go code and
    the C code, but are not exported.  To make this work, add temporary
    accessor functions acquireWorldsema, releaseWorldsema, getMstats (the
    latter known as mstats in the C code).
    
    Check the preemptoff field of m when allocating and when considering
    whether to start a GC.  This works with the new stopTheWorld and
    startTheWorld functions in Go, which are essentially the Go 1.7
    versions.
    
    Change the compiler to stack allocate closures when compiling the
    runtime package.  Within the runtime packages closures do not escape.
    This is similar to what the gc compiler does, except that the gc
    compiler, when compiling the runtime package, gives an error if escape
    analysis shows that a closure does escape.  I added this here because
    the Go version of ReadMemStats calls systemstack with a closure, and
    having that allocate memory was causing some tests that measure memory
    allocations to fail.
    
    Reviewed-on: https://go-review.googlesource.com/30972

From-SVN: r241124
2016-10-13 15:24:50 +00:00
Ian Lance Taylor 80b489ebba syscall: don't use pt_regs in clone_linux.c
It's unnecessary and it reportedly breaks the build on arm64 GNU/Linux.
    
    Reviewed-on: https://go-review.googlesource.com/30978

From-SVN: r241084
2016-10-13 04:19:57 +00:00
Ian Lance Taylor 1ad16c5284 compiler, runtime: copy string code from Go 1.7
Add compiler support for turning concatenating strings into a call to
    a runtime function that takes the appropriate number of arguments.
    
    Rename some local variables in mgc0.c to avoid macros that the new
    rune.go causes to appear in runtime.inc.
    
    Reviewed-on: https://go-review.googlesource.com/30827

From-SVN: r241074
2016-10-12 18:17:52 +00:00
Ian Lance Taylor fa8e596366 syscall: mark rawClone as no_split_stack
Reviewed-on: https://go-review.googlesource.com/30955

From-SVN: r241072
2016-10-12 17:42:49 +00:00
Ian Lance Taylor 543f217b7a runtime: copy Go 1.7 runtime semaphore code
This triggered a check in releaseSudog that g.param not nil, because
    libgo uses the param field when starting a goroutine.  Fixed by clearing
    g->param in kickoff in proc.c.
    
    Reviewed-on: https://go-review.googlesource.com/30951

From-SVN: r241067
2016-10-12 15:38:56 +00:00
Ian Lance Taylor c8dc49fb03 syscall, internal/syscall/unix: Fix getrandom, clone on sparc64
Since sparc is a valid architecture, the name of
    getrandom_linux_sparc.go means that it will be ignored on sparc64,
    even though it's whitelisted with a +build line.
    
    On SPARC, clone has a unique return value convention which requires
    some inline assembly to convert it to the normal convention.
    
    Reviewed-on: https://go-review.googlesource.com/30873

From-SVN: r241051
2016-10-12 14:28:05 +00:00
Ian Lance Taylor 207f844e6e configure: redirect -fsplit-stack compilation to dev/null
Avoid an error message in the middle of the configure output.
    
    Patch by Eric Botcazou.
    
    Reviewed-on: https://go-review.googlesource.com/30813

From-SVN: r240993
2016-10-11 13:13:17 +00:00
Ian Lance Taylor abe08b7d90 Accidentally failed to commit these earlier, as part of:
Update the compiler to use the new names.  Add calls to printlock and
    printunlock around print statements.  Move expression evaluation before
    the call to printlock.  Update g's writebuf field to a slice, and adjust
    C code accordingly.

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

From-SVN: r240958
2016-10-11 00:08:35 +00:00
Ian Lance Taylor 65180edc56 runtime: copy print/println support from Go 1.7
Update the compiler to use the new names.  Add calls to printlock and
    printunlock around print statements.  Move expression evaluation before
    the call to printlock.  Update g's writebuf field to a slice, and adjust
    C code accordingly.
    
    Reviewed-on: https://go-review.googlesource.com/30717

From-SVN: r240956
2016-10-10 23:13:39 +00:00
Ian Lance Taylor 5d8c099ede runtime: copy channel code from Go 1.7 runtime
Change the compiler to use the new routines. Drop the separation of
    small and large values when sending on a channel. Allocate the select
    struct on the stack. Remove the old C implementation of channels. Adjust
    the garbage collector for the new data structure.
    
    Bring in part of the tracing code, enough for the channel code to call.
    
    Bump the permitted number of allocations in one of the tests in
    context_test.go. The difference is that now receiving from a channel
    allocates a sudog, which the C code used to simply put on the
    stack. This will be somewhat better when we port proc.go.
    
    Reviewed-on: https://go-review.googlesource.com/30714

From-SVN: r240941
2016-10-10 16:52:09 +00:00
Ian Lance Taylor 95ccd17c61 re PR go/77809 ("_LITTLE_ENDIAN" redefined)
PR go/77809

    libgo: strip most C macros from runtime.inc
    
    The Go runtime package is picking up C macros from runtime_sysinfo.go
    and then re-exporting them to runtime.inc.  This can cause name
    conflicts.  Change the Makefile so that we only put the macros we need
    into runtime.inc.  These are the constants that are actually defined by
    Go code, not runtime_sysinfo.go.  There are only a few, so we can
    pattern match.
    
    This is an additional hack on runtime.inc.  The long term goal is to
    convert the runtime package to Go and eliminate runtime.inc entirely, so
    a few hacks seem acceptable.
    
    Fixes GCC PR 77809.

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

From-SVN: r240724
2016-10-03 18:39:54 +00:00
Ian Lance Taylor c0401cf78c runtime: copy internal locking code from Go 1.7 runtime
Remove the old locking code written in C.
    
    Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go
    file, so that we can get Go copies of the system time structures and
    other types.
    
    Tweak the compiler so that when compiling the runtime package the
    address operator does not cause local variables to escape.  When the gc
    compiler compiles the runtime, an escaping local variable is treated as
    an error.  We should implement that, instead of this change, when escape
    analysis is turned on.
    
    Tweak the compiler so that the generated C header does not include names
    that start with an underscore followed by a non-upper-case letter,
    except for the special cases of _defer and _panic.  Otherwise we
    translate C types to Go in runtime_sysinfo.go and then generate those Go
    types back as C types in runtime.inc, which is useless and painful for
    the C code.
    
    Change entersyscall and friends to take a dummy argument, as the gc
    versions do, to simplify calls from the shared code.
    
    Reviewed-on: https://go-review.googlesource.com/30079

From-SVN: r240657
2016-09-30 13:45:08 +00:00
Ian Lance Taylor 6748787813 runtime: copy runtime.go and runtime1.go from Go 1.7
Also copy over cputicks.go, env_posix.go, vdso_none.go, stubs2.go, and a
    part of os_linux.go.  Remove the corresponding functions from the C code
    in libgo/go/runtime.  Add some transitional support functions to
    stubs.go.  This converts several minor functions from C to Go.
    
    Reviewed-on: https://go-review.googlesource.com/29962

From-SVN: r240609
2016-09-29 00:56:44 +00:00
Ian Lance Taylor 58920998e3 libgo: fix for runtime/check failure with "-O0 -g"
Tweak the makefile rules for the runtime/check test to
    insure that the runtime package is compiled with
    "-fgo-compiling-runtime". This resolves a test failure
    (unsat on runtime.getcallerpc) when in a build directory where the
    compiler flags have been configured to disable optimization.
    
    Reviewed-on: https://go-review.googlesource.com/30010

From-SVN: r240588
2016-09-28 18:02:40 +00:00
Ian Lance Taylor 14cda8a1cf libgo: separate mksysinfo inputs into separate Makefile targets
This is a step toward a version of mksysinfo that generates information
    for the runtime package.  This will be used to generate the
    runtime_sysinfo.go file, which is currently directly generated by a
    Makefile target.
    
    Reviewed-on: https://go-review.googlesource.com/29683

From-SVN: r240560
2016-09-27 21:32:50 +00:00
Ian Lance Taylor 6465652c87 internal/syscall/unix: add getrandom syscall for MIPS and SPARC
Reviewed-on: https://go-review.googlesource.com/29678

From-SVN: r240457
2016-09-23 21:00:43 +00:00
Ian Lance Taylor 4a2bb7fcb0 compiler, runtime: replace hashmap code with Go 1.7 hashmap
This change removes the gccgo-specific hashmap code and replaces it with
    the hashmap code from the Go 1.7 runtime.  The Go 1.7 hashmap code is
    more efficient, does a better job on details like when to update a key,
    and provides some support against denial-of-service attacks.
    
    The compiler is changed to call the new hashmap functions instead of the
    old ones.
    
    The compiler now tracks which types are reflexive and which require
    updating when used as a map key, and records the information in map type
    descriptors.
    
    Map_index_expression is simplified.  The special case for a map index on
    the right hand side of a tuple expression has been unnecessary for some
    time, and is removed.  The support for specially marking a map index as
    an lvalue is removed, in favor of lowering an assignment to a map index
    into a function call.  The long-obsolete support for a map index of a
    pointer to a map is removed.
    
    The __go_new_map_big function (known to the compiler as
    Runtime::MAKEMAPBIG) is no longer needed, as the new runtime.makemap
    function takes an int64 hint argument.
    
    The old map descriptor type and supporting expression is removed.
    
    The compiler was still supporting the long-obsolete syntax `m[k] = 0,
    false` to delete a value from a map.  That is now removed, requiring a
    change to one of the gccgo-specific tests.
    
    The builtin len function applied to a map or channel p is now compiled
    as `p == nil ? 0 : *(*int)(p)`.  The __go_chan_len function (known to
    the compiler as Runtime::CHAN_LEN) is removed.
    
    Support for a shared zero value for maps to large value types is
    introduced, along the lines of the gc compiler.  The zero value is
    handled as a common variable.
    
    The hash function is changed to take a seed argument, changing the
    runtime hash functions and the compiler-generated hash functions.
    Unlike the gc compiler, both the hash and equal functions continue to
    take the type length.
    
    Types that can not be compared now store nil for the hash and equal
    functions, rather than pointing to functions that throw.  Interface hash
    and comparison functions now check explicitly for nil.  This matches the
    gc compiler and permits a simple implementation for ismapkey.
    
    The compiler is changed to permit marking struct and array types as
    incomparable, meaning that they have no hash or equal function.  We use
    this for thunk types, removing the existing special code to avoid
    generating hash/equal functions for them.
    
    The C runtime code adds memclr, memequal, and memmove functions.
    
    The hashmap code uses go:linkname comments to make the functions
    visible, as otherwise the compiler would discard them.
    
    The hashmap code comments out the unused reference to the address of the
    first parameter in the race code, as otherwise the compiler thinks that
    the parameter escapes and copies it onto the heap.  This is probably not
    needed when we enable escape analysis.
    
    Several runtime map tests that ere previously skipped for gccgo are now
    run.
    
    The Go runtime picks up type kind information and stubs.  The type kind
    information causes the generated runtime header file to define some
    constants, including `empty`, and the C code is adjusted accordingly.
    
    A Go-callable version of runtime.throw, that takes a Go string, is
    added to be called from the hashmap code.
    
    Reviewed-on: https://go-review.googlesource.com/29447

	* go.go-torture/execute/map-1.go: Replace old map deletion syntax
	with call to builtin delete function.

From-SVN: r240334
2016-09-21 20:58:51 +00:00
Ian Lance Taylor 321f72a231 syscall: build export_unix_test.go on solaris
Patch from Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/29436

From-SVN: r240285
2016-09-20 18:26:55 +00:00
Ian Lance Taylor b276eda4b4 re PR go/77642 (GO Bootstrap fail starting with r239872 splitstack signature does not match)
PR go/77642

    runtime: pass correct type to __splitstack_find
    
    The code was passing uintptr* to a function that expected size_t*.
    
    Based on patch by Andreas Krebbel.
    
    Fixes GCC PR 77642.
    
    Reviewed-on: https://go-review.googlesource.com/29433

From-SVN: r240275
2016-09-20 16:48:19 +00:00
Ian Lance Taylor f6c7d678f8 libgo: fix typo in configure.ac (PCQUANTUm -> PCQUANTUM)
Reviewed-on: https://go-review.googlesource.com/29154

From-SVN: r240146
2016-09-14 20:52:51 +00:00
Ian Lance Taylor a846424359 runtime/internal/sys: new package, API copied from Go 1.7
Copy over the Go 1.7 runtime/internal/sys package, but instead of having
    separate files for each GOARCH and GOOS value, set the values in
    configure.ac and write them out in Makefile.am.  Setting the values in
    configure.ac should make it easier to add new processors.
    
    Remove the automake GOARCH conditionals, which are no longer used.
    Leave the GOOS conditionals for now, as they are used for the C runtime
    package.
    
    Reviewed-on: https://go-review.googlesource.com/29018

From-SVN: r240083
2016-09-11 13:23:27 +00:00
Ian Lance Taylor af4b8a5233 libgo: update to Go 1.7.1 release
Reviewed-on: https://go-review.googlesource.com/29012

From-SVN: r240071
2016-09-10 13:14:00 +00:00
Ian Lance Taylor 337fa50b7b runtime/internal/atomic: new package, API copied from Go 1.7
Copy over the Go 1.7 runtime/internal/atomic package, but implement the
    functions in C using __atomic functions rather than using the
    processor-specific assembler code.
    
    Reviewed-on: https://go-review.googlesource.com/29010

From-SVN: r240070
2016-09-10 12:21:59 +00:00
Ian Lance Taylor ac376b15df runtime: use alignof to check alignment of ucontext_t
Use alignof rather than assuming a 16 byte alignment.
    
    Reviewed-on: https://go-review.googlesource.com/28913

From-SVN: r240047
2016-09-09 16:39:44 +00:00
Ian Lance Taylor a9ca0a9d02 runtime: remove remaining use of MAKECONTEXT_STACK_TOP macro
The definition and most uses of MAKECONTEXT_STACK_TOP were removed in
    https://golang.org/cl/88660043, which removed support for Solaris 8/9.
    One use of MAKECONTEXT_STACK_TOP was accidentally left in the source
    code.  Remove it now.
    
    Reviewed-on: https://go-review.googlesource.com/28911

From-SVN: r240045
2016-09-09 14:00:43 +00:00
Ian Lance Taylor 6f02c13813 runtime: align ucontext_t argument to 16 byte boundary
Some systems, such as ia64 and PPC, require that a ucontext_t pointer
    passed to getcontext and friends be aligned to a 16-byte boundary.
    Currently the ucontext_t fields in the g structure are defined in Go,
    and Go has no way to ensure a 16-byte alignment for a struct field.
    The fields are currently represented by an array of unsafe.Pointer.
    Enforce the alignment by making the array larger, and picking an offset
    into the array that is 16-byte aligned.
    
    Reviewed-on: https://go-review.googlesource.com/28910

From-SVN: r240044
2016-09-09 13:31:49 +00:00
Ian Lance Taylor fc4eaccf10 runtime: make gsignal stack at least SIGSTKSZ bytes
The default stack size for the gsignal goroutine, 32K, is not enough on
    ia64.  Make sure that the stack size is at least SIGSTKSZ.
    
    Reviewed-on: https://go-review.googlesource.com/28224

From-SVN: r239894
2016-08-31 13:59:03 +00:00
Ian Lance Taylor 75791bab05 runtime: use -fgo-c-header to build C header file
Use the new -fgo-c-header option to build a header file for the Go
    runtime code in libgo/go/runtime, and use the new header file in the C
    runtime code in libgo/runtime.  This will ensure that the Go code and C
    code share the same data structures as we convert the runtime from C to
    Go.
    
    The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7
    release, and then edited to remove unnecessary data structures and
    modify others for use with libgo.
    
    The new file libgo/go/runtime/mcache.go is an initial version of the
    same files in the Go 1.7 release, and will be replaced by the Go 1.7
    file when we convert to the new memory allocator.
    
    The new file libgo/go/runtime/type.go describes the gccgo version of the
    reflection data structures, and replaces the Go 1.7 runtime file which
    describes the gc version of those structures.
    
    Using the new header file means changing a number of struct fields to
    use Go naming conventions (that is, no underscores) and to rename
    constants to have a leading underscore so that they are not exported
    from the Go package.  These names were updated in the C code.
    
    The C code was also changed to drop the thread-local variable m, as was
    done some time ago in the gc sources.  Now the m field is always
    accessed using g->m, where g is the single remaining thread-local
    variable.  This in turn required some adjustments to set g->m correctly
    in all cases.
    
    Also pass the new -fgo-compiling-runtime option when compiling the
    runtime package, although that option doesn't do anything yet.
    
    Reviewed-on: https://go-review.googlesource.com/28051

From-SVN: r239872
2016-08-30 21:07:47 +00:00
Ian Lance Taylor 87155d4f6c cmd/go: ignore errors from go/build for standard packages
The go/build package does not know that gccgo's standard packages don't
    have source, and will report an error saying that it can not find them.
    Work around that in the cmd/go sources, since the go/build sources don't
    currently have a list of standard packages.
    
    This should get a real fix in the master sources, somehow.
    
    Fixes golang/go#16701.
    
    Reviewed-on: https://go-review.googlesource.com/27052

From-SVN: r239486
2016-08-15 18:05:24 +00:00
Ian Lance Taylor 82b709f9c4 libgo: don't unset in shell script
Reportedly ksh fails to unset a variable that was not previously set.
    Change match.sh and gotest to not unset LANG, but instead set LANG=C.
    Also don't combine exporting and setting variable in a single statement.
    
    Reviewed-on: https://go-review.googlesource.com/26999

From-SVN: r239443
2016-08-13 02:52:42 +00:00
Ian Lance Taylor 237673d052 crypto/aes, hash/crc32: ignore s390x specific files for now
These files are used to select s390x assembler support in the gc
    toolchain.  We don't currently have that support, as it is written in
    the cmd/asm syntax rather than gas syntax.  Mark the files to be ignored
    for now, falling back to the default implementations.
    
    Patch by Andreas Krebbel.
    
    Reviewed-on: https://go-review.googlesource.com/26994

From-SVN: r239442
2016-08-13 00:19:56 +00:00
Ian Lance Taylor 7159824eb3 syscall: remove exec_solaris_test.go
It is testing functionality that gccgo does not need and does not
    support.
    
    Reviewed-on: https://go-review.googlesource.com/26992

From-SVN: r239438
2016-08-13 00:14:19 +00:00
Ian Lance Taylor 3d0fa95d5c os: fix build tags for dir_regfile.go
We want to build dir_regfile.go if not GNU/linux, and not solaris/386,
    and not solaris/sparc.  The latter two conditions were incorrect.  To
    write ! solaris/386 we have to write !solaris !386.  I forgot De
    Morgan's Law.
    
    Reviewed-on: https://go-review.googlesource.com/26870

From-SVN: r239393
2016-08-11 21:36:13 +00:00
Ian Lance Taylor bbc824cd56 mksysinfo.sh: always define CLONE_NEWNET
CLONE_NEWNET is needed to compile the syscall tests on GNU/Linux.
    The symbol is not defined in the CentOS 5.11 header files.
    
    Patch from Uros Bizjak.
    
    Reviewed-on: https://go-review.googlesource.com/26630

From-SVN: r239296
2016-08-09 16:38:23 +00:00
Ian Lance Taylor 0717bdbfbd text/template: reduce maxExecDepth for gccgo further
We already lowered the limit of recursive template invocations from
    100,000 to 10,000, but the tests still fail occasionally on
    x86_64-pc-linux-gnu when using GNU ld (so that split stacks are not
    fully functional).  Reduce the limit further, to 1000, enough so that
    the test passes consistently.
    
    Permitting 1000 recursive template invocations still seems capacious
    enough for real world use.
    
    Reviewed-on: https://go-review.googlesource.com/25590

From-SVN: r239261
2016-08-08 22:55:29 +00:00
Ian Lance Taylor b123572d81 libgo: don't have .lo depend on .lo.dep
Having each .lo depend on the corresponding .lo.dep caused too many
    rebuilds, because the .lo.dep files are rebuilt when Makefile changes.
    Instead, if the .lo.dep file changes, remove the .lo file.
    
    Reviewed-on: https://go-review.googlesource.com/25588

From-SVN: r239258
2016-08-08 21:23:57 +00:00
Ian Lance Taylor 9a7b016159 testsuite: fix gotest for absolute srcdir
The recent changes to Makefile.am mean that if you configure with an
    absolute path as srcdir then gotest will be invoked with absolute paths
    for the files.  That case never worked.  This patch fixes it.
    
    Reviewed-on: https://go-review.googlesource.com/25587

From-SVN: r239256
2016-08-08 20:34:05 +00:00
Ian Lance Taylor f432d1282d re PR go/72814 (reflect FAILs on 32-bit Solaris/SPARC: SIGILL)
PR go/72814

    runtime: treat zero-sized result value as void
    
    Change the FFI interface to treat a call to a function that returns a
    zero-sized result as a call to a function that returns void.
    
    This is part of the fix for https://gcc.gnu.org/PR72814.  On 32-bit
    SPARC systems, a call to a function that returns a non-zero-sized struct
    is followed by an unimp instruction that describes the size of the
    struct.  The function returns to the address after the unimp
    instruction.  The libffi library can not represent a zero-sized struct,
    so we wind up treating it as a 1-byte struct.  Thus in that case libffi
    calls the function with an unimp instruction, but the function does not
    adjust the return address.  The result is that the program attempts to
    execute the unimp instruction, causing a crash.
    
    This is part of a change that fixes the crash by treating all functions
    that return zero bytes as functions that return void.
    
    Reviewed-on: https://go-review.googlesource.com/25585

	* go-gcc.cc (Gcc_backend::function_type): If the return type is
	zero bytes, treat the function as returning void.
	(return_statement): If the return type is zero bytes, don't
	actually return any values.

From-SVN: r239252
2016-08-08 19:53:44 +00:00
Ian Lance Taylor 4f8e688afc internal/syscall/unix: fix syscalls for alpha, ia64, s390
Also change the configure script to set GOARCH correctly for ia64, and
    add ia64 as a processor to match.sh and gotest.
    
    Reviewed-on: https://go-review.googlesource.com/25549

From-SVN: r239225
2016-08-07 22:32:46 +00:00
Ian Lance Taylor 851e6c6a8e libgo: fix getrandom build for 32-bit ppc
Add a ppc build constraint for internal/syscall/unix.
    
    Reviewed-on: https://go-review.googlesource.com/25547

From-SVN: r239210
2016-08-06 15:58:22 +00:00
Ian Lance Taylor e0f69f36ea libgo: change build procedure to use build tags
Previously the libgo Makefile explicitly listed the set of files to
    compile for each package.  For packages that use build tags, this
    required a lot of awkward automake conditionals in the Makefile.
    
    This CL changes the build to look at the build tags in the files.
    The new shell script libgo/match.sh does the matching.  This required
    adjusting a lot of build tags, and removing some files that are never
    used.  I verified that the exact same sets of files are compiled on
    amd64 GNU/Linux.  I also tested the build on i386 Solaris.
    
    Writing match.sh revealed some bugs in the build tag handling that
    already exists, in a slightly different form, in the gotest shell
    script.  This CL fixes those problems as well.
    
    The old code used automake conditionals to handle systems that were
    missing strerror_r and wait4.  Rather than deal with those in Go, those
    functions are now implemented in runtime/go-nosys.c when necessary, so
    the Go code can simply assume that they exist.
    
    The os testsuite looked for dir_unix.go, which was never built for gccgo
    and has now been removed.  I changed the testsuite to look for dir.go
    instead.
    
    Reviewed-on: https://go-review.googlesource.com/25546

From-SVN: r239189
2016-08-06 00:36:33 +00:00
Ian Lance Taylor e91f59b919 runtime: fix incorrectly commented out code in heapdump.c
Reviewed-on: https://go-review.googlesource.com/25490

From-SVN: r239144
2016-08-04 17:21:23 +00:00