Commit Graph

1318 Commits

Author SHA1 Message Date
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
Ian Lance Taylor
3972574f11 misc/cgo/testcarchive: don't use == for string equality in C code
Backport of https://golang.org/cl/300993.

For PR go/99553

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301458
2021-03-12 20:06:50 -08:00
Ian Lance Taylor
d5d3f15a0e runtime: cast SIGSTKSZ to uintptr
In newer versions of glibc it is long, which causes a signed
comparison warning.

Fixes PR go/99458
2021-03-08 16:23:31 -08: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
Ian Lance Taylor
530203d6e3 libgo: install new 1.16 packages
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/289069
2021-02-03 08:47:28 -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
Samuel Thibault
f56de3557f Update GNU/Hurd configure support
ChangeLog:

	* libtool.m4: Match gnu* along other GNU systems.
	* libgo/config/libtool.m4: Match gnu* along other GNU systems.
	* libgo/configure: Re-generate.

libffi/
	* configure: Re-generate.

libgomp/
	* configure: Re-generate.

gcc/

	* configure: Re-generate.

libatomic/

	* configure: Re-generate.

libbacktrace/

	* configure: Re-generate.

libcc1/

	* configure: Re-generate.

libgfortran/

	* configure: Re-generate.

libgomp/

	* configure: Re-generate.

libhsail-rt/

	* configure: Re-generate.

libitm/

	* configure: Re-generate.

libobjc/

	* configure: Re-generate.

liboffloadmic/

	* configure: Re-generate.
	* plugin/configure: Re-generate.

libphobos/

	* configure: Re-generate.

libquadmath/

	* configure: Re-generate.

libsanitizer/

	* configure: Re-generate.

libssp/

	* configure: Re-generate.

libstdc++-v3/

	* configure: Re-generate.

libvtv/

	* configure: Re-generate.

lto-plugin/

	* configure: Re-generate.

zlib/

	* configure: Re-generate.
2021-01-05 16:04:14 -07: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
Nikhil Benesch
9bac66390c libgo: adjust sysinfo scripts for changed -fdump-go-spec
The -fdump-go-spec flag to GCC recently changed to be more fastidious
about handling incomplete types. This caused some breakage in
mk[r]sysinfo.sh on Solaris. This commit adjusts for the new behavior.
Specifically:

  * Types that refer to _in6_addr may be hidden behind a typedef and can
    no longer be filtered out with `grep -v in6_addr`. Instead just
    rewrite the definition of _in6_addr to [16]byte wherever it appears.

  * timestruc_t is now (correctly) emitted as an alias for timespec, so this
    case is handled specially.

  * stdio.h is included in sysinfo.c to avoid emitting an incomplete
    definition of the FILE type.

  * Dummy definitions for _u?pad128_t are now emitted automatically,
    which conflict with the definitions installed by mk[r]sysinfo.sh.
    These definitions were actually dead code, so just remove them.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278672
2020-12-20 20:16:50 -08:00
Ian Lance Taylor
5128f8d0d9 compiler: check for floating-point exponent overflow
Adjust mksysinfo and mkrsysinfo to strip out floating-point max numbers,
as they can trigger this error.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278476
2020-12-18 15:56:20 -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
918a5b84a2 runtime: update type descriptor name in fieldtrack C support code
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-04 14:51:09 -08:00
Ian Lance Taylor
cd34d5f2c4 compiler: defer to middle-end for complex division
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-12-03 08:21:02 -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
Ian Lance Taylor
e848a83f46 libgo: define SO_RCVTIMEO on 32-bit GNU/Linux
Fixes golang/go#42872

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273892
2020-11-30 12:17:01 -08:00
Ian Lance Taylor
bcbde431aa log/syslog: correct asm name for C function
Patch from Rainer Orth.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/272259
2020-11-23 08:14:20 -08:00
Ian Lance Taylor
dec42fe4e3 libgo: update to Go 1.15.5 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/272146
2020-11-20 17:09:30 -08:00
Ian Lance Taylor
a01dda3c23 compiler, libgo: change mangling scheme
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-11-20 12:44:35 -08:00
Ian Lance Taylor
397654d66a cmd/go, cmd/cgo: update gofrontend mangling checks
This is a port of two patches in the master repository.

https://golang.org/cl/259298

    cmd/cgo: split gofrontend mangling checks into cmd/internal/pkgpath

    This is a step toward porting https://golang.org/cl/219817 from the
    gofrontend repo to the main repo.

    Note that this also corrects the implementation of the v2 mangling
    scheme to use ..u and ..U where appropriate.

https://golang.org/cl/259299

    cmd/go: use cmd/internal/pkgpath for gccgo pkgpath symbol

For golang/go#37272
For golang/go#41862

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/270637
2020-11-17 18:32:07 -08:00
Ian Lance Taylor
cf392dbdf1 libgo: update to Go 1.15.4 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/268177
2020-11-10 07:25:32 -08:00
Nikhil Benesch
0cdde1e7ae libgo: handle linking to NetBSD's versioned symbols
On NetBSD, for backwards compatibility, various libc symbols are
renamed to a symbol with a version suffix. For example, this is the
(abbreviated) definition of sigaction:

    int sigaction(...) __asm__ ("__sigaction14")

This poses a challenge for libgo, which attempts to link sigaction by
way of an "//extern" comment:

    //extern sigaction
    func sigaction(...)

This results in a reference to the deprecated compatibility symbol
"sigaction", rather than the desired "__sigaction14" symbol.

This patch introduces a new "//extern-sysinfo" comment to handle this
situation. The new mklinknames.awk script scans a package for these
comments and outputs a "//go:linkname" directive that links the wrapper
to the correct versioned symbol, as determined by parsing the __asm__
annotation on the function's declaration in gen-sysinfo.go.

For now, only the following packages are scanned by mklinknames.awk:

    os
    os/user
    runtime
    syscall

gotools/:
	* Makefile.am (check-runtime): Add runtime_linknames.go to
	--extrafiles.
	* Makefile.in: Regenerate.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265125
2020-10-28 18:20:50 -07:00
Ian Lance Taylor
dfbadb8ce9 syscall: don't build libcall_bsd.go on solaris
This new file was based on master sources that are built for *BSD
but not Solaris

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/266017
2020-10-28 12:18:01 -07:00
Ian Lance Taylor
668894d7b5 libgo: update to Go 1.15.3 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265717
2020-10-27 13:58:02 -07:00
Ian Lance Taylor
b7ac5fdbe7 compiler, go/internal/gccgoimporter: export notinheap annotation
This is the gofrontend version of https://golang.org/cl/259297.
This is required now because that change is in the 1.15.3 release.

This requires changing the go/internal/gccgoimporter package, to skip
the new annotation. This change will need to be ported to the gc and
x/tools repos.

For golang/go#41761

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265258
2020-10-27 11:03:11 -07:00
Nikhil Benesch
a573530d50 syscall: import additional BSD-specific syscall wrappers
Import additional code from upstream for handing system
calls on BSD systems. This makes the syscall package on
NetBSD complete enough to compile the standard library.

Updates golang/go#38538.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265123
2020-10-26 15:04:16 -07:00
Nikhil Benesch
27f7ab27d1 net/http/cgi: merge upstream changes to default env vars
Incorporate upstream modifications to the cgi package's set of rules
about which environment variables should be inherited by child processes
by default on each platform. In particular this permits tests to pass on
NetBSD by preserving the value of the LD_LIBRARY_PATH environment
variable.

This is a partial backport of the following upstream CLs:

    https://golang.org/cl/263802
    https://golang.org/cl/263577
    https://golang.org/cl/254740

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/264097
2020-10-23 16:55:57 -07:00
Nikhil Benesch
439407aa2c syscall: only compile ptrace varargs shim on Linux
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-21 22:29:04 -07:00
Nikhil Benesch
2ab1fc7a32 syscall: import upstream code for BSD sockets and sysctls
Import some missing upstream code for BSD sockets and sysctls and
adapt it for gccgo.

Updates golang/go#38538.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261137
2020-10-21 16:57:59 -07:00
Nikhil Benesch
7cf256c3c8 libgo: adjust NetBSD-specific types for stable syscall API
The backwards-compatibility guarantees of the syscall package
require some munging of the C API inferred by mksysinfo.sh.
Specifically, the RTM_RESOLVE constant must be added if it is
missing, and the stat_t struct must use the suffix "timespec"
rather than "tim" for its time-related fields.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263519
2020-10-20 13:01:26 -07:00
Nikhil Benesch
522307281c syscall: remove Sendfile on NetBSD
NetBSD does not support the sendfile syscall.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263521
2020-10-20 10:57:10 -07:00
Nikhil Benesch
f33ac3b0cd runtime: use correct types in __go_ptrace shim
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-15 13:36:08 -07:00
Nikhil Benesch
6949fbefe2 libgo: correct Makefile typo in path to x/net/route package
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/262342
2020-10-15 12:37:39 -07:00
Nikhil Benesch
28774a6015 libgo: print reason code if throwing unwind exception fails
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-14 17:00:02 -07:00
Nikhil Benesch
dc570700be libgo: export NetBSD-specific types in mksysinfo.sh
The syscall package depends on many NetBSD-specific types on NetBSD.
Teach mksysinfo.sh to export these types.

This alone is not sufficient to get the syscall package to compile on
NetBSD, but it's a start.

Note that the IfMsgHdr type is recapitalized to IfMsghdr, which requires
changes in the AIX port. The new capitalization is what's used by
upstream in existing NetBSD-specific code and is more consistent with
the capitalization of other C structs with the "hdr" suffix.

Updates golang/go#38538.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261739
2020-10-14 13:56:01 -07:00
Nikhil Benesch
ca56d57624 runtime: correct semaphore implementation on netbsd
NetBSD's semaphores use the underlying lighweight process mechanism
(LWP) on NetBSD, rather than pthreads. This means the m.prodcid needs
to be set to the LWP ID rather than the pthread ID in order for unpark
notifications to get sent to the right place.

Introduce a new getProcID() method that selects the correct ID for the
platform.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261742
2020-10-14 13:56:01 -07:00