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
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
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
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.
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.
Fixesgolang/go#41428
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/294931
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
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
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
On AIX, duplication of type descriptors can occur if one is
declared in the libgo and one in the Go program being compiled.
The AIX linker isn't able to merge them together as Linux one does.
One solution is to always load libgo first but that needs a huge mechanism in
gcc core. Thus, this patch ensures that the duplication isn't visible
for the end user.
In reflect and internal/reflectlite, the comparison of rtypes is made on their
name and not only on their addresses.
In reflect, toType() function is using a canonicalization map to force rtypes
having the same rtype.String() to return the same Type. This can't be made in
internal/reflectlite as it needs sync package. But, for now, it doesn't matter
as internal/reflectlite is not widely used.
Fixesgolang/go#39276
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/260158
AIX-style libraries contains both 32 and 64 bit shared objects.
This patch follows the adding of FAT libraries support in other gcc
libraries (libgcc, listdc++, etc).
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/242957
This avoids problems finding libgo.so when running the test as root,
which invokes the test as a child process in various limited environments.
Fixes PR go/95061
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/233897
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
Restore Solaris compatibility fixes lost when internal/x/net/lif moved
to golang.org/x/net/lif. Also fix the Makefile for x/net/lif and
x/net/route.
Change x/sys/cpu to get the cache line size from goarch.sh as the
gofrontend version of internal/cpu does.
Partially based on work by Rainer Orth.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194438
From-SVN: r275611
The C file has a build tag, but the procedure we use for building C
files ignores build tags.
This should fix the libgo build on non-x86 systems.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194378
From-SVN: r275544
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
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
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
Currently, goroutine switches are implemented with libc
getcontext/setcontext functions, which saves/restores the machine
register states and also the signal context. This does more than
what we need, and performs an expensive syscall.
This CL implements a simplified version of getcontext/setcontext,
in assembly, that only saves/restores the necessary part, i.e.
the callee-save registers, and the PC, SP. A simplified version
of makecontext, written in C, is also added. Currently this is
only implemented on Linux/AMD64.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/178298
From-SVN: r271818
PR go/89172
internal/cpu, runtime, runtime/pprof: handle function descriptors
When using PPC64 ELF ABI v1 a function address is not a PC, but is the
address of a function descriptor. The first field in the function
descriptor is the actual PC (see
http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUNC-DES).
The libbacktrace library knows about this, and libgo uses actual PC
values consistently except for the helper function funcPC that appears
in both runtime and runtime/pprof.
This patch fixes funcPC by recording, in the internal/cpu package,
whether function descriptors are being used. We have to check for
function descriptors using a C compiler check, because GCC can be
configured using --with-abi to select the ELF ABI to use.
Fixes https://gcc.gnu.org/PR89172
Reviewed-on: https://go-review.googlesource.com/c/162978
From-SVN: r269266
GCC has supported the __atomic intrinsics since 4.7. They are better
than the __sync intrinsics in that they specify a memory model and,
more importantly for our purposes, they are reliably implemented
either in the compiler or in libatomic.
Fixes https://gcc.gnu.org/PR52084
Reviewed-on: https://go-review.googlesource.com/c/160820
From-SVN: r268458
Restore some of the fixes that were applied to golang_org/x/net/lif
but were lost when 1.12 moved the directory to internal/x/net/lif.
Add support for reading /proc to fetch argc/argv/env for c-archive mode.
Reviewed-on: https://go-review.googlesource.com/c/158640
From-SVN: r268130
Reviewed-on: https://go-review.googlesource.com/c/158019
gotools/:
* Makefile.am (go_cmd_vet_files): Update for Go1.12beta2 release.
(GOTOOLS_TEST_TIMEOUT): Increase to 600.
(check-runtime): Export LD_LIBRARY_PATH before computing GOARCH
and GOOS.
(check-vet): Copy golang.org/x/tools into check-vet-dir.
* Makefile.in: Regenerate.
gcc/testsuite/:
* go.go-torture/execute/names-1.go: Stop using debug/xcoff, which
is no longer externally visible.
From-SVN: r268084
PR bootstrap/82856
libgo: update to autoconf 2.69 and automake 1.15.1
Initial patch from Joseph Myers.
Reviewed-on: https://go-review.googlesource.com/c/146417
From-SVN: r265701
In internal/bytealg correct a +build tag to never build indexbyte_generic.go
for the gofrontend, where we always use indexbyte_native.go.
For internal/cpu let the Makefile define CacheLineSize using goarch.sh,
rather than trying to enumerate all the possibilities in cpu_ARCH.go files.
In internal/poll call the C fcntl function rather than using SYS_FCNTL.
Change mksysinfo.sh to ensure that F_GETPIPE_SZ is always defined,
and check that in internal/poll.
Reviewed-on: https://go-review.googlesource.com/137256
From-SVN: r264572