aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
AgeCommit message (Collapse)AuthorFilesLines
2024-02-02compiler: export the type "any" as a builtinIan Lance Taylor1-14/+16
Otherwise we can't tell the difference between builtin type "any" and a locally defined type "any". This will require updates to the gccgo export data parsers in the main Go repo and the x/tools repo. These updates are https://go.dev/cl/537195 and https://go.dev/cl/537215. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536715
2023-10-23syscall: add missing type conversionIan Lance Taylor1-1/+1
The gofrontend incorrectly accepted code that was missing a type conversion. The test case for this is bug518.go in https://go.dev/cl/536537. Future CLs in this series will detect the type error. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536638
2023-09-06cmd/go: permit $AR to include optionsIan Lance Taylor1-6/+2
Handle the AR environment variable, used by gccgo, the same way we handle the CC environment variable. This ports https://go.dev/cl/526275 to the gofrontend repo. This is needed for gccgo testing because the top-level GCC Makefile now passes a --plugin option to ar if it supports one. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/526295
2023-07-20cmd/go: don't collect package CGOLDFLAGS when using gccgoIan Lance Taylor2-11/+2
They are already collected via cmd/cgo. The gccgo_link_c test is tweaked to do real linking as with this change the cgo ldflags are not fully reflected in go build -n output, since they now only come from the built archive. This is a backport of https://go.dev/cl/497117 from the main repo. For golang/go#60287 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/511675
2023-06-23compiler, libgo: support bootstrapping gc compilerIan Lance Taylor1-8/+2
In the Go 1.21 release the package internal/profile imports internal/lazyregexp. That works when bootstrapping with Go 1.17, because that compiler has internal/lazyregep and permits importing it. We also have internal/lazyregexp in libgo, but since it is not installed it is not available for importing. This CL adds internal/lazyregexp to the list of internal packages that are installed for bootstrapping. The Go 1.21, and earlier, releases have a couple of functions in the internal/abi package that are always fully intrinsified. The gofrontend recognizes and intrinsifies those functions as well. However, the gofrontend was also building function descriptors for references to the functions without calling them, which failed because there was nothing to refer to. That is OK for the gc compiler, which guarantees that the functions are only called, not referenced. This CL arranges to not generate function descriptors for these functions. For golang/go#60913 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504798
2023-06-20runtime: use a C function to call mmapIan Lance Taylor1-3/+3
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
2023-06-16libgo/testsuite: add benchmarks and examples to listIan Lance Taylor1-0/+9
In CL 384695 I simplified the code that built lists of benchmarks, examples, and fuzz tests, and managed to break it. This CL corrects the code to once again make the benchmarks available, and to run the examples with output and the fuzz targets. Doing this revealed a test failure in internal/fuzz on 32-bit x86: a signalling NaN is turned into a quiet NaN on the 387 floating-point stack that GCC uses by default. This CL skips the test. Fixes golang/go#60826 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/503798
2023-05-11syscall: add prlimitIan Lance Taylor1-0/+8
As of https://go.dev/cl/476695 golang.org/x/sys/unix can call syscall.prlimit, so we need such a function in libgo. For golang/go#46279 Fixes golang/go#59712 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/486576
2023-04-07mime: remove test ordering dependencyIan Lance Taylor2-1/+5
Backport CL 421442 from upstream. Original description: Arrange for tests that call setMimeInit to fully restore the old values, by clearing the sync.Once that controls initialization. Once we've done that, call initMime in initMimeUnixTest because otherwise the test types loaded there will be cleared by the call to initMime that previously was not being done. For golang/go#51648 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/483117
2022-11-29syscall, runtime: always call XSI strerror_rIan Lance Taylor2-47/+9
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-10-27runtime: use _libgo_off_t_type when calling C mmapIan Lance Taylor1-2/+4
The last argument to the C mmap function is type off_t, not uintptr. On some 32-bit systems, off_t is larger than uintptr. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/445735
2022-09-27runtime: portable access to sigev_notify_thread_idIan Lance Taylor1-1/+11
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-27runtime: synchronize empty struct field handlingmelonedo1-4/+10
In GCCGO and gollvm, the logic for allocating one byte for the last field is: 1. the last field has zero size 2. the struct itself does not have zero size 3. the last field is not blank this commit adds the last two conditions to runtime.structToFFI. For golang/go#55146 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/431735
2022-09-22cmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheapIan Lance Taylor5-51/+66
This ports https://go.dev/cl/421879 to libgo. This is a quick port to update gofrontend to work with the version of cgo in gc mainline. A more complete port will follow, changing the gc version of cmd/cgo to choose an approach based on feature testing the gccgo in use. Updates golang/go#46731 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/432338
2022-06-28libgo: make runtime.Version return a meaningful stringIan Lance Taylor1-10/+0
Fixes golang/go#51850 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414734
2022-06-17libgo: permit loff_t and off_t to be macrosIan Lance Taylor1-8/+8
They are macros in musl libc, rather than typedefs, and -fgo-dump-spec doesn't handle that case. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412075
2022-06-14syscall: gofmtIan Lance Taylor42-6/+52
Add blank lines after //sys comments where needed, and then run gofmt on the syscall package with the new formatter. This is the libgo version of CL 407136. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412074
2022-04-18runtime: add special handling for signal 34A. Wilcox1-1/+2
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-15compiler: revert `for package-scope "a = b; b = x" just set "a = x"`Ian Lance Taylor2-6/+8
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-03-16libgo: update to final Go 1.18 releaseIan Lance Taylor87-599/+1978
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/393377
2022-03-04libgo: fix AIX build for the Go1.18 updateClément Chigot4-4/+2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388635
2022-02-21runtime/internal/syscall: build dummy package if not LinuxIan Lance Taylor1-0/+7
Fixes libgo build on non-Linux systems. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/387134
2022-02-18libgo: update Hurd supportIan Lance Taylor8-9/+297
Patches from Svante Signell for PR go/104290. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386797
2022-02-18libgo: update to Go1.18rc1 releaseIan Lance Taylor177-2945/+3655
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386594
2022-02-17net: add hurd build tag for setReadMsgCloseOnExecIan Lance Taylor1-1/+1
Patch from Svante Signell. PR go/103573 PR go/104290 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386216
2022-02-16libgo: restore building on SolarisIan Lance Taylor7-8/+17
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-13runtime: call timer functions via syscallIan Lance Taylor1-10/+11
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-11libgo: update to Go1.18beta2Ian Lance Taylor1913-36042/+82937
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-08compiler, internal/abi: implement FuncPCABI0, FuncPCABIInternalIan Lance Taylor2-5/+41
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-01-20runtime: build panic32.go on amd64p32Ian Lance Taylor1-2/+2
Fixes https://gcc.gnu.org/PR104149 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/380054
2021-09-21runtime: set runtime.GOROOT value at build timeIan Lance Taylor1-2/+0
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-16libgo: update to go1.17.1 releaseIan Lance Taylor11-18/+151
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/350414
2021-09-07runtime: use hash32, not hash64, for amd64p32, mips64p32, mips64p32leIan Lance Taylor2-4/+4
Fixes PR go/102102 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/348015
2021-09-05libgo: update to final Go 1.17 releaseIan Lance Taylor8-63/+103
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/343729
2021-08-14libgo: various fixes for Solaris supportIan Lance Taylor8-15/+33
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342189
2021-08-12libgo: update to Go1.17rc2Ian Lance Taylor1944-22608/+73883
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341629
2021-08-12runtime: run gofmt on testdata/testwinsignal/main.goIan Lance Taylor1-19/+19
2021-08-12compiler: store pointers to go:notinheap types indirectlyIan Lance Taylor1-2/+2
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-05runtime: extend internal atomics to comply with sync/atomicIan Lance Taylor2-0/+105
This is the gofrontend version of https://golang.org/cl/289152. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339690
2021-08-03compile, runtime: make selectnbrecv return two valuesIan Lance Taylor1-28/+3
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-02compiler, runtime: allow slice to array pointer conversionIan Lance Taylor2-0/+9
Panic if the slice is too short. For golang/go#395 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/338630
2021-08-02compiler, runtime: support unsafe.Add and unsafe.SliceIan Lance Taylor1-0/+29
For golang/go#19367 For golang/go#40481 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/338949
2021-06-10libgo: update to Go1.16.5 releaseIan Lance Taylor29-129/+779
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/326772
2021-05-18libgo: update bzip2 binary test cases to match source repoIan Lance Taylor2-0/+0
2021-05-18libgo: use Windows line endings in testwinsignalIan Lance Taylor1-19/+19
2021-04-12libgo: update to Go1.16.3 releaseIan Lance Taylor13-65/+271
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/309490
2021-03-15libgo: update to Go 1.16.2 releaseIan Lance Taylor26-182/+449
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301459
2021-02-25libgo: ensure memmove, memset 8 byte atomicity on ppc64xLynn Boger1-2/+0
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-19libgo: update to Go1.16 releaseIan Lance Taylor32-79/+378
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/293793
2021-01-29internal/cpu: correctly link to getsystemcfgClément Chigot2-4/+1
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