aboutsummaryrefslogtreecommitdiff
path: root/libgo
AgeCommit message (Collapse)AuthorFilesLines
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
2019-02-01runtime: add hurd netpoll and semaphore supportIan Lance Taylor3-3/+330
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/160827 From-SVN: r268465
2019-02-01runtime: add getproccount for hurdIan Lance Taylor1-0/+16
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/160825 From-SVN: r268463
2019-02-01libgo: add configury and sysinfo support for hurdIan Lance Taylor6-5/+56
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/160824 From-SVN: r268461
2019-02-01libgo: add hurd build tags to test filesIan Lance Taylor23-23/+27
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/160823 From-SVN: r268460
2019-02-01libgo: add hurd build tagsIan Lance Taylor105-101/+106
Patch by Svante Signell. Reviewed-on: https://go-review.googlesource.com/c/160822 From-SVN: r268459
2019-02-01runtime, sync: use __atomic intrinsics instead of __syncIan Lance Taylor13-489/+41
GCC has supported the __atomic intrinsics since 4.7. They are better than the __sync intrinsics in that they specify a memory model and, more importantly for our purposes, they are reliably implemented either in the compiler or in libatomic. Fixes https://gcc.gnu.org/PR52084 Reviewed-on: https://go-review.googlesource.com/c/160820 From-SVN: r268458
2019-01-29runtime: fix sigprof frame countingIan Lance Taylor1-2/+1
If sigtramp and sigtrampgo are both on stack, n -= framesToDiscard is executed twice, which should actually run only once. Reviewed-on: https://go-review.googlesource.com/c/159238 From-SVN: r268366
2019-01-29runtime: use the call instruction's PC for panic-in-runtime detectionIan Lance Taylor2-3/+3
If a panic happens in the runtime we turn that into a fatal error. We use the caller's PC to determine if the panic call is inside the runtime. getcallerpc returns the PC immediately after the call instruction. If the call is the very last instruction of a function, it may not find this PC belong to a runtime function, giving false result. We need to back off the PC by 1 to the call instruction. The gc runtime doesn't do this because the gc compiler always emit an instruction following a panic call, presumably an UNDEF instruction which turns into an architecture-specific illegal instruction. Our compiler doesn't do this. Reviewed-on: https://go-review.googlesource.com/c/159437 From-SVN: r268358
2019-01-24runtime: install SIGURG handler on C created threadsIan Lance Taylor1-2/+2
Precise stack scan uses SIGURG to trigger a stack scan. We need to have Go signal handler installed for SIGURG. Reviewed-on: https://go-review.googlesource.com/c/159097 From-SVN: r268230
2019-01-22golang.org/x/tools/go/analysis: pass "gccgo" to types.SizesForIan Lance Taylor4-4/+4
For the gofrontend copy, change calls to types.SizesFor to pass "gccgo" rather than "gc". Leave the asmdecl pass unchanged since that pass is gc-specific anyhow. This has been fixed in a better way in the external repo by https://golang.org/cl/158317 and friends, but that is not in 1.12, so use this approach for now. Reviewed-on: https://go-review.googlesource.com/c/158842 From-SVN: r268153
2019-01-22re PR go/88927 (Bootstrap failure on arm in libgo starting with r268084)Ian Lance Taylor2-0/+39
PR go/88927 runtime, internal/cpu: fix build for ARM GNU/Linux Was failing with ../../../libgo/go/internal/cpu/cpu.go:138:2: error: reference to undefined name 'doinit' 138 | doinit() | ^ Fix it by adding in Go 1.12 internal/cpu/cpu_arm.go, and the code in runtime that initializes the values. Fixes https://gcc.gnu.org/PR88927. Reviewed-on: https://go-review.googlesource.com/c/158717 From-SVN: r268131
2019-01-21libgo: fix building, and some testing, on SolarisIan Lance Taylor6-18/+135
Restore some of the fixes that were applied to golang_org/x/net/lif but were lost when 1.12 moved the directory to internal/x/net/lif. Add support for reading /proc to fetch argc/argv/env for c-archive mode. Reviewed-on: https://go-review.googlesource.com/c/158640 From-SVN: r268130
2019-01-18libgo: update to Go1.12beta2Ian Lance Taylor1325-44922/+71590
Reviewed-on: https://go-review.googlesource.com/c/158019 gotools/: * Makefile.am (go_cmd_vet_files): Update for Go1.12beta2 release. (GOTOOLS_TEST_TIMEOUT): Increase to 600. (check-runtime): Export LD_LIBRARY_PATH before computing GOARCH and GOOS. (check-vet): Copy golang.org/x/tools into check-vet-dir. * Makefile.in: Regenerate. gcc/testsuite/: * go.go-torture/execute/names-1.go: Stop using debug/xcoff, which is no longer externally visible. From-SVN: r268084
2019-01-18re PR go/88202 (FAIL: runtime/pprof)Ian Lance Taylor1-2/+9
PR go/88202 runtime: in sigprof, skip to sigtrampgo if we don't find sigtramp Fixes https://gcc.gnu.org/PR88202 Reviewed-on: https://go-review.googlesource.com/c/158218 From-SVN: r268057
2019-01-17runtime: dropg before CAS g status to _Grunnable/_GwaitingIan Lance Taylor3-10/+22
Currently, we dropg (which clears gp.m) after we CAS the g status to _Grunnable or _Gwaiting. Immediately after CASing the g status, another thread may CAS it to _Gscan status and scan its stack. With precise stack scan, it accesses gp.m in order to switch to g and back (in doscanstackswitch). This races with dropg. If doscanstackswitch reads gp.m, then dropg runs, when we restore the m at the end of the scan it will set to a stale value. Worse, if dropg runs after doscanstackswitch sets the new m, gp will be running with a nil m. To fix this, we do dropg before CAS g status to _Grunnable or _Gwaiting. We can do this safely if we are CASing from _Grunning, as we own the g when it is in _Grunning. There is one case where we CAS from _Gsyscall to _Grunnable. It is not safe to dropg when it is in _Gsyscall, as precise stack scan needs to read gp.m in order to signal the m. So we need to introduce a transient state, _Gexitingsyscall, between _Gsyscall and _Grunnable, where the GC should not scan its stack. In is a little unfortunate that we have to add another g status. We could reuse an existing one (e.g. _Gcopystack), but it is clearer and safer to just use a new one, as Austin suggested. Reviewed-on: https://go-review.googlesource.com/c/158157 From-SVN: r268001
2019-01-16syscall: mark C syscall functions noescapeIan Lance Taylor2-0/+2
Many C syscall functions take pointer arguments. The pointers don't escape in the C functions. Mark the C functions noescape so calling them doesn't need allocation. Reviewed-on: https://go-review.googlesource.com/c/158158 From-SVN: r267989
2019-01-15runtime: add padding to FFI type of struct ending with zero-sized fieldIan Lance Taylor1-0/+10
CL 157557 changes the compiler to add one byte padding to non-empty struct ending with a zero-sized field. Add the same padding to the FFI type, so reflect.Call works. This fixes test/fixedbugs/issue26335.go in the main repo. Reviewed-on: https://go-review.googlesource.com/c/158018 From-SVN: r267956
2019-01-15compiler, runtime: panic on uncomparable map key, even if map is emptyIan Lance Taylor3-59/+109
This ports https://golang.org/cl/155918 from the master repo. runtime: panic on uncomparable map key, even if map is empty Reorg map flags a bit so we don't need any extra space for the extra flag. This is a pre-req for updating libgo to the Go 1.12beta2 release. Reviewed-on: https://go-review.googlesource.com/c/157858 From-SVN: r267950
2019-01-12Remove svn:executable property from a couple of text filesJakub Jelinek2-0/+0
which shouldn't be executable. From-SVN: r267873
2019-01-07runtime: in doscanstackswitch, set gp->m before gogoIan Lance Taylor1-6/+7
This is following CL 156038. doscanstackswitch uses the same mechanism of switching goroutines as getTraceback, and so has the same problem as described in issue golang/go#29448. This CL applies the same fix. Reviewed-on: https://go-review.googlesource.com/c/156697 From-SVN: r267661
2019-01-07compiler: move slice construction to callers of makesliceIan Lance Taylor2-6/+5
This is the gccgo version of https://golang.org/cl/141822: Only return a pointer p to the new slices backing array from makeslice. Makeslice callers then construct sliceheader{p, len, cap} explictly instead of makeslice returning the slice. This change caused the GCC backend to break the runtime/pprof test by merging together the identical functions allocateReflectTransient and allocateTransient2M. This caused the traceback to be other than expected. Fix that by making the functions not identical. This is a step toward updating libgo to the Go1.12beta1 release. Reviewed-on: https://go-review.googlesource.com/c/155937 From-SVN: r267660
2019-01-07runtime: in getTraceback, set gp->m before gogoIan Lance Taylor2-6/+42
Currently, when collecting a traceback for another goroutine, getTraceback calls gogo(gp) switching to gp, which will resume in mcall, which will call gtraceback, which will set up gp->m. There is a gap between setting the current running g to gp and setting gp->m. If a profiling signal arrives in between, sigtramp will see a non-nil gp with a nil m, and will seg fault. Fix this by setting up gp->m first. Fixes golang/go#29448. Reviewed-on: https://go-review.googlesource.com/c/156038 From-SVN: r267658
2019-01-05runtime: prevent deadlock when profiling signal arrives during tracebackIan Lance Taylor2-2/+9
Traceback routines, e.g. callers and funcentry, may call __go_get_backtrace_state. If a profiling signal arrives while we are in the critical section of __go_get_backtrace_state, it tries to do a traceback, which also calls __go_get_backtrace_state, which tries to enter the same critical section and will deadlock. Prevent this deadlock by setting up runtime_in_callers before calling __go_get_backtrace_state. Found while investigating golang/go#29448. Will add a test in the next CL. Updates golang/go#29448. Reviewed-on: https://go-review.googlesource.com/c/156037 From-SVN: r267590
2018-12-29runtime: prevent deadlock when profiling signal arrives in stack scanIan Lance Taylor3-4/+12
Precise stack scan needs to unwind the stack. When it is unwinding the stack, if a profiling signal arrives, which also does a traceback, it may deadlock in dl_iterate_phdr. Prevent this deadlock by setting up runtime_in_callers before traceback. Reviewed-on: https://go-review.googlesource.com/c/155766 From-SVN: r267457
2018-12-27runtime: delete export_arm_test.goIan Lance Taylor1-9/+0
The only thing export_arm_test.go does is to export usplit, which does not exist in gccgo. Reviewed-on: https://go-review.googlesource.com/c/155760 From-SVN: r267435
2018-12-27runtime: let ARM32 EABI personality function continue unwind when called ↵Ian Lance Taylor1-0/+3
from traceback On ARM32 EABI, unlike other platforms, the personality function is called during _Unwind_Backtrace (libgcc/unwind-arm-common.inc:581). In this case, simply unwind the frame without returning any handlers. Otherwise traceback will loop if there is a frame with a defer on stack. Reviewed-on: https://go-review.googlesource.com/c/155759 From-SVN: r267434
2018-12-27runtime: on ARM32 EABI, don't get LSDA if compact model is usedIan Lance Taylor1-0/+11
On ARM32 EABI, when the "compact" unwinding model is used, it does not have standard LSDA and _Unwind_GetLanguageSpecificData will not return data that is parseable by us. Check this conditon before calling _Unwind_GetLanguageSpecificData. Fix ARM32 build. Reviewed-on: https://go-review.googlesource.com/c/155758 From-SVN: r267428
2018-12-12runtime: handle DW_EH_PE_absptr in type table encodingIan Lance Taylor1-0/+2
The type table encoding can be DW_EH_PE_absptr, but this case was missing, which was causing abort on ARM32 EABI. Add the missing case. Reviewed-on: https://go-review.googlesource.com/c/153857 From-SVN: r267070
2018-12-12os/signal: increase deliver time for signal testcaseIan Lance Taylor1-3/+3
This increases the time to wait for signals to be delivered in the TestAtomicStop testcase. When running gccgo tests on ppc64 or ppc64le, there are intermittent failures in this test because the wait time is too small. Updates golang/go#29046 Reviewed-on: https://go-review.googlesource.com/c/153879 From-SVN: r267068
2018-12-11runtime: use _URC_FAILURE on ARM32Ian Lance Taylor1-2/+8
ARM32 EABI unwinder does not define _URC_NORMAL_STOP. Instead, it has _URC_FAILURE. Use _URC_FAILURE there. Should fix ARM32 build. Reviewed-on: https://go-review.googlesource.com/c/153417 From-SVN: r267033
2018-12-07runtime: add missing return for non-GNU/Linux version of tgkillIan Lance Taylor1-0/+1
Path from Rainer Orth. Reviewed-on: https://go-review.googlesource.com/c/153118 From-SVN: r266890
2018-12-05runtime: add precise stack scan supportIan Lance Taylor12-22/+572
This CL adds support of precise stack scan using stack maps to the runtime. The stack maps are generated by the compiler (if supported). Each safepoint is associated with a (real or dummy) landing pad, and its "type info" in the exception table is a pointer to the stack map. When a stack is scanned, the stack map is found by the stack unwinding code by inspecting the exception table (LSDA). For precise stack scan we need to unwind the stack. There are three cases: - If a goroutine is scanning its own stack, it can unwind the stack and scan the frames. - If a goroutine is scanning another, stopped, goroutine, it cannot directly unwind the target stack. We handle this by switching (runtime.gogo) to the target g, letting it unwind and scan the stack, and switch back. - If we are scanning a goroutine that is blocked in a syscall, we send a signal to the target goroutine's thread, and let the signal handler unwind and scan the stack. Extra care is needed as this races with enter/exit syscall. Currently this is only implemented on linux. Reviewed-on: https://go-review.googlesource.com/c/140518 From-SVN: r266832