aboutsummaryrefslogtreecommitdiff
path: root/libgo
AgeCommit message (Collapse)AuthorFilesLines
2019-05-08libgo: add Debugging section to READMEIan Lance Taylor1-0/+25
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/176001 From-SVN: r271019
2019-05-08runtime: use builtin memmove directlyCherry Zhang4-31/+10
We can use the intrinsic memmove directly, without going through C. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/170004 * go-gcc.cc (Gcc_backend::Gcc_backend): Define memmove builtin. From-SVN: r271016
2019-05-08reflect: correctly handle direct interface typed receiver in Value.callIan Lance Taylor1-1/+1
A direct interface type's value method takes value receiver now. Don't pass pointer to the method function. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/175798 From-SVN: r271000
2019-05-03compiler: recognize and optimize array range clearIan Lance Taylor1-0/+1
Recognize for i := range a { a[i] = zero } for array or slice a, and rewrite it to call memclr, as the gc compiler does. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/169398 From-SVN: r270862
2019-05-03os/user: disable TestGroupIds for AIXIan Lance Taylor1-0/+3
The corresponding Go Toolchain patch is CL 164039 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/175079 From-SVN: r270857
2019-05-01compiler: recognize and optimize map range clearIan Lance Taylor1-0/+1
Recognize for k := range m { delete(m, k) } for map m, and rewrite it to runtime.mapclear, as the gc compiler does. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/169397 From-SVN: r270780
2019-05-01compiler,runtime: do more direct interfacesIan Lance Taylor6-16/+31
A direct interface is an interface whose data word contains the actual data value, instead of a pointer to it. The gc toolchain creates a direct interface if the value is pointer shaped, that includes pointers (including unsafe.Pointer), functions, channels, maps, and structs and arrays containing a single pointer-shaped field. In gccgo, we only do this for pointers. This CL unifies direct interface types with gc. This reduces allocations when converting such types to interfaces. Our method functions used to always take pointer receivers, to make interface calls easy. Now for direct interface types, their value methods will take value receivers. For a pointer to those types, when converted to interface, the interface data contains the pointer. For that interface to call a value method, it will need a wrapper method that dereference the pointer and invokes the value method. The wrapper method, instead of the actual one, is put into the itable of the pointer type. In the runtime, adjust funcPC for the new layout of interfaces of functions. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/168409 From-SVN: r270779
2019-05-01runtime: persistentalloc and cache itabsIan Lance Taylor1-31/+225
Previously, each time we do an interface conversion for which the method table is not known at compile time, we allocate a new method table. This CL ports the mechanism of itab caching from the gc runtime, adapted to our itab representation and method finding mechanism. With the cache, we reuse the same itab for the same (interface, concrete) type pair. This reduces allocations in interface conversions. Unlike the gc runtime, we don't prepopulate the cache with statically allocated itabs, as currently we don't have a way to find them. This means we don't deduplicate run-time allocated itabs with compile-time allocated ones. But that is not too bad -- it is just a cache anyway. As now itabs are never freed, it is also possible to drop the write barrier for writing the first word of an interface header. I'll leave this optimization for the future. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/171617 From-SVN: r270778
2019-04-26runtime: fix TestPhysPageSize on AIXIan Lance Taylor1-0/+5
AIX doesn't allow to mmap an address range which is already mmap. Therefore, once the region has been allocated, it must munmap before being able to play with it. The corresponding Go Toolchain patch is CL 174059. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/174138 From-SVN: r270615
2019-04-24re PR target/89093 (C++ exception handling clobbers d8 VFP register)Ian Lance Taylor1-1/+4
PR target/89093 runtime: mark unwind functions general-regs-only on ARM For https://gcc.gnu.org/PR89093. Change-Id: Ic426b43d633c77104bda01d4e7835bc9ab4695ef Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/173657 Reviewed-by: Ian Lance Taylor <iant@golang.org> From-SVN: r270542
2019-04-19libgo/go/syscall: add SockAddrDatalink on AIXIan Lance Taylor1-0/+24
This patch is required in order to build golang.org/x/net. The corresponding Go Toolchain patch is CL 170537. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/172898 From-SVN: r270458
2019-04-08libgo: update to Go 1.12.2Ian Lance Taylor20-73/+269
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/170706 From-SVN: r270214
2019-03-19compiler,runtime: pass old slice's ptr/len/cap by value to growsliceIan Lance Taylor1-15/+15
In the C calling convention, on AMD64, and probably a number of other architectures, a 3-word struct argument is passed on stack. This is less efficient than passing in three registers. Further, this may affect the code generation in other part of the program, even if the function is not actually called. Slices are common in Go and append is a common slice operation, which calls growslice in the growing path. To improve the code generation, pass the slice header's three fields as separate values, instead of a struct, to growslice. The drawback is that this makes the runtime implementation slightly diverges from the gc runtime. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/168277 From-SVN: r269811
2019-03-19libgo: fix build on AIXIan Lance Taylor28-201/+139
Since aix/ppc64 has been added to GC toolchain, a mix between new and old files were created in gcc toolchain. This commit corrects this merge for aix/ppc64 and aix/ppc. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167658 From-SVN: r269797
2019-03-18libgo: update to Go 1.12.1Ian Lance Taylor22-137/+397
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167749 From-SVN: r269780
2019-03-09re PR go/89447 (libgo largefile support is incomplete and inconsistent)Ian Lance Taylor11-9/+75
PR go/89447 syscall, internal/syscall: adjust use of largefile functions Consistently call __go_openat for openat. Use fstatat64, creat64, sendfile64, and getdents64 where needed. Based on patch by Rainer Orth. Fixes https://gcc.gnu.org/PR89447 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/166420 From-SVN: r269521
2019-03-06mksysinfo: actually use modified Statfs_t valueIan Lance Taylor1-5/+4
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165737 From-SVN: r269424
2019-03-05runtime: enable precise GC checks when using stack mapsIan Lance Taylor3-5/+9
In the runtime there are bad pointer checks that currently don't work with the concervative collector. With stack maps, the GC is precise and the checks should work. Enable them. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/153871 From-SVN: r269406
2019-03-05cmd/go: pass -X64 to ar on aix/ppc64Ian Lance Taylor1-3/+10
On aix/ppc64, ar tool must always have -X64 argument if it aims to create 64 bits archives. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165317 From-SVN: r269404
2019-03-05sysinfo: add Flags to Statfs_t if not already thereIan Lance Taylor1-0/+4
If there is no f_flags field in statfs_t then rename one of the f_spare fields, as happened in Linux kernel version 2.6.36. This fixes the build on CentOS 5.11. The CentOS kernel will hopefully not fill in the f_spare field, so the resulting flags will be zero. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165417 From-SVN: r269401
2019-03-02re PR go/89406 (Go testing leaves many temporary directories in /tmp around)Ian Lance Taylor1-6/+6
PR go/89406 go/internal/gccgoimporter: remove temporary directories in test Backport of https://golang.org/cl/164862. Updates https://gcc.gnu.org/PR89406 Reviewed-on: https://go-review.googlesource.com/c/164863 From-SVN: r269338
2019-03-01cmd/go: restore passing D to arIan Lance Taylor1-3/+6
This restores part of https://golang.org/cl/45695 that was accidentally lost in https://golang.org/cl/158019 (the update to Go1.12beta2). Reviewed-on: https://go-review.googlesource.com/c/164737 From-SVN: r269333
2019-03-01runtime: call execname and getpagesize on SolarisIan Lance Taylor1-34/+8
Interpreting auxv as []uintptr is incorrect on 64-bit big-endian, as auxv alternates a 32-bit int with a 64-bit pointer. Patch from Rainer Orth. Reviewed-on: https://go-review.googlesource.com/c/164739 From-SVN: r269315
2019-03-01cmd/go: add -O2 to invocation of gccgoIan Lance Taylor1-1/+1
When using the go tool with gccgo, this changes the default compilation to use -O2. The -gccgoflags option can be used to override this default. I think this change better corresponds to what people expect when using the go tool. Reviewed-on: https://go-review.googlesource.com/c/164378 From-SVN: r269299
2019-03-01commit 66ac9466852d11e968f8fd2ad6ffc7386cee49e1Ian Lance Taylor1-5/+9
gotest: avoid using echo inside $() The handling of newlines is not portable between bash and ksh. Reviewed-on: https://go-review.googlesource.com/c/164597 From-SVN: r269298
2019-02-28libgo: fix go_export extraction on DarwinIan Lance Taylor2-2/+10
On Darwin, the section name is prefixed with the segment name, __GNU_GO. Reviewed-on: https://go-review.googlesource.com/c/151097 From-SVN: r269271
2019-02-27re PR go/89172 (FAIL: runtime/pprof)Ian Lance Taylor7-4/+59
PR go/89172 internal/cpu, runtime, runtime/pprof: handle function descriptors When using PPC64 ELF ABI v1 a function address is not a PC, but is the address of a function descriptor. The first field in the function descriptor is the actual PC (see http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUNC-DES). The libbacktrace library knows about this, and libgo uses actual PC values consistently except for the helper function funcPC that appears in both runtime and runtime/pprof. This patch fixes funcPC by recording, in the internal/cpu package, whether function descriptors are being used. We have to check for function descriptors using a C compiler check, because GCC can be configured using --with-abi to select the ELF ABI to use. Fixes https://gcc.gnu.org/PR89172 Reviewed-on: https://go-review.googlesource.com/c/162978 From-SVN: r269266
2019-02-27runtime: align first persistentalloc chunk as requestedIan Lance Taylor1-1/+1
Backport of upstream https://golang.org/cl/163859. This fixes various failures on 32-bit SPARC. Patch from Eric Boctazou. Reviewed-on: https://go-review.googlesource.com/c/163860 From-SVN: r269258
2019-02-27cmd/go: preserve CC for TestScript child processesIan Lance Taylor1-7/+6
Reviewed-on: https://go-review.googlesource.com/c/158838 From-SVN: r269240
2019-02-26libgo: update to Go 1.12 releaseIan Lance Taylor18-48/+282
Reviewed-on: https://go-review.googlesource.com/c/163742 From-SVN: r269216
2019-02-26re PR go/86535 (FreeBSD/PowerPC64 - Building Go Frontend support for gcc ↵Ian Lance Taylor1-7/+0
7.3.0 fails) PR go/86535 runtime: always declare nanotime in Go For libgo it's always defined in C. Updates https://gcc.gnu.org/PR86535 Reviewed-on: https://go-review.googlesource.com/c/163743 From-SVN: r269214
2019-02-26libgo: update to Go1.12rc1Ian Lance Taylor67-235/+2057
Reviewed-on: https://go-review.googlesource.com/c/162881 From-SVN: r269202
2019-02-22re PR go/89406 (Go testing leaves many temporary directories in /tmp around)Ian Lance Taylor3-2/+4
PR go/89406 net: remove unixgram test sockets Backport https://golang.org/cl/163277 from the master library. Updates https://gcc.gnu.org/PR89406 Reviewed-on: https://go-review.googlesource.com/c/163200 From-SVN: r269087
2019-02-22cmd/go: remove work directory on usage errorIan Lance Taylor10-19/+71
Backport https://golang.org/cl/163237 from the master library: Ensure that cmd/go consistently calls base.Exit rather than os.Exit, so that we don't incorrectly leave the work directory around on exit. Test this by modifying the testsuite to run all the tests with TMPDIR set to a temporary directory, and then check that no files are left behind in that temporary directory. Adjust a couple of tests to make this approach work. Updates https://gcc.gnu.org/PR89406 Reviewed-on: https://go-review.googlesource.com/c/163198 From-SVN: r269086
2019-02-21re PR go/89407 (go bootstrap failure on s390x starting with r268941)Ian Lance Taylor1-2/+2
PR go/89407 internal/cpu: use #ifdef __s390x__ in C code Patch by Jakub Jelinek. Fixes https://gcc.gnu.org/PR89407 Reviewed-on: https://go-review.googlesource.com/c/163297 From-SVN: r269063
2019-02-19re PR go/89169 (FAIL: internal/cpu)Ian Lance Taylor1-3/+1
PR go/89169 internal/cpu: do not require POWER8 Although the gc toolchain requires POWER8, the gccgo toolchain does not. Fixes https://gcc.gnu.org/PR89169 Reviewed-on: https://go-review.googlesource.com/c/162979 From-SVN: r269019
2019-02-19runtime: abort stack scan in cases that we cannot unwind the stackIan Lance Taylor5-16/+58
In signal-triggered stack scan, if the signal is delivered at certain bad time (e.g. in vdso, or in the middle of setcontext?), the unwinder may not be able to unwind the whole stack, while it still reports _URC_END_OF_STACK. So we cannot rely on _URC_END_OF_STACK to tell if it successfully scanned the stack. Instead, we check the last Go frame to see it actually reached the end of the stack. For Go-created stack, this is runtime.kickoff. For C-created stack, we need to record the outermost Go frame when it enters the Go side. Also we cannot unwind the stack if the signal is delivered in the middle of runtime.gogo, halfway through a goroutine switch, where the g and the stack don't match. Give up in this case as well. Reviewed-on: https://go-review.googlesource.com/c/159098 From-SVN: r269018
2019-02-15compiler,runtime: use __builtin_dwarf_cfa for getcallerspCherry Zhang1-1/+1
Currently, the compiler lowers runtime.getcallersp to __builtin_frame_address(1). In the C side of the runtime, getcallersp is defined as __builtin_frame_address(0). They don't match. Further, neither of them actually returns the caller's SP. On AMD64, __builtin_frame_address(0) just returns the frame pointer. __builtin_frame_address(1) returns the memory content where the frame pointer points to, which is typically the caller's frame pointer but can also be garbage if the frame pointer is not enabled. This CL changes it to use __builtin_dwarf_cfa(), which returns the caller's SP at the call site. This matches the SP we get from unwinding the stack. Currently getcallersp is not used for anything real. It will be used for precise stack scan (a new version of CL 159098). Reviewed-on: https://go-review.googlesource.com/c/162905 * go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_dwarf_cfa instead of __builtin_frame_address. From-SVN: r268952
2019-02-15re PR go/89123 (Too many go test failures on s390x-linux)Ian Lance Taylor3-16/+137
PR go/89123 internal/cpu, runtime: add S/390 CPU capability support Patch by Robin Dapp. Updates https://gcc.gnu.org/PR89123 Reviewed-on: https://go-review.googlesource.com/c/162887 From-SVN: r268941
2019-02-15runtime: include <syscall.h> and <sys/syscall.h> if availableIan Lance Taylor1-0/+6
Fixes Solaris build. Reviewed-on: https://go-review.googlesource.com/c/162885 From-SVN: r268940
2019-02-15runtime: add type cast for non-split-stack calls to scanstackblockIan Lance Taylor1-4/+4
Reviewed-on: https://go-review.googlesource.com/c/162884 From-SVN: r268939
2019-02-15compiler, runtime: harmonize types referenced by both C and GoIan Lance Taylor15-76/+58
Compiling with LTO revealed a number of cases in the runtime and standard library where C and Go disagreed about the type of an object or function (or where Go and code generated by the compiler disagreed). In all cases the underlying representation was the same (e.g., uintptr vs. void*), so this wasn't causing actual problems, but it did result in a number of annoying warnings when compiling with LTO. Reviewed-on: https://go-review.googlesource.com/c/160700 From-SVN: r268923
2019-02-15re PR go/89168 (FAIL: cmd/go/internal/load)Ian Lance Taylor2-44/+74
PR go/89168 libgo: change gotest to run examples with output Change the gotest script to act like "go test" and run examples that have "output" comments. This is not done with full generality, but just enough to run the libgo tests. Other packages should be tested with "go test" as usual. While we're here clean up some old bits of gotest, and only run TestXXX functions that are actually in *_test.go files. The latter change should fix https://gcc.gnu.org/PR89168. Reviewed-on: https://go-review.googlesource.com/c/162139 From-SVN: r268922
2019-02-12syscall: don't assume that WIFCONTINUED is definedIan Lance Taylor1-0/+4
It's not defined on the Hurd. Reviewed-on: https://go-review.googlesource.com/c/161963 From-SVN: r268828
2019-02-12mksysinfo: remove incorrect quotes in st_fsid handling for HurdIan Lance Taylor1-4/+3
Also stop converting st_dev on Hurd; it shouldn't appear, but if it somehow does we don't want to convert it. Reviewed-on: https://go-review.googlesource.com/c/161961 From-SVN: r268785
2019-02-07os, syscall: Hurd fixes for a couple of testsIan Lance Taylor2-5/+11
Based on patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/161520 From-SVN: r268605
2019-02-07os, net, crypto/x509: add hurd supportIan Lance Taylor7-1/+76
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/161519 From-SVN: r268604
2019-02-07syscall: add Hurd supportIan Lance Taylor9-133/+188
Loosely based on a patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/161518 From-SVN: r268603
2019-02-07internal/syscall/unix: add constants for hurdIan Lance Taylor1-0/+8
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/161517 From-SVN: r268602
2019-02-06re PR go/89199 (libgo regression in implementation of CompareAndSwap ↵Ian Lance Taylor1-5/+5
functions resulting in intermittent testcase failures on ppc64le power9 after r268458) PR go/89199 sync/atomic: use strong form of atomic_compare_exchange_n In the recent change to use atomic_compare_exchange_n I thought we could use the weak form, which can spuriously fail. But that is not how it is implemented in the gc library, and it is not what the rest of the library expects. Thanks to Lynn Boger for identifying the problem. Fixes https://gcc.gnu.org/PR89199 Reviewed-on: https://go-review.googlesource.com/c/161359 From-SVN: r268591