gcc/libgo/configure.ac

950 lines
29 KiB
Plaintext
Raw Normal View History

# configure.ac -- Go library configure script.
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Process this file with autoreconf to produce configure.
AC_PREREQ(2.64)
AC_INIT(package-unused, version-unused,, libgo)
AC_CONFIG_SRCDIR(Makefile.am)
AC_CONFIG_HEADER(config.h)
libtool_VERSION=13:0:0
AC_SUBST(libtool_VERSION)
AM_ENABLE_MULTILIB(, ..)
AC_CANONICAL_SYSTEM
target_alias=${target_alias-$host_alias}
AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability])
AH_TEMPLATE(PACKAGE, [Name of package])
AH_TEMPLATE(VERSION, [Version number of package])
m4_rename([_AC_ARG_VAR_PRECIOUS],[glibgo_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
AC_PROG_GO
m4_rename_force([glibgo_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
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: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 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-11 01:26:09 +08:00
case ${host} in
*-*-aix*)
# static hash tables crashes on AIX when libgo is built with O2
CFLAGS="$CFLAGS -fno-section-anchors"
GOCFLAGS="$GOCFLAGS -fno-section-anchors"
;;
esac
AM_MAINTAINER_MODE
AC_PROG_LD
AC_PROG_RANLIB
AC_CHECK_TOOL(OBJCOPY, objcopy, missing-objcopy)
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
AC_SUBST(CC_FOR_BUILD)
AC_PROG_AWK
WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
AC_SUBST(WARN_FLAGS)
AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
[turns on -Werror @<:@default=yes@:>@])])
if test "x$enable_werror" != "xno"; then
WERROR="-Werror"
fi
AC_SUBST(WERROR)
glibgo_toolexecdir=no
glibgo_toolexeclibdir=no
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE([version-specific-runtime-libs],
AC_HELP_STRING([--enable-version-specific-runtime-libs],
[Specify that runtime libraries should be installed in a compiler-specific directory]),
[case "$enableval" in
yes) version_specific_libs=yes ;;
no) version_specific_libs=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
esac],
[version_specific_libs=no])
AC_MSG_RESULT($version_specific_libs)
# Version-specific runtime libs processing.
if test $version_specific_libs = yes; then
glibgo_toolexecdir='${libdir}/gcc/${host_alias}'
glibgo_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
fi
# Calculate glibgo_toolexecdir, glibgo_toolexeclibdir
# Install a library built with a cross compiler in tooldir, not libdir.
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
nover_glibgo_toolexecdir='${exec_prefix}/${host_alias}'
nover_glibgo_toolexeclibdir='${toolexecdir}/lib'
else
nover_glibgo_toolexecdir='${libdir}/gcc/${host_alias}'
nover_glibgo_toolexeclibdir='${libdir}'
fi
multi_os_directory=`$GOC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) nover_glibgo_toolexeclibdir=${nover_glibgo_toolexeclibdir}/${multi_os_directory} ;;
esac
if test x"$glibgo_toolexecdir" = x"no"; then
glibgo_toolexecdir="${nover_glibgo_toolexecdir}"
glibgo_toolexeclibdir="${nover_glibgo_toolexeclibdir}"
fi
AC_SUBST(glibgo_toolexecdir)
AC_SUBST(glibgo_toolexeclibdir)
AC_SUBST(nover_glibgo_toolexeclibdir)
# See if the user wants to configure without libffi. Some
# architectures don't support it. FIXME: We should set a default
# based on the host.
AC_ARG_WITH(libffi,
AS_HELP_STRING([--without-libffi],
[don't use libffi]),
[:],
[with_libffi=${with_libffi_default-yes}])
LIBFFI=
LIBFFIINCS=
if test "$with_libffi" != no; then
AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.])
LIBFFI=../libffi/libffi_convenience.la
LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include'
fi
AC_SUBST(LIBFFI)
AC_SUBST(LIBFFIINCS)
AM_CONDITIONAL(USE_LIBFFI, test "$with_liffi" != "no")
# See if the user wants to configure without libatomic. This is useful if we are
# on an architecture for which libgo does not need an atomic support library and
# libatomic does not support our C compiler.
AC_ARG_WITH(libatomic,
AS_HELP_STRING([--without-libatomic],
[don't use libatomic]),
[:],
[with_libatomic=${with_libatomic_default-yes}])
LIBATOMIC=
if test "$with_libatomic" != no; then
LIBATOMIC=../libatomic/libatomic_convenience.la
fi
AC_SUBST(LIBATOMIC)
# Used to tell GNU make to include a file without telling automake to
# include it.
go_include="-include"
AC_SUBST(go_include)
# All known GOOS values. This is the union of all operating systems
# supported by the gofrontend and all operating systems supported by
# the gc toolchain.
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: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 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-11 01:26:09 +08:00
ALLGOOS="aix android darwin dragonfly freebsd irix linux netbsd openbsd plan9 rtems solaris windows"
is_darwin=no
is_freebsd=no
is_irix=no
is_linux=no
is_netbsd=no
is_openbsd=no
is_dragonfly=no
is_rtems=no
is_solaris=no
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: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 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-11 01:26:09 +08:00
is_aix=no
GOOS=unknown
case ${host} in
*-*-darwin*) is_darwin=yes; GOOS=darwin ;;
*-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
*-*-irix6*) is_irix=yes; GOOS=irix ;;
*-*-linux*) is_linux=yes; GOOS=linux ;;
*-*-netbsd*) is_netbsd=yes; GOOS=netbsd ;;
*-*-openbsd*) is_openbsd=yes; GOOS=openbsd ;;
*-*-dragonfly*) is_dragonfly=yes; GOOS=dragonfly ;;
*-*-rtems*) is_rtems=yes; GOOS=rtems ;;
*-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
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: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 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-11 01:26:09 +08:00
*-*-aix*) is_aix=yes; GOOS=aix ;;
esac
AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
AM_CONDITIONAL(LIBGO_IS_IRIX, test $is_irix = yes)
AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes)
AM_CONDITIONAL(LIBGO_IS_NETBSD, test $is_netbsd = yes)
AM_CONDITIONAL(LIBGO_IS_OPENBSD, test $is_openbsd = yes)
AM_CONDITIONAL(LIBGO_IS_DRAGONFLY, test $is_dragonfly = yes)
AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
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: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 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-11 01:26:09 +08:00
AM_CONDITIONAL(LIBGO_IS_AIX, test $is_aix = yes)
AM_CONDITIONAL(LIBGO_IS_BSD, test $is_darwin = yes -o $is_dragonfly = yes -o $is_freebsd = yes -o $is_netbsd = yes -o $is_openbsd = yes)
AC_SUBST(GOOS)
AC_SUBST(ALLGOOS)
dnl Test whether we need to use DejaGNU or whether we can use the
dnl simpler gotest approach. We can only use gotest for a native
dnl build.
USE_DEJAGNU=no
case ${host} in
*-*-rtems*) USE_DEJAGNU=yes ;;
${build}) ;;
*) USE_DEJAGNU=yes ;;
esac
AC_SUBST(USE_DEJAGNU)
# All known GOARCH values. This is the union of all architectures
# supported by the gofrontend and all architectures supported by the
# gc toolchain.
# To add a new architecture:
# - add it to this list
# - if appropriate, add an entry to ALLGOARCHFAMILY below
# - add an entry to the case on ${host} below to set GOARCH
# - update goarchList in libgo/go/go/build/syslist.go
# - update goarch.sh to report the values for this architecture
# - update go-set-goarch in gcc/testsuite/go.test/go-test.exp
# - update ptrSizeMap and intSizeMap in libgo/go/cmd/cgo/main.go
# - update arch lists in libgo/match.sh
# - update arch lists in libgo/testsuite/gotest
# - update +build lines in several places
# - libgo/go/runtime/lfstack_NNbit.go
# - libgo/go/runtime/hashNN.go
# - libgo/go/runtime/unalignedN.go
# - libgo/go/syscall/endian_XX.go
# - possibly others
# - possibly update files in libgo/go/internal/syscall/unix
ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sh shbe sparc sparc64"
# All known GOARCH family values.
ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SH SPARC SPARC64"
GOARCH=unknown
case ${host} in
alpha*-*-*)
GOARCH=alpha
;;
aarch64-*-*)
GOARCH=arm64
;;
arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
GOARCH=arm
case ${host} in
arm*b*-*-*)
GOARCH=armbe
;;
esac
;;
changequote(,)dnl
i[34567]86-*-* | x86_64-*-*)
changequote([,])dnl
AC_COMPILE_IFELSE([
#ifdef __x86_64__
#error 64-bit
#endif],
[GOARCH=386],
[GOARCH=amd64])
;;
ia64-*-*)
GOARCH=ia64
;;
m68k*-*-*)
GOARCH=m68k
;;
mips*-*-*)
AC_COMPILE_IFELSE([
#if _MIPS_SIM != _ABIO32
#error not o32
#endif],
[mips_abi="o32"],
[AC_COMPILE_IFELSE([
#if _MIPS_SIM != _ABIN32
#error not n32
#endif],
[mips_abi="n32"],
[AC_COMPILE_IFELSE([
#if _MIPS_SIM != _ABI64
#error not n64
#endif],
[mips_abi="n64"],
[AC_MSG_ERROR([unknown MIPS ABI])
[mips_abi="n32"]])])])
case "$mips_abi" in
"o32") GOARCH=mips ;;
"n32") GOARCH=mips64p32 ;;
"n64") GOARCH=mips64 ;;
esac
case "${host}" in
mips*el-*-*)
GOARCH="${GOARCH}le"
;;
esac
;;
rs6000*-*-* | powerpc*-*-*)
AC_COMPILE_IFELSE([
#ifdef _ARCH_PPC64
#error 64-bit
#endif],
[GOARCH=ppc],
[
AC_COMPILE_IFELSE([
#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
#error 64be
#endif],
[GOARCH=ppc64le],
[GOARCH=ppc64])])
;;
libgo: add s390 support From Dominik Vogt. * libgo/go/syscall/libcall_linux_s390.go: New file for s390 support. * libgo/go/syscall/syscall_linux_s390.go: Ditto. * libgo/go/syscall/libcall_linux_s390x.go: New file for s390x support. * libgo/go/syscall/syscall_linux_s390x.go: Ditto. * libgo/go/runtime/pprof/pprof.go (printStackRecord): Support s390 and s390x. * libgo/runtime/runtime.c (runtime_cputicks): Add support for s390 and s390x * libgo/mksysinfo.sh: Ditto. (upcase_fields): New helper function * libgo/go/debug/elf/file.go (applyRelocations): Implement relocations on s390x. (applyRelocationsS390x): Ditto. (DWARF): Ditto. * libgo/go/debug/elf/elf.go (R_390): New constants for S390 relocations. (r390Strings): Ditto. (String): Helper function for S390 relocations. (GoString): Ditto. * libgo/go/reflect/makefuncgo_s390.go: New file. (S390MakeFuncStubGo): Implementation of s390 abi. * libgo/go/reflect/makefuncgo_s390x.go: New file. (S390xMakeFuncStubGo): Implementation of s390x abi. * libgo/go/reflect/makefunc_s390.c: New file. (makeFuncStub): s390 and s390x specific implementation of function. * libgo/go/reflect/makefunc.go (MakeFunc): Add support for s390 and s390x. (makeMethodValue): Ditto. (makeValueMethod): Ditto. * libgo/Makefile.am (go_reflect_makefunc_s_file): Ditto. (go_reflect_makefunc_file): Ditto. * libgo/go/reflect/makefunc_dummy.c: Ditto. * libgo/runtime/runtime.h (__go_makefunc_can_recover): Export prototype for use in makefunc_s390.c. (__go_makefunc_returning): Ditto. * libgo/go/syscall/exec_linux.go (forkAndExecInChild): Fix order of the arguments of the clone system call for s390[x]. * libgo/configure.ac (is_s390): New variable. (is_s390x): Ditto (LIBGO_IS_S390): Ditto. (LIBGO_IS_S390X): Ditto. (GOARCH): Support s390 and s390x. * libgo/go/go/build/build.go (cgoEnabled): Ditto. * libgo/go/go/build/syslist.go (goarchList): Ditto. From-SVN: r217106
2014-11-05 06:39:30 +08:00
s390*-*-*)
AC_COMPILE_IFELSE([
#if defined(__s390x__)
#error 64-bit
#endif],
[GOARCH=s390],
[GOARCH=s390x])
;;
sh3eb*-*-* | sh4eb*-*-*)
GOARCH=shbe
;;
sh3*-*-* | sh4*-*-*)
GOARCH=sh
;;
sparc*-*-*)
AC_COMPILE_IFELSE([
#if defined(__sparcv9) || defined(__arch64__)
#error 64-bit
#endif],
[GOARCH=sparc],
[GOARCH=sparc64])
;;
esac
AC_SUBST(GOARCH)
AC_SUBST(ALLGOARCH)
AC_SUBST(ALLGOARCHFAMILY)
dnl Some files are only present when needed for specific architectures.
GO_LIBCALL_OS_FILE=
GO_LIBCALL_OS_ARCH_FILE=
GO_SYSCALL_OS_FILE=
GO_SYSCALL_OS_ARCH_FILE=
if test -f "${srcdir}/go/syscall/libcall_${GOOS}.go"; then
GO_LIBCALL_OS_FILE="go/syscall/libcall_${GOOS}.go"
fi
if test -f "${srcdir}/go/syscall/libcall_${GOOS}_${GOARCH}.go"; then
GO_LIBCALL_OS_ARCH_FILE="go/syscall/libcall_${GOOS}_${GOARCH}.go"
fi
if test -f "${srcdir}/go/syscall/syscall_${GOOS}.go"; then
GO_SYSCALL_OS_FILE="go/syscall/syscall_${GOOS}.go"
fi
if test -f "${srcdir}/go/syscall/syscall_${GOOS}_${GOARCH}.go"; then
GO_SYSCALL_OS_ARCH_FILE="go/syscall/syscall_${GOOS}_${GOARCH}.go"
fi
AC_SUBST(GO_LIBCALL_OS_FILE)
AC_SUBST(GO_LIBCALL_OS_ARCH_FILE)
AC_SUBST(GO_SYSCALL_OS_FILE)
AC_SUBST(GO_SYSCALL_OS_ARCH_FILE)
dnl Special flags used to generate sysinfo.go.
OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
case "$target" in
mips-sgi-irix6.5*)
# IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
# msghdr in <sys/socket.h>.
OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500"
;;
*-*-solaris2.1[[01]])
# Solaris 10+ needs this so struct msghdr gets the msg_control
# etc. fields in <sys/socket.h> (_XPG4_2). _XOPEN_SOURCE=600 as
# above doesn't work with C99.
OSCFLAGS="$OSCFLAGS -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
;;
esac
AC_SUBST(OSCFLAGS)
dnl Check if assembler supports disabling hardware capability support.
GCC_CHECK_ASSEMBLER_HWCAP
dnl Use -fsplit-stack when compiling C code if available.
AC_CACHE_CHECK([whether -fsplit-stack is supported],
[libgo_cv_c_split_stack_supported],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -fsplit-stack"
AC_COMPILE_IFELSE([[int i;]],
[libgo_cv_c_split_stack_supported=yes],
[libgo_cv_c_split_stack_supported=no])
CFLAGS=$CFLAGS_hold])
dnl Make sure the linker permits -fsplit-stack. Old versions of gold will
dnl reject split-stack code calling non-split-stack code on targets
dnl they don't support.
AC_CACHE_CHECK([whether linker supports split/non-split linked together],
[libgo_cv_c_linker_split_non_split],
[cat > conftest1.c << EOF
extern void f();
int main() { f(); return 0; }
EOF
cat > conftest2.c << EOF
void f() {}
EOF
$CC -c -fsplit-stack $CFLAGS $CPPFLAGS conftest1.c >/dev/null 2>&1
$CC -c $CFLAGS $CPPFLAGS conftest2.c > /dev/null 2>&1
if $CC -o conftest conftest1.$ac_objext conftest2.$ac_objext > /dev/null 2>&1; then
libgo_cv_c_linker_split_non_split=yes
else
libgo_cv_c_linker_split_non_split=no
fi
rm -f conftest1.* conftest2.* conftest])
if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then
SPLIT_STACK=-fsplit-stack
AC_DEFINE(USING_SPLIT_STACK, 1,
[Define if the compiler supports -fsplit-stack])
else
SPLIT_STACK=
fi
AC_SUBST(SPLIT_STACK)
AM_CONDITIONAL(USING_SPLIT_STACK,
test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes)
dnl If the compiler supports split-stack but the linker does not, then
dnl we need to explicitly disable split-stack for Go.
if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = no; then
GO_SPLIT_STACK=-fno-split-stack
else
GO_SPLIT_STACK=
fi
AC_SUBST(GO_SPLIT_STACK)
dnl Check whether the linker does stack munging when calling from
dnl split-stack into non-split-stack code. We check this by looking
dnl at the --help output. FIXME: This is only half right: it's
dnl possible for the linker to support this for some targets but not
dnl others.
dnl This is slightly different from the above check, which is whether
dnl the linker permits the call at all.
AC_CACHE_CHECK([whether linker supports split stack],
[libgo_cv_c_linker_supports_split_stack],
[libgo_cv_c_linker_supports_split_stack=no
if $GOC -Wl,--help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
libgo_cv_c_linker_supports_split_stack=yes
fi])
if test "$libgo_cv_c_linker_supports_split_stack" = yes; then
AC_DEFINE(LINKER_SUPPORTS_SPLIT_STACK, 1,
[Define if the linker support split stack adjustments])
fi
AC_CACHE_CHECK([whether compiler is llgo],
[libgo_cv_c_goc_is_llgo],
[libgo_cv_c_goc_is_llgo=no
if $GOC -dumpversion 2>/dev/null | grep llgo >/dev/null 2>&1; then
libgo_cv_c_goc_is_llgo=yes
fi])
AM_CONDITIONAL(GOC_IS_LLGO, test "$libgo_cv_c_goc_is_llgo" = yes)
dnl Test for the -lm library.
MATH_LIBS=
AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm)
AC_SUBST(MATH_LIBS)
dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac.
AC_CACHE_CHECK([for socket libraries], libgo_cv_lib_sockets,
[libgo_cv_lib_sockets=
libgo_check_both=no
AC_CHECK_FUNC(connect, libgo_check_socket=no, libgo_check_socket=yes)
if test "$libgo_check_socket" = "yes"; then
unset ac_cv_func_connect
AC_CHECK_LIB(socket, main, libgo_cv_lib_sockets="-lsocket",
libgo_check_both=yes)
fi
if test "$libgo_check_both" = "yes"; then
libgo_old_libs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
AC_CHECK_FUNC(accept,
[libgo_check_nsl=no
libgo_cv_lib_sockets="-lsocket -lnsl"])
unset ac_cv_func_accept
LIBS=$libgo_old_libs
fi
unset ac_cv_func_gethostbyname
libgo_old_libs="$LIBS"
AC_CHECK_FUNC(gethostbyname, ,
[AC_CHECK_LIB(nsl, main,
[libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lnsl"])])
unset ac_cv_func_gethostbyname
AC_CHECK_FUNC(sendfile, ,
[AC_CHECK_LIB(sendfile, main,
[libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lsendfile"])])
LIBS=$libgo_old_libs
])
NET_LIBS="$libgo_cv_lib_sockets"
AC_SUBST(NET_LIBS)
dnl Test whether the compiler supports the -pthread option.
AC_CACHE_CHECK([whether -pthread is supported],
[libgo_cv_lib_pthread],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -pthread -L../libatomic/.libs"
AC_COMPILE_IFELSE([[int i;]],
[libgo_cv_lib_pthread=yes],
[libgo_cv_lib_pthread=no])
CFLAGS=$CFLAGS_hold])
PTHREAD_CFLAGS=
if test "$libgo_cv_lib_pthread" = yes; then
# RISC-V apparently adds -latomic when using -pthread.
PTHREAD_CFLAGS="-pthread -L../libatomic/.libs"
fi
AC_SUBST(PTHREAD_CFLAGS)
dnl Test for the -lpthread library.
PTHREAD_LIBS=
AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
AC_SUBST(PTHREAD_LIBS)
dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime.
AC_SEARCH_LIBS([sched_yield], [rt])
AC_SEARCH_LIBS([nanosleep], [rt])
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_C_BIGENDIAN
GCC_CHECK_UNWIND_GETIPINFO
AC_CHECK_HEADERS(port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
AC_CHECK_HEADERS([netinet/icmp6.h], [], [],
[#include <netinet/in.h>
])
AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h linux/netlink.h linux/rtnetlink.h], [], [],
[#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
AC_CACHE_CHECK([whether <ustat.h> can be used],
[libgo_cv_c_ustat_h],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <sys/types.h>
#ifdef HAVE_LINUX_FILTER_H
#include <linux/filter.h>
#endif
#include <ustat.h>
])], [libgo_cv_c_ustat_h=yes], [libgo_cv_c_ustat_h=no])
CFLAGS=$CFLAGS_hold])
if test $libgo_cv_c_ustat_h = yes; then
AC_DEFINE(HAVE_USTAT_H, 1,
[Define to 1 if you have the <ustat.h> header file and it works.])
fi
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
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: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 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-11 01:26:09 +08:00
AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat open64 openat pipe2 removexattr renameat setxattr sync_file_range splice syscall tee unlinkat unshare utimensat)
AC_TYPE_OFF_T
AC_CHECK_TYPES([loff_t])
LIBS_hold="$LIBS"
LIBS="$LIBS -lm"
AC_CHECK_FUNCS(cosl expl logl sinl tanl acosl asinl atanl atan2l expm1l ldexpl log10l log1pl)
LIBS="$LIBS_hold"
CFLAGS_hold="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS_hold="$LIBS"
LIBS="$LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS(sem_timedwait)
CFLAGS="$CFLAGS_hold"
LIBS="$LIBS_hold"
LIBS_hold="$LIBS"
LIBS="$LIBS $MATH_LIBS"
AC_CHECK_FUNCS(matherr)
LIBS="$LIBS_hold"
AC_CACHE_CHECK([for __sync_bool_compare_and_swap_4],
[libgo_cv_func___sync_bool_compare_and_swap_4],
[AC_LINK_IFELSE([
typedef unsigned int uint32 __attribute__ ((mode (SI)));
uint32 i;
int main() { return __sync_bool_compare_and_swap (&i, 0, 1); }
],
[libgo_cv_func___sync_bool_compare_and_swap_4=yes],
[libgo_cv_func___sync_bool_compare_and_swap_4=no])])
if test "$libgo_cv_func___sync_bool_compare_and_swap_4" = "yes"; then
AC_DEFINE(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4, 1,
[Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint32])
fi
AC_CACHE_CHECK([for __sync_bool_compare_and_swap_8],
[libgo_cv_func___sync_bool_compare_and_swap_8],
[AC_LINK_IFELSE([
typedef unsigned int uint64 __attribute__ ((mode (DI)));
uint64 i;
int main() { return __sync_bool_compare_and_swap (&i, 0, 1); }
],
[libgo_cv_func___sync_bool_compare_and_swap_8=yes],
[libgo_cv_func___sync_bool_compare_and_swap_8=no])])
if test "$libgo_cv_func___sync_bool_compare_and_swap_8" = "yes"; then
AC_DEFINE(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8, 1,
[Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint64])
fi
AC_CACHE_CHECK([for __sync_fetch_and_add_4],
[libgo_cv_func___sync_fetch_and_add_4],
[AC_LINK_IFELSE([
typedef unsigned int uint32 __attribute__ ((mode (SI)));
uint32 i;
int main() { return __sync_fetch_and_add (&i, 1); }
],
[libgo_cv_func___sync_fetch_and_add_4=yes],
[libgo_cv_func___sync_fetch_and_add_4=no])])
if test "$libgo_cv_func___sync_fetch_and_add_4" = "yes"; then
AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD_4, 1,
[Define to 1 if the compiler provides the __sync_fetch_and_add function for uint32])
fi
AC_CACHE_CHECK([for __sync_add_and_fetch_8],
[libgo_cv_func___sync_add_and_fetch_8],
[AC_LINK_IFELSE([
typedef unsigned int uint64 __attribute__ ((mode (DI)));
uint64 i;
int main() { return __sync_add_and_fetch (&i, 1); }
],
[libgo_cv_func___sync_add_and_fetch_8=yes],
[libgo_cv_func___sync_add_and_fetch_8=no])])
if test "$libgo_cv_func___sync_add_and_fetch_8" = "yes"; then
AC_DEFINE(HAVE_SYNC_ADD_AND_FETCH_8, 1,
[Define to 1 if the compiler provides the __sync_add_and_fetch function for uint64])
fi
dnl For x86 we want to use the -minline-all-stringops option to avoid
dnl forcing a stack split when calling memcpy and friends.
AC_CACHE_CHECK([whether compiler supports -minline-all-stringops],
[libgo_cv_c_stringops],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -minline-all-stringops"
AC_COMPILE_IFELSE([int i;],
[libgo_cv_c_stringops=yes],
[libgo_cv_c_stringops=no])
CFLAGS=$CFLAGS_hold])
STRINGOPS_FLAG=
if test "$libgo_cv_c_stringops" = yes; then
STRINGOPS_FLAG=-minline-all-stringops
fi
AC_SUBST(STRINGOPS_FLAG)
dnl For x86 we want to compile the math library with -mfancy-math-387
dnl so that we can use the builtin instructions directly.
AC_CACHE_CHECK([whether compiler supports -mfancy-math-387],
[libgo_cv_c_fancymath],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -mfancy-math-387"
AC_COMPILE_IFELSE([int i;],
[libgo_cv_c_fancymath=yes],
[libgo_cv_c_fancymath=no])
CFLAGS=$CFLAGS_hold])
MATH_FLAG=
if test "$libgo_cv_c_fancymath" = yes; then
MATH_FLAG="-mfancy-math-387"
fi
MATH_FLAG="${MATH_FLAG} -ffp-contract=off -fno-math-errno -fno-trapping-math"
AC_SUBST(MATH_FLAG)
CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
AC_CHECK_TYPES([off64_t])
CFLAGS=$CFLAGS_hold
dnl Work out the size of the epoll_events struct on GNU/Linux.
AC_CACHE_CHECK([epoll_event size],
[libgo_cv_c_epoll_event_size],
[AC_COMPUTE_INT(libgo_cv_c_epoll_event_size,
[sizeof (struct epoll_event)],
[#include <sys/epoll.h>],
[libgo_cv_c_epoll_event_size=0])])
SIZEOF_STRUCT_EPOLL_EVENT=${libgo_cv_c_epoll_event_size}
AC_SUBST(SIZEOF_STRUCT_EPOLL_EVENT)
dnl Work out the offset of the fd field in the epoll_events struct on
dnl GNU/Linux.
AC_CACHE_CHECK([epoll_event data.fd offset],
[libgo_cv_c_epoll_event_fd_offset],
[AC_COMPUTE_INT(libgo_cv_c_epoll_event_fd_offset,
[offsetof (struct epoll_event, data.fd)],
[#include <stddef.h>
#include <sys/epoll.h>],
[libgo_cv_c_epoll_event_fd_offset=0])])
STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset}
AC_SUBST(STRUCT_EPOLL_EVENT_FD_OFFSET)
dnl Check if <sys/stat.h> uses timespec_t for st_?tim members. Introduced
dnl in Solaris 11.4 for XPG7 compatibility.
AC_EGREP_HEADER([timespec_t.*st_atim], [sys/stat.h],
[have_stat_timespec=yes], [have_stat_timespec=no])
AM_CONDITIONAL(HAVE_STAT_TIMESPEC, test $have_stat_timespec = yes)
dnl See if struct exception is defined in <math.h>.
AC_CHECK_TYPE([struct exception],
[libgo_has_struct_exception=yes],
[libgo_has_struct_exception=no],
[#include <math.h>])
if test "$libgo_has_struct_exception" = "yes"; then
AC_DEFINE(HAVE_STRUCT_EXCEPTION, 1,
[Define to 1 if <math.h> defines struct exception])
fi
dnl See whether setcontext changes the value of TLS variables.
AC_CACHE_CHECK([whether setcontext clobbers TLS variables],
[libgo_cv_lib_setcontext_clobbers_tls],
[CFLAGS_hold="$CFLAGS"
CFLAGS="$PTHREAD_CFLAGS"
LIBS_hold="$LIBS"
LIBS="$LIBS $PTHREAD_LIBS"
AC_CHECK_SIZEOF([void *])
AS_VAR_ARITH([ptr_type_size], [$ac_cv_sizeof_void_p \* 8])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([
#include <pthread.h>
#include <stdlib.h>
#include <ucontext.h>
#include <unistd.h>
__thread int tls;
static char stack[[10 * 1024 * 1024]];
static ucontext_t c;
/* Called via makecontext/setcontext. */
static void
cfn (void)
{
exit (tls);
}
/* Called via pthread_create. */
static void *
tfn (void *dummy)
{
/* The thread should still see this value after calling
setcontext. */
tls = 0;
setcontext (&c);
/* The call to setcontext should not return. */
abort ();
}
int
main ()
{
pthread_t tid;
/* The thread should not see this value. */
tls = 1;
if (getcontext (&c) < 0)
abort ();
c.uc_stack.ss_sp = stack;
#ifdef MAKECONTEXT_STACK_TOP
c.uc_stack.ss_sp += sizeof stack;
#endif
c.uc_stack.ss_flags = 0;
c.uc_stack.ss_size = sizeof stack;
c.uc_link = NULL;
makecontext (&c, cfn, 0);
if (pthread_create (&tid, NULL, tfn, NULL) != 0)
abort ();
if (pthread_join (tid, NULL) != 0)
abort ();
/* The thread should have called exit. */
abort ();
}
])],
[libgo_cv_lib_setcontext_clobbers_tls=no],
[libgo_cv_lib_setcontext_clobbers_tls=yes],
[case "$target:$ptr_type_size" in
i?86-*-solaris2.1[[01]]:64 | x86_64*-*-solaris2.1[[01]]:64)
libgo_cv_lib_setcontext_clobbers_tls=yes ;;
*)
libgo_cv_lib_setcontext_clobbers_tls=no ;;
esac
])
CFLAGS="$CFLAGS_hold"
LIBS="$LIBS_hold"
])
if test "$libgo_cv_lib_setcontext_clobbers_tls" = "yes"; then
AC_DEFINE(SETCONTEXT_CLOBBERS_TLS, 1,
[Define if setcontext clobbers TLS variables])
fi
AC_CACHE_CHECK([whether .eh_frame section should be read-only],
libgo_cv_ro_eh_frame, [
libgo_cv_ro_eh_frame=no
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
libgo_cv_ro_eh_frame=yes
elif grep '.section.*eh_frame.*#alloc' conftest.c \
| grep -v '#write' > /dev/null; then
libgo_cv_ro_eh_frame=yes
fi
fi
rm -f conftest.*
])
if test "x$libgo_cv_ro_eh_frame" = xyes; then
AC_DEFINE(EH_FRAME_FLAGS, "a",
[Define to the flags needed for the .section .eh_frame directive.])
else
AC_DEFINE(EH_FRAME_FLAGS, "aw",
[Define to the flags needed for the .section .eh_frame directive.])
fi
AC_CACHE_CHECK([if compiler supports -Qunused-arguments],
[libgo_cv_c_unused_arguments],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -Qunused-arguments"
AC_COMPILE_IFELSE([[int i;]],
[libgo_cv_c_unused_arguments=yes],
[libgo_cv_c_unused_arguments=no])
CFLAGS=$CFLAGS_hold])
AC_CACHE_CHECK([if assembler supports GNU comdat group syntax],
libgo_cv_as_comdat_gnu, [
echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s
CFLAGS_hold=$CFLAGS
if test "$libgo_cv_c_unused_arguments" = yes; then
CFLAGS="$CFLAGS -Qunused-arguments"
fi
if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
libgo_cv_as_comdat_gnu=yes
else
libgo_cv_as_comdat_gnu=no
fi
CFLAGS=$CFLAGS_hold
])
if test "x$libgo_cv_as_comdat_gnu" = xyes; then
AC_DEFINE(HAVE_AS_COMDAT_GAS, 1,
[Define if your assembler supports GNU comdat group syntax.])
fi
AC_CACHE_CHECK([assembler supports pc related relocs],
libgo_cv_as_x86_pcrel, [
libgo_cv_as_x86_pcrel=yes
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
CFLAGS_hold=$CFLAGS
if test "$libgo_cv_c_unused_arguments" = yes; then
CFLAGS="$CFLAGS -Qunused-arguments"
fi
if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
libgo_cv_as_x86_pcrel=no
fi
CFLAGS=$CFLAGS_hold
])
if test "x$libgo_cv_as_x86_pcrel" = xyes; then
AC_DEFINE(HAVE_AS_X86_PCREL, 1,
[Define if your assembler supports PC relative relocs.])
fi
AC_CACHE_CHECK([assembler supports unwind section type],
libgo_cv_as_x86_64_unwind_section_type, [
libgo_cv_as_x86_64_unwind_section_type=yes
echo '.section .eh_frame,"a",@unwind' > conftest.s
CFLAGS_hold=$CFLAGS
if test "$libgo_cv_c_unused_arguments" = yes; then
CFLAGS="$CFLAGS -Qunused-arguments"
fi
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
libgo_cv_as_x86_64_unwind_section_type=no
fi
CFLAGS=$CFLAGS_hold
])
if test "x$libgo_cv_as_x86_64_unwind_section_type" = xyes; then
AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
[Define if your assembler supports unwind section type.])
fi
AC_CACHE_CHECK([assembler supports AES instructions],
libgo_cv_as_x86_aes, [
libgo_cv_as_x86_aes=yes
echo 'aesenc %xmm0, %xmm1' > conftest.s
CFLAGS_hold=$CFLAGS
if test "$libgo_cv_c_unused_arguments" = yes; then
CFLAGS="$CFLAGS -Qunused-arguments"
fi
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i error > /dev/null; then
libgo_cv_as_x86_aes=no
fi
CFLAGS=$CFLAGS_hold
])
if test "x$libgo_cv_as_x86_aes" = xyes; then
AC_DEFINE(HAVE_AS_X86_AES, 1,
[Define if your assembler supports AES instructions.])
fi
AC_CACHE_SAVE
if test ${multilib} = yes; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
AC_CONFIG_FILES(Makefile testsuite/Makefile)
AC_CONFIG_COMMANDS([default],
[if test -n "$CONFIG_FILES"; then
# Multilibs need MULTISUBDIR defined correctly in certain makefiles so
# that multilib installs will end up installed in the correct place.
# The testsuite needs it for multilib-aware ABI baseline files.
# To work around this not being passed down from config-ml.in ->
# srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
# append it here. Only modify Makefiles that have just been created.
#
# Also, get rid of this simulated-VPATH thing that automake does.
cat > vpsed << \_EOF
s!`test -f '$<' || echo '$(srcdir)/'`!!
_EOF
for i in $SUBDIRS; do
case $CONFIG_FILES in
*${i}/Makefile*)
#echo "Adding MULTISUBDIR to $i/Makefile"
sed -f vpsed $i/Makefile > tmp
grep '^MULTISUBDIR =' Makefile >> tmp
mv tmp $i/Makefile
;;
esac
done
rm vpsed
fi
],
[
# Variables needed in config.status (file generation) which aren't already
# passed by autoconf.
SUBDIRS="$SUBDIRS"
])
AC_OUTPUT