Commit Graph

768 Commits

Author SHA1 Message Date
A. Wilcox 208b7d85d7 runtime: add special handling for signal 34
The musl libc uses signal 34 internally for setgid (similar to how glibc
uses signal 32 and signal 33).  For this reason, special handling is
needed for this signal in the runtime. The gc implementation already
handles the signal accordingly.  As such, this commit intends to
simply copy the behavior of the Google Go implementation to libgo.

See https://go.dev/issues/39343

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400594
2022-04-18 15:16:35 -07:00
Ian Lance Taylor d00dd52ea1 compiler: revert `for package-scope "a = b; b = x" just set "a = x"`
Revert CL 245098.  It caused incorrect initialization ordering.

Adjust the runtime package to work even with the CL reverted.

Original description of CL 245098:

    This avoids requiring an init function to initialize the variable.
    This can only be done if x is a static initializer.

    The go1.15rc1 runtime package relies on this optimization.
    The package has a variable "var maxSearchAddr = maxOffAddr".
    The maxSearchAddr variable is used by code that runs before package
    initialization is complete.

For golang/go#51913

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/395994
2022-04-15 14:27:05 -07:00
Ian Lance Taylor 69921f4a7e libgo: update to final Go 1.18 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/393377
2022-03-16 13:52:32 -07:00
Clément Chigot 6be8281c16 libgo: fix AIX build for the Go1.18 update
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388635
2022-03-04 10:19:50 -08:00
Ian Lance Taylor a7eeaa4898 runtime/internal/syscall: build dummy package if not Linux
Fixes libgo build on non-Linux systems.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/387134
2022-02-21 13:24:38 -08:00
Ian Lance Taylor 3343e7e2c4 libgo: update Hurd support
Patches from Svante Signell for PR go/104290.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386797
2022-02-18 15:33:32 -08:00
Ian Lance Taylor 20a33efdf3 libgo: update to Go1.18rc1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386594
2022-02-18 13:12:08 -08:00
Ian Lance Taylor 3f2a6b041d net: add hurd build tag for setReadMsgCloseOnExec
Patch from Svante Signell.

	PR go/103573
	PR go/104290

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386216
2022-02-17 09:30:02 -08:00
Ian Lance Taylor 24ca97325c libgo: restore building on Solaris
Add build tags and a few other changes so that libgo builds on Solaris.

Patch partially from Rainer Orth.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386215
2022-02-16 12:20:10 -08:00
Ian Lance Taylor 58aeb75d40 runtime: call timer functions via syscall
It turns out to be painful to require linking against -lrt on
GNU/Linux, as that makes it harder to link Go code into C programs.
Instead just call the timer syscalls directly.  That is what the
upstream library does anyhow.

gcc/go/
	* gospec.cc: Revert 2022-02-09 change:
	(RTLIB, RT_LIBRARY): Don't define.
	(lang_specific_driver): Don't add -lrt if linking statically
	on GNU/Linux.

gotools/
	* configure.ac: Revert 2022-02-09 change:
	(RT_LIBS): Don't define.
	* Makefile.am (check-runtime): Don't set GOLIBS to $(RT_LIBS).
	* configure, Makefile.in: Regenerate.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/385475
2022-02-13 11:03:45 -08:00
Ian Lance Taylor 8dc2499aa6 libgo: update to Go1.18beta2
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
2022-02-11 15:01:19 -08:00
Ian Lance Taylor 3ab49b1c82 compiler, internal/abi: implement FuncPCABI0, FuncPCABIInternal
The Go 1.18 standard library uses an internal/abi package with two
functions that are implemented in the compiler. This patch implements
them in the gofrontend, to support the upcoming update to 1.18.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/383514
2022-02-08 20:08:09 -08:00
Ian Lance Taylor 39cd3cce52 runtime: build panic32.go on amd64p32
Fixes https://gcc.gnu.org/PR104149

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/380054
2022-01-20 19:06:50 -08:00
Ian Lance Taylor 09e18d113b runtime: set runtime.GOROOT value at build time
In Go 1.17 the gc toolchain changed to set runtime.GOROOT in cmd/link
(previously it was runtime/internal/sys.GOROOT).  Do the same in libgo.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/351313

gotools/:
	* Makefile.am (check-runtime): Add goroot.go to --extrafiles.
	* Makefile.in: Regenerate.
2021-09-21 14:31:10 -07:00
Ian Lance Taylor 54866f7a81 libgo: update to go1.17.1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/350414
2021-09-16 16:48:19 -07:00
Ian Lance Taylor 21b046bade runtime: use hash32, not hash64, for amd64p32, mips64p32, mips64p32le
Fixes PR go/102102

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/348015
2021-09-07 15:05:11 -07:00
Ian Lance Taylor 74df79ec3e libgo: update to final Go 1.17 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/343729
2021-09-05 16:10:51 -07:00
Ian Lance Taylor 829931ec93 libgo: various fixes for Solaris support
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342189
2021-08-14 17:34:52 -07:00
Ian Lance Taylor c5b21c3f4c libgo: update to Go1.17rc2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341629
2021-08-12 20:23:07 -07:00
Ian Lance Taylor 0ace3d4d0a runtime: run gofmt on testdata/testwinsignal/main.go 2021-08-12 17:15:16 -07:00
Ian Lance Taylor 1196b60f8f compiler: store pointers to go:notinheap types indirectly
This is the gofrontend version of https://golang.org/cl/264480.

For golang/go#42076

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/340609
2021-08-12 16:33:10 -07:00
Ian Lance Taylor 582c24e9fe runtime: extend internal atomics to comply with sync/atomic
This is the gofrontend version of https://golang.org/cl/289152.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339690
2021-08-05 11:41:57 -07:00
Ian Lance Taylor e435e72ad7 compile, runtime: make selectnbrecv return two values
The only different between selectnbrecv and selectnbrecv2 is the later
set the input pointer value by second return value from chanrecv.

So by making selectnbrecv return two values from chanrecv, we can get
rid of selectnbrecv2, the compiler can now call only selectnbrecv and
generate simpler code.

This is the gofrontend version of https://golang.org/cl/292890.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339529
2021-08-03 16:40:00 -07:00
Ian Lance Taylor 7459bfa8a3 compiler, runtime: allow slice to array pointer conversion
Panic if the slice is too short.

For golang/go#395

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/338630
2021-08-02 15:27:08 -07:00
Ian Lance Taylor 06d0437d4a compiler, runtime: support unsafe.Add and unsafe.Slice
For golang/go#19367
For golang/go#40481

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/338949
2021-08-02 13:56:28 -07:00
Ian Lance Taylor ee52bf609b libgo: update to Go1.16.5 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/326772
2021-06-10 14:41:23 -07:00
Ian Lance Taylor 28ec1174f9 libgo: update bzip2 binary test cases to match source repo 2021-05-18 19:57:03 -07:00
Ian Lance Taylor 39ed6a88c7 libgo: use Windows line endings in testwinsignal 2021-05-18 18:28:17 -07:00
Ian Lance Taylor eb49f7de93 libgo: update to Go1.16.3 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/309490
2021-04-12 15:23:16 -07:00
Ian Lance Taylor 3a5bcac339 libgo: update to Go 1.16.2 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301459
2021-03-15 14:52:55 -07:00
Lynn Boger 2fbed0dc6c libgo: ensure memmove, memset 8 byte atomicity on ppc64x
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
2021-02-25 17:01:23 -08:00
Ian Lance Taylor 13e6fadd96 libgo: update to Go1.16 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/293793
2021-02-19 12:33:25 -08:00
Clément Chigot 4d31df4089 internal/cpu: correctly link to getsystemcfg
Directly set getsystemcfg as //extern in internal/cpu instead of
trying to use the runtime as in Go toolchain.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287932
2021-01-29 16:12:43 -08:00
Ian Lance Taylor 726b7aa004 libgo: update to Go1.16rc1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287493
2021-01-29 11:04:55 -08:00
Ian Lance Taylor 9ac3e2feb3 libgo: update hurd support
Patch from Svante Signell.

Fixes PR go/98496

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/283692
2021-01-14 09:57:04 -08:00
Paul E. Murphy cfaaa6a1ca syscall: ensure openat uses variadic libc wrapper
On powerpc64le, this caused a failure in TestUnshareUidGidMapping
due to stack corruption which resulted in a bogus execve syscall.

Use the existing c wrapper to ensure we respect the ppc abi for
variadic functions.

Fixes PR go/98610

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/282717
2021-01-12 13:21:09 -08:00
Ian Lance Taylor f47c00cf95 syscall: don't define sys_SETREUID and friends
We don't use them, since we always call the C library functions which do
the right thing anyhow.  And they aren't defined on all GNU/Linux variants.

Fixes PR go/98510

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281473
2021-01-05 13:53:13 -08:00
Ian Lance Taylor a9f76d03bb internal/cpu: more build fixes for Go1.16beta1 release
Some files were missing from the libgo copy of internal/cpu, because they
used to only declare CacheLinePadSize which libgo gets from goarch.sh.
Now they also declare doinit, so copy them over.  Adjust cpu_other.go.

Fix the amd64p32 build by adding a build constraint to cpu_no_name.go.

Fixes PR go/98493

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281472
2021-01-05 13:48:59 -08:00
Ian Lance Taylor 5a4e0d121a internal/cpu: add aarch64 support functions
Patch from Andreas Schwab.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281000
2021-01-01 15:13:50 -08:00
Ian Lance Taylor 0b9ef8be40 runtime: move startupRandomData back to runtime2.go
In libgo it's referenced from os_gccgo.go on all platforms.

Fixes go/98496

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280999
2021-01-01 15:11:45 -08:00
Ian Lance Taylor abca670596 internal/cpu, golang.org/x/sys/cpu: support other GOARCH values
Add support (mostly dummy support) for GOARCH values supported by
gofrontend but not gc.  Fix PPC handling.

Fixes https://gcc.gnu.org/PR98493

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280932
2021-01-01 15:10:06 -08:00
Ian Lance Taylor cfcbb4227f libgo: update to Go1.16beta1 release
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-30 15:13:24 -08:00
Ian Lance Taylor 313890530c runtime: eliminate scase.kind field
This is the gofrontend version of https://golang.org/cl/245125.

Original CL description:

    Currently, we include a "kind" field on scase to distinguish the three
    kinds of cases in a select statement: sends, receives, and defaults.

    This commit removes by kind field by instead arranging for the
    compiler to always place sends before receives, and to provide their
    counts separately. It also passes an explicit "block bool" parameter
    to avoid needing to include a default case in the array.

    It's safe to shuffle cases like this because the runtime will
    randomize the order they're polled in anyway.

    For golang/go#40410.

This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279735
2020-12-22 14:42:22 -08:00
Ian Lance Taylor 3b2d8145a4 runtime: add "success" field to sudog
This is the gofrontend version of https://golang.org/cl/245019.
Original CL description:

    The current wakeup protocol for channel communications is that the
    second goroutine sets gp.param to the sudog when a value is
    successfully communicated over the channel, and to nil when the wakeup
    is due to closing the channel.

    Setting nil to indicate channel closure works okay for chansend and
    chanrecv, because they're only communicating with one channel, so they
    know it must be the channel that was closed. However, it means
    selectgo has to re-poll all of the channels to figure out which one
    was closed.

    This commit adds a "success" field to sudog, and changes the wakeup
    protocol to always set gp.param to sg, and to use sg.success to
    indicate successful communication vs channel closure.

    While here, this also reorganizes the chansend code slightly so that
    the sudog is still released to the pool if the send blocks and then is
    awoken because the channel closed.

    For golang/go#40410

This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1, setting up for more compiler changes related to select handling.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279734
2020-12-22 12:13:13 -08:00
Ian Lance Taylor 48357ce4f2 runtime: omit nil-channel cases from selectgo's orders
This is the gofrontend version of https://golang.org/cl/245123.
Original CL description:

    Currently, selectgo does an initial pass over the cases array to look
    for entries with nil channels, so they can be easily recognized and
    skipped later on. But this still involves actually visiting the cases.

    This commit changes selectgo to omit cases with nil channels when
    constructing pollorder, so that they'll be skipped over entirely later
    on. It also checks for caseDefault up front, which will facilitate
    changing it to use a "block bool" parameter instead.

    Updates golang/go#40410

This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1, setting up for more compiler changes related to select handling.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279733
2020-12-22 11:56:41 -08:00
Ian Lance Taylor 1fa5fc7408 runtime: remove scase.releasetime field
This is the gofrontend version of https://golang.org/cl/245122.
Original CL description:

    selectgo will report at most one block event, so there's no need to
    keep a releasetime for every select case. It suffices to simply track
    the releasetime of the case responsible for the wakeup.

    Updates golang/go#40410.

This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279732
2020-12-22 11:54:03 -08:00
Ian Lance Taylor 5ea350d1d7 libgo: update to 1.15.6 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/276153
2020-12-08 14:01:04 -08:00
Ian Lance Taylor 9121f80841 syscall: don't use AF_LINK on hurd
Patch from Svante Signell.

Fixes PR go/98153

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/275939
2020-12-07 17:08:48 -08:00
Ian Lance Taylor eafb46ce90 internal/cpu: don't define CacheLinePadSize for mips64x
For libgo the definition comes from the generated file cpugen.go.

Fixes PR go/98041

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273866
2020-11-30 12:24:17 -08:00
Ian Lance Taylor 9ebad4b01c compiler, runtime: check len/cap for append(s, make(T, l)...)
The overflow checks done in growslice always reported an error for the
capacity argument, even if it was the length argument that overflowed.
This change lets the code pass the current issue4085b.go test.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273806
2020-11-30 12:22:14 -08:00