Commit Graph

718 Commits

Author SHA1 Message Date
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
Ian Lance Taylor aa8a418bbc text/template: reduce maxExecDepth for gccgo
When using gccgo on systems without full support for split stacks a
    recursive template can overrun the available stack space.  Reduce the
    limit from 100000 to 10000 to make this less likely.  It's still high
    enough that real uses will work.
    
    Reviewed-on: https://go-review.googlesource.com/25467

From-SVN: r239141
2016-08-04 16:48:28 +00:00
Ian Lance Taylor 9c26dfd08a gotest: multiple +build lines must all be true
The code that handled +build lines did not correctly require them to all
    be true.  While looking into this I discovered that multiple +build
    lines were mishandled in a different way, because the shell does not
    preseve line breaks in backquoted data.  Look for the +build token to
    tell us when we are switching from one +build line to another.
    
    Reviewed-on: https://go-review.googlesource.com/25460

From-SVN: r239100
2016-08-03 22:46:06 +00:00
Ian Lance Taylor c5fe5e8032 libgo: bump library version number for 1.7
Reviewed-on: https://go-review.googlesource.com/25211

From-SVN: r238743
2016-07-26 01:53:27 +00:00
Ian Lance Taylor 870e8ca5a7 os/user: fix Solaris declaration.
Patch from Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/25210

From-SVN: r238742
2016-07-26 01:38:33 +00:00
Ian Lance Taylor 22b955cca5 libgo: update to go1.7rc3
Reviewed-on: https://go-review.googlesource.com/25150

From-SVN: r238662
2016-07-22 18:15:38 +00:00
Ian Lance Taylor a38f74e823 cmd/go: bring in final version of gccgo pkg-config support
This updates gccgo to the final version of https://golang.org/cl/18790,
    by Michael Hudson-Doyle.
    
    Update golang/go#11739.
    
    Reviewed-on: https://go-review.googlesource.com/22400

From-SVN: r235380
2016-04-23 00:41:03 +00:00
Ian Lance Taylor 88b5d499b5 libgo: update to Go 1.6.1 release
Reviewed-on: https://go-review.googlesource.com/22007

From-SVN: r234958
2016-04-13 19:11:16 +00:00
Ian Lance Taylor d90936ff88 reflect: change Value.Call results to not be addressable
Leaving them incorrectly marked as addressable broke a use of the
    text/template package, because state.evalField checks CanAddr and takes
    the address if it is addressable.
    
    Reviewed-on: https://go-review.googlesource.com/21908

From-SVN: r234923
2016-04-12 22:20:30 +00:00
Ian Lance Taylor bb72703282 runtime: Use atomic load for in entersyscall.
Reportedly fixes PPC64 deadlock.
    
    From a comment by Gabriel Russell.
    
    Fixes golang/go#15051.
    
    Reviewed-on: https://go-review.googlesource.com/21450

From-SVN: r234694
2016-04-02 00:47:53 +00:00
Ian Lance Taylor 6b2cd37bd9 re PR go/69966 (libgo: Port syscall.SetsockoptUcred from golang)
PR go/69966
    syscall: Add new Getsockopt functions.
    
    Add GetsockoptICMPv6Filter, GetsockoptIPv6MTUInfo, GetsockoptUcred as
    appropriate.  These functions exist in the master library.
    
    For GCC PR 69966.

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

From-SVN: r233747
2016-02-26 17:36:00 +00:00
Ian Lance Taylor 4501d9ad44 runtime: lock M during cgo call
cgo should lock the M.
    
    
    See also https://golang.org/cl/18882 .
    
    Reviewed-on: https://go-review.googlesource.com/18883

From-SVN: r233670
2016-02-24 15:03:04 +00:00
Ian Lance Taylor 43414a5dd3 libgo: Update to final Go 1.6 release.
Reviewed-on: https://go-review.googlesource.com/19592

From-SVN: r233515
2016-02-18 05:56:46 +00:00
Ian Lance Taylor 54c9c975f1 runtime: For c-archive/c-shared, install signal handlers synchronously.
This is a port of https://golang.org/cl/18150 to the gccgo runtime.
    
    The previous behaviour of installing the signal handlers in a separate
    thread meant that Go initialization raced with non-Go initialization if
    the non-Go initialization also wanted to install signal handlers.  Make
    installing signal handlers synchronous so that the process-wide behavior
    is predictable.
    
    Reviewed-on: https://go-review.googlesource.com/19494

From-SVN: r233393
2016-02-12 22:10:09 +00:00
Ian Lance Taylor 931f434a72 re PR go/66904 (cmd/go: "#cgo pkg-config:" comments do not work with gccgo)
PR go/66904
    cmd/go: fix "#cgo pkg-config:" comments with gccgo
    
    Copy of https://golang.org/cl/18790 by Michael Hudson-Doyle.
    
    The unique difficulty of #cgo pkg-config is that the linker flags are recorded
    when the package is compiled but (obviously) must be used when the package is
    linked into an executable -- so the flags need to be stored on disk somewhere.
    As it happens cgo already writes out a _cgo_flags file: nothing uses it
    currently, but this change adds it to the lib$pkg.a file when compiling a
    package, reads it out when linking (and passes a version of the .a file with
    _cgo_flags stripped out of it to the linker). It's all fairly ugly but it works
    and I can't really think of any way of reducing the essential level of
    ugliness.
    
    Update golang/go#11739.
    GCC PR 66904.

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

From-SVN: r233290
2016-02-10 18:30:27 +00:00
Ian Lance Taylor de24ed7803 re PR go/69511 (G.gcstack_size uses uintptr instead of size_t)
PR go/69511
    runtime: change G gcstack_size field to size_t
    
    Because its address is passed to __splitstack_find, which expects size_t*.
    
    From Dominik Vogt in GCC PR 69511.
    
    Reviewed-on: https://go-review.googlesource.com/19429

From-SVN: r233260
2016-02-10 02:16:04 +00:00
Ian Lance Taylor cc240aa7d1 re PR go/69357 (libgo refers to _end in a non-weak way)
PR go/69537
    runtime: Don't refer to _end symbol in shared library.
    
    Fixes GCC PR 69357.
    
    Reviewed-on: https://go-review.googlesource.com/19362

From-SVN: r233235
2016-02-09 00:34:55 +00:00
Ian Lance Taylor d5bc1c65ef libgo: bump version number for upgrade to 1.6rc1
Reviewed-on: https://go-review.googlesource.com/19233

From-SVN: r233156
2016-02-04 22:54:20 +00:00
Ian Lance Taylor f98dd1a338 libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200

From-SVN: r233110
2016-02-03 21:58:02 +00:00
Ian Lance Taylor 06caa02ccf compiler, runtime: mark stub methods, ignore them in runtime.Caller.
This fixes the long-standing bug in which the testing package misreports
    the file/line of an error.
    
    Reviewed-on: https://go-review.googlesource.com/19179

From-SVN: r233098
2016-02-03 06:54:41 +00:00
Ian Lance Taylor de41ebf5dd re PR go/68980 (ps -o cmd in gotest isn't portable)
PR 68980
    libgo/testsuite: portable ps usage in gotest
    
    gotest is using "ps" to list descendant sleep
    processes in its timeout handling, grepping
    the command name.
    
    We are currently using the "cmd" ps output
    formatter, which is non-portable. We should
    use "comm" which is part of the POSIX
    standard, and outputs only the command name
    and not the arguments.
    
    Fixes https://gcc.gnu.org/PR68980
    
    Reviewed-on: https://go-review.googlesource.com/18426

From-SVN: r232234
2016-01-11 17:55:39 +00:00
Ian Lance Taylor 474c8a0757 syscall: Add definition for NLA_HDRLEN
This change updates mksysinfo.sh so it correctly
    includes the define NLA_HDRLEN in the syscall package.
    
    Fixes golang/go/#13629
    
    Reviewed-on: https://go-review.googlesource.com/17893

From-SVN: r231796
2015-12-18 01:15:37 +00:00
Ian Lance Taylor ae026741df re PR go/61303 (gccgo: segfault, regression since 4.8.2)
PR go/61303
    runtime: don't overallocate in select code
    
    If we've already allocated an fd_set, don't allocate another one.
    
    Also, don't bother to read from rdwake if it wasn't returned in select.
    
    Fixes https://gcc.gnu.org/PR61303.
    
    Reviewed-on: https://go-review.googlesource.com/17243

From-SVN: r230922
2015-11-26 00:24:21 +00:00
Ian Lance Taylor 8c61286797 re PR go/68496 ([libgo] reflect test fails on Linux x86-64)
PR go/68496
    reflect: Allocate space for FFI functions returning a zero-sized type.
    
    The libffi library does not understand zero-sized types.  We represent
    them as a struct with a single field of type void.  If such a type is
    returned from a function, libffi will copy 1 byte of data.  Allocate
    space for that byte, although we won't use it.
    
    Fixes https://gcc.gnu.org/PR68496.

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

From-SVN: r230776
2015-11-23 21:17:45 +00:00
Ian Lance Taylor 3b29389671 re PR go/66378 (libgo syscall.Sendfile() does not honor/use offset argument)
PR go/66378
    syscall: Fix initial offset value in syscall.Sendfile.
    
    Bug reported in https://gcc.gnu.org/PR66378.
    
    Reviewed-on: https://go-review.googlesource.com/17159

From-SVN: r230699
2015-11-21 04:43:50 +00:00
Ian Lance Taylor eaa7bc3388 re PR go/65785 (libgo TestIPv4MulticastListener test fails on machine with no network connection)
PR go/65785
    net: don't run multicast listen test on nil interface in short mode
    
    This is a backport of https://golang.org/cl/17154.
    
    The gccgo bug report https://gcc.gnu.org/PR65785 points out that the
    multicast listen tests will use the network even with -test.short.
    Fix test by checking testing.Short with a nil interface.
    
    Reviewed-on: https://go-review.googlesource.com/17158

From-SVN: r230695
2015-11-21 01:41:24 +00:00
Ian Lance Taylor bbbe8b338b re PR go/66574 (Time is provided in millisecond precision instead of nanoseconds as described in go documentation)
PR go/66574
    runtime: Use clock_gettime to get current time.
    
    Fetch the current time in nanoseconds, not microseconds, by using
    clock_gettime rather than gettimeofday.
    
    Update golang/go#11222.
    
    Fixes https://gcc.gnu.org/PR66574.
    
    Reviewed-on: https://go-review.googlesource.com/17156

From-SVN: r230694
2015-11-21 01:27:44 +00:00
Ian Lance Taylor 4944c7791b re PR go/68072 (malformed DWARF TagVariable entry)
PR go/68072
    cmd/cgo: ignore vars with no name or type if they have a AttrSpecification
    
    Backport of master CL https://golang.org/cl/17151.
    
    Fixes https://gcc.gnu.org/PR/68072.
    
    Reviewed-on: https://go-review.googlesource.com/17152

From-SVN: r230685
2015-11-20 22:48:47 +00:00
Ian Lance Taylor dcfa3345eb cmd: Use correct install tool dir with gccgo
When using the go command built from gccgo to build and
    install a go tool, use the value from runtime GCCGOTOOLDIR as
    the install directory.
    
    This also fixes the output from 'go tool' when used with the
    gccgo-built go command, to only include the go tools and not
    other binaries found in the same directory.
    
    Reviewed-on: https://go-review.googlesource.com/16516

From-SVN: r230677
2015-11-20 21:30:16 +00:00
Ian Lance Taylor 88cf4de8b7 libgo: use Solaris sendfile lib, fix Solaris _in6_addr_t fields
Before Solaris 12 the sendfile function is found in -lsendfile, so look
    for it there.
    
    Solaris 12 adds some more types that use _in6_addr_t, that need to be
    edited in mksysinfo.
    
    Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/16779

From-SVN: r230132
2015-11-10 21:38:30 +00:00
Ian Lance Taylor ea5c200338 re PR go/68255 (cgo-generated constructor not being called)
PR go/68255
    cmd/go: always use --whole-archive for gccgo packages
    
    This is a backport of https://golang.org/cl/16775.
    
    This is, in effect, what the gc toolchain does.  It fixes cases where Go
    code refers to a C global variable; without this, if the global variable
    was the only thing visible in the C code, the generated cgo file might
    not get pulled in from the archive, leaving the Go variable
    uninitialized.
    
    This was reported against gccgo as https://gcc.gnu.org/PR68255 .
    
    Reviewed-on: https://go-review.googlesource.com/16778

From-SVN: r230120
2015-11-10 20:31:11 +00:00
Ian Lance Taylor f5eb9a8ec6 re PR go/66138 (json decoder Decode function fails for some structure return values)
PR go/66138
    reflect, encoding/json, encoding/xml: fix unexported embedded structs
    
    Bring in three changes from the master Go repository.  These changes
    will be in Go 1.6, but they are appropriate for gccgo now because they
    resolve a long-standing discrepancy between how gc and gccgo handle the
    PkgPath field for embedded unexported struct fields.  The core issue is
    described at https://golang.org/cl/7247.  This has been reported against
    gccgo as https://gcc.gnu.org/PR66138.
    
    The three changes being brought over are:
    
    https://golang.org/cl/14010
    
    reflect: adjust access to unexported embedded structs
    
    This CL changes reflect to allow access to exported fields and
    methods in unexported embedded structs for gccgo and after gc
    has been adjusted to disallow access to embedded unexported structs.
    
    Adresses #12367, #7363, #11007, and #7247.
    
    https://golang.org/cl/14011
    
    encoding/json: check for exported fields in embedded structs
    
    Addresses issue #12367.
    
    https://golang.org/cl/14012
    
    encoding/xml: check for exported fields in embedded structs
    
    Addresses issue #12367.
    
    Reviewed-on: https://go-review.googlesource.com/16723

From-SVN: r229907
2015-11-07 01:24:57 +00:00