Commit Graph

1367 Commits

Author SHA1 Message Date
Ian Lance Taylor
cf17256105 libgo: use POSIX shell arithmetic expansion
Avoid bash-specific ((expression)) syntax.  As the bash syntax
converts a non-zero value to a zero status (and a zero value to a 1
status), and POSIX arithmetic expansion does not, we have to negate
the result.

Based on patch by Sören Tempel.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/419154
2022-07-22 11:57:18 -07:00
Ian Lance Taylor
f35d65517a libgo: don't include <linux/fs.h> when building gen-sysinfo.go
Removing this doesn't change anything at least with glibc 2.33.
The include was added in https://go.dev/cl/6100049 but it's not
clear why.

Fixes PR go/106266

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/417294
2022-07-13 09:02:20 -07:00
Ian Lance Taylor
762fd5e554 libgo: handle stat st_atim32 field and SYS_SECCOMP
Patches for musl support, from Sören Tempel.

Fixes PR go/105225

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415294
2022-06-30 12:35:08 -07:00
Ian Lance Taylor
53c4ef1e3c libgo: make runtime.Version return a meaningful string
Fixes golang/go#51850

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414734
2022-06-28 10:19:58 -07:00
Ian Lance Taylor
7905a9ac26 libgo: #include <sys/types.h> when checking for loff_t
PR go/106033

Fixes golang/go#53469

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413214
2022-06-21 08:03:17 -07:00
Ian Lance Taylor
7f195a2270 libgo: permit loff_t and off_t to be macros
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-17 14:27:06 -07:00
Ian Lance Taylor
cf79b1117b syscall: gofmt
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-06-14 15:11:17 -07:00
Ian Lance Taylor
6a4e993454 runtime: use correct field name for PPC32 GLIBC registers
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-20 17:49:44 -07:00
Ian Lance Taylor
4a1a72a89c libgo: make a couple of sed uses POSIX compliant
Patch from Jonathan Wakely.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401054
2022-04-19 12:49:42 -07:00
Sören Tempel
ace4928a29 libgo: only add signum to siglist if it doesn't exist yet
This fixes a build issue on musl libc where the same signal number
is used for SIGIO and SIGPOLL.  This causes a compilation error since
the signal numbers must be unique for the signal table.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400595
2022-04-18 15:17:16 -07:00
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
af27d545dc runtime: use regset indexes for PPC register values
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-04-14 15:14:57 -07:00
Ian Lance Taylor
0abc1cbad1 runtime: support PPC32 MUSL register access
Based on patch by Sören Tempel.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/397394
2022-03-31 13:26:13 -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
Ian Lance Taylor
c3402486af mkruntimeinc: skip _FILE
We don't need it, and it breaks uclibc.

	PR go/101246

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/390021
2022-03-04 10:46:55 -08:00
Clément Chigot
e71079517f libgo: move golang.org/x/sync/semaphore to gotool packages
golang/x/sync/semaphore is required by gofmt.go.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388634
2022-03-04 10:27:10 -08: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
3d54f1ffaf libgo: update README.gcc
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/387514
2022-02-22 15:34:46 -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
David Seifert
45ba6bf28b make -Werror optional in libatomic/libbacktrace/libgomp/libitm/libsanitizer
* `-Werror` can cause issues when a more recent version of GCC compiles
  an older version:
  - https://bugs.gentoo.org/229059
  - https://bugs.gentoo.org/475350
  - https://bugs.gentoo.org/667104

libatomic/ChangeLog:

	* configure.ac: Support --disable-werror.
	* configure: Regenerate.

libbacktrace/ChangeLog:

	* configure.ac: Support --disable-werror.
	* configure: Regenerate.

libgomp/ChangeLog:

	* configure.ac: Support --disable-werror.
	* configure: Regenerate.

libitm/ChangeLog:

	* configure.ac: Support --disable-werror.
	* configure: Regenerate.

libsanitizer/ChangeLog:

	* configure.ac: Support --disable-werror.
	* aclocal.m4: Include also ../config/warnings.m4.
	* libbacktrace/Makefile.am (WARN_FLAGS): Remove.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* asan/Makefile.in: Regenerate.
	* hwasan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
2022-02-03 16:10:18 +01: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
62c3f75fd2 compiler, libgo: don't pad sparc64-linux epollevent
Change the compiler to not add zero padding because of zero-sized
fields named "_", since those can't be referenced anyhow.

Change the sparc-linux64 epollevent struct to name the alignment
field "_", to avoid zero padding.

Fixes PR go/103847

	PR go/103847
	* godump.c (go_force_record_alignment): Name the alignment
	field "_".

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/374914
2021-12-29 15:52:23 -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
e5c00544cc runtime: use C cast syntax in stack.c
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-13 10:38:36 -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
1798cac7a8 runtime: remove direct assignments to memory locations
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-07-09 19:48:53 -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
c922c6539e libgo: update configure to current sources
Change-Id: I12766baf02bfdf2233f1c5bde1a270f06b020aa7
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/321076
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-18 19:57:54 -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