aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
AgeCommit message (Collapse)AuthorFilesLines
2019-01-18libgo: update to Go1.12beta2Ian Lance Taylor1281-44774/+70730
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-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 Taylor1-0/+35
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
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-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-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 Taylor8-8/+217
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
2018-12-05syscall: remove Flock for aix/ppc64Ian Lance Taylor1-22/+0
CL 152397 removed it from gc's syscall package. Updates golang/go#29084 Reviewed-on: https://go-review.googlesource.com/c/152557 From-SVN: r266812
2018-12-04cmd/vet: use default compiler when determining type sizesIan Lance Taylor1-1/+1
Fixes a segfault running vet on alpha. Patch by Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/c/152437 From-SVN: r266781
2018-12-03cmd/go: allow buildmode c-archive for gccgo on ppc64Ian Lance Taylor1-15/+16
In buildmodeinit, the c-archive buildmode is flagged as invalid on linux/ppc64 for gccgo when it should be valid. This happens because the check against the gccgo flag is done after the checks for valid GOOS/GOARCH pairs instead of before as is done for all other buildmode cases in this switch. This corrects the problem and allows several of the gccgo gotools testcases to pass on linux/ppc64. Updates #29046 Reviewed-on: https://go-review.googlesource.com/c/152137 From-SVN: r266764
2018-11-27compiler: add '$' to names in expression export dataIan Lance Taylor1-0/+9
For inlined function bodies we're going to need to refer to variables, so change the existing export data to add a '$' to names that look like identifiers: true, false, nil, convert. While we're here drop an unnecessary space character after operators. Reviewed-on: https://go-review.googlesource.com/c/150067 From-SVN: r266529
2018-11-26compiler: initial support for exporting function bodiesIan Lance Taylor1-6/+57
Create a framework for putting function bodies in export data. At present only empty functions will be put there, and they will be ignored on import. Later patches will get this to the point of supporting inlining of (some) functions defined in other packages. Reviewed-on: https://go-review.googlesource.com/c/150061 From-SVN: r266490
2018-11-09cmd/cgo: fix typo in gccgo name mangling recipeIan Lance Taylor1-1/+1
The code to implement new-style gccgo name mangling had a recipe that didn't quite match the one in the compiler (incorrect handling for '.'). This showed up as a failure in the gotools cgo test if the directory containing the test run included a "." character. Reviewed-on: https://go-review.googlesource.com/c/147917 From-SVN: r265981
2018-10-26libgo: fix improperly mangled linker symbol directiveIan Lance Taylor1-1/+1
Fix asm name directive for the C version of log/syslog.syslog_c, which didn't get included in the recent name mangling change. Reviewed-on: https://go-review.googlesource.com/c/145017 From-SVN: r265533
2018-10-25compiler: improve name mangling for packpathsIan Lance Taylor26-113/+293
The current implementation of Gogo::pkgpath_for_symbol was written in a way that allowed two distinct package paths to map to the same symbol, which could cause collisions at link- time or compile-time. Switch to a better mangling scheme to insure that we get a unique packagepath symbol for each package. In the new scheme instead of having separate mangling schemes for identifiers and package paths, the main identifier mangler ("go_encode_id") now handles mangling of both packagepath characters and identifier characters. The new mangling scheme is more intrusive: "foo/bar.Baz" is mangled as "foo..z2fbar.Baz" instead of "foo_bar.Baz". To mitigate this, this patch also adds a demangling capability so that function names returned from runtime.CallersFrames are converted back to their original unmangled form. Changing the pkgpath_for_symbol scheme requires updating a number of //go:linkname directives and C "__asm__" directives to match the new scheme, as well as updating the 'gotest' driver (which makes assumptions about the correct mapping from pkgpath symbol to package name). Fixes golang/go#27534. Reviewed-on: https://go-review.googlesource.com/c/135455 From-SVN: r265510
2018-10-23re PR go/87661 (libgo bootstrap failure on arm-linux-gnueabihf (redefinition ↵Ian Lance Taylor1-23/+0
of constants)) PR go/87661 runtime: remove unused armArch, hwcap and hardDiv After CL 140057 these are only written but never read in gccgo. Reviewed-on: https://go-review.googlesource.com/c/141077 From-SVN: r265439
2018-10-23compiler: export indexed type data, read unexported types lazilyIan Lance Taylor1-3/+78
Introduce a new "types" command to the export data to record the number of types and the size of their export data. It is immediately followed by new "type" commands that can be indexed. Parse all the exported types immediately so that we register them, but parse other type data only as needed. Reviewed-on: https://go-review.googlesource.com/c/143022 From-SVN: r265409
2018-10-18compiler: list indirect imports separately in export dataIan Lance Taylor1-0/+8
Previously when export data referred to a type that was not defined in a directly imported package, we would write the package name as additional information in the type's export data. That approach required all type information to be read in order. This patch changes the compiler to find all references to indirectly imported packages, and write them out as an indirectimport line in the import data. This will permit us to read exported type data out of order. The type traversal used to find indirect imports is a little more complicated than necessary in preparation for later patches in this series. Reviewed-on: https://go-review.googlesource.com/c/143020 From-SVN: r265296
2018-10-18compiler: drop semicolons in export dataIan Lance Taylor3-38/+51
The export data, which is approximately readable and looks something like Go, was first implemented back when Go still used semicolons. Drop the semicolons, to make it look slightly more Go like and make it slightly smaller. This updates the compiler and the gccgoimporter package. This introduces a new version of the export data. There are going to be more changes to the export data, so this version is still subject to change. Reviewed-on: https://go-review.googlesource.com/c/143018 From-SVN: r265284
2018-10-09runtime: skip testSetPanicOnFault for gollvmIan Lance Taylor1-0/+3
LLVM doesn't support non-call exception. This test was passing more or less by luck: if the faulting instruction is between two calls with the same landing pad (in instruction layout order, not the program's logic order), it generates a merged PC range that covers the faulting instruction. If the instruction layout order changes, or it uses two different (but may be degenerate) landing pads, this doesn't work. Reviewed-on: https://go-review.googlesource.com/c/140517 From-SVN: r264985
2018-10-08libgo: update to Go 1.11.1 releaseIan Lance Taylor25-164/+396
Reviewed-on: https://go-review.googlesource.com/c/140277 From-SVN: r264932
2018-10-05libgo: use inline assembly in favor of call to _xgetbv()Ian Lance Taylor1-4/+10
Use inline assembly in the implementation of internal_cpu.xgetbv as opposed to a call to the intrinsic _xgetbv(), since non-gcc compilers (e.g. clang) may or may not have support for it. Reviewed-on: https://go-review.googlesource.com/c/140137 From-SVN: r264882
2018-10-05runtime: remove checkgoarm functionIan Lance Taylor1-19/+0
Nothing in libgo calls checkgoarm, and it relies on a variable, goarm, that is not set. Reviewed-on: https://go-review.googlesource.com/c/140057 From-SVN: r264872
2018-10-02internal/bytealg: support systems that don't have memmemIan Lance Taylor1-0/+27
Reviewed-on: https://go-review.googlesource.com/138839 From-SVN: r264798
2018-10-02net: don't fail test if splice fails because pipe2 is missingIan Lance Taylor1-0/+6
This reportedly happens on CentOS 5.11. The real code will work fine; this test is assuming that the unexported slice function will handle the splice, but if pipe2 does not work then it doesn't. The relevant code in internal/poll/splice_linux.go says "Falling back to pipe is possible, but prior to 2.6.29 splice returns -EAGAIN instead of 0 when the connection is closed." Reviewed-on: https://go-review.googlesource.com/138838 From-SVN: r264793
2018-10-01libgo: support x32 as GOARCH=amd64p32 GOOS=linuxIan Lance Taylor3-1/+12
This is enough to let libgo build when configured using --with-multilib-list=m64,m32,mx32. I don't have an x32-enabled kernel so I haven't tested whether it executes correctly. For https://gcc.gnu.org/PR87470 Reviewed-on: https://go-review.googlesource.com/138817 From-SVN: r264772
2018-09-26syscall: don't assume we have a GETEUID system callIan Lance Taylor1-0/+4
On Alpha GNU/Linux there is no geteuid system call, there is only getresuid. The raw geteuid system call is only used for testing, so just skip the test if it's not available. Reviewed-on: https://go-review.googlesource.com/137655 From-SVN: r264647
2018-09-26runtime, os: fix the build on SolarisIan Lance Taylor3-4/+61
Reviewed-on: https://go-review.googlesource.com/137535 From-SVN: r264593
2018-09-25internal/bytealg, internal/cpu, internal/poll: portability fixesIan Lance Taylor12-53/+8
In internal/bytealg correct a +build tag to never build indexbyte_generic.go for the gofrontend, where we always use indexbyte_native.go. For internal/cpu let the Makefile define CacheLineSize using goarch.sh, rather than trying to enumerate all the possibilities in cpu_ARCH.go files. In internal/poll call the C fcntl function rather than using SYS_FCNTL. Change mksysinfo.sh to ensure that F_GETPIPE_SZ is always defined, and check that in internal/poll. Reviewed-on: https://go-review.googlesource.com/137256 From-SVN: r264572
2018-09-25cmd/go: pass down testing gccgo in TestScriptIan Lance Taylor3-4/+11
This permits TestScript to work when gccgo is not installed. Previous testing was using a previously installed gccgo, not the newly built one. This revealed that the testing of whether an internal package is permitted was incorrect for standard library packages, since the uninstalled gccgo can see internal packages in the uninstalled libgo. Fix the internal package tests. This permitted removing a couple of gccgo-specific changes in the testsuite. Reviewed-on: https://go-review.googlesource.com/137255 From-SVN: r264570
2018-09-24libgo: update to Go 1.11Ian Lance Taylor1429-18857/+82698
Reviewed-on: https://go-review.googlesource.com/136435 gotools/: * Makefile.am (mostlyclean-local): Run chmod on check-go-dir to make sure it is writable. (check-go-tools): Likewise. (check-vet): Copy internal/objabi to check-vet-dir. * Makefile.in: Rebuild. From-SVN: r264546
2018-09-14cmd/go: correct gccgo buildid file on ARMIan Lance Taylor1-2/+6
Bring in https://golang.org/cl/135297 from the gc repository to fix a GCC bug report. Original CL description: The GNU assembler for ARM treats @ as a comment character, so section types must be written using % instead. Fixes https://gcc.gnu.org/PR87260. Reviewed-on: https://go-review.googlesource.com/135360 From-SVN: r264330
2018-09-13compiler, runtime: call gcWriteBarrier instead of writebarrierptrIan Lance Taylor2-21/+26
In 1.11 writebarrierptr is going away, so change the compiler to call gcWriteBarrier instead. We weren't using gcWriteBarrier before; adjust the implementation to use the putFast method. This revealed a problem in the kickoff function. When using cgo, kickoff can be called on the g0 of an m allocated by newExtraM. In that case the m will generally have a p, but systemstack may be called by wbBufFlush as part of flushing the write barrier buffer. At that point the buffer is full, so we can not do a write barrier. So adjust the existing code in kickoff so that in the case where we are g0, don't do any write barrier at all. Reviewed-on: https://go-review.googlesource.com/131395 From-SVN: r264295
2018-09-13runtime: correct counters in sweepIan Lance Taylor2-8/+27
In the sweep code we can sometimes see incorrect counts when conservative stack scanning causes us to grey an object that we earlier decided could be freed. We already ignored this check, but adjust this case to maintain correct span counts when it happens. This gives us slightly more correct numbers in MemStats, and helps avoid a rare failure in TestReadMemStats. Also fix the free index, and cope with finding a full span when allocating a new one. Reviewed-on: https://go-review.googlesource.com/134216 From-SVN: r264294
2018-09-13compiler, runtime: open code selectIan Lance Taylor1-205/+61
This is the gofrontend version of https://golang.org/cl/37933, https://golang.org/cl/37934, and https://golang.org/cl/37935. Open code the initialization of select cases. This is a step toward updating libgo to the 1.11 release. Reviewed-on: https://go-review.googlesource.com/135000 From-SVN: r264290
2018-09-13runtime: avoid write barriers with traceback infoIan Lance Taylor4-6/+8
Unlike the gc runtime, libgo stores traceback information in location structs, which contain strings. Therefore, copying location structs around appears to require write barriers, although in fact write barriers are never important because the strings are never allocated in Go memory. They come from libbacktrace. Some of the generated write barriers come at times when write barriers are not permitted. For example, exitsyscall, marked nowritebarrierrec, calls exitsyscallfast which calls traceGoSysExit which calls traceEvent which calls traceStackID which calls trace.stackTab.put which copies location values into memory allocated by tab.newStack. This write barrier can be invoked when there is no p, causing a crash. This change fixes the problem by ensuring that location values are copied around in the tracing code with no write barriers. This was found by fixing the compiler to fully implement //go:nowritebarrierrec; CL to follow. Reviewed-on: https://go-review.googlesource.com/134226 From-SVN: r264282
2018-09-13libgo: build roots index to speed up bulkBarrierPreWriteIan Lance Taylor4-21/+122
To reduce the amount of time spent in write barrier processing (specifically runtime.bulkBarrierPreWrite), add support for building a 'GC roots index', basically a sorted list of all roots, so as to allow more efficient lookups of gcdata structures for globals. The previous implementation worked on the raw (unsorted) roots list itself, which did not scale well. Reviewed-on: https://go-review.googlesource.com/132595 From-SVN: r264276
2018-08-29compiler, runtime: remove hmap field from maptypesIan Lance Taylor3-15/+1
This is the gofrontend version of https://golang.org/cl/91796. This is part of that CL, just the compiler change and required runtime changes, in preparation for updating libgo to 1.11. Relevant part of original CL description: The hmap field in the maptype is only used by the runtime to check the sizes of the hmap structure created by the compiler and runtime agree. Comments are already present about the hmap structure definitions in the compiler and runtime needing to be in sync. Reviewed-on: https://go-review.googlesource.com/130976 From-SVN: r263941
2018-08-24runtime: remove the dummy arg of getcallerspIan Lance Taylor7-27/+25
This is a port of https://golang.org/cl/109596 to the gofrontend, in preparation for updating libgo to 1.11. Original CL description: getcallersp is intrinsified, and so the dummy arg is no longer needed. Remove it, as well as a few dummy args that are solely to feed getcallersp. Reviewed-on: https://go-review.googlesource.com/131116 From-SVN: r263840
2018-08-07runtime: use poll rather than pollset for netpoll on AIXIan Lance Taylor2-109/+95
Updates golang/go#26634 Reviewed-on: https://go-review.googlesource.com/126857 From-SVN: r263364
2018-08-07libgo: uncomment trace.Stop() call in testing packageIan Lance Taylor1-1/+1
Fix up the testing package to insure that execution traces work properly (e.g. "-test.trace=<XXX>" command line option). The call to stop tracing and emit the output file was stubbed out. Reviewed-on: https://go-review.googlesource.com/128275 From-SVN: r263363
2018-07-27libgo: prune sighandler frames in runtime.sigprofIan Lance Taylor2-11/+70
When writing stack frames to the pprof CPU profile machinery, it is very important to insure that the frames emitted do not contain any frames corresponding to artifacts of the profiling process itself (signal handlers, sigprof, etc). This patch changes runtime.sigprof to strip out those frames from the raw stack generated by "runtime.callers". Fixes golang/go#26595. Reviewed-on: https://go-review.googlesource.com/126175 From-SVN: r263035
2018-07-13runtime: skip zero-sized fields in structs when converting to FFIIan Lance Taylor1-3/+45
The libffi library doesn't understand zero-sized objects. When we see a zero-sized field in a struct, just skip it when converting to the FFI data structures. There is no value to pass in any case, so not telling libffi about the field doesn't affect anything. The test case for this is https://golang.org/cl/123316. Fixes golang/go#26335 Reviewed-on: https://go-review.googlesource.com/123335 From-SVN: r262651
2018-07-02re PR go/86331 (the gccgo's "go" tool looks like failing to invoke any sub ↵Ian Lance Taylor1-2/+5
go command) PR go/86331 os: check return value as well as error from waitid https://gcc.gnu.org/PR86331 indicates that if a signal handler runs it is possible for syscall.Syscall6 to return a non-zero errno value even if no error occurs. That is a problem in general, but this fix will let us work around the general problem for the specific case of calling waitid. Reviewed-on: https://go-review.googlesource.com/121595 From-SVN: r262313