aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
AgeCommit message (Collapse)AuthorFilesLines
2024-04-29runtime: dump registers on SolarisIan Lance Taylor1-4/+59
Patch by Rainer Orth <ro@gcc.gnu.org>. Fixes PR go/106813 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/581724
2024-04-29runtime: use <stdbool.h>Ian Lance Taylor1-6/+1
<stdbool.h> has been available since C99. Use it rather than defining our own boolean type and values. Fixes https://gcc.gnu.org/PR114875 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/582275
2023-06-20runtime: use a C function to call mmapIan Lance Taylor2-3/+21
The final argument to mmap, of type off_t, varies. In CL 445375 we changed it to always use the C off_t type, but that broke 32-bit big-endian Linux systems. On those systems, using the C off_t type requires calling the mmap64 function. In C this is automatically handled by the <sys/mman.h> file. In Go, we would have to change the magic //extern comment to call mmap64 when appropriate. Rather than try to get that right, we instead go through a C function that uses C implicit type conversions to pick the right type. Fixes PR go/110297 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504415
2022-11-30runtime: force XSI strerror on hurdIan Lance Taylor1-2/+2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454275
2022-11-29syscall, runtime: always call XSI strerror_rIan Lance Taylor1-0/+37
This does the right thing for either glibc or musl on GNU/Linux. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
2022-09-27runtime: portable access to sigev_notify_thread_idIan Lance Taylor1-0/+18
Previously, libgo relied on the _sigev_un implementation-specific field in struct sigevent, which is only available on glibc. This patch uses the sigev_notify_thread_id macro instead which is mandated by timer_create(2). In theory, this should work with any libc implementation for Linux. Unfortunately, there is an open glibc bug as glibc does not define this macro. For this reason, a glibc-specific workaround is required. Other libcs (such as musl) define the macro and don't require the workaround. See https://sourceware.org/bugzilla/show_bug.cgi?id=27417 This makes libgo compatible with musl libc. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/434755
2022-09-06runtime: ignore __morestack function in runtime.CallersIan Lance Taylor1-1/+1
We were ignoring all functions starting with "__morestack_", but not the function "__morestack" itself. Without this change, some tests such as recover.go started failing recently, though I'm not sure exactly what changed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/427935
2022-04-20runtime: use correct field name for PPC32 GLIBC registersIan Lance Taylor1-12/+23
One of these days we will get this right. Fixes PR go/105315 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401374
2022-04-14runtime: use regset indexes for PPC register valuesIan Lance Taylor1-15/+10
Using names depended on <asm/ptrace.h>, which glibc includes somewhere but musl did not. Change to just always use indexes. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400214
2022-03-31runtime: support PPC32 MUSL register accessIan Lance Taylor1-0/+18
Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/397394
2022-02-11libgo: update to Go1.18beta2Ian Lance Taylor1-4/+11
gotools/ * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
2021-08-13runtime: use C cast syntax in stack.cIan Lance Taylor1-1/+1
Didn't notice earlier because this code is only used on systems that do not support -fsplit-stack. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342051
2021-08-12libgo: update to Go1.17rc2Ian Lance Taylor3-4/+88
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341629
2021-07-09runtime: remove direct assignments to memory locationsIan Lance Taylor2-3/+3
PR bootstrap/101374 They cause a warning with the updated GCC -Warray-bounds option. Replace them with calls to abort, which for our purposes is fine. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/333409
2021-03-08runtime: cast SIGSTKSZ to uintptrIan Lance Taylor1-2/+2
In newer versions of glibc it is long, which causes a signed comparison warning. Fixes PR go/99458
2021-02-25libgo: ensure memmove, memset 8 byte atomicity on ppc64xLynn Boger3-2/+135
Go requires that pointer moves are done 8 bytes at a time, but gccgo uses libc's memmove and memset which does not require that, and there are some cases where an 8 byte move might be done as 4+4. To enforce 8 byte moves for memmove and memset, this adds a C implementation in libgo/runtime for memmove and memset to be used on ppc64le and ppc64. Asm implementations were considered but discarded to avoid different implementations for different target ISAs. Fixes golang/go#41428 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/294931
2020-12-30libgo: update to Go1.16beta1 releaseIan Lance Taylor1-4/+3
This does not yet include support for the //go:embed directive added in this release. * Makefile.am (check-runtime): Don't create check-runtime-dir. (mostlyclean-local): Don't remove check-runtime-dir. (check-go-tool, check-vet): Copy in go.mod and modules.txt. (check-cgo-test, check-carchive-test): Add go.mod file. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280172
2020-12-08libgo: update to 1.15.6 releaseIan Lance Taylor1-0/+3
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/276153
2020-12-04runtime: update type descriptor name in fieldtrack C support codeIan Lance Taylor1-1/+1
We were using the old name, but nothing noticed because it is a weak reference that is permitted to be nil, so that it works with code that does not use the field tracking library. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/275449
2020-12-03compiler: defer to middle-end for complex divisionIan Lance Taylor1-49/+0
Go used to use slightly different semantics than C99 for complex division, so we used runtime routines to handle the different. The gc compiler has changes its behavior to match C99, so changes ours as well. For golang/go#14644 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274213
2020-11-20compiler, libgo: change mangling schemeIan Lance Taylor5-20/+20
Overhaul the mangling scheme to avoid ambiguities if the package path contains a dot. Instead of using dot both to separate components and to mangle characters, use dot only to separate components and use underscore to mangle characters. For golang/go#41862 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/271726
2020-10-21syscall: only compile ptrace varargs shim on LinuxNikhil Benesch1-4/+3
Only compile the __go_ptrace varargs shim on Linux to avoid compilation failures on some other platforms. The C ptrace function is not entirely portable (e.g., NetBSD has `int data` instead of `void* data`), and so far Linux is the only platform that needs the varargs shim. Additionally, make the types in the ptrace and raw_ptrace function declarations match. This makes it more clear that the only difference between the two is that calls via the former are allowed to block while calls via the latter are not. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263517
2020-10-15runtime: use correct types in __go_ptrace shimNikhil Benesch1-1/+1
Make the types of the addr and data arguments in the __go_ptrace shim match the types declared in Go and the types declared by the C ptrace function, i.e., void*. This avoids a warning about an implicit int-to-pointer cast on some platforms. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/262340
2020-10-14libgo: print reason code if throwing unwind exception failsNikhil Benesch1-5/+9
Calls to _Unwind_RaiseException and friends *can* return due to bugs in libgo or memory corruption. When this occurs, print a message to stderr with the reason code before aborting to aid debugging. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261257
2020-10-13runtime: populate signal PC on NetBSDNikhil Benesch1-0/+2
The NetBSD libc provides an architecture-independent macro that can extract the PC from a ucontext struct. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261740
2020-09-24runtime: remove __go_ptrace on AIXClément Chigot1-1/+3
AIX ptrace syscalls doesn't have the same semantic than the glibc one. The syscall package is already handling it correctly so disable the new __go_ptrace C function for AIX. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/256777
2020-09-17libgo: fix ptrace syscall hooks into glibcPaul E. Murphy1-0/+16
ptrace is actually declared as a variadic function. On ppc64le the ABI requires to the caller to allocate space for the parameters and allows the caller to modify them. On ppc64le, depending on how and what version of GCC is used, it will save to parameter save area. This happened to clobber a saved LR, and caused syscall.TestExecPtrace to fail with a timeout when the tracee segfaults, and waits for the parent process to inspect. Wrap this function to avoid directly calling glibc's ptrace from go. Fixes golang/go#36698 Fixes go/92567 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254755
2020-04-20gccgo: fix runtime compilation on NetBSDBenny Siegert1-0/+12
si_code in siginfo_t is a macro on NetBSD, not a member of the struct itself, so add a C trampoline for receiving its value. Also replace references to mos.waitsemacount with the replacement and add some helpers from os_netbsd.go in the GC repository. Update golang/go#38538. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/228918
2020-04-15runtime: use 64 bits of hash seed on arm64eric fang1-6/+6
This is the same issue as #33960, but on gofrontend. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/220297
2020-04-06libgo: update to almost the 1.14.2 releaseIan Lance Taylor1-0/+36
Update to edea4a79e8d7dea2456b688f492c8af33d381dc2 which is likely to be approximately the 1.14.2 release. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/227377
2020-02-28runtime: handle linux/arm64 signal registereric fang1-40/+23
Set sigpc and implement dumpregs for linux/arm64. Without this change, cmd/vet tool test will fail randomly. Updates golang/go#20931 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/220543
2020-01-22runtime: call runtime_nanotime1, not runtime_nanotimeIan Lance Taylor1-1/+1
The function name was changed in 1.14beta1. Fix the non-x86, non-s390 code. Fixes golang/go#36694 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/215724
2020-01-21libgo: update to Go1.14beta1Ian Lance Taylor6-39/+122
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/214297
2020-01-07compiler, runtime: stop using __go_runtime_errorIan Lance Taylor1-124/+0
Use specific panic functions instead, which are mostly already in the runtime package. Also correct "defer nil" to panic when we execute the defer, rather than throw when we queue it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/213642 From-SVN: r279979
2020-01-02compiler, runtime, reflect: generate hash functions only for map keysIan Lance Taylor1-15/+9
Right now we generate hash functions for all types, just in case they are used as map keys. That's a lot of wasted effort and binary size for types which will never be used as a map key. Instead, generate hash functions only for types that we know are map keys. Just doing that is a bit too simple, since maps with an interface type as a key might have to hash any concrete key type that implements that interface. So for that case, implement hashing of such types at runtime (instead of with generated code). It will be slower, but only for maps with interface types as keys, and maybe only a bit slower as the aeshash time probably dominates the dispatch time. Reorg where we keep the equals and hash functions. Move the hash function from the key type to the map type, saving a field in every non-map type. That leaves only one function in the alg structure, so get rid of that and just keep the equal function in the type descriptor itself. While we're here, reorganize the rtype struct to more closely match the gc version. This is the gofrontend version of https://golang.org/cl/191198. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/212843 From-SVN: r279848
2019-12-05re PR go/92820 (libgo.so.15 has executable stack)Ian Lance Taylor1-1/+2
PR go/92820 runtime: always mark assembly file as non-executable stack Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210037 From-SVN: r279010
2019-11-21re PR go/92605 (r278509 causes/reveals issue in building go library)Ian Lance Taylor2-1/+3
PR go/92605 runtime: declare runtime_usestackmaps in stack.c, not runtime.h Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/208161 From-SVN: r278540
2019-10-02runtime: mark go-context.S as no-executable-stack and split-stack supportedIan Lance Taylor1-0/+4
The .note.GNU-stack section tells the linker that this object does not require an executable stack. The .note.GNU-split-stack section tells the linker that functions in this object can be called directly by split-stack functions, without require a large stack. The .note.GNU-no-split-stack section tells the linker that functions in this object do not have a split-stack prologue. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198440 From-SVN: r276488
2019-09-17re PR go/91781 (r275691 breaks go test "reflect")Ian Lance Taylor1-8/+4
PR go/91781 reflect: promote integer closure return to full word The libffi library expects an integer return type to be promoted to a full word. Implement that when returning from a closure written in Go. This only matters on big-endian systems when returning an integer smaller than the pointer size, which is why we didn't notice it until now. Fixes https://gcc.gnu.org/PR91781. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195858 From-SVN: r275813
2019-09-06libgo: update to Go 1.13beta1 releaseIan Lance Taylor4-30/+74
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473
2019-08-30compile, runtime: permit anonymous and empty fields in C headerIan Lance Taylor8-329/+90
Permit putting structs with anonymous and empty fields in the C header file runtime.inc that is used to build the C runtime code. This is required for upcoming 1.13 support, as the m struct has picked up an anonymous field. Doing this lets the C header contain all the type descriptor structs, so start using those in the C code. This cuts the number of copies of type descriptor definitions from 3 to 2. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192343 From-SVN: r275227
2019-08-28runtime: move osinit to GoIan Lance Taylor10-145/+4
This is a step toward updating libgo to 1.13. This adds the 1.13 version of the osinit function to Go code, and removes the corresponding code from the C runtime. This should simplify future updates. Some additional 1.13 code was brought in to simplify this change. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191717 From-SVN: r275010
2019-08-20compiler, runtime: implement shifts by signed amountsIan Lance Taylor1-1/+7
Shifting by signed types is a new language feature in Go 1.13. This requires a patch to the testsuite. Updates golang/go#19113 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190977 * go.test/test/fixedbugs/bug073.go: Update for language changes. From-SVN: r274755
2019-07-15runtime: expose the g variableIan Lance Taylor1-2/+2
Currently, getg is implemented in C, which loads the thread-local g variable. The g variable is declared static in C. This CL exposes the g variable, so it can be accessed from the Go side. This allows the Go compiler to inline getg calls to direct access of g. Currently, the actual inlining is only implemented in the gollvm compiler. The g variable is thread-local and the compiler backend may choose to cache the TLS address in a register or on stack. If a thread switch happens the cache may become invalid. I don't know how to disable the TLS address cache in gccgo, therefore the inlining of getg is not implemented. In the future gccgo may gain this if we know how to do it safely. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/186238 From-SVN: r273499
2019-06-25runtime: mark memequal and memclrNoHeapPointers nosplitIan Lance Taylor2-2/+4
They are wrappers of libc functions that use no stack. Mark them nosplit so the linker won't patch it to call __morestack_non_split. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183629 From-SVN: r272633
2019-06-24compiler: use builtin memcmp directlyIan Lance Taylor1-13/+0
Instead of going through a C function __go_memcmp, we can just use __builtin_memcmp directly. This allows more optimizations in the compiler backend. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183537 From-SVN: r272620
2019-06-21compiler: open code string slice expressionsIan Lance Taylor1-30/+0
Currently a string slice expression is implemented with a runtime call __go_string_slice. Change it to open code it, which is more efficient, and allows the backend to further optimize it. Also omit the write barrier for length-only update (i.e. s = s[:n]). Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182540 From-SVN: r272549
2019-06-03libgo: delay applying profile stack-frame skip until fixupIan Lance Taylor1-9/+1
When the runtime collects a stack trace to associate it with some profiling event (mem alloc, mutex, etc) there is a skip count passed to runtime.Callers (or equivalent) to skip some known count of frames in order to get to the "interesting" frame corresponding to the profile event. Now that the profiling mechanism uses lazy fixup (when removing compiler artifacts like thunks, morestack calls etc), we also need to move the frame skipping logic after the fixup, so as to insure that the skip count isn't thrown off by these artifacts. Fixes golang/go#32290. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/179740 From-SVN: r271892
2019-06-03runtime: remove unnecessary functions calling between C and GoIan Lance Taylor4-27/+0
These functions were needed during the transition of the runtime from C to Go, but are no longer necessary. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/179879 From-SVN: r271890
2019-06-03runtime: fix assembly syntaxIan Lance Taylor1-1/+1
Some assembler doesn't accept ULL suffix. In fact the suffix is not really necessary. Drop it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/180217 From-SVN: r271883