libgo patch committed: Use in runtime/runtime.h
This libgo patch changes runtime/runtime.h to use the C99 header file rather than defining a bool type and true/false constants itself. C99 was a long time ago and in case this file is always compiled by the newly built GCC. This should fix GCC PR 114875. Bootstrapped on x86_64-pc-linux-gnu. Committed to mainline. Ian ef246d48fd487805f1c4181c7482545c54a4d4a9 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 50d430d5034..8a2810d5b2d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -98e92493db2ab7857a5934a950a830fc1f95a4e5 +1f0c8364cd35026a647aa4e66ee4d8563c8a5d27 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index 699770d53ad..da31e11bb77 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -7,6 +7,7 @@ #include "go-assert.h" #include #include +#include #include #include #include @@ -51,7 +52,6 @@ typedef uintptr uintreg; /* Defined types. */ -typedef_Bool bool; typedefuint8 byte; typedefstruct g G; typedefstruct mutex Lock; @@ -114,11 +114,6 @@ extern M* runtime_m(void); extern G* runtime_g(void) __asm__(GOSYM_PREFIX "runtime.getg"); -enum -{ - true= 1, - false = 0, -}; enum { PtrSize = sizeof(void*),
libgo patch committed: Bump version number
This libgo patch bumps the version number for the GCC 14 release. This is for GCC PR 113668. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 7b0597eba6b29387b56b8d6a4b38f3586e6b49a5 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index ec7e2ab1acf..73cb095322c 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -1cb83a415e86ab4de0d436d277377d8fc060cb61 +e15a14e410b8fc5d28012d5b313cb6c8476c7df9 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/configure.ac b/libgo/configure.ac index 22158ac7f5d..898091276f7 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -10,7 +10,7 @@ AC_INIT(package-unused, version-unused,, libgo) AC_CONFIG_SRCDIR(Makefile.am) AC_CONFIG_HEADER(config.h) -libtool_VERSION=22:0:0 +libtool_VERSION=23:0:0 AC_SUBST(libtool_VERSION) AM_ENABLE_MULTILIB(, ..)
libgo patch committed: Better error messages for unsupported target
This libgo patch generates better error messages then the Go GOARCH and GOOS values can't be determined from the target. This indicates that the target is not supported. This is for GCC PR 113530. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian cfc6d9ae8143cf0e903384bc63e8d659ca1c9fe7 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 18281c6cd1e..429904a2b8f 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -7ab229670f7dad1d79f33929f9a4f8e6e4a71526 +8c056e335cecec67d1d223a329b7ba4dac778a65 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index c95dc2106cd..3eccadbac67 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -497,6 +497,10 @@ s-version: Makefile zgoarch.go: s-zgoarch; @true s-zgoarch: Makefile goarch.sh rm -f zgoarch.go.tmp + if ! $(SHELL) $(srcdir)/goarch.sh $(GOARCH) family >/dev/null 2>/dev/null; then \ + $(SHELL) $(srcdir)/goarch.sh $(GOARCH) family; \ + exit 1; \ + fi echo "package goarch" > zgoarch.go.tmp echo >> zgoarch.go.tmp echo 'const GOARCH = "'$(GOARCH)'"' >> zgoarch.go.tmp diff --git a/libgo/configure.ac b/libgo/configure.ac index e8d66f8415d..22158ac7f5d 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -209,6 +209,10 @@ AM_CONDITIONAL(LIBGO_IS_BSD, test $is_darwin = yes -o $is_dragonfly = yes -o $is AC_SUBST(GOOS) AC_SUBST(ALLGOOS) +if test "${GOOS}" = "unknown"; then + AC_MSG_ERROR("could not determine GOOS from ${host}") +fi + dnl Test whether we need to use DejaGNU or whether we can use the dnl simpler gotest approach. We can only use gotest for a native dnl build. @@ -376,6 +380,10 @@ AC_SUBST(GOARCH) AC_SUBST(ALLGOARCH) AC_SUBST(ALLGOARCHFAMILY) +if test "${GOARCH}" = "unknown"; then + AC_MSG_ERROR("could not determine GOARCH from ${host}") +fi + AM_CONDITIONAL(LIBGO_IS_X86, test "$GOARCH" = "386" -o "$GOARCH" = "amd64" -o "$GOARCH" = "amd64p32") FUNCTION_DESCRIPTORS=false
libgo patch committed: Add missing type conversion
This libgo patch adds a missing type conversion. 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. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 2621bd1bac614b63e52d0deb4ab2ff287a9fafa8 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 398d2671b64..0f961157dfd 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -c201fa2a684ada551ca9a0825a3075a0a69498de +081ec9824a74ec9d82628d8d2f6b9a7a4c35a529 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go index 9f688e2a0c7..02f228adc59 100644 --- a/libgo/go/syscall/errstr.go +++ b/libgo/go/syscall/errstr.go @@ -24,7 +24,7 @@ func Errstr(errnum int) string { } return string(b[:i]) } - if errno != ERANGE { + if Errno(errno) != ERANGE { return "strerror_r failure" } }
libgo patch committed: permit $AR to include options
This libgo patch changes the go tool to permit the AR environment variable to include options. This mirrors the way it already handles 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. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian dab7163feedc99bd94549ee490031f86f8d0a6ca diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 83ab3e2d64c..30710e856cb 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d04b024021bb7dbaa434a6d902bd12beb08e315f +53cdfab53ce79d8dfc1df01a696d4ffc43f17c3d The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/cmd/go/internal/work/gccgo.go b/libgo/go/cmd/go/internal/work/gccgo.go index c1026c71e01..3e07f8791eb 100644 --- a/libgo/go/cmd/go/internal/work/gccgo.go +++ b/libgo/go/cmd/go/internal/work/gccgo.go @@ -45,12 +45,8 @@ func (gccgoToolchain) linker() string { return GccgoBin } -func (gccgoToolchain) ar() string { - ar := cfg.Getenv("AR") - if ar == "" { - ar = "ar" - } - return ar +func (gccgoToolchain) ar() []string { + return envList("AR", "ar") } func checkGccgoBin() {
Re: [gofrontend-dev] Re: libgo patch committed: Use a C function to call mmap
On Tue, Jun 20, 2023 at 3:37 PM Ian Lance Taylor wrote: > On Tue, Jun 20, 2023 at 11:35 AM Andreas Schwab > wrote: > > > > On Jun 20 2023, Ian Lance Taylor via Gcc-patches wrote: > > > > > This libgo patches changes the runtime pacakge to use a C function to > call mmap. > > > > > > The final argument to mmap, of type off_t, varies. In > > > https://go.dev/cl/445375 > > > (https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604158.html) > > > we changed it to always use the C off_t type, but that broke 32-bit > > > big-endian Linux systems. > > > > This has nothing to do with big-endian, armv7 isn't big-endian. > > OK, but I think that it does have something to do with big-endian. > The bug was that on some 32-bit systems it was passing a 64-bit value > to a function that expected a 32-bit value. The problem didn't show > up on 32-bit x86 because it is little-endian, and did show up on > 32-bit PPC because it is big-endian. I guess the armv7 case was > failing for a different reason. I think there is a calling convention issue. On 32-bit ARM, for the case of mmap, if the last argument is 32-bit, it is passed 4 bytes at sp+4. If it is 64-bit, the offset is aligned and it is stored as 8 bytes at sp+8. So if the callee tries to read at sp+4, it gets the wrong value, even for little endian. On 32-bit x86 it doesn't seem to have that alignment padding.
Re: libgo patch committed: Use a C function to call mmap
On Jun 20 2023, Ian Lance Taylor wrote: > OK, but I think that it does have something to do with big-endian. > The bug was that on some 32-bit systems it was passing a 64-bit value > to a function that expected a 32-bit value. The problem didn't show > up on 32-bit x86 because it is little-endian, and did show up on > 32-bit PPC because it is big-endian. I guess the armv7 case was > failing for a different reason. Not failing is no proof for correctness. It fails everywhere for the same reason. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: libgo patch committed: Use a C function to call mmap
On Tue, Jun 20, 2023 at 11:35 AM Andreas Schwab wrote: > > On Jun 20 2023, Ian Lance Taylor via Gcc-patches wrote: > > > This libgo patches changes the runtime pacakge to use a C function to call > > mmap. > > > > The final argument to mmap, of type off_t, varies. In > > https://go.dev/cl/445375 > > (https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604158.html) > > we changed it to always use the C off_t type, but that broke 32-bit > > big-endian Linux systems. > > This has nothing to do with big-endian, armv7 isn't big-endian. OK, but I think that it does have something to do with big-endian. The bug was that on some 32-bit systems it was passing a 64-bit value to a function that expected a 32-bit value. The problem didn't show up on 32-bit x86 because it is little-endian, and did show up on 32-bit PPC because it is big-endian. I guess the armv7 case was failing for a different reason. Ian
Re: libgo patch committed: Use a C function to call mmap
On Jun 20 2023, Ian Lance Taylor via Gcc-patches wrote: > This libgo patches changes the runtime pacakge to use a C function to call > mmap. > > The final argument to mmap, of type off_t, varies. In > https://go.dev/cl/445375 > (https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604158.html) > we changed it to always use the C off_t type, but that broke 32-bit > big-endian Linux systems. This has nothing to do with big-endian, armv7 isn't big-endian. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
libgo patch committed: Use a C function to call mmap
This libgo patches changes the runtime pacakge to use a C function to call mmap. The final argument to mmap, of type off_t, varies. In https://go.dev/cl/445375 (https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604158.html) 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 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. This fixes https://gcc.gnu.org/PR110297. Bootstrapped and tested on x86_64-pc-linux-gnu and powerpc-pc-linux-gnu (32-bit and 64-bit). Committed to trunk and GCC 13 branch. Ian 7f5a6c8a27190daf9daadf5e9f14ef5f4ece diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 1191a8d663d..dbb2d68f909 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a3a3c3a2d1bc6a8ca51b302d08c94ef27cdd8f0f +6a1d165c2218cd127ee937a1f45599075762f716 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 207d5a98127..920f8cc7071 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -462,6 +462,7 @@ runtime_files = \ runtime/go-memclr.c \ runtime/go-memmove.c \ runtime/go-memequal.c \ + runtime/go-mmap.c \ runtime/go-nanotime.c \ runtime/go-now.c \ runtime/go-nosys.c \ diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go index 1e84f4f5c56..e7b51ff37cc 100644 --- a/libgo/go/runtime/mem_gccgo.go +++ b/libgo/go/runtime/mem_gccgo.go @@ -14,8 +14,8 @@ import ( //go:linkname sysAlloc //go:linkname sysFree -//extern mmap -func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _libgo_off_t_type) unsafe.Pointer +//extern __go_mmap +func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer //extern munmap func munmap(addr unsafe.Pointer, length uintptr) int32 @@ -38,7 +38,7 @@ func init() { } func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) { - p := sysMmap(addr, n, prot, flags, fd, _libgo_off_t_type(off)) + p := sysMmap(addr, n, prot, flags, fd, off) if uintptr(p) == _MAP_FAILED { return nil, errno() } diff --git a/libgo/runtime/go-mmap.c b/libgo/runtime/go-mmap.c new file mode 100644 index 000..b2327ba68f5 --- /dev/null +++ b/libgo/runtime/go-mmap.c @@ -0,0 +1,21 @@ +/* go-mmap.c -- functions for calling C mmap functions. + + Copyright 2023 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. */ + +#include "config.h" + +#include +#include + +/* The exact C function to call varies between mmap and mmap64, and + the size of the off_t argument also varies. Here we provide a + function that Go code can call with consistent types. */ + +void * +__go_mmap(void *addr, uintptr_t length, int32_t prot, int32_t flags, + int32_t fd, uintptr_t offset) +{ + return mmap(addr, length, prot, flags, fd, offset); +} diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index b3dc4fd2414..699770d53ad 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -355,9 +355,6 @@ boolruntime_notetsleepg(Note*, int64) // false - timeout /* * low level C-called */ -#define runtime_mmap mmap -#define runtime_munmap munmap -#define runtime_madvise madvise #define runtime_memclr(buf, size) __builtin_memset((buf), 0, (size)) #define runtime_getcallerpc() __builtin_return_address(0)
libgo patch committed: Add benchmarks and examples to test list
In https://go.dev/cl/384695 (https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590289.html) I simplified the code that built lists of benchmarks, examples, and fuzz tests, and managed to break it. This patch 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. This fixes https://go.dev/issue/60826. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian bc6bd0d608da1609c1caeb04ab795a83720add55 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 702257009d2..1191a8d663d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -737de90a63002d4872b19772a7116404ee5815b4 +a3a3c3a2d1bc6a8ca51b302d08c94ef27cdd8f0f The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/internal/fuzz/encoding_test.go b/libgo/go/internal/fuzz/encoding_test.go index 8e3800eb77f..53fc5b8dc71 100644 --- a/libgo/go/internal/fuzz/encoding_test.go +++ b/libgo/go/internal/fuzz/encoding_test.go @@ -6,6 +6,7 @@ package fuzz import ( "math" + "runtime" "strconv" "testing" "unicode" @@ -330,6 +331,14 @@ func FuzzFloat64RoundTrip(f *testing.F) { f.Add(math.Float64bits(math.Inf(-1))) f.Fuzz(func(t *testing.T, u1 uint64) { + // The signaling NaN test fails on 32-bit x86 with gccgo, + // which uses the 387 floating-point stack by default. + // Converting a signaling NaN in and out of the stack + // changes the NaN to a quiet NaN. + if runtime.GOARCH == "386" && u1 == 0x7FF1 { + t.Skip("skipping signalling NaN test on 386 with gccgo") + } + x1 := math.Float64frombits(u1) b := marshalCorpusFile(x1) diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 0a0a7e14d74..33c98d804d6 100755 --- a/libgo/testsuite/gotest +++ b/libgo/testsuite/gotest @@ -577,13 +577,13 @@ symtogo() { # Find Go benchmark/fuzz/example functions. # The argument is the function name prefix. findfuncs() { - pattern='$1([^a-z].*)?' + pattern="$1([^a-z].*)?" syms=$($NM -p -v _gotest_.o | egrep " $text .*\."$pattern'$' | fgrep -v ' __go_' | egrep -v '\.\.\w+$' | sed 's/.* //') if $havex; then xsyms=$($NM -p -v $xofile | egrep " $text .*\."$pattern'$' | fgrep -v ' __go_' | egrep -v '\.\.\w+$' | sed 's/.* //') syms="$syms $xsyms" fi -$(symtogo "$benchmarksyms") +symtogo "$syms" } # Takes an example name and puts any output into the file example.txt. @@ -643,11 +643,13 @@ exampleoutput() { fi if $havex; then needxtest=false - if test -n "$testxsyms" -o -n "$benchmarkxsyms"; then + if test -n "$testxsyms"; then + needxtest=true + elif echo "$benchmarks" | grep '_test\.' >/dev/null; then needxtest=true else # Check whether any example has output. - for i in $(symtogo "$examplexsyms"); do + for i in $(echo "$examples" | grep '_test\.'); do exampleoutput $i if test -f example.txt; then rm -f example.txt
libgo patch committed: Add syscall.prlimit
As of https://go.dev/cl/476695 the package golang.org/x/sys/unix expects a syscall.prlimit function to exist. This libgo patch adds that function. This is for https://go.dev/issue/46279 and https://go.dev/issue/59712. Since this is a small patch and is needed to compile the widely used x/sys/unix package, committed to tip and to GCC 11, 12, and 13 branches. Ian ba8160449c646138a3a9e1723ac1db0716a8b103 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e133650ad91..702257009d2 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -0411a2733fd468e69f1998edd91e8fe3ba40ff9e +737de90a63002d4872b19772a7116404ee5815b4 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go index 19ae4393cf1..03ca7261b59 100644 --- a/libgo/go/syscall/libcall_linux.go +++ b/libgo/go/syscall/libcall_linux.go @@ -189,6 +189,14 @@ func Gettid() (tid int) { //sys PivotRoot(newroot string, putold string) (err error) //pivot_root(newroot *byte, putold *byte) _C_int +// Used by golang.org/x/sys/unix. +//sys prlimit(pid int, resource int, newlimit *Rlimit, oldlimit *Rlimit) (err error) +//prlimit(pid Pid_t, resource _C_int, newlimit *Rlimit, oldlimit *Rlimit) _C_int + +func Prlimit(pid int, resource int, newlimit *Rlimit, oldlimit *Rlimit) error { + return prlimit(pid, resource, newlimit, oldlimit) +} + //sys Removexattr(path string, attr string) (err error) //removexattr(path *byte, name *byte) _C_int
libgo patch committed: Remove test ordering dependency in mime
This libgo patch removes a test ordering dependency in the mime package. This is a backport of https://go.dev/cl/421442 from the upstream repo. This fixes https://go.dev/issue/51648. Bootstrapped and ran mime tests on x86_64-pc-linux-gnu. Committed to mainline. Ian f22c12d7361d22d47cce73d342edf2e1ebf20520 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index addef6f8f51..e133650ad91 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -63ba7dd52f2cc49dab4b70ac81309296a920d4dc +0411a2733fd468e69f1998edd91e8fe3ba40ff9e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/mime/type_test.go b/libgo/go/mime/type_test.go index 5e4d25cc872..5769c6a55de 100644 --- a/libgo/go/mime/type_test.go +++ b/libgo/go/mime/type_test.go @@ -14,7 +14,10 @@ import ( func setMimeInit(fn func()) (cleanup func()) { once = sync.Once{} testInitMime = fn - return func() { testInitMime = nil } + return func() { + testInitMime = nil + once = sync.Once{} + } } func clearMimeTypes() { diff --git a/libgo/go/mime/type_unix_test.go b/libgo/go/mime/type_unix_test.go index 4d109aa71a2..43db44b7aa1 100644 --- a/libgo/go/mime/type_unix_test.go +++ b/libgo/go/mime/type_unix_test.go @@ -11,6 +11,7 @@ import ( ) func initMimeUnixTest(t *testing.T) { + once.Do(initMime) err := loadMimeGlobsFile("testdata/test.types.globs2") if err != nil { t.Fatal(err)
libgo patch committed: Bump major version
This libgo patch bumps the major version. The current version is the same as for GCC 12, but there have been minor changes like new type descriptors that make it impossible to run Go programs built with GCC 12 with the current GCC. This fixes https://gcc.gnu.org/PR108057. Bootstrapped on x86_64-pc-linux-gnu. Committed to mainline. Ian 3c2e866832dd5612de1468807bc144e4824593c7 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a26f779557d..d8c4e02d6e6 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -1c5bfd57131b68b91d8400bb017f35d416f7aa7b +9906861dc86c1733bb304d3d45b1534adb32712c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/configure.ac b/libgo/configure.ac index 274fcfc35c7..09554a37a23 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -10,7 +10,7 @@ AC_INIT(package-unused, version-unused,, libgo) AC_CONFIG_SRCDIR(Makefile.am) AC_CONFIG_HEADER(config.h) -libtool_VERSION=21:0:0 +libtool_VERSION=22:0:0 AC_SUBST(libtool_VERSION) AM_ENABLE_MULTILIB(, ..)
libgo patch committed: Synchronize empty struct field handling
This libgo patch by Funan Zeng synchronizes the handling of empty struct fields between the Go frontend and the libgo FFI code. In the compiler the logic for allocating one byte for the last field of a struct 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 patch adds the last two conditions to runtime.structToFFI. This is for https://go.dev/issue/55146. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 085bacba3502ff77c70a7660c19a68f50e9b7877 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index f7a7985287d..73aa712dbdf 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -42efec8c126cf3787bc7c89d9c7f224eff7c5a21 +0140cca9bc0fad1108c7ed369376ac71cc4bfecf The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/ffi.go b/libgo/go/runtime/ffi.go index cd8479ef551..86ce5b85d04 100644 --- a/libgo/go/runtime/ffi.go +++ b/libgo/go/runtime/ffi.go @@ -4,6 +4,7 @@ // Only build this file if libffi is supported. +//go:build libffi // +build libffi package runtime @@ -221,9 +222,6 @@ func stringToFFI() *__ffi_type { // structToFFI returns an ffi_type for a Go struct type. func structToFFI(typ *structtype) *__ffi_type { c := len(typ.fields) - if c == 0 { - return emptyStructToFFI() - } if typ.typ.kind != 0 { return ffi_type_pointer() } @@ -231,6 +229,7 @@ func structToFFI(typ *structtype) *__ffi_type { fields := make([]*__ffi_type, 0, c+1) checkPad := false lastzero := false + sawnonzero := false for i, v := range typ.fields { // Skip zero-sized fields; they confuse libffi, // and there is no value to pass in any case. @@ -239,10 +238,13 @@ func structToFFI(typ *structtype) *__ffi_type { // next field. if v.typ.size == 0 { checkPad = true - lastzero = true + if v.name == nil || *v.name != "_" { + lastzero = true + } continue } lastzero = false + sawnonzero = true if checkPad { off := uintptr(0) @@ -263,6 +265,10 @@ func structToFFI(typ *structtype) *__ffi_type { fields = append(fields, typeToFFI(v.typ)) } + if !sawnonzero { + return emptyStructToFFI() + } + if lastzero { // The compiler adds one byte padding to non-empty struct ending // with a zero-sized field (types.cc:get_backend_struct_fields).
libgo patch committed: Add cgo.Incomplete
This libgo patch changes the cgo command to use runtime/cgo.Incomplete instead of //go:notinheap, and to define the new type in the runtime/cgo package. This ports https://go.dev/cl/421879 to libgo. This is a quick port to update libgo 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. Bootstrapped and tested on x86_64-pc-linux-gnu. Committed to mainline. Ian c69b87678d3c4e9b995b8ccb51fb38c75a134323 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index dce38e727a7..f7a7985287d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -6543b7fc6da533eb976b37649a925e7fd5a521fa +42efec8c126cf3787bc7c89d9c7f224eff7c5a21 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/cmd/cgo/gcc.go b/libgo/go/cmd/cgo/gcc.go index 02391495bbe..e786aeaafa9 100644 --- a/libgo/go/cmd/cgo/gcc.go +++ b/libgo/go/cmd/cgo/gcc.go @@ -132,12 +132,11 @@ func (p *Package) addToFlag(flag string, args []string) { // // For example, the following string: // -// `a b:"c d" 'e''f' "g\""` +// `a b:"c d" 'e''f' "g\""` // // Would be parsed as: // -// []string{"a", "b:c d", "ef", `g"`} -// +// []string{"a", "b:c d", "ef", `g"`} func splitQuoted(s string) (r []string, err error) { var args []string arg := make([]rune, len(s)) @@ -1156,13 +1155,19 @@ func (p *Package) mangle(f *File, arg *ast.Expr, addPosition bool) (ast.Expr, bo // checkIndex checks whether arg has the form [i], possibly inside // type conversions. If so, then in the general case it writes -//_cgoIndexNN := a -//_cgoNN := [i] // with type conversions, if any +// +// _cgoIndexNN := a +// _cgoNN := [i] // with type conversions, if any +// // to sb, and writes -//_cgoCheckPointer(_cgoNN, _cgoIndexNN) +// +// _cgoCheckPointer(_cgoNN, _cgoIndexNN) +// // to sbCheck, and returns true. If a is a simple variable or field reference, // it writes -//_cgoIndexNN := +// +// _cgoIndexNN := +// // and dereferences the uses of _cgoIndexNN. Taking the address avoids // making a copy of an array. // @@ -1210,10 +1215,14 @@ func (p *Package) checkIndex(sb, sbCheck *bytes.Buffer, arg ast.Expr, i int) boo // checkAddr checks whether arg has the form , possibly inside type // conversions. If so, it writes -//_cgoBaseNN := -//_cgoNN := _cgoBaseNN // with type conversions, if any +// +// _cgoBaseNN := +// _cgoNN := _cgoBaseNN // with type conversions, if any +// // to sb, and writes -//_cgoCheckPointer(_cgoBaseNN, true) +// +// _cgoCheckPointer(_cgoBaseNN, true) +// // to sbCheck, and returns true. This tells _cgoCheckPointer to check // just the contents of the pointer being passed, not any other part // of the memory allocation. This is run after checkIndex, which looks @@ -2131,8 +2140,8 @@ type typeConv struct { // Type names X for which there exists an XGetTypeID function with type func() CFTypeID. getTypeIDs map[string]bool - // badStructs contains C structs that should be marked NotInHeap. - notInHeapStructs map[string]bool + // incompleteStructs contains C structs that should be marked Incomplete. + incompleteStructs map[string]bool // Predeclared types. bool ast.Expr @@ -2145,7 +2154,6 @@ type typeConv struct { string ast.Expr goVoid ast.Expr // _Ctype_void, denotes C's void goVoidPtr ast.Expr // unsafe.Pointer or *byte - goVoidPtrNoHeapast.Expr // *_Ctype_void_notinheap, like goVoidPtr but marked NotInHeap ptrSize int64 intSize int64 @@ -2169,7 +2177,7 @@ func (c *typeConv) Init(ptrSize, intSize int64) { c.m = make(map[string]*Type) c.ptrs = make(map[string][]*Type) c.getTypeIDs = make(map[string]bool) - c.notInHeapStructs = make(map[string]bool) + c.incompleteStructs = make(map[string]bool) c.bool = c.Ident("bool") c.byte = c.Ident("byte") c.int8 = c.Ident("int8") @@ -2188,7 +2196,6 @@ func (c *typeConv) Init(ptrSize, intSize int64) { c.void = c.Ident("void") c.string = c.Ident("string") c.goVoid = c.Ident("_Ctype_void") - c.goVoidPtrNoHeap = c.Ident("*_Ctype_void_notinheap") // Normally cgo translates void* to unsafe.Pointer, // but for historical reasons -godefs uses *byte instead. @@ -2531,19 +2538,13 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ // other than try to determine a Go representation. tt := *t tt.C = {"%s %s",
Re: libgo patch committed: Make runtime.Version return a useful value
On Tue, Jun 28, 2022 at 10:20 AM Ian Lance Taylor wrote: > > This libgo patch makes runtime.Version return a meaningful string. > This also means that "go version" will print something useful, e.g., > > go version go1.18 gccgo (GCC) 12.0.1 20220216 (experimental) linux/amd64 > > This fixes https://go.dev/issue/51850. > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > to mainline. I've committed this to the GCC 12 branch, for PR 106747. Ian
Re: libgo patch committed: Ignore __morestack in runtime.Callers
On Tue, Sep 6, 2022 at 6:40 PM Ian Lance Taylor wrote: > > This libgo patch ignores the __morestack function in runtime.Callers. > We were ignoring all functions starting with "__morestack_", but not > the function "__morestack" itself. Without this change, some tests > such as recover.go started failing recently, though I'm not sure > exactly what changed. Bootstrapped and ran Go testsuite on > x86_64-pc-linux-gnu. Committed to mainline. I've also committed this patch to GCC 12 branch. Ian
libgo patch committed: Ignore __morestack in runtime.Callers
This libgo patch ignores the __morestack function in runtime.Callers. We were ignoring all functions starting with "__morestack_", but not the function "__morestack" itself. Without this change, some tests such as recover.go started failing recently, though I'm not sure exactly what changed. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian c0852b51b7a68ada822955eb7ef83d933cc33e47 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index ca797045d66..dce38e727a7 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d53e8a0e94e34dc609e34dd5e404debda2640cfb +6543b7fc6da533eb976b37649a925e7fd5a521fa The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c index 31783696a08..1d4dee66279 100644 --- a/libgo/runtime/go-callers.c +++ b/libgo/runtime/go-callers.c @@ -107,7 +107,7 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno, p = function; if (__builtin_strncmp (p, "___", 3) == 0) ++p; - if (__builtin_strncmp (p, "__morestack_", 12) == 0) + if (__builtin_strncmp (p, "__morestack", 11) == 0) return 0; } else if (filename != NULL)
Re: libgo patch committed: Don't include in sysinfo.c
On Thu, Jul 21, 2022 at 4:53 AM Martin Liška wrote: > > On 7/21/22 12:19, Richard Biener via Gcc-patches wrote: > > On Wed, Jul 13, 2022 at 6:03 PM Ian Lance Taylor via Gcc-patches > > wrote: > >> > >> This libgo patch stops including 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. This should fix GCC PR 106266. Bootstrapped and > >> ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. > > > > Btw, active branches are affected the same way - can you please backport? > > I've just done that. Thanks. Ian
Re: libgo patch committed: Don't include in sysinfo.c
On 7/21/22 12:19, Richard Biener via Gcc-patches wrote: > On Wed, Jul 13, 2022 at 6:03 PM Ian Lance Taylor via Gcc-patches > wrote: >> >> This libgo patch stops including 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. This should fix GCC PR 106266. Bootstrapped and >> ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. > > Btw, active branches are affected the same way - can you please backport? I've just done that. Martin > >> Ian
Re: libgo patch committed: Don't include in sysinfo.c
On Wed, Jul 13, 2022 at 6:03 PM Ian Lance Taylor via Gcc-patches wrote: > > This libgo patch stops including 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. This should fix GCC PR 106266. Bootstrapped and > ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Btw, active branches are affected the same way - can you please backport? > Ian
libgo patch committed: Don't include in sysinfo.c
This libgo patch stops including 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. This should fix GCC PR 106266. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 9b487dbc298242fdde127e7827e728545c308aac diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 7c5c45672d7..5ea0406cd8e 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d295a0a2c96c0f7c3abd94fea3aa4e2303bf2af2 +ff68b1a147eb60082fd60c198db0ef5477ade938 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c index a4259c02ded..fc0210992fa 100644 --- a/libgo/sysinfo.c +++ b/libgo/sysinfo.c @@ -158,9 +158,6 @@ #if defined(HAVE_LINUX_ETHER_H) #include #endif -#if defined(HAVE_LINUX_FS_H) -#include -#endif #if defined(HAVE_LINUX_REBOOT_H) #include #endif
libgo patch committed: Make runtime.Version return a useful value
This libgo patch makes runtime.Version return a meaningful string. This also means that "go version" will print something useful, e.g., go version go1.18 gccgo (GCC) 12.0.1 20220216 (experimental) linux/amd64 This fixes https://go.dev/issue/51850. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 0d8541c7c906c92c750c779958beafb0e0dbfe47 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a0e386ab4f6..551ea650acf 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -28fe9fad4acb4e02083faf5503b06e3e6e8eecaf +d5b4abed2f206e492890acc20738e89617ea542c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index a5d4b6a3525..b03e6553e90 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -568,6 +568,7 @@ s-goroot: Makefile rm -f goroot.go.tmp echo "package runtime" > goroot.go.tmp echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp + echo 'var buildVersion = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> goroot.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go $(STAMP) $@ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 22f48a52938..16ed62a82ed 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -2780,6 +2780,7 @@ s-goroot: Makefile rm -f goroot.go.tmp echo "package runtime" > goroot.go.tmp echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp + echo 'var buildVersion = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> goroot.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go $(STAMP) $@ diff --git a/libgo/go/runtime/extern.go b/libgo/go/runtime/extern.go index a371d9c0ee0..8e226147965 100644 --- a/libgo/go/runtime/extern.go +++ b/libgo/go/runtime/extern.go @@ -231,16 +231,6 @@ func GOROOT() string { return defaultGOROOT } -// buildVersion is the Go tree's version string at build time. -// -// If any GOEXPERIMENTs are set to non-default values, it will include -// "X:". -// -// This is set by the linker. -// -// This is accessed by "go version ". -var buildVersion string - // Version returns the Go tree's version string. // It is either the commit hash and date at the time of the build or, // when possible, a release tag like "go1.3".
libgo patch committed: Format the syscall package
This Go formatter is starting to format documentation comments in some cases. As a step toward that in libgo, this patch adds blank lines after //sys comments in the syscall package where needed, and then runs the new formatter on the syscall package files. This is the libgo version of https://go.dev/cl/407136. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 3f4a86eef4ebc28e394a7108a2353098d2ca4856 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 2cf7141c4fa..aeada9f8d0c 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -0058658a9efb6e5c5faa6f0f65949beea5ddbc98 +bbb3a4347714faee620dc205674510a0f20b81ae The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/dir_plan9.go b/libgo/go/syscall/dir_plan9.go index 4ed052de761..1667cbc02f4 100644 --- a/libgo/go/syscall/dir_plan9.go +++ b/libgo/go/syscall/dir_plan9.go @@ -184,6 +184,7 @@ func gbit8(b []byte) (uint8, []byte) { } // gbit16 reads a 16-bit number in little-endian order from b and returns it with the remaining slice of b. +// //go:nosplit func gbit16(b []byte) (uint16, []byte) { return uint16(b[0]) | uint16(b[1])<<8, b[2:] diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go index 6c2441d364d..59f7a82c6d7 100644 --- a/libgo/go/syscall/errstr.go +++ b/libgo/go/syscall/errstr.go @@ -4,8 +4,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !hurd -// +build !linux +//go:build !hurd && !linux +// +build !hurd,!linux package syscall diff --git a/libgo/go/syscall/errstr_glibc.go b/libgo/go/syscall/errstr_glibc.go index 5b19e6f202d..03a327dbc90 100644 --- a/libgo/go/syscall/errstr_glibc.go +++ b/libgo/go/syscall/errstr_glibc.go @@ -7,6 +7,7 @@ // We use this rather than errstr.go because on GNU/Linux sterror_r // returns a pointer to the error message, and may not use buf at all. +//go:build hurd || linux // +build hurd linux package syscall diff --git a/libgo/go/syscall/exec_bsd.go b/libgo/go/syscall/exec_bsd.go index 86e513efdea..e631593cbd9 100644 --- a/libgo/go/syscall/exec_bsd.go +++ b/libgo/go/syscall/exec_bsd.go @@ -49,6 +49,7 @@ func runtime_AfterForkInChild() // For the same reason compiler does not race instrument it. // The calls to RawSyscall are okay because they are assembly // functions that do not grow the stack. +// //go:norace func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { // Declare all variables at top in case any diff --git a/libgo/go/syscall/exec_freebsd.go b/libgo/go/syscall/exec_freebsd.go index f02f89d1ca0..8e8ecb7e989 100644 --- a/libgo/go/syscall/exec_freebsd.go +++ b/libgo/go/syscall/exec_freebsd.go @@ -57,6 +57,7 @@ func runtime_AfterForkInChild() // For the same reason compiler does not race instrument it. // The calls to RawSyscall are okay because they are assembly // functions that do not grow the stack. +// //go:norace func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { // Declare all variables at top in case any diff --git a/libgo/go/syscall/exec_hurd.go b/libgo/go/syscall/exec_hurd.go index 06df513c55c..a62b3e920e6 100644 --- a/libgo/go/syscall/exec_hurd.go +++ b/libgo/go/syscall/exec_hurd.go @@ -49,6 +49,7 @@ func runtime_AfterForkInChild() // For the same reason compiler does not race instrument it. // The calls to RawSyscall are okay because they are assembly // functions that do not grow the stack. +// //go:norace func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { // Declare all variables at top in case any diff --git a/libgo/go/syscall/exec_linux.go b/libgo/go/syscall/exec_linux.go index 86fb8e84a66..77846af89e4 100644 --- a/libgo/go/syscall/exec_linux.go +++ b/libgo/go/syscall/exec_linux.go @@ -80,6 +80,7 @@ func runtime_AfterFork() func runtime_AfterForkInChild() // Implemented in clone_linux.c +// //go:noescape func rawClone(flags _C_ulong, child_stack *byte, ptid *Pid_t, ctid *Pid_t, regs unsafe.Pointer) _C_long @@ -92,6 +93,7 @@ func rawClone(flags _C_ulong, child_stack *byte, ptid *Pid_t, ctid *Pid_t, regs // For the same reason compiler does not race instrument it. // The calls to RawSyscall are okay because they are assembly // functions that do not grow the stack. +// //go:norace func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { // Set up and fork. This returns immediately in the parent or diff --git a/libgo/go/syscall/exec_stubs.go b/libgo/go/syscall/exec_stubs.go index
libgo patch committed: Skip _FILE in mkruntimeinc
This libgo patch skips the _FILE struct in mkruntimeinc.sh. We don't need it, and it breaks uclibc. This should fix GCC PR 101246. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 59a20b189dcbda8d929503ae1b1f864535a27584 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 7778cd91235..e68d2d967cc 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -943b95876ca0f14c3cea7067d33170ba76cf0fab +787fd4475f9d9101bc138d0b9763b0f5ecca89a9 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/mkruntimeinc.sh b/libgo/mkruntimeinc.sh index 61d830af876..5ef3eca25cc 100755 --- a/libgo/mkruntimeinc.sh +++ b/libgo/mkruntimeinc.sh @@ -18,13 +18,14 @@ rm -f runtime.inc.tmp2 runtime.inc.tmp3 # sigset conflicts with system type sigset on AIX, so we need to rename it. # boundsError has a field name that is a C keyword, and we don't need it. # mSpanInuse is both a constant and a field name, and we don't need it. +# _FILE has incomplete __lock and __state fields on uclibc-ng. grep -v "#define _" ${IN} | grep -v "#define [cm][012345] " | grep -v "#define empty " | grep -v "#define \\$" | grep -v "#define mSpanInUse " > runtime.inc.tmp2 for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num do grep "#define $pattern" ${IN} >> runtime.inc.tmp2 done -TYPES="_Complex_lock _Reader_lock semt boundsError" +TYPES="_Complex_lock _Reader_lock semt boundsError _FILE" for TYPE in $TYPES do sed -e '/struct '${TYPE}' {/,/^}/s/^.*$//' runtime.inc.tmp2 > runtime.inc.tmp3;
libgo patch committed: move semaphore to gotool packages
This patch by Clément Chigot moves golang.org/x/sync/semaphore from the libgo packages to the gotools packages, since it is only used by gofmt. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian e71079517f16fee6759bad2be14f574c3548743e diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 5cf2ace711b..7778cd91235 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -34dece725f9f8826f4abe86209112626867bc716 +943b95876ca0f14c3cea7067d33170ba76cf0fab The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/gotool-packages.txt b/libgo/gotool-packages.txt index 78ce9ba602a..8e105030a7b 100644 --- a/libgo/gotool-packages.txt +++ b/libgo/gotool-packages.txt @@ -63,6 +63,7 @@ golang.org/x/mod/sumdb/dirhash golang.org/x/mod/sumdb/note golang.org/x/mod/sumdb/tlog golang.org/x/mod/zip +golang.org/x/sync/semaphore golang.org/x/tools/go/analysis golang.org/x/tools/go/analysis/internal/analysisflags golang.org/x/tools/go/analysis/internal/facts diff --git a/libgo/libgo-packages.txt b/libgo/libgo-packages.txt index cb2f19d61b3..6b722e1c3ec 100644 --- a/libgo/libgo-packages.txt +++ b/libgo/libgo-packages.txt @@ -95,7 +95,6 @@ golang.org/x/net/http/httpproxy golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/nettest -golang.org/x/sync/semaphore golang.org/x/sys/cpu golang.org/x/text/secure/bidirule golang.org/x/text/transform
libgo patch committed: Fix AIX build
This patch by Clément Chigot fixes the build of libgo on AIX, which was broken in the update to the Go 1.18 release. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 98a7a7b5275b226932f503cc1dcc21fd9a9f8476 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 424bbebfeed..5cf2ace711b 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -45fd14ab8baf5e86012a808426f8ef52c1d77943 +34dece725f9f8826f4abe86209112626867bc716 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/internal/syscall/unix/ioctl_aix.go b/libgo/go/internal/syscall/unix/ioctl_aix.go index af105d6158b..1a768048ba8 100644 --- a/libgo/go/internal/syscall/unix/ioctl_aix.go +++ b/libgo/go/internal/syscall/unix/ioctl_aix.go @@ -12,7 +12,7 @@ import ( //extern __go_ioctl_ptr func ioctl(int32, int32, unsafe.Pointer) int32 -func Ioctl(fd int, cmd int, args uintptr) (err error) { +func Ioctl(fd int, cmd int, args unsafe.Pointer) (err error) { if ioctl(int32(fd), int32(cmd), unsafe.Pointer(args)) < 0 { return syscall.GetErrno() } diff --git a/libgo/go/os/user/listgroups_unix.go b/libgo/go/os/user/listgroups_unix.go index b3cf839b3ec..af9b544bcbe 100644 --- a/libgo/go/os/user/listgroups_unix.go +++ b/libgo/go/os/user/listgroups_unix.go @@ -14,7 +14,6 @@ import ( "io" "os" "strconv" - "syscall" ) const groupFile = "/etc/group" diff --git a/libgo/go/runtime/malloc.go b/libgo/go/runtime/malloc.go index e5ab8dedafa..7c019ee42d3 100644 --- a/libgo/go/runtime/malloc.go +++ b/libgo/go/runtime/malloc.go @@ -321,7 +321,7 @@ const ( // // On other platforms, the user address space is contiguous // and starts at 0, so no offset is necessary. - arenaBaseOffset = 0x8000*goarch.IsAmd64 + 0x0a00*goos.IsAix + arenaBaseOffset = 0x8000*goarch.IsAmd64 + 0x0a00*goos.IsAix*goarch.IsPpc64 // A typed version of this constant that will make it into DWARF (for viewcore). arenaBaseOffsetUintptr = uintptr(arenaBaseOffset) diff --git a/libgo/go/runtime/os_aix.go b/libgo/go/runtime/os_aix.go index d43765ab884..943cd2205d1 100644 --- a/libgo/go/runtime/os_aix.go +++ b/libgo/go/runtime/os_aix.go @@ -7,7 +7,6 @@ package runtime import ( - "internal/abi" "unsafe" )
libgo patch committed: Update README.gcc
I committed this libgo patch to update the README.gcc file. Ian 0f16f4ad82cb47bc444688822cc142d80192c284 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 7455d01c179..424bbebfeed 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -aee8eddbfc3ef1b03353a060e79e7d668fb229e2 +45fd14ab8baf5e86012a808426f8ef52c1d77943 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/README.gcc b/libgo/README.gcc index d5aabb0f9c2..3c56ec7be17 100644 --- a/libgo/README.gcc +++ b/libgo/README.gcc @@ -1,7 +1,6 @@ The files in this directory are mirrored from the gofrontend project -hosted at http://code.google.com/p/gofrontend. These files are the +hosted at https://go.googlesource.com/gofrontend/ and mirrored at +https://github.com/golang/gofrontend. These files are the ones in the libgo subdirectory of that project. -By default, the networking tests are not run. In order to run all the -libgo tests, you need to define the environment variable -GCCGO_RUN_ALL_TESTS to a non-empty string. +To change these files, see https://go.dev/doc/gccgo_contribute.
libgo patch committed: make -Werror optional
I committed ths libgo patch to make -Werror optional. This patch is already in the GCC sources, where it was erroneously applied before the upstream patch. This is the upstream patch. Ian diff --git a/libgo/configure.ac b/libgo/configure.ac index 3cadc6d20..7e2b98ba6 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -62,11 +62,10 @@ AC_PROG_AWK WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' AC_SUBST(WARN_FLAGS) -AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror], - [turns on -Werror @<:@default=yes@:>@])]) -if test "x$enable_werror" != "xno"; then - WERROR="-Werror" -fi +AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--disable-werror], [disable building with -Werror])]) +AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"], + [WERROR="-Werror"]) AC_SUBST(WERROR) glibgo_toolexecdir=no
Re: libgo patch committed: Update to Go1.18rc1 release
Hi Ian, > On Sun, Feb 20, 2022 at 2:13 PM Rainer Orth > wrote: >> >> > This patch updates libgo to the Go1.18rc1 release. Bootstrapped and >> > ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. >> >> this broke Solaris bootstrap: >> >> ld: fatal: file runtime/internal/.libs/syscall.o: open failed: No such >> file or directory >> collect2: error: ld returned 1 exit status >> >> Creating a dummy syscall_solaris.go worked around that for now. > > Sorry about that. I committed this patch which should fix the problem. great, thanks. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: libgo patch committed: Update to Go1.18rc1 release
On Sun, Feb 20, 2022 at 2:13 PM Rainer Orth wrote: > > > This patch updates libgo to the Go1.18rc1 release. Bootstrapped and > > ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. > > this broke Solaris bootstrap: > > ld: fatal: file runtime/internal/.libs/syscall.o: open failed: No such file > or directory > collect2: error: ld returned 1 exit status > > Creating a dummy syscall_solaris.go worked around that for now. Sorry about that. I committed this patch which should fix the problem. Ian e185b127566139818309f8b0c89ee0ce3e42a8d1 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 3c0380e8285..7455d01c179 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -20e74f9ef8206fb02fd28ce3d6e0f01f6fb95dc9 +aee8eddbfc3ef1b03353a060e79e7d668fb229e2 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/internal/syscall/syscall_other.go b/libgo/go/runtime/internal/syscall/syscall_other.go new file mode 100644 index 000..c0945ceec09 --- /dev/null +++ b/libgo/go/runtime/internal/syscall/syscall_other.go @@ -0,0 +1,7 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !linux + +package syscall
Re: libgo patch committed: Update to Go1.18rc1 release
Hi Ian, > This patch updates libgo to the Go1.18rc1 release. Bootstrapped and > ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. this broke Solaris bootstrap: ld: fatal: file runtime/internal/.libs/syscall.o: open failed: No such file or directory collect2: error: ld returned 1 exit status Creating a dummy syscall_solaris.go worked around that for now. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
libgo patch committed: Update hurd support
This libgo patch based on patches by Svante Signell updates the hurd support in libgo. This is for GCC PR 104290. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian fa59861178df32a1f1271be6f763b71d2bb5ecab diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 073fb4b50a8..3c0380e8285 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -fade776395ffe5497d8aae5c0e6bd6d15e09e04a +20e74f9ef8206fb02fd28ce3d6e0f01f6fb95dc9 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/internal/testenv/testenv_unix.go b/libgo/go/internal/testenv/testenv_unix.go index 3dc5daf45e7..19112076a3c 100644 --- a/libgo/go/internal/testenv/testenv_unix.go +++ b/libgo/go/internal/testenv/testenv_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris +//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris package testenv diff --git a/libgo/go/os/exec/internal/fdtest/exists_unix.go b/libgo/go/os/exec/internal/fdtest/exists_unix.go index 49f264cebda..fca328fc65b 100644 --- a/libgo/go/os/exec/internal/fdtest/exists_unix.go +++ b/libgo/go/os/exec/internal/fdtest/exists_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris +//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris // Package fdtest provides test helpers for working with file descriptors across exec. package fdtest diff --git a/libgo/go/os/user/cgo_listgroups_unix.go b/libgo/go/os/user/cgo_listgroups_unix.go index 5621c1a63aa..09ec1cc5d2a 100644 --- a/libgo/go/os/user/cgo_listgroups_unix.go +++ b/libgo/go/os/user/cgo_listgroups_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (dragonfly || darwin || freebsd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo +//go:build (dragonfly || darwin || freebsd || hurd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo package user diff --git a/libgo/go/os/user/getgrouplist_unix.go b/libgo/go/os/user/getgrouplist_unix.go index 527d941308e..e97e0bc64f6 100644 --- a/libgo/go/os/user/getgrouplist_unix.go +++ b/libgo/go/os/user/getgrouplist_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (dragonfly || freebsd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo +//go:build (dragonfly || freebsd || hurd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo package user diff --git a/libgo/go/runtime/netpoll_hurd.go b/libgo/go/runtime/netpoll_hurd.go index 3d3fa4b76d3..96b013845fa 100644 --- a/libgo/go/runtime/netpoll_hurd.go +++ b/libgo/go/runtime/netpoll_hurd.go @@ -238,10 +238,7 @@ retry: pfd.events &= ^_POLLOUT } if mode != 0 { - pds[i].everr = false - if pfd.revents == _POLLERR { - pds[i].everr = true - } + pds[i].setEventErr(pfd.revents == _POLLERR) netpollready(, pds[i], mode) n-- } diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 8bde23edb81..9750a4822cf 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -129,3 +129,16 @@ func osinit() { physPageSize = uintptr(getPageSize()) } } + +func setProcessCPUProfiler(hz int32) { + setProcessCPUProfilerTimer(hz) +} + +func setThreadCPUProfiler(hz int32) { + setThreadCPUProfilerHz(hz) +} + +//go:nosplit +func validSIGPROF(mp *m, c *sigctxt) bool { + return true +} diff --git a/libgo/go/syscall/exec_bsd.go b/libgo/go/syscall/exec_bsd.go index ff88bc45366..86e513efdea 100644 --- a/libgo/go/syscall/exec_bsd.go +++ b/libgo/go/syscall/exec_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || hurd || netbsd || openbsd || solaris +//go:build aix || darwin || dragonfly || netbsd || openbsd || solaris package syscall diff --git a/libgo/go/syscall/exec_hurd.go b/libgo/go/syscall/exec_hurd.go new file mode 100644 index 000..06df513c55c --- /dev/null +++ b/libgo/go/syscall/exec_hurd.go @@ -0,0 +1,278
libgo patch committed: Update to Go1.18rc1 release
This patch updates libgo to the Go1.18rc1 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian patch.txt.bz2 Description: application/bzip
libgo patch committed: Add hurd build tag for setReadMsgCloseOnExec
This libgo patch, from Svante Signell, adds a hurd build tag for setReadMsgCloseOnExec. This fixes GCC PRs 103573 and 104290. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu (which doesn't test much). Committed to mainline. Ian 8ec374f329b72e640bffe3abf8c082f9a287adb3 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 3742414c828..1fdc5a95d44 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -3742e8a154bfec805054b4ebf0809f12dc7694da +90ed127ef053b758288af9c4e43473e257770bc3 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/net/unixsock_readmsg_cloexec.go b/libgo/go/net/unixsock_readmsg_cloexec.go index fa4fd7d9331..84479e58d65 100644 --- a/libgo/go/net/unixsock_readmsg_cloexec.go +++ b/libgo/go/net/unixsock_readmsg_cloexec.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || freebsd || solaris +//go:build aix || darwin || freebsd || hurd || solaris package net
Re: libgo patch committed: Update to Go1.18beta2 release
> I've committed this patch to fix these problems. Bootstrapped and ran > Go testsuite on x86_64-pc-linux-gnu and x86_64-solaris. Fine by me, thanks for the quick turnaround! -- Eric Botcazou
Re: libgo patch committed: Update to Go1.18beta2 release
On Tue, Feb 15, 2022 at 1:19 AM Eric Botcazou wrote: > > > I've committed a change to update libgo to the Go1.18beta2 release. > > This apparently broke the build on SPARC/Solaris 11.3: I've committed this patch to fix these problems. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu and x86_64-solaris. Ian p 24ca97325cab7bc454c785d55f37120fe7ea6f74 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 745132a3d9d..3742414c828 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -0af68c0552341a44f1fb12301f9eff954b9dde88 +3742e8a154bfec805054b4ebf0809f12dc7694da The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/net/fcntl_libc_test.go b/libgo/go/net/fcntl_libc_test.go index f59a1aa33ba..c935c4540cf 100644 --- a/libgo/go/net/fcntl_libc_test.go +++ b/libgo/go/net/fcntl_libc_test.go @@ -6,7 +6,10 @@ package net -import "syscall" +import ( + "syscall" + _ "unsafe" +) // Use a helper function to call fcntl. This is defined in C in // libgo/runtime. diff --git a/libgo/go/os/signal/internal/pty/pty.go b/libgo/go/os/signal/internal/pty/pty.go index e5ee3f6dc01..01c3908becf 100644 --- a/libgo/go/os/signal/internal/pty/pty.go +++ b/libgo/go/os/signal/internal/pty/pty.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (aix || darwin || dragonfly || freebsd || hurd || (linux && !android) || netbsd || openbsd) && cgo +//go:build (aix || darwin || dragonfly || freebsd || hurd || (linux && !android) || netbsd || openbsd || solaris) && cgo // Package pty is a simple pseudo-terminal package for Unix systems, // implemented by calling C functions via cgo. diff --git a/libgo/go/runtime/os3_solaris.go b/libgo/go/runtime/os3_solaris.go index ec23ce2cc0c..6c825746fbc 100644 --- a/libgo/go/runtime/os3_solaris.go +++ b/libgo/go/runtime/os3_solaris.go @@ -36,6 +36,14 @@ func solarisExecutablePath() string { return executablePath } +func setProcessCPUProfiler(hz int32) { + setProcessCPUProfilerTimer(hz) +} + +func setThreadCPUProfiler(hz int32) { + setThreadCPUProfilerHz(hz) +} + //go:nosplit func validSIGPROF(mp *m, c *sigctxt) bool { return true diff --git a/libgo/go/runtime/stubs2.go b/libgo/go/runtime/stubs2.go index 0b9e60587e1..587109209d1 100644 --- a/libgo/go/runtime/stubs2.go +++ b/libgo/go/runtime/stubs2.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !aix && !darwin && !js && !openbsd && !plan9 && !solaris && !windows +//go:build !js && !plan9 && !windows package runtime diff --git a/libgo/go/syscall/exec_bsd.go b/libgo/go/syscall/exec_bsd.go index c05ae138811..ff88bc45366 100644 --- a/libgo/go/syscall/exec_bsd.go +++ b/libgo/go/syscall/exec_bsd.go @@ -143,13 +143,13 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // User and groups if cred := sys.Credential; cred != nil { ngroups := len(cred.Groups) - var groups *Gid_t + var groups unsafe.Pointer if ngroups > 0 { gids := make([]Gid_t, ngroups) for i, v := range cred.Groups { gids[i] = Gid_t(v) } - groups = [0] + groups = unsafe.Pointer([0]) } if !cred.NoSetGroups { err1 = raw_setgroups(ngroups, groups) diff --git a/libgo/go/syscall/export_unix_test.go b/libgo/go/syscall/export_unix_test.go index 184eb84c0b1..bd904c70f36 100644 --- a/libgo/go/syscall/export_unix_test.go +++ b/libgo/go/syscall/export_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build dragonfly || freebsd || hurd || linux || netbsd || openbsd +//go:build dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris package syscall diff --git a/libgo/go/syscall/syscall_solaris.go b/libgo/go/syscall/syscall_solaris.go index 13c60a493d9..673ba8223fc 100644 --- a/libgo/go/syscall/syscall_solaris.go +++ b/libgo/go/syscall/syscall_solaris.go @@ -6,8 +6,6 @@ package syscall import "unsafe" -const _F_DUP2FD_CLOEXEC = F_DUP2FD_CLOEXEC - func (ts *Timestruc) Unix() (sec int64, nsec int64) { return int64(ts.Sec), int64(ts.Nsec) }
Re: libgo patch committed: Update to Go1.18beta2 release
Thanks, I'm working on it. I'm having some trouble with the Solaris machines I have access to. Ian On Tue, Feb 15, 2022, 1:20 AM Eric Botcazou via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: > > I've committed a change to update libgo to the Go1.18beta2 release. > > This apparently broke the build on SPARC/Solaris 11.3: > > /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:32:26: error: > reference to undefined name 'open' >32 | mmapFD = open([0], 0 /* O_RDONLY */, 0) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:35:25: error: > reference to undefined name 'exit' >35 | exit(2) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:56:25: error: > reference to undefined name 'exit' >56 | exit(2) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:60:25: error: > reference to undefined name 'exit' >60 | exit(2) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/os_gccgo.go:53:15: error: > reference to undefined name 'open' >53 | fd := open(_dev[0], 0 /* O_RDONLY */, 0) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/os_gccgo.go:54:14: error: > reference to undefined name 'read' >54 | n := read(fd, unsafe.Pointer([0]), int32(len(r))) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/os_gccgo.go:55:9: error: > reference to undefined name 'closefd' >55 | closefd(fd) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1077:9: error: > reference to undefined name 'exit' > 1077 | exit(2) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1115:17: error: > reference to undefined name 'exit' > 1115 | exit(2) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1172:17: error: > reference to undefined name 'exit' > 1172 | exit(4) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1176:17: error: > reference to undefined name 'exit' > 1176 | exit(5) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:312:9: error: > reference > to undefined name 'exit' > 312 | exit(0) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:872:17: error: > reference > to undefined name 'usleep' > 872 | usleep(1000) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:875:9: error: > reference > to undefined name 'usleep' > 875 | usleep(1000) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:877:9: error: > reference > to undefined name 'usleep' > 877 | usleep(1000) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:1493:9: error: > reference > to undefined name 'exitThread' > 1493 | exitThread() > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:1715:17: error: > reference to undefined name 'exit' > 1715 | exit(1) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:1926:25: error: > reference to undefined name 'usleep_no_g' > 1926 | usleep_no_g(1) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:2431:17: error: > reference to undefined name 'setThreadCPUProfiler' > 2431 | setThreadCPUProfiler(hz) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4364:9: error: > reference > to undefined name 'setThreadCPUProfiler' > 4364 | setThreadCPUProfiler(0) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4370:17: error: > reference to undefined name 'setProcessCPUProfiler' > 4370 | setProcessCPUProfiler(hz) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4380:17: error: > reference to undefined name 'setThreadCPUProfiler' > 4380 | setThreadCPUProfiler(hz) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4846:17: error: > reference to undefined name 'usleep' > 4846 | usleep(delay) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:5671:57: error: > reference to undefined name 'usleep' > 5671 | usleep(3) > | ^ > /homes/botcazou/gcc-head/src/libgo/go/runtime/runtime.go:35:17: error: > reference to undefined name 'usleep' >35 | usleep(100 * 1000) > | ^ >
Re: libgo patch committed: Update to Go1.18beta2 release
> I've committed a change to update libgo to the Go1.18beta2 release. This apparently broke the build on SPARC/Solaris 11.3: /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:32:26: error: reference to undefined name 'open' 32 | mmapFD = open([0], 0 /* O_RDONLY */, 0) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:35:25: error: reference to undefined name 'exit' 35 | exit(2) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:56:25: error: reference to undefined name 'exit' 56 | exit(2) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/mem_gccgo.go:60:25: error: reference to undefined name 'exit' 60 | exit(2) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/os_gccgo.go:53:15: error: reference to undefined name 'open' 53 | fd := open(_dev[0], 0 /* O_RDONLY */, 0) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/os_gccgo.go:54:14: error: reference to undefined name 'read' 54 | n := read(fd, unsafe.Pointer([0]), int32(len(r))) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/os_gccgo.go:55:9: error: reference to undefined name 'closefd' 55 | closefd(fd) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1077:9: error: reference to undefined name 'exit' 1077 | exit(2) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1115:17: error: reference to undefined name 'exit' 1115 | exit(2) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1172:17: error: reference to undefined name 'exit' 1172 | exit(4) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/panic.go:1176:17: error: reference to undefined name 'exit' 1176 | exit(5) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:312:9: error: reference to undefined name 'exit' 312 | exit(0) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:872:17: error: reference to undefined name 'usleep' 872 | usleep(1000) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:875:9: error: reference to undefined name 'usleep' 875 | usleep(1000) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:877:9: error: reference to undefined name 'usleep' 877 | usleep(1000) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:1493:9: error: reference to undefined name 'exitThread' 1493 | exitThread() | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:1715:17: error: reference to undefined name 'exit' 1715 | exit(1) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:1926:25: error: reference to undefined name 'usleep_no_g' 1926 | usleep_no_g(1) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:2431:17: error: reference to undefined name 'setThreadCPUProfiler' 2431 | setThreadCPUProfiler(hz) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4364:9: error: reference to undefined name 'setThreadCPUProfiler' 4364 | setThreadCPUProfiler(0) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4370:17: error: reference to undefined name 'setProcessCPUProfiler' 4370 | setProcessCPUProfiler(hz) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4380:17: error: reference to undefined name 'setThreadCPUProfiler' 4380 | setThreadCPUProfiler(hz) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:4846:17: error: reference to undefined name 'usleep' 4846 | usleep(delay) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/proc.go:5671:57: error: reference to undefined name 'usleep' 5671 | usleep(3) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/runtime.go:35:17: error: reference to undefined name 'usleep' 35 | usleep(100 * 1000) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/runtime.go:66:9: error: reference to undefined name 'exit' 66 | exit(int32(code)) | ^ /homes/botcazou/gcc-head/src/libgo/go/runtime/signal_unix.go:662:25: error: reference to undefined name 'usleep' 662 | usleep(5 * 1000 * 1000) | ^
libgo patch committed: Update to Go1.18beta2 release
I've committed a change to update libgo to the Go1.18beta2 release. Bootstrapped and tested on x86_64-pc-linux-gnu. As usual with these release updates, the change is too large for this e-mail. Please see the git history or https://go.dev/cl/384695 for the exact changes. Ian gotools/: * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. 1829e768a958f9886085d3f7a03677b2f45ea422 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 52f4b423f02..4e6bac7b7d5 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -b0dcd2d1e5e73952408b9f2d4d86ae12d102b20c +47380f733ca932384e59492d2f04374edd8ec95e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 9e81024ea78..46481cb5173 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -62,6 +62,7 @@ go_cmd_gofmt_files = \ go_cmd_cgo_files = \ $(cmdsrcdir)/cgo/ast.go \ + $(cmdsrcdir)/cgo/ast_go118.go \ $(cmdsrcdir)/cgo/doc.go \ $(cmdsrcdir)/cgo/gcc.go \ $(cmdsrcdir)/cgo/godefs.go \ @@ -224,6 +225,7 @@ check-go-tool: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc cp -r $(libgosrcdir)/golang.org/x/mod check-go-dir/src/cmd/vendor/golang.org/x/ cp -r $(libgosrcdir)/golang.org/x/crypto check-go-dir/src/cmd/vendor/golang.org/x/ cp -r $(libgosrcdir)/golang.org/x/xerrors check-go-dir/src/cmd/vendor/golang.org/x/ + cp -r $(libgosrcdir)/golang.org/x/tools check-go-dir/src/cmd/vendor/golang.org/x/ cp $(libgodir)/objabi.go check-go-dir/src/cmd/internal/objabi/ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ abs_checkdir=`cd check-go-dir && $(PWD_COMMAND)`; \ diff --git a/libgo/MERGE b/libgo/MERGE index 4473f479d5f..662af9af882 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -21a4e67ad58e3c4a7c5254f60cda5be5c3c450ff +41f485b9a7d8fd647c415be1d11b612063dff21c The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 5c377a30df9..be889f2a984 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -220,6 +220,7 @@ toolexeclibgodatabasesql_DATA = \ toolexeclibgodebugdir = $(toolexeclibgodir)/debug toolexeclibgodebug_DATA = \ + debug/buildinfo.gox \ debug/dwarf.gox \ debug/elf.gox \ debug/gosym.gox \ @@ -325,6 +326,7 @@ toolexeclibgonetdir = $(toolexeclibgodir)/net toolexeclibgonet_DATA = \ net/http.gox \ net/mail.gox \ + net/netip.gox \ net/rpc.gox \ net/smtp.gox \ net/textproto.gox \ @@ -429,6 +431,7 @@ noinst_DATA = \ internal/testenv.gox \ internal/trace.gox \ net/internal/socktest.gox \ + os/exec/internal/fdtest.gox \ os/signal/internal/pty.gox \ reflect/internal/example1.gox \ reflect/internal/example2.gox @@ -483,53 +486,68 @@ version.go: s-version; @true s-version: Makefile rm -f version.go.tmp echo "package sys" > version.go.tmp - echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp - echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp echo 'const StackGuardMultiplierDefault = 1' >> version.go.tmp - echo >> version.go.tmp - echo "const (" >> version.go.tmp - echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp + $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go + $(STAMP) $@ + +zgoarch.go: s-zgoarch; @true +s-zgoarch: Makefile goarch.sh + rm -f zgoarch.go.tmp + echo "package goarch" > zgoarch.go.tmp + echo >> zgoarch.go.tmp + echo 'const GOARCH = "'$(GOARCH)'"' >> zgoarch.go.tmp + echo >> zgoarch.go.tmp + echo 'const (' >> zgoarch.go.tmp + echo " _ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> zgoarch.go.tmp + echo " _BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> zgoarch.go.tmp + echo " _DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> zgoarch.go.tmp + echo " _Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> zgoarch.go.tmp + echo " _MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> zgoarch.go.tmp + echo " _PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> zgoarch.go.tmp + echo " _StackAlign = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) stackalign`" >> zgoarch.go.tmp + echo ")" >> zgoarch.go.tmp + echo >> zgoarch.go.tmp + echo "const (" >> zgoarch.go.tmp + echo " UNKNOWN ArchFamilyType = iota" >> zgoarch.go.tmp for a in $(ALLGOARCHFAMILY); do \ -
libgo patch committed: Build panic32.go on amd64p32
This libgo patch builds panic32.go on amd64p32 (that is, x86 x32 mode). This fixes GCC PR 104149. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu, and H.J. tested the patch on x32 (thanks!). Committed to mainline. Ian 4f614712c908ca00fdb83057420e0023c9171477 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9cc6a1c63c6..a42d88d25c4 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -799e9807c36fc661b14dfff136369556f09a5ebf +7d510bf5fcec9b0ccc0282f4193a80c0a164df63 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/panic32.go b/libgo/go/runtime/panic32.go index a2bf7e8fa2a..11d2a8450d9 100644 --- a/libgo/go/runtime/panic32.go +++ b/libgo/go/runtime/panic32.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build 386 || arm || mips || mipsle || armbe || m68k || nios2 || ppc || riscv || s390 || sh || shbe || sparc -// +build 386 arm mips mipsle armbe m68k nios2 ppc riscv s390 sh shbe sparc +//go:build 386 || amd64p32 || arm || mips || mipsle || armbe || m68k || nios2 || ppc || riscv || s390 || sh || shbe || sparc +// +build 386 amd64p32 arm mips mipsle armbe m68k nios2 ppc riscv s390 sh shbe sparc package runtime
Re: libgo patch committed: redirect mkrsysinfo.sh grep output to /dev/null
On Fri, Nov 19, 2021 at 3:47 AM Bernhard Reutner-Fischer via Gcc-patches wrote: > > On Fri, 28 Oct 2016 10:55:18 -0700 > Ian Lance Taylor wrote: > > > This patch to libgo redirects the output of a grep command in > > mkrsysinfo.sh to /dev/null. The output otherwise appears in the > > grep -q exists since at least SUSv2, fwiw. There has traditionally been confusion between grep -q and grep -s. Older grep programs supported -s but not -q. Perhaps that confusion is all cleared up now on all systems that GCC supports. I don't know. I do know that the patch I applied five years ago works everywhere. Ian
Re: libgo patch committed: redirect mkrsysinfo.sh grep output to /dev/null
On Fri, 28 Oct 2016 10:55:18 -0700 Ian Lance Taylor wrote: > This patch to libgo redirects the output of a grep command in > mkrsysinfo.sh to /dev/null. The output otherwise appears in the grep -q exists since at least SUSv2, fwiw. thanks, > middle of a build log, where it is harmless but confusing. > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > to mainline. > > Ian
libgo patch committed: set runtime.GOROOT at build time
This patch changes libto to 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). This patch does the same in libgo. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian gotools: * Makefile.am (check-runtime): Add goroot.go to --extrafiles. * Makefile.in: Regenerate. 9a5c82b7c1cd935c4a35d6dd532a2aa3356d6785 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e2abd5fc4b7..edfbe46d8f4 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -850235e4b974b9c5c2d7a1f9860583bd07f2a45c +e3bfc0889237a5bb8aa7ae30e1cff14f90a5f941 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 6576fe77b85..199899b9ef0 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -245,14 +245,14 @@ check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc export LD_LIBRARY_PATH; \ GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ - files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ + files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go $(libgodir)/goroot.go" --tag=libffi`; \ echo "$(ECHO_ENV) GC='$(abs_builddir)/check-gccgo -fgo-compiling-runtime' GOARCH=$${GOARCH} GOOS=$${GOOS} $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles='$${files}' $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > runtime-testlog $(CHECK_ENV) \ GC="$${GCCGO} -fgo-compiling-runtime"; \ export GC; \ GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ - files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ + files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go $(libgodir)/goroot.go" --tag=libffi`; \ $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v >> runtime-testlog 2>&1 || echo "--- $${fl}: go test runtime (0.00s)" >> runtime-testlog grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 92fedcf6eb8..5c377a30df9 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -545,6 +545,14 @@ s-gcpu: Makefile $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go $(STAMP) $@ +goroot.go: s-goroot; @true +s-goroot: Makefile + rm -f goroot.go.tmp + echo "package runtime" > goroot.go.tmp + echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp + $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go + $(STAMP) $@ + buildcfg.go: s-buildcfg; @true s-buildcfg: Makefile rm -f buildcfg.go.tmp @@ -1005,7 +1013,8 @@ math_lo_GOCFLAGS = $(MATH_FLAG) math_check_GOCFLAGS = $(MATH_FLAG) # Add generated files to the runtime package. -extra_go_files_runtime = runtime_linknames.go runtime_sysinfo.go sigtab.go +extra_go_files_runtime = \ + runtime_linknames.go runtime_sysinfo.go sigtab.go goroot.go runtime.lo.dep: $(extra_go_files_runtime) # Add generated files to the syscall package. diff --git a/libgo/go/runtime/extern.go b/libgo/go/runtime/extern.go index 0d7f3577913..6bd612fcf32 100644 --- a/libgo/go/runtime/extern.go +++ b/libgo/go/runtime/extern.go @@ -211,8 +211,6 @@ func Caller(skip int) (pc uintptr, file string, line int, ok bool) // program counter adjustment. func Callers(skip int, pc []uintptr) int -var defaultGOROOT string // set by cmd/link - // GOROOT returns the root of the Go tree. It uses the // GOROOT environment variable, if set at process start, // or else the root used during the Go build.
libgo patch committed: Update to go1.17.1 release
This patch updates libgo to the go1.17.1 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 1d62d26192bf7c2f303d993f9a2963a0fd5b475a diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index f4816816500..e2abd5fc4b7 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -c11d9f8275f2bbe9b05cdd815c79ac331f78e15c +850235e4b974b9c5c2d7a1f9860583bd07f2a45c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index d037d8d06a2..4473f479d5f 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -ec5170397c724a8ae440b2bc529f857c86f0e6b1 +21a4e67ad58e3c4a7c5254f60cda5be5c3c450ff The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index efcff2916b0..844393b24b0 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.17 +go1.17.1 diff --git a/libgo/go/archive/zip/reader.go b/libgo/go/archive/zip/reader.go index 2d53f4c7231..c91a8d00e6c 100644 --- a/libgo/go/archive/zip/reader.go +++ b/libgo/go/archive/zip/reader.go @@ -102,7 +102,7 @@ func (z *Reader) init(r io.ReaderAt, size int64) error { // indicate it contains up to 1 << 128 - 1 files. Since each file has a // header which will be _at least_ 30 bytes we can safely preallocate // if (data size / 30) >= end.directoryRecords. - if (uint64(size)-end.directorySize)/30 >= end.directoryRecords { + if end.directorySize < uint64(size) && (uint64(size)-end.directorySize)/30 >= end.directoryRecords { z.File = make([]*File, 0, end.directoryRecords) } z.Comment = end.comment diff --git a/libgo/go/archive/zip/reader_test.go b/libgo/go/archive/zip/reader_test.go index 37dafe6c8e7..afb03ace24d 100644 --- a/libgo/go/archive/zip/reader_test.go +++ b/libgo/go/archive/zip/reader_test.go @@ -1384,3 +1384,21 @@ func TestCVE202133196(t *testing.T) { t.Errorf("Archive has unexpected number of files, got %d, want 5", len(r.File)) } } + +func TestCVE202139293(t *testing.T) { + // directory size is so large, that the check in Reader.init + // overflows when subtracting from the archive size, causing + // the pre-allocation check to be bypassed. + data := []byte{ + 0x50, 0x4b, 0x06, 0x06, 0x05, 0x06, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x4b, + 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x4b, + 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0x50, 0xfe, 0x00, 0xff, 0x00, 0x3a, 0x00, 0x00, 0x00, 0xff, + } + _, err := NewReader(bytes.NewReader(data), int64(len(data))) + if err != ErrFormat { + t.Fatalf("unexpected error, got: %v, want: %v", err, ErrFormat) + } +} diff --git a/libgo/go/cmd/go/internal/modload/edit.go b/libgo/go/cmd/go/internal/modload/edit.go index c350b9d1b5c..47f236ce168 100644 --- a/libgo/go/cmd/go/internal/modload/edit.go +++ b/libgo/go/cmd/go/internal/modload/edit.go @@ -190,8 +190,8 @@ func limiterForEdit(ctx context.Context, rs *Requirements, tryUpgrade, mustSelec // raiseLimitsForUpgrades increases the module versions in maxVersions to the // versions that would be needed to allow each of the modules in tryUpgrade -// (individually) and all of the modules in mustSelect (simultaneously) to be -// added as roots. +// (individually or in any combination) and all of the modules in mustSelect +// (simultaneously) to be added as roots. // // Versions not present in maxVersion are unrestricted, and it is assumed that // they will not be promoted to root requirements (and thus will not contribute @@ -213,18 +213,42 @@ func raiseLimitsForUpgrades(ctx context.Context, maxVersion map[string]string, d } } - var eagerUpgrades []module.Version + var ( + eagerUpgrades []module.Version + isLazyRootPath map[string]bool + ) if depth == eager { eagerUpgrades = tryUpgrade } else { + isLazyRootPath = make(map[string]bool, len(maxVersion)) + for p := range maxVersion { + isLazyRootPath[p] = true + } for _, m := range tryUpgrade { + isLazyRootPath[m.Path] = true + } + for _, m := range mustSelect { + isLazyRootPath[m.Path] = true + } + + allowedRoot :=
Re: libgo patch committed: Update to Go1.17rc2 release
On Fri, Sep 3, 2021 at 2:00 AM Matthias Klose wrote: > > On 8/31/21 3:24 PM, H.J. Lu via Gcc-patches wrote: > > On Thu, Aug 12, 2021 at 8:24 PM Ian Lance Taylor via Gcc-patches > > wrote: > >> > >> This patch updates libgo from the Go1.16.5 release to the Go 1.17rc2 > >> release. As usual with these version updates, the patch itself is too > >> large to attach to this e-mail message. I've attached the changes to > >> files that are specific to gccgo. Bootstraped and ran Go testsuite on > >> x86_64-pc-linux-gnu. Committed to mainline. > >> > >> Ian > > > > This breaks build with x32: > > This is PR/102102 > > Also seen on x86_64-linux-gnu, when configuring with > --with-multilib-list=m32,m64,mx32 Should be fixed now, I hope. I don't know how to test this, as my desktop does not support x32 mode. Ian
libgo patch committed: Use hash32 for p32 variants
This libgo patch uses hash32 rather than hash64 for amd32p32 (x32 mode) and mips64p32 and mips64p32le (the n32 ABI). This should fix PR 102102. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 3e86f786c08a5ae8b3153352a1295ab7fe6a4b51 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e9f38d449a4..c3772694780 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -b3fad6957a04520013197ea7cab11bec3298d552 +e42c7c0216aec70834e8827174458aa4a50169fa The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/hash32.go b/libgo/go/runtime/hash32.go index 58ae38b200d..0df73035c05 100644 --- a/libgo/go/runtime/hash32.go +++ b/libgo/go/runtime/hash32.go @@ -5,8 +5,8 @@ // Hashing algorithm inspired by // wyhash: https://github.com/wangyi-fudan/wyhash/blob/ceb019b530e2c1c14d70b79bfa2bc49de7d95bc1/Modern%20Non-Cryptographic%20Hash%20Function%20and%20Pseudorandom%20Number%20Generator.pdf -//go:build 386 || arm || mips || mipsle || armbe || m68k || nios2 || ppc || riscv || s390 || sh || shbe || sparc -// +build 386 arm mips mipsle armbe m68k nios2 ppc riscv s390 sh shbe sparc +//go:build 386 || arm || mips || mipsle || amd64p32 || armbe || m68k || mips64p32 || mips64p32le || nios2 || ppc || riscv || s390 || sh || shbe || sparc +// +build 386 arm mips mipsle amd64p32 armbe m68k mips64p32 mips64p32le nios2 ppc riscv s390 sh shbe sparc package runtime diff --git a/libgo/go/runtime/hash64.go b/libgo/go/runtime/hash64.go index 4b32d515c4b..96ed90b9753 100644 --- a/libgo/go/runtime/hash64.go +++ b/libgo/go/runtime/hash64.go @@ -5,8 +5,8 @@ // Hashing algorithm inspired by // wyhash: https://github.com/wangyi-fudan/wyhash -//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || alpha || amd64p32 || arm64be || ia64 || mips64p32 || mips64p32le || sparc64 -// +build amd64 arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x wasm alpha amd64p32 arm64be ia64 mips64p32 mips64p32le sparc64 +//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || alpha || arm64be || ia64 || sparc64 +// +build amd64 arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x wasm alpha arm64be ia64 sparc64 package runtime
libgo patch committed: Update to final Go 1.17 release
This patch updates libgo to the final Go 1.17 release. (I'm aware of a couple of bug reports building libgo, I haven't had time to get to them yet.) Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian patch.txt 1d98014a8ae3c357071478d337f0169edec2ce0c diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 950f1797b55..e9f38d449a4 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -77bc32767b61feb6499ca7921e96b356603517dc +b3fad6957a04520013197ea7cab11bec3298d552 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index 4286d5c5433..d037d8d06a2 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -72ab3ff68b1ec894fe5599ec82b8849f3baa9d94 +ec5170397c724a8ae440b2bc529f857c86f0e6b1 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index 904eb73bd5c..efcff2916b0 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.17rc2 +go1.17 diff --git a/libgo/go/cmd/go/internal/modload/buildlist.go b/libgo/go/cmd/go/internal/modload/buildlist.go index 604a57b4373..bf695673167 100644 --- a/libgo/go/cmd/go/internal/modload/buildlist.go +++ b/libgo/go/cmd/go/internal/modload/buildlist.go @@ -191,6 +191,19 @@ func (rs *Requirements) rootSelected(path string) (version string, ok bool) { return "", false } +// hasRedundantRoot returns true if the root list contains multiple requirements +// of the same module or a requirement on any version of the main module. +// Redundant requirements should be pruned, but they may influence version +// selection. +func (rs *Requirements) hasRedundantRoot() bool { + for i, m := range rs.rootModules { + if m.Path == Target.Path || (i > 0 && m.Path == rs.rootModules[i-1].Path) { + return true + } + } + return false +} + // Graph returns the graph of module requirements loaded from the current // root modules (as reported by RootModules). // @@ -882,6 +895,12 @@ func updateLazyRoots(ctx context.Context, direct map[string]bool, rs *Requiremen // and (trivially) version. if !rootsUpgraded { + if cfg.BuildMod != "mod" { + // The only changes to the root set (if any) were to remove duplicates. + // The requirements are consistent (if perhaps redundant), so keep the + // original rs to preserve its ModuleGraph. + return rs, nil + } // The root set has converged: every root going into this iteration was // already at its selected version, although we have have removed other // (redundant) roots for the same path. diff --git a/libgo/go/cmd/go/internal/modload/init.go b/libgo/go/cmd/go/internal/modload/init.go index a8cbd9fe16d..45f724d5e36 100644 --- a/libgo/go/cmd/go/internal/modload/init.go +++ b/libgo/go/cmd/go/internal/modload/init.go @@ -449,13 +449,22 @@ func loadModFile(ctx context.Context) (rs *Requirements, needCommit bool) { } setDefaultBuildMod() // possibly enable automatic vendoring - rs = requirementsFromModFile(ctx) - + rs = requirementsFromModFile() if cfg.BuildMod == "vendor" { readVendorList() checkVendorConsistency() rs.initVendor(vendorList) } + if rs.hasRedundantRoot() { + // If any module path appears more than once in the roots, we know that the + // go.mod file needs to be updated even though we have not yet loaded any + // transitive dependencies. + rs, err = updateRoots(ctx, rs.direct, rs, nil, nil, false) + if err != nil { + base.Fatalf("go: %v", err) + } + } + if index.goVersionV == "" { // TODO(#45551): Do something more principled instead of checking // cfg.CmdName directly here. @@ -530,7 +539,12 @@ func CreateModFile(ctx context.Context, modPath string) { base.Fatalf("go: %v", err) } - commitRequirements(ctx, modFileGoVersion(), requirementsFromModFile(ctx)) + rs := requirementsFromModFile() + rs, err = updateRoots(ctx, rs.direct, rs, nil, nil, false) + if err != nil { + base.Fatalf("go: %v", err) + } + commitRequirements(ctx, modFileGoVersion(), rs) // Suggest running 'go mod tidy' unless the project is empty. Even if we // imported all the correct requirements above, we're probably missing @@ -641,9 +655,8 @@ func initTarget(m module.Version) { //
Re: libgo patch committed: Update to Go1.17rc2 release
On 8/31/21 3:24 PM, H.J. Lu via Gcc-patches wrote: > On Thu, Aug 12, 2021 at 8:24 PM Ian Lance Taylor via Gcc-patches > wrote: >> >> This patch updates libgo from the Go1.16.5 release to the Go 1.17rc2 >> release. As usual with these version updates, the patch itself is too >> large to attach to this e-mail message. I've attached the changes to >> files that are specific to gccgo. Bootstraped and ran Go testsuite on >> x86_64-pc-linux-gnu. Committed to mainline. >> >> Ian > > This breaks build with x32: This is PR/102102 Also seen on x86_64-linux-gnu, when configuring with --with-multilib-list=m32,m64,mx32 Matthias
Re: libgo patch committed: Update to Go1.17rc2 release
On Thu, Aug 12, 2021 at 8:24 PM Ian Lance Taylor via Gcc-patches wrote: > > This patch updates libgo from the Go1.16.5 release to the Go 1.17rc2 > release. As usual with these version updates, the patch itself is too > large to attach to this e-mail message. I've attached the changes to > files that are specific to gccgo. Bootstraped and ran Go testsuite on > x86_64-pc-linux-gnu. Committed to mainline. > > Ian This breaks build with x32: /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:35:30: error: integer constant overflow 35 | seed ^= hashkey[0] ^ m1 | ^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:61:50: error: integer constant overflow 61 | seed = mix(r8(p)^m2, r8(add(p, 8))^seed) | ^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:62:60: error: integer constant overflow 62 | seed1 = mix(r8(add(p, 16))^m3, r8(add(p, 24))^seed1) |^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:63:60: error: integer constant overflow 63 | seed2 = mix(r8(add(p, 32))^m4, r8(add(p, 40))^seed2) |^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:69:42: error: integer constant overflow 69 | seed = mix(r8(p)^m2, r8(add(p, 8))^seed) | ^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:76:20: error: integer constant overflow 76 | return mix(m5^s, mix(a^m2, b^seed)) |^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:76:32: error: integer constant overflow 76 | return mix(m5^s, mix(a^m2, b^seed)) |^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:81:22: error: integer constant overflow 81 | return mix(m5^4, mix(a^m2, a^seed^hashkey[0]^m1)) | ^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:81:32: error: integer constant overflow 81 | return mix(m5^4, mix(a^m2, a^seed^hashkey[0]^m1)) |^ /export/gnu/import/git/gitlab/x86-gcc/libgo/go/runtime/hash64.go:81:54: error: integer constant overflow 81 | return mix(m5^4, mix(a^m2, a^seed^hashkey[0]^m1)) The problem is that hashkey is an array of uintptr, but hash64.go is enabled for many targets with 32-bit uintptr: commit c5b21c3f4c17b0649155035d2f9aa97b2da8a813 Author: Ian Lance Taylor Date: Fri Jul 30 14:28:58 2021 -0700 libgo: update to Go1.17rc2 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341629 diff --git a/libgo/go/runtime/hash64.go b/libgo/go/runtime/hash64.go index 704bbe6f62b..4b32d515c4b 100644 --- a/libgo/go/runtime/hash64.go +++ b/libgo/go/runtime/hash64.go @@ -3,113 +3,98 @@ // license that can be found in the LICENSE file. // Hashing algorithm inspired by -// xxhash: https://code.google.com/p/xxhash/ -// cityhash: https://code.google.com/p/cityhash/ +// wyhash: https://github.com/wangyi-fudan/wyhash +//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || alpha || amd64p32 || arm64be || ia64 || mips64p32 || mips64p32le || sparc64 // +build amd64 arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x wasm alpha amd64p32 arm64be ia64 mips64p32 mips64p32le sparc64 -- H.J.
Re: libgo patch committed: Update to Go1.17rc2 release
On Fri, Aug 13, 2021 at 2:08 PM Rainer Orth wrote: > > unfortunately, things are considerably worse: syscall.lo fails to build > and go1 even ICEs: > > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_posix_utimesnano.go:13:1: > error: redefinition of ‘UtimesNano’ >13 | func UtimesNano(path string, ts []Timespec) error { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_linux_utimesnano.go:13:1: > note: previous definition of ‘UtimesNano’ was here >13 | func UtimesNano(path string, ts []Timespec) (err error) { > | ^ > > The second file is Linux-only and needs a corresponding build guard. > > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:193:16: error: use > of undefined type ‘SysProcAttr’ > 193 | Sys *SysProcAttr > |^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:235:15: error: > reference to field ‘Chroot’ in object which has no fields or methods > 235 | if sys.Chroot != "" { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:236:52: error: > reference to field ‘Chroot’ in object which has no fields or methods > 236 | chroot, err = BytePtrFromString(sys.Chroot) > |^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:251:15: error: > reference to field ‘Setctty’ in object which has no fields or methods > 251 | if sys.Setctty && sys.Foreground { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:251:30: error: > reference to field ‘Foreground’ in object which has no fields or methods > 251 | if sys.Setctty && sys.Foreground { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:254:15: error: > reference to field ‘Setctty’ in object which has no fields or methods > 254 | if sys.Setctty && sys.Ctty >= len(attr.Files) { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:254:30: error: > reference to field ‘Ctty’ in object which has no fields or methods > 254 | if sys.Setctty && sys.Ctty >= len(attr.Files) { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:269:21: error: > reference to undefined name ‘forkAndExecInChild’ > 269 | pid, err1 = forkAndExecInChild(argv0p, argvp, envvp, chroot, > dir, attr, sys, p[1]) > | ^ > > I found that upstream has exec_libc.go for AIX and Solaris with the > missing SysProcAttr and forkAndExecInChild definitions. It doesn't work > out of the box, though: > > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_libc.go:63:9: error: > reference to undefined name ‘execveLibc’ >63 | execveLibc = execve > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_libc.go:137:25: error: > reference to undefined name ‘_Pid_t’ > 137 | pgrp := _Pid_t(sys.Pgid) > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_libc.go:144:32: error: > reference to undefined name ‘_Pid_t’ > 144 | pgrp = _Pid_t(r1) > |^ > > For one, switching to Pid_t is needed: > > > Besides, support for execveLibc has been dropped in exec_unix.go > compared to upstream. > > terminate called after throwing an instance of 'std::out_of_range' > what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is > 1) > go1: internal compiler error: Abort > 0xce1abf crash_signal > /vol/gcc/src/hg/master/local/gcc/toplev.c:328 > > This went away after the fixes above. > > Next, I get > > /vol/gcc/src/hg/master/local/libgo/go/internal/syscall/unix/getrandom_solaris.go:10:15: > error: imported and not used: unsafe >10 | "unsafe" > | ^ > /vol/gcc/src/hg/master/local/libgo/go/internal/syscall/unix/getrandom_solaris.go:32:30: > error: reference to undefined name 'getrandomUnsupported' >32 | if atomic.LoadInt32() != 0 { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/internal/syscall/unix/getrandom_solaris.go:41:44: > error: reference to undefined name 'getrandomUnsupported' >41 | atomic.StoreInt32(, 1) > |^ > make[4]: *** [Makefile:3008: internal/syscall/unix.lo] Error 1 > > The definition dropped compared to upstream. > > /vol/gcc/src/hg/master/local/libgo/go/os/user/listgroups_unix.go:39:15: > error: reference to undefined name ‘libc_getgrouplist’ >39 | rv := libc_getgrouplist(nameC, userGID, [0], ) > | ^ > /vol/gcc/src/hg/master/local/libgo/go/os/user/listgroups_unix.go:49:23: > error: reference to undefined name ‘libc_getgrouplist’ >49 | rv := libc_getgrouplist(nameC,
Re: libgo patch committed: Update to Go1.17rc2 release
Hi Ian, > Sorry about that. I've committed this patch. thanks. unfortunately, things are considerably worse: syscall.lo fails to build and go1 even ICEs: /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_posix_utimesnano.go:13:1: error: redefinition of ‘UtimesNano’ 13 | func UtimesNano(path string, ts []Timespec) error { | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_linux_utimesnano.go:13:1: note: previous definition of ‘UtimesNano’ was here 13 | func UtimesNano(path string, ts []Timespec) (err error) { | ^ The second file is Linux-only and needs a corresponding build guard. /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:193:16: error: use of undefined type ‘SysProcAttr’ 193 | Sys *SysProcAttr |^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:235:15: error: reference to field ‘Chroot’ in object which has no fields or methods 235 | if sys.Chroot != "" { | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:236:52: error: reference to field ‘Chroot’ in object which has no fields or methods 236 | chroot, err = BytePtrFromString(sys.Chroot) |^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:251:15: error: reference to field ‘Setctty’ in object which has no fields or methods 251 | if sys.Setctty && sys.Foreground { | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:251:30: error: reference to field ‘Foreground’ in object which has no fields or methods 251 | if sys.Setctty && sys.Foreground { | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:254:15: error: reference to field ‘Setctty’ in object which has no fields or methods 254 | if sys.Setctty && sys.Ctty >= len(attr.Files) { | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:254:30: error: reference to field ‘Ctty’ in object which has no fields or methods 254 | if sys.Setctty && sys.Ctty >= len(attr.Files) { | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_unix.go:269:21: error: reference to undefined name ‘forkAndExecInChild’ 269 | pid, err1 = forkAndExecInChild(argv0p, argvp, envvp, chroot, dir, attr, sys, p[1]) | ^ I found that upstream has exec_libc.go for AIX and Solaris with the missing SysProcAttr and forkAndExecInChild definitions. It doesn't work out of the box, though: /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_libc.go:63:9: error: reference to undefined name ‘execveLibc’ 63 | execveLibc = execve | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_libc.go:137:25: error: reference to undefined name ‘_Pid_t’ 137 | pgrp := _Pid_t(sys.Pgid) | ^ /vol/gcc/src/hg/master/local/libgo/go/syscall/exec_libc.go:144:32: error: reference to undefined name ‘_Pid_t’ 144 | pgrp = _Pid_t(r1) |^ For one, switching to Pid_t is needed: --- /vol/gcc/src/go/go/dist-1.17/src/syscall/exec_libc.go 2021-08-13 22:10:42.0 + +++ go/syscall/exec_libc.go 2021-08-13 22:41:34.028618677 + @@ -134,14 +134,14 @@ func forkAndExecInChild(argv0 *byte, arg } if sys.Foreground { - pgrp := _Pid_t(sys.Pgid) + pgrp := Pid_t(sys.Pgid) if pgrp == 0 { r1, err1 = getpid() if err1 != 0 { goto childerror } - pgrp = _Pid_t(r1) + pgrp = Pid_t(r1) } // Place process group in foreground. Besides, support for execveLibc has been dropped in exec_unix.go compared to upstream. terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 1) go1: internal compiler error: Abort 0xce1abf crash_signal /vol/gcc/src/hg/master/local/gcc/toplev.c:328 This went away after the fixes above. Next, I get /vol/gcc/src/hg/master/local/libgo/go/internal/syscall/unix/getrandom_solaris.go:10:15: error: imported and not used: unsafe 10 | "unsafe" | ^ /vol/gcc/src/hg/master/local/libgo/go/internal/syscall/unix/getrandom_solaris.go:32:30: error: reference to undefined name 'getrandomUnsupported' 32 | if atomic.LoadInt32() != 0 { | ^ /vol/gcc/src/hg/master/local/libgo/go/internal/syscall/unix/getrandom_solaris.go:41:44: error: reference to undefined name 'getrandomUnsupported' 41 | atomic.StoreInt32(, 1) |^ make[4]: *** [Makefile:3008: internal/syscall/unix.lo] Error 1 The definition dropped compared to upstream. /vol/gcc/src/hg/master/local/libgo/go/os/user/listgroups_unix.go:39:15: error: reference to
Re: libgo patch committed: Update to Go1.17rc2 release
On Fri, Aug 13, 2021 at 5:43 AM Rainer Orth wrote: > > Hi Ian, > > > This patch updates libgo from the Go1.16.5 release to the Go 1.17rc2 > > release. As usual with these version updates, the patch itself is too > > large to attach to this e-mail message. I've attached the changes to > > files that are specific to gccgo. Bootstraped and ran Go testsuite on > > x86_64-pc-linux-gnu. Committed to mainline. > > this patch broke Solaris bootstrap: > > /vol/gcc/src/hg/master/local/libgo/runtime/stack.c: In function > 'onCurrentStack': > /vol/gcc/src/hg/master/local/libgo/runtime/stack.c:177:21: error: expected > expression before 'uintptr' > 177 | if (uintptr(initialsp2) < uintptr(nextsp2)) { > | ^~~ > > Fixed by turning those into proper casts. Sorry about that. I've committed this patch. Ian a91ca5ff5fa56b54cfc03f43891ff613d714b722 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index bcbe1d93018..3000285fbf0 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -33f65dce43bd01c1fa38cd90a78c9aea6ca6dd59 +f2b7a2ce94127ad444a772bd1631516c5c67fb73 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/runtime/stack.c b/libgo/runtime/stack.c index 0c0c30e46ac..65e8fa30077 100644 --- a/libgo/runtime/stack.c +++ b/libgo/runtime/stack.c @@ -174,7 +174,7 @@ bool onCurrentStack(uintptr p) nextsp2 = secondary_stack_pointer(); if (nextsp2 != nil) { initialsp2 = (byte*)(void*)(gp->gcinitialsp2); - if (uintptr(initialsp2) < uintptr(nextsp2)) { + if ((uintptr)(initialsp2) < (uintptr)(nextsp2)) { temp = initialsp2; initialsp2 = nextsp2; nextsp2 = temp;
Re: libgo patch committed: Update to Go1.17rc2 release
Hi Ian, > This patch updates libgo from the Go1.16.5 release to the Go 1.17rc2 > release. As usual with these version updates, the patch itself is too > large to attach to this e-mail message. I've attached the changes to > files that are specific to gccgo. Bootstraped and ran Go testsuite on > x86_64-pc-linux-gnu. Committed to mainline. this patch broke Solaris bootstrap: /vol/gcc/src/hg/master/local/libgo/runtime/stack.c: In function 'onCurrentStack': /vol/gcc/src/hg/master/local/libgo/runtime/stack.c:177:21: error: expected expression before 'uintptr' 177 | if (uintptr(initialsp2) < uintptr(nextsp2)) { | ^~~ Fixed by turning those into proper casts. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
libgo patch committed: Update to Go1.17rc2 release
This patch updates libgo from the Go1.16.5 release to the Go 1.17rc2 release. As usual with these version updates, the patch itself is too large to attach to this e-mail message. I've attached the changes to files that are specific to gccgo. Bootstraped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 5fe441d33024fe33b9835c3e8d6b9f6cf24715f1 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 539d886b08f..bcbe1d93018 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -5edbb624b2595d644eb6842c952a292c41f7d6fa +33f65dce43bd01c1fa38cd90a78c9aea6ca6dd59 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index ac842716022..4286d5c5433 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -7677616a263e8ded606cc8297cb67ddc667a876e +72ab3ff68b1ec894fe5599ec82b8849f3baa9d94 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index dec98756673..92fedcf6eb8 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -366,6 +366,7 @@ toolexeclibgoregexp_DATA = \ toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime toolexeclibgoruntime_DATA = \ + runtime/cgo.gox \ runtime/debug.gox \ runtime/metrics.gox \ runtime/pprof.gox \ @@ -428,7 +429,9 @@ noinst_DATA = \ internal/testenv.gox \ internal/trace.gox \ net/internal/socktest.gox \ - os/signal/internal/pty.gox + os/signal/internal/pty.gox \ + reflect/internal/example1.gox \ + reflect/internal/example2.gox if LIBGO_IS_RTEMS rtems_task_variable_add_file = runtime/rtems-task-variable-add.c @@ -480,14 +483,10 @@ version.go: s-version; @true s-version: Makefile rm -f version.go.tmp echo "package sys" > version.go.tmp - echo 'func init() { DefaultGoroot = "$(prefix)" }' >> version.go.tmp - echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp - echo 'const Goexperiment = ``' >> version.go.tmp echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp - echo >> version.go.tmp - echo "type ArchFamilyType int" >> version.go.tmp + echo 'const StackGuardMultiplierDefault = 1' >> version.go.tmp echo >> version.go.tmp echo "const (" >> version.go.tmp echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp @@ -507,13 +506,13 @@ s-version: Makefile done echo >> version.go.tmp echo "const (" >> version.go.tmp - echo " ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> version.go.tmp - echo " BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp - echo " CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp - echo " DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp - echo " Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp - echo " MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp - echo " PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp + echo " _ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> version.go.tmp + echo " _BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp + echo " _DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp + echo " _Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp + echo " _MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp + echo " _PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp + echo " _StackAlign = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) stackalign`" >> version.go.tmp echo ")" >> version.go.tmp echo >> version.go.tmp for a in $(ALLGOOS); do \ @@ -526,7 +525,6 @@ s-version: Makefile fi; \ done echo >> version.go.tmp - echo "type Uintreg uintptr" >> version.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go $(STAMP) $@ @@ -547,24 +545,31 @@ s-gcpu: Makefile $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go $(STAMP) $@ +buildcfg.go: s-buildcfg; @true +s-buildcfg: Makefile + rm -f buildcfg.go.tmp + echo "package buildcfg" > buildcfg.go.tmp + echo "import \"runtime\"" >> buildcfg.go.tmp + echo 'func
libgo patch committed: Update libgo to Go 1.16.5
This patch updates libgo to the Go 1.16.5 release. Bootstrapped and tested on x86_64-pc-linux-gnu. Committed to tip and GCC 11 branch. Ian a7d86ad16c5afdbbbae5218c012e1bbf6966bf1d diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 1f38c9110ba..f16fb9facc3 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -5a801b15699cced5203af5c7339b375cd55ecbac +bcafcb3c39530bb325514d6377747eb3127d1a03 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index 81cd0623486..ac842716022 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -9baddd3f21230c55f0ad2a10f5f20579dcf0a0bb +7677616a263e8ded606cc8297cb67ddc667a876e The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index e592dfd1338..e336ec201bf 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.16.3 +go1.16.5 diff --git a/libgo/go/archive/zip/reader.go b/libgo/go/archive/zip/reader.go index c288ad965bc..ddef2b7b5a5 100644 --- a/libgo/go/archive/zip/reader.go +++ b/libgo/go/archive/zip/reader.go @@ -99,7 +99,15 @@ func (z *Reader) init(r io.ReaderAt, size int64) error { return err } z.r = r - z.File = make([]*File, 0, end.directoryRecords) + // Since the number of directory records is not validated, it is not + // safe to preallocate z.File without first checking that the specified + // number of files is reasonable, since a malformed archive may + // indicate it contains up to 1 << 128 - 1 files. Since each file has a + // header which will be _at least_ 30 bytes we can safely preallocate + // if (data size / 30) >= end.directoryRecords. + if (uint64(size)-end.directorySize)/30 >= end.directoryRecords { + z.File = make([]*File, 0, end.directoryRecords) + } z.Comment = end.comment rs := io.NewSectionReader(r, 0, size) if _, err = rs.Seek(int64(end.directoryOffset), io.SeekStart); err != nil { @@ -628,10 +636,11 @@ func (b *readBuf) sub(n int) readBuf { } // A fileListEntry is a File and its ename. -// If file == nil, the fileListEntry describes a directory, without metadata. +// If file == nil, the fileListEntry describes a directory without metadata. type fileListEntry struct { - name string - file *File // nil for directories + name string + file *File + isDir bool } type fileInfoDirEntry interface { @@ -640,20 +649,26 @@ type fileInfoDirEntry interface { } func (e *fileListEntry) stat() fileInfoDirEntry { - if e.file != nil { + if !e.isDir { return headerFileInfo{} } return e } // Only used for directories. -func (f *fileListEntry) Name() string { _, elem, _ := split(f.name); return elem } -func (f *fileListEntry) Size() int64{ return 0 } -func (f *fileListEntry) ModTime() time.Time { return time.Time{} } -func (f *fileListEntry) Mode() fs.FileMode { return fs.ModeDir | 0555 } -func (f *fileListEntry) Type() fs.FileMode { return fs.ModeDir } -func (f *fileListEntry) IsDir() bool{ return true } -func (f *fileListEntry) Sys() interface{} { return nil } +func (f *fileListEntry) Name() string { _, elem, _ := split(f.name); return elem } +func (f *fileListEntry) Size() int64 { return 0 } +func (f *fileListEntry) Mode() fs.FileMode { return fs.ModeDir | 0555 } +func (f *fileListEntry) Type() fs.FileMode { return fs.ModeDir } +func (f *fileListEntry) IsDir() bool { return true } +func (f *fileListEntry) Sys() interface{} { return nil } + +func (f *fileListEntry) ModTime() time.Time { + if f.file == nil { + return time.Time{} + } + return f.file.FileHeader.Modified.UTC() +} func (f *fileListEntry) Info() (fs.FileInfo, error) { return f, nil } @@ -673,15 +688,32 @@ func toValidName(name string) string { func (r *Reader) initFileList() { r.fileListOnce.Do(func() { dirs := make(map[string]bool) + knownDirs := make(map[string]bool) for _, file := range r.File { + isDir := len(file.Name) > 0 && file.Name[len(file.Name)-1] == '/' name := toValidName(file.Name) for dir := path.Dir(name); dir != "."; dir = path.Dir(dir) { dirs[dir] = true } - r.fileList = append(r.fileList, fileListEntry{name, file}) + entry := fileListEntry{ + name: name, + file: file, + isDir: isDir, + } + r.fileList = append(r.fileList, entry) + if isDir {
libgo patch committed: Regenerate configure script
This patch updates the libgo configure script to the current source repo. This just fixes a couple of line numbers. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Ian commit c922c6539e63a775ee29751320d678f0a0a33d07 Author: Ian Lance Taylor Date: Tue May 18 18:09:27 2021 -0700 libgo: update configure to current sources Change-Id: I12766baf02bfdf2233f1c5bde1a270f06b020aa7 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/321076 Trust: Ian Lance Taylor Reviewed-by: Cherry Mui Reviewed-by: Than McIntosh diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index efb7a772882..373b58c75a4 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -9782e85bef1c16c72a4980856d921cea104b129c +38228e7a91d37588463307ec60420c8f17f1aee4 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/configure b/libgo/configure index 70f64c974fd..915eeaf050b 100755 --- a/libgo/configure +++ b/libgo/configure @@ -11544,7 +11544,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11557 "configure" +#line 11547 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11650,7 +11650,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11663 "configure" +#line 11653 "configure" #include "confdefs.h" #if HAVE_DLFCN_H
libgo patch committed: Update compression test cases
I've committed a trivial patch to libgo to update two compression test cases to match the main sources: the file libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 is removed, and the file libgo/go/compress/bzip2/testdata/Isaac.Newton-Opticks.txt.bz2 is updated. No patch appended here as these are binary files. Ian
libgo patch committed: Update to Go1.16.3 release
This patch updates libgo to the Go1.16.3 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian dfbc12e031900c1f30bb94332823d39e5b241b40 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a3eef239eca..efb7a772882 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -4bdff733a0c2a9ddc3eff104b1be03df058a79c4 +9782e85bef1c16c72a4980856d921cea104b129c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index a52dceb182f..81cd0623486 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -3979fb9af9ccfc0b7ccb613dcf256b18c2c295f0 +9baddd3f21230c55f0ad2a10f5f20579dcf0a0bb The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index d0b0a900460..e592dfd1338 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.16.2 +go1.16.3 diff --git a/libgo/go/cmd/go.mod b/libgo/go/cmd/go.mod index 35582f3975f..70b1b0690b3 100644 --- a/libgo/go/cmd/go.mod +++ b/libgo/go/cmd/go.mod @@ -6,7 +6,7 @@ require ( github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2 golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 - golang.org/x/mod v0.4.2-0.20210302225053-d515b24adc21 + golang.org/x/mod v0.4.2-0.20210325185522-dbbbf8a3c6ea golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff ) diff --git a/libgo/go/cmd/go/alldocs.go b/libgo/go/cmd/go/alldocs.go index e7c63f0749d..84f89c9d2d2 100644 --- a/libgo/go/cmd/go/alldocs.go +++ b/libgo/go/cmd/go/alldocs.go @@ -692,18 +692,22 @@ // arguments must satisfy the following constraints: // // - Arguments must be package paths or package patterns (with "..." wildcards). -// They must not be standard packages (like fmt), meta-patterns (std, cmd, -// all), or relative or absolute file paths. +// They must not be standard packages (like fmt), meta-patterns (std, cmd, +// all), or relative or absolute file paths. +// // - All arguments must have the same version suffix. Different queries are not -// allowed, even if they refer to the same version. +// allowed, even if they refer to the same version. +// // - All arguments must refer to packages in the same module at the same version. +// // - No module is considered the "main" module. If the module containing -// packages named on the command line has a go.mod file, it must not contain -// directives (replace and exclude) that would cause it to be interpreted -// differently than if it were the main module. The module must not require -// a higher version of itself. +// packages named on the command line has a go.mod file, it must not contain +// directives (replace and exclude) that would cause it to be interpreted +// differently than if it were the main module. The module must not require +// a higher version of itself. +// // - Package path arguments must refer to main packages. Pattern arguments -// will only match main packages. +// will only match main packages. // // If the arguments don't have version suffixes, "go install" may run in // module-aware mode or GOPATH mode, depending on the GO111MODULE environment diff --git a/libgo/go/cmd/go/internal/modfetch/cache.go b/libgo/go/cmd/go/internal/modfetch/cache.go index 3a2ff63721c..07e046c8cba 100644 --- a/libgo/go/cmd/go/internal/modfetch/cache.go +++ b/libgo/go/cmd/go/internal/modfetch/cache.go @@ -84,6 +84,7 @@ func DownloadDir(m module.Version) (string, error) { return "", err } + // Check whether the directory itself exists. dir := filepath.Join(cfg.GOMODCACHE, enc+"@"+encVer) if fi, err := os.Stat(dir); os.IsNotExist(err) { return dir, err @@ -92,6 +93,9 @@ func DownloadDir(m module.Version) (string, error) { } else if !fi.IsDir() { return dir, {dir, errors.New("not a directory")} } + + // Check if a .partial file exists. This is created at the beginning of + // a download and removed after the zip is extracted. partialPath, err := CachePath(m, "partial") if err != nil { return dir, err @@ -101,6 +105,19 @@ func DownloadDir(m module.Version) (string, error) { } else if !os.IsNotExist(err) { return dir, err } + + // Check if a .ziphash file exists. It should be created before the + // zip is extracted, but if it was deleted (by another program?), we need + // to re-calculate it. + ziphashPath, err := CachePath(m, "ziphash") + if err != nil { + return dir, err + } + if _, err := os.Stat(ziphashPath); os.IsNotExist(err) { + return dir, {dir,
libgo patch committed: Update to Go 1.16.2 release
This patch updates libgo to the Go 1.16.2 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian d5eae60451faeea9d87ae3815f7e4db0e6e182ed diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e5756c6662c..c0bfa1ff78a 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2f281eb24ef256a2d3bb9fc1a7ef964d82b40182 +10b00ad87303d37c68b2d54dd25d655bd316946e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index 183b0245ee2..a52dceb182f 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -f21be2fdc6f1becdbed1592ea0b245cdeedc5ac8 +3979fb9af9ccfc0b7ccb613dcf256b18c2c295f0 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index 4befab24bc9..d0b0a900460 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.16 +go1.16.2 diff --git a/libgo/go/archive/zip/reader.go b/libgo/go/archive/zip/reader.go index 8b4e77875fb..c288ad965bc 100644 --- a/libgo/go/archive/zip/reader.go +++ b/libgo/go/archive/zip/reader.go @@ -664,7 +664,7 @@ func toValidName(name string) string { if strings.HasPrefix(p, "/") { p = p[len("/"):] } - for strings.HasPrefix(name, "../") { + for strings.HasPrefix(p, "../") { p = p[len("../"):] } return p diff --git a/libgo/go/archive/zip/reader_test.go b/libgo/go/archive/zip/reader_test.go index 34e96f7da43..5faf1f49b51 100644 --- a/libgo/go/archive/zip/reader_test.go +++ b/libgo/go/archive/zip/reader_test.go @@ -1081,3 +1081,38 @@ func TestFS(t *testing.T) { t.Fatal(err) } } + +func TestCVE202127919(t *testing.T) { + // Archive containing only the file "../test.txt" + data := []byte{ + 0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2e, 0x2e, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x78, + 0x74, 0x0a, 0xc9, 0xc8, 0x2c, 0x56, 0xc8, 0x2c, + 0x56, 0x48, 0x54, 0x28, 0x49, 0x2d, 0x2e, 0x51, + 0x28, 0x49, 0xad, 0x28, 0x51, 0x48, 0xcb, 0xcc, + 0x49, 0xd5, 0xe3, 0x02, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x50, 0x4b, 0x07, 0x08, 0xc0, 0xd7, 0xed, + 0xc3, 0x20, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, + 0x00, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, + 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0xd7, 0xed, 0xc3, 0x20, 0x00, 0x00, + 0x00, 0x1a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, + 0x2e, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, + 0x78, 0x74, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x39, 0x00, + 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, + } + r, err := NewReader(bytes.NewReader([]byte(data)), int64(len(data))) + if err != nil { + t.Fatalf("Error reading the archive: %v", err) + } + _, err = r.Open("test.txt") + if err != nil { + t.Errorf("Error reading file: %v", err) + } +} diff --git a/libgo/go/cmd/go.mod b/libgo/go/cmd/go.mod index 235e28f64f3..35582f3975f 100644 --- a/libgo/go/cmd/go.mod +++ b/libgo/go/cmd/go.mod @@ -6,7 +6,7 @@ require ( github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2 golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 - golang.org/x/mod v0.4.1 + golang.org/x/mod v0.4.2-0.20210302225053-d515b24adc21 golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff ) diff --git a/libgo/go/cmd/go/internal/get/get.go b/libgo/go/cmd/go/internal/get/get.go index 38ff3823f22..329a2f5eda4 100644 --- a/libgo/go/cmd/go/internal/get/get.go +++ b/libgo/go/cmd/go/internal/get/get.go @@ -431,7 +431,7 @@ func downloadPackage(p *load.Package) error { } importPrefix = importPrefix[:slash] } - if err := module.CheckImportPath(importPrefix); err != nil { + if err := checkImportPath(importPrefix); err != nil { return fmt.Errorf("%s: invalid import path: %v", p.ImportPath, err) } security := web.SecureOnly @@ -591,3 +591,31 @@ func selectTag(goVersion string, tags []string) (match string) { } return "" } + +// checkImportPath is like module.CheckImportPath, but it forbids
libgo patch committed: Don't use == for string equality in C code
This patch to libgo avoids using == for string equality in C code. This is a backport of https://golang.org/cl/300993. This is for GCC PR 99553. Bootstrapped and ran gotools testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian eb7eb29c37b1326bd4c8af7e5c35439a5d4521d4 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 58c881a7872..e5756c6662c 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -bf35249a7c752836741b1cab43a312f87916fcb0 +2f281eb24ef256a2d3bb9fc1a7ef964d82b40182 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/misc/cgo/testcarchive/testdata/main_unix.c b/libgo/misc/cgo/testcarchive/testdata/main_unix.c index b23ac1c2428..bd00f9d2339 100644 --- a/libgo/misc/cgo/testcarchive/testdata/main_unix.c +++ b/libgo/misc/cgo/testcarchive/testdata/main_unix.c @@ -36,7 +36,7 @@ int install_handler() { return 2; } // gccgo does not set SA_ONSTACK for SIGSEGV. - if (getenv("GCCGO") == "" && (osa.sa_flags_ONSTACK) == 0) { + if (getenv("GCCGO") == NULL && (osa.sa_flags_ONSTACK) == 0) { fprintf(stderr, "Go runtime did not install signal handler\n"); return 2; }
libgo patch committed: Cast SIGSTKSZ to uintptr
This libgo patch casts SIGSTKSZ to uintptr before comparing it to a uintptr value. This fixes build failures with newer versions of glibc in which SIGSTKSZ has changed such that the type is now long. The build failure is a signed-unsigned comparison warning that turns into an error due to -Werror. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline and GCC 9 and 10 branches. Ian d03d1688cebc0985aac189bcf6f46089044056ad diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 5c9fc7db4e1..5b45f03a26e 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2c5188b5ad6143e791f2ba42f02a4ea7887d87b6 +93380a9126e76b71fa208e62c31c7914084c0e37 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index c037df645b9..38bf7a6b255 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -802,8 +802,8 @@ runtime_malg(bool allocatestack, bool signalstack, byte** ret_stack, uintptr* re if(signalstack) { stacksize = 32 * 1024; // OS X wants >= 8K, GNU/Linux >= 2K #ifdef SIGSTKSZ - if(stacksize < SIGSTKSZ) - stacksize = SIGSTKSZ; + if(stacksize < (uintptr)(SIGSTKSZ)) + stacksize = (uintptr)(SIGSTKSZ); #endif }
libgo patch committed: Ensure 8 byte atomicity on ppc64
This libgo patch by Lynn Boger ensures 8 byte atomicity in memmove and memset on ppc64. Go requires that pointer moves are done 8 bytes at a time, so that the concurrent garbage collector always sees an entire pointer value. 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. This fixes https://golang.org/issue/41428. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 0689d6198ac4f1c00ba4722e0321f0cedfdd6d16 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 217bdd55f1d..9806b9da1e1 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -78a840e4940159a66072237f6b002ab79f441b79 +56cf388da8d04bbd3824c4df34d77a8afa69749b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index eea7ff15aed..dec98756673 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -454,6 +454,7 @@ runtime_files = \ runtime/go-fieldtrack.c \ runtime/go-matherr.c \ runtime/go-memclr.c \ + runtime/go-memmove.c \ runtime/go-memequal.c \ runtime/go-nanotime.c \ runtime/go-now.c \ diff --git a/libgo/go/runtime/stubs.go b/libgo/go/runtime/stubs.go index 6d20c384330..dea7234b3ad 100644 --- a/libgo/go/runtime/stubs.go +++ b/libgo/go/runtime/stubs.go @@ -106,9 +106,7 @@ func reflect_memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) { memclrNoHeapPointers(ptr, n) } -// memmove copies n bytes from "from" to "to". //go:noescape -//extern __builtin_memmove func memmove(to, from unsafe.Pointer, n uintptr) //go:linkname reflect_memmove reflect.memmove diff --git a/libgo/runtime/go-memclr.c b/libgo/runtime/go-memclr.c index b5d4975e57d..53b81178539 100644 --- a/libgo/runtime/go-memclr.c +++ b/libgo/runtime/go-memclr.c @@ -13,5 +13,48 @@ void memclrNoHeapPointers(void *, uintptr) void memclrNoHeapPointers (void *p1, uintptr len) { - __builtin_memset (p1, 0, len); + +#if !defined(__PPC64__) + __builtin_memset(p1, 0, len); +#else + int64 rem,drem,i; + uint64 offset; + volatile uint64 *vp; + + if (len == 0) { +return; + } + rem = len; + + offset = (uint64)p1 % 8; + // This memset is OK since it can't contain + // an 8 byte aligned pointer. + if ((rem < 8) || (offset > 0 && offset+rem <= 16)) { +__builtin_memset(p1, 0, rem); +return; + } + // Move initial bytes to get to 8 byte boundary + if (offset > 0) { +__builtin_memset(p1, 0, 8-offset); +p1 = (void*)((char*)p1+8-offset); +rem -= 8-offset; + } + + // If at least 8 bytes left, clear + drem = rem>>3; + + vp = (volatile uint64*)(p1); + // Without the use of volatile here, the compiler + // might convert the loop into a memset. + for (i=0; i 0) { +__builtin_memset (p1, 0, rem); + } +#endif } diff --git a/libgo/runtime/go-memmove.c b/libgo/runtime/go-memmove.c new file mode 100644 index 000..1ca3f4822b7 --- /dev/null +++ b/libgo/runtime/go-memmove.c @@ -0,0 +1,89 @@ +/* go-memmove.c -- memmove + + Copyright 2021 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. */ + +#include "runtime.h" + +void gomemmove(void *, void *, uintptr) + __asm__ (GOSYM_PREFIX "runtime.memmove") + __attribute__ ((no_split_stack)); + +// This implementation is necessary since +// the __builtin_memmove might use __libc_memmove +// which doesn't require atomicity of 8 byte +// moves. + +void +gomemmove (void *dst, void *src, uintptr len) +{ +#if !defined(__PPC64__) + __builtin_memmove(dst, src, len); +#else + uint64 offset, tail; + int64 rem; + uint64 dwords; + uint64 i; + char *bdst,*bsrc; + + rem = len; + + if (len == 0) { + return; + } + + // If src and dst don't have the same 8 byte alignment then + // there is no issue with copying pointer atomicity. Use the + // builtin. + if (((uint64)dst % 8) != ((uint64)src % 8) || len < 8) { + __builtin_memmove(dst, src, len); + return; + } + + // Length >= 8 && same ptr alignment + offset = (uint64)dst % 8; + + // If not 8 byte alignment, move the intial bytes. + if (offset > 0) { + __builtin_memmove(dst, src, 8-offset); + dst += (8-offset); + src += (8-offset); + rem -= (8-offset); + } + + // Move the tail bytes to make the backward move + // easier. + tail = rem % 8; + if (tail > 0) { + __builtin_memmove(dst+rem-tail, src+rem-tail, tail); + rem -= tail; + } + + if (rem == 0) { + return; + } + + // Must now be 8 byte alignment and
libgo patch committed: Update to Go1.16 release
This patch updates libgo to the final Go 1.16 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian c89b42d3b9d76dedb35e8478913ddf5367f3b5e6 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index eed9ce01905..217bdd55f1d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -c406de0594782b1d6782a732a50f5b76387852dc +78a840e4940159a66072237f6b002ab79f441b79 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index b2fc633f06c..183b0245ee2 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -3e06467282c6d5678a6273747658c04314e013ef +f21be2fdc6f1becdbed1592ea0b245cdeedc5ac8 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index a19294250b3..4befab24bc9 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.16rc1 +go1.16 diff --git a/libgo/go/archive/tar/strconv.go b/libgo/go/archive/tar/strconv.go index 6d0a4038082..f0b61e6dba6 100644 --- a/libgo/go/archive/tar/strconv.go +++ b/libgo/go/archive/tar/strconv.go @@ -265,8 +265,27 @@ func parsePAXRecord(s string) (k, v, r string, err error) { return "", "", s, ErrHeader } + afterSpace := int64(sp + 1) + beforeLastNewLine := n - 1 + // In some cases, "length" was perhaps padded/malformed, and + // trying to index past where the space supposedly is goes past + // the end of the actual record. + // For example: + //"30 mtime=1432668921.098285006\n30 ctime=2147483649.15163319" + // ^ ^ + // | | + // | afterSpace=35 + // | + // beforeLastNewLine=29 + // yet indexOf(firstSpace) MUST BE before endOfRecord. + // + // See https://golang.org/issues/40196. + if afterSpace >= beforeLastNewLine { + return "", "", s, ErrHeader + } + // Extract everything between the space and the final newline. - rec, nl, rem := s[sp+1:n-1], s[n-1:n], s[n:] + rec, nl, rem := s[afterSpace:beforeLastNewLine], s[beforeLastNewLine:n], s[n:] if nl != "\n" { return "", "", s, ErrHeader } diff --git a/libgo/go/archive/tar/strconv_test.go b/libgo/go/archive/tar/strconv_test.go index dd3505a758a..add65e272ae 100644 --- a/libgo/go/archive/tar/strconv_test.go +++ b/libgo/go/archive/tar/strconv_test.go @@ -368,6 +368,13 @@ func TestParsePAXRecord(t *testing.T) { {"16 longkeyname=hahaha\n", "16 longkeyname=hahaha\n", "", "", false}, {"3 somelongkey=\n", "3 somelongkey=\n", "", "", false}, {"50 tooshort=\n", "50 tooshort=\n", "", "", false}, + {"30 mtime=1432668921.098285006\n30 ctime=2147483649.15163319", "30 mtime=1432668921.098285006\n30 ctime=2147483649.15163319", "mtime", "1432668921.098285006", false}, + {"06 k=v\n", "06 k=v\n", "", "", false}, + {"6 k=v\n", "6 k=v\n", "", "", false}, + {"06 k=v\n", "06 k=v\n", "", "", false}, + {"00 k=v\n", "00 k=v\n", "", "", false}, + {"0 k=v\n", "0 k=v\n", "", "", false}, + {"+005 x=\n", "+005 x=\n", "", "", false}, } for _, v := range vectors { diff --git a/libgo/go/cmd/go/alldocs.go b/libgo/go/cmd/go/alldocs.go index 49d390297cd..e7c63f0749d 100644 --- a/libgo/go/cmd/go/alldocs.go +++ b/libgo/go/cmd/go/alldocs.go @@ -1808,7 +1808,7 @@ // The directory where the go command will write // temporary source files, packages, and binaries. // GOVCS -// Lists version control commands that may be used with matching servers. +// Lists version control commands that may be used with matching servers. // See 'go help vcs'. // // Environment variables for use with cgo: @@ -2410,6 +2410,17 @@ // // For a detailed reference on modules, see https://golang.org/ref/mod. // +// By default, the go command may download modules from https://proxy.golang.org. +// It may authenticate modules using the checksum database at +// https://sum.golang.org. Both services are operated by the Go team at Google. +// The privacy policies for these services are available at +// https://proxy.golang.org/privacy and https://sum.golang.org/privacy, +// respectively. +// +// The go command's download behavior may be configured using GOPROXY, GOSUMDB, +// GOPRIVATE, and other environment variables. See 'go help environment' +// and
libgo patch committed: Install new packages
In the update of libgo to the Go 1.16 beta and release candidate, I forgot to update the Makefile to actually install new packages. This patch does that. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 8e6839059d52c02acb52a4ba1ea6a5fcda88d16b diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index cb12c83a700..905c6fe9326 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -271a043537f2f0ae93bde2cf4f4897e68a476ece +78770fd9c29037dec8b2919c0f02067915c6ad33 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 7be90a564fe..eea7ff15aed 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -130,6 +130,7 @@ toolexeclibgo_DATA = \ bytes.gox \ context.gox \ crypto.gox \ + embed.gox \ encoding.gox \ errors.gox \ expvar.gox \ @@ -256,6 +257,11 @@ toolexeclibgogo_DATA = \ go/token.gox \ go/types.gox +toolexeclibgogobuilddir = $(toolexeclibgogodir)/build + +toolexeclibgogobuild_DATA = \ + go/build/constraint.gox + toolexeclibgohashdir = $(toolexeclibgodir)/hash toolexeclibgohash_DATA = \ @@ -292,6 +298,7 @@ toolexeclibgoindex_DATA = \ toolexeclibgoiodir = $(toolexeclibgodir)/io toolexeclibgoio_DATA = \ + io/fs.gox \ io/ioutil.gox toolexeclibgologdir = $(toolexeclibgodir)/log @@ -360,6 +367,7 @@ toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime toolexeclibgoruntime_DATA = \ runtime/debug.gox \ + runtime/metrics.gox \ runtime/pprof.gox \ runtime/trace.gox @@ -371,6 +379,7 @@ toolexeclibgosync_DATA = \ toolexeclibgotestingdir = $(toolexeclibgodir)/testing toolexeclibgotesting_DATA = \ + testing/fstest.gox \ testing/iotest.gox \ testing/quick.gox
libgo patch committed: Correct reference to getsystemcgf
This libgo patch by Clément Chigot directly sets getsystemcfg as //extern in internal/cpu instead of trying to use the runtime as in Go toolchain. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 7da2394fc591a3fb236190c8712f3960a4ee8e5f diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 366fcf02885..cb12c83a700 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2663206528a6d46cbde60dbccf84c8288707ab8d +271a043537f2f0ae93bde2cf4f4897e68a476ece The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/internal/cpu/cpu_ppc64x_aix.go b/libgo/go/internal/cpu/cpu_ppc64x_aix.go index a932684baf2..e2422a6ddaa 100644 --- a/libgo/go/internal/cpu/cpu_ppc64x_aix.go +++ b/libgo/go/internal/cpu/cpu_ppc64x_aix.go @@ -17,5 +17,5 @@ func osinit() { PPC64.IsPOWER9 = isSet(impl, _IMPL_POWER9) } -// getsystemcfg is defined in runtime/os2_aix.go +//extern getsystemcfg func getsystemcfg(label uint) uint diff --git a/libgo/go/runtime/os_aix.go b/libgo/go/runtime/os_aix.go index 630a1c22d7f..d902ae04dc9 100644 --- a/libgo/go/runtime/os_aix.go +++ b/libgo/go/runtime/os_aix.go @@ -13,9 +13,6 @@ import ( //extern sysconf func sysconf(int32) _C_long -//extern getsystemcfg -func getsystemcfg(int32) uint64 - type mOS struct { waitsema uintptr // semaphore for parking on locks }
libgo patch committed: Update hurd support
This libgo patch by Svante Signell updates the hurd support. This fixes GCC PR 98496. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian ab5bf5f728be354427a5b06784f34011fea555bc diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index cd95c3d0755..8cfc63248a7 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -255657dc8d61ab26121ca68f124412ef37599166 +fd5396b1af389a55d1e3612702cfdad6755084e9 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 2e8c37e170d..6188725f73b 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -881,7 +881,7 @@ GOBENCH = CHECK = \ GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ export GC; \ - GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ + GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ export GOLIBS; \ RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ export RUNTESTFLAGS; \ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 34b0e1d0056..daae4f842d7 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -1029,7 +1029,7 @@ GOBENCH = CHECK = \ GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ export GC; \ - GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ + GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ export GOLIBS; \ RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ export RUNTESTFLAGS; \ diff --git a/libgo/go/crypto/x509/root_hurd.go b/libgo/go/crypto/x509/root_hurd.go index 59e9ff0c81b..a25b8a1bc08 100644 --- a/libgo/go/crypto/x509/root_hurd.go +++ b/libgo/go/crypto/x509/root_hurd.go @@ -9,3 +9,9 @@ package x509 var certFiles = []string{ "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc. } + +// Possible directories with certificate files; stop after successfully +// reading at least one file from a directory. +var certDirectories = []string{ + "/etc/ssl/certs", // SLES10/SLES11, https://golang.org/issue/12139 +} diff --git a/libgo/go/runtime/export_pipe2_test.go b/libgo/go/runtime/export_pipe2_test.go index 9d580d33134..209c6b14a11 100644 --- a/libgo/go/runtime/export_pipe2_test.go +++ b/libgo/go/runtime/export_pipe2_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build freebsd linux netbsd openbsd solaris +// +build freebsd hurd linux netbsd openbsd solaris package runtime diff --git a/libgo/go/runtime/nbpipe_test.go b/libgo/go/runtime/nbpipe_test.go index 981143ec27b..d7c5d45c854 100644 --- a/libgo/go/runtime/nbpipe_test.go +++ b/libgo/go/runtime/nbpipe_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris package runtime_test diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 1613b410e2c..8bde23edb81 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -27,19 +27,19 @@ func libc_malloc(uintptr) unsafe.Pointer //go:noescape //extern sem_init -func sem_init(sem *_sem_t, pshared int32, value uint32) int32 +func sem_init(sem *semt, pshared int32, value uint32) int32 //go:noescape //extern sem_wait -func sem_wait(sem *_sem_t) int32 +func sem_wait(sem *semt) int32 //go:noescape //extern sem_post -func sem_post(sem *_sem_t) int32 +func sem_post(sem *semt) int32 //go:noescape //extern sem_timedwait -func sem_timedwait(sem *_sem_t, timeout *timespec) int32 +func sem_timedwait(sem *semt, timeout *timespec) int32 //go:noescape //extern clock_gettime @@ -51,12 +51,12 @@ func semacreate(mp *m) { return } - var sem *_sem_t + var sem *semt // Call libc's malloc rather than malloc. This will // allocate space on the C heap. We can't call malloc // here because it could cause a deadlock. - sem = (*_sem_t)(libc_malloc(unsafe.Sizeof(*sem))) + sem = (*semt)(libc_malloc(unsafe.Sizeof(*sem))) if sem_init(sem, 0, 0) != 0 { throw("sem_init") } @@ -86,7 +86,7 @@ func semasleep(ns int64) int32 { ts.tv_sec = timespec_sec_t(sec) ts.tv_nsec = timespec_nsec_t(nsec) - if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.waitsema)), ) != 0 { + if sem_timedwait((*semt)(unsafe.Pointer(_m_.waitsema)), ) != 0 {
libgo patch committed: Ensure openat uses variadic wrapper
This libgo patch by Paul Murphy ensures that openat always uses the variadic libc wrapper. On powerpc64le, not using the wrapper caused a failure in TestUnshareUidGidMapping due to stack corruption which resulted in a bogus execve syscall. This fixes GCC PR 98610. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 3cab7034b52dbc40c78c8ccb1738795de80e927b diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 094b8fad483..cd95c3d0755 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a2578eb3983514641f0baf44d27d6474d3a96758 +255657dc8d61ab26121ca68f124412ef37599166 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/exec_linux.go b/libgo/go/syscall/exec_linux.go index 38975810432..0da6c964966 100644 --- a/libgo/go/syscall/exec_linux.go +++ b/libgo/go/syscall/exec_linux.go @@ -20,7 +20,7 @@ import ( //mount(source *byte, target *byte, fstype *byte, flags _C_long, data *byte) _C_int //sysnb rawOpenat(dirfd int, pathname *byte, flags int, perm uint32) (fd int, err Errno) -//openat(dirfd _C_int, pathname *byte, flags _C_int, perm Mode_t) _C_int +//__go_openat(dirfd _C_int, pathname *byte, flags _C_int, perm Mode_t) _C_int // SysProcIDMap holds Container ID to Host ID mappings used for User Namespaces in Linux. // See user_namespaces(7).
libgo patch committed: Don't define sys_SETREUID and friends
This libgo patch changes the syscall package to not define sys_SETREUID and some friends. We don't use them anyhow, sice we always call the C library functions which do the right thing. And they aren't defined on all GNU/Linux variants. This fixes GCC PR 98510. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian f47c00cf95d7dbbe7147c61a4a6bc20921c3da2c diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index c80f1cc1425..094b8fad483 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -5b075d039a20f32b9c2711ca67a3e52fba74f957 +a2578eb3983514641f0baf44d27d6474d3a96758 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/setuidgid_32_linux.go b/libgo/go/syscall/setuidgid_32_linux.go index b0b7f61d221..1fe7120d1c6 100644 --- a/libgo/go/syscall/setuidgid_32_linux.go +++ b/libgo/go/syscall/setuidgid_32_linux.go @@ -12,10 +12,4 @@ const ( sys_SETGID = SYS_SETGID32 sys_SETUID = SYS_SETUID32 - - sys_SETREGID = SYS_SETREGID32 - sys_SETREUID = SYS_SETREUID32 - - sys_SETRESGID = SYS_SETRESGID32 - sys_SETRESUID = SYS_SETRESUID32 ) diff --git a/libgo/go/syscall/setuidgid_linux.go b/libgo/go/syscall/setuidgid_linux.go index 38c83c92f97..22fa334bfa5 100644 --- a/libgo/go/syscall/setuidgid_linux.go +++ b/libgo/go/syscall/setuidgid_linux.go @@ -12,10 +12,4 @@ const ( sys_SETGID = SYS_SETGID sys_SETUID = SYS_SETUID - - sys_SETREGID = SYS_SETREGID - sys_SETREUID = SYS_SETREUID - - sys_SETRESGID = SYS_SETRESGID - sys_SETRESUID = SYS_SETRESUID )
Re: libgo patch committed: Update to Go1.16beta1 release
On Sat, Jan 2, 2021 at 6:14 AM Matthias Klose wrote: > > On 1/2/21 12:11 AM, Ian Lance Taylor wrote: > > On Thu, Dec 31, 2020 at 7:40 AM Matthias Klose wrote: > >> > >> On 12/31/20 12:14 AM, Ian Lance Taylor via Gcc-patches wrote: > >>> I've committed a patch to update libgo to the Go 1.16beta1 release. > >>> > >>> This patch does not include support for the new //go:embed directive > >>> that will be available in Go 1.16.1 (https://golang.org/issue/41191) > >>> Support for that requires compiler changes, which will come later. > >>> > >>> As usual with these big updates, I have not included the complete > >>> changes in this e-mail message, only changes that are gccgo-specific. > >>> > >>> Testing this requires some changes to gotools. > >>> > >>> Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > >>> to mainline. > >> > >> also breaks the s390x 32bit multilib build (s390). > >> > >> ../../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to > >> undefined name 'doinit' > >> 123 | doinit() > >> | ^ > > > > The problems building the internal/cpu and golang.org/x/sys/cpu > > packages on less common architectures should be fixed by this patch. > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > > to mainline. > > still ftbfs on power*, tested with a multilib build on powerpc64-linux-gnu. > patch attached, didn't check on aix. > > ../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined > name 'doinit' > 123 | doinit() > | ^ > > > ../../../src/libgo/go/internal/cpu/cpu_ppc64x_linux.go:26:26: error: reference > to undefined name 'isSet' >26 | PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00) > | ^ > ../../../src/libgo/go/internal/cpu/cpu_ppc64x_linux.go:27:25: error: reference > to undefined name 'isSet' >27 | PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN) > | ^ > ../../../src/libgo/go/internal/cpu/cpu_ppc64x_linux.go:28:24: error: reference > to undefined name 'isSet' >28 | PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV) > |^ This patch cleans up internal/cpu some more, including bringing in some files from the source repo. It should fix these problems. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu and powerpc64-unknown-linux-gnu. Committed to mainline. Ian 9c56d98e6b7f38ee3fc0993a2baa6de1224ef1f1 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index f4c99756d25..c80f1cc1425 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2b5bdd22b7ec2fc13ae0f644c781f64c1a209500 +5b075d039a20f32b9c2711ca67a3e52fba74f957 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/internal/cpu/cpu_arm.go b/libgo/go/internal/cpu/cpu_arm.go index 7324e7b8151..06962cfc518 100644 --- a/libgo/go/internal/cpu/cpu_arm.go +++ b/libgo/go/internal/cpu/cpu_arm.go @@ -4,6 +4,8 @@ package cpu +// const CacheLinePadSize = 32 + // arm doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. // These are initialized by archauxv() and should not be changed after they are // initialized. diff --git a/libgo/go/internal/cpu/cpu_mips.go b/libgo/go/internal/cpu/cpu_mips.go new file mode 100644 index 000..48755b6d1ae --- /dev/null +++ b/libgo/go/internal/cpu/cpu_mips.go @@ -0,0 +1,10 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +// const CacheLinePadSize = 32 + +func doinit() { +} diff --git a/libgo/go/internal/cpu/cpu_mips64x.go b/libgo/go/internal/cpu/cpu_mips64x.go index af10a5071ea..58fbd3db93d 100644 --- a/libgo/go/internal/cpu/cpu_mips64x.go +++ b/libgo/go/internal/cpu/cpu_mips64x.go @@ -6,6 +6,8 @@ package cpu +// const CacheLinePadSize = 32 + // This is initialized by archauxv and should not be changed after it is // initialized. var HWCap uint diff --git a/libgo/go/internal/cpu/cpu_mipsle.go b/libgo/go/internal/cpu/cpu_mipsle.go new file mode 100644 index 000..48755b6d1ae --- /dev/null +++ b/libgo/go/internal/cpu/cpu_mipsle.go @@ -0,0 +1,10 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +// const CacheLinePadSize = 32 + +func doinit() { +} diff --git a/libgo/go/internal/cpu/cpu_no_name.go b/libgo/go/internal/cpu/cpu_no_name.go index ce1c37a3c7c..f028a92c935 100644 --- a/libgo/go/internal/cpu/cpu_no_name.go +++ b/libgo/go/internal/cpu/cpu_no_name.go @@ -4,6 +4,7 @@ // +build !386 // +build !amd64 +// +build !amd64p32 package cpu diff --git a/libgo/go/internal/cpu/cpu_other.go b/libgo/go/internal/cpu/cpu_other.go index d0f1f2e2150..ba3c42ad569
Re: libgo patch committed: Update to Go1.16beta1 release
On 1/2/21 12:11 AM, Ian Lance Taylor wrote: > On Thu, Dec 31, 2020 at 7:40 AM Matthias Klose wrote: >> >> On 12/31/20 12:14 AM, Ian Lance Taylor via Gcc-patches wrote: >>> I've committed a patch to update libgo to the Go 1.16beta1 release. >>> >>> This patch does not include support for the new //go:embed directive >>> that will be available in Go 1.16.1 (https://golang.org/issue/41191) >>> Support for that requires compiler changes, which will come later. >>> >>> As usual with these big updates, I have not included the complete >>> changes in this e-mail message, only changes that are gccgo-specific. >>> >>> Testing this requires some changes to gotools. >>> >>> Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed >>> to mainline. >> >> also breaks the s390x 32bit multilib build (s390). >> >> ../../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to >> undefined name 'doinit' >> 123 | doinit() >> | ^ > > The problems building the internal/cpu and golang.org/x/sys/cpu > packages on less common architectures should be fixed by this patch. > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > to mainline. still ftbfs on power*, tested with a multilib build on powerpc64-linux-gnu. patch attached, didn't check on aix. ../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined name 'doinit' 123 | doinit() | ^ ../../../src/libgo/go/internal/cpu/cpu_ppc64x_linux.go:26:26: error: reference to undefined name 'isSet' 26 | PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00) | ^ ../../../src/libgo/go/internal/cpu/cpu_ppc64x_linux.go:27:25: error: reference to undefined name 'isSet' 27 | PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN) | ^ ../../../src/libgo/go/internal/cpu/cpu_ppc64x_linux.go:28:24: error: reference to undefined name 'isSet' 28 | PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV) |^ Matthias --- a/libgo/go/internal/cpu/cpu_ppc64x_aix.go +++ b/libgo/go/internal/cpu/cpu_ppc64x_aix.go @@ -12,10 +12,14 @@ const ( _IMPL_POWER9 = 0x2 ) -func osinit() { +func doinit() { impl := getsystemcfg(_SC_IMPL) PPC64.IsPOWER9 = isSet(impl, _IMPL_POWER9) } +func isSet(hwc uint, value uint) bool { +return hwc != 0 +} + // getsystemcfg is defined in runtime/os2_aix.go func getsystemcfg(label uint) uint --- a/libgo/go/internal/cpu/cpu_ppc64x_linux.go +++ b/libgo/go/internal/cpu/cpu_ppc64x_linux.go @@ -22,8 +22,12 @@ const ( hwcap2_SCV = 0x0010 ) -func osinit() { +func doinit() { PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00) PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN) PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV) } + +func isSet(hwc uint, value uint) bool { +return hwc != 0 +}
Re: libgo patch committed: Update to Go1.16beta1 release
On Fri, Jan 1, 2021 at 3:15 PM Ian Lance Taylor via Gcc-patches wrote: > > As far as I know all the build problems introduced by the update to > Go1.16beta1 are now fixed. > > Please let me know if I missed anything. > You missed this one for x32: diff --git a/libgo/go/internal/cpu/cpu_no_name.go b/libgo/go/internal/cpu/cpu_no_name.go index ce1c37a3c7c..f028a92c935 100644 --- a/libgo/go/internal/cpu/cpu_no_name.go +++ b/libgo/go/internal/cpu/cpu_no_name.go @@ -4,6 +4,7 @@ // +build !386 // +build !amd64 +// +build !amd64p32 package cpu -- H.J.
Re: libgo patch committed: Update to Go1.16beta1 release
As far as I know all the build problems introduced by the update to Go1.16beta1 are now fixed. Please let me know if I missed anything. Sorry for the difficulties, it's hard to test on so many systems. Ian On Fri, Jan 1, 2021 at 3:14 PM Ian Lance Taylor wrote: > > On Fri, Jan 1, 2021 at 1:32 AM Andreas Schwab wrote: > > > > --- a/libgo/go/internal/cpu/cpu_gccgo.c > > +++ b/libgo/go/internal/cpu/cpu_gccgo.c > > @@ -200,3 +200,29 @@ struct queryResult kdsaQuery() { > > } > > > > #endif /* defined(__s390x__) */ > > + > > +#ifdef __aarch64__ > > + > > +uint64_t getisar0(void) > > + __asm__(GOSYM_PREFIX "internal_1cpu.getisar0") > > + __attribute__((no_split_stack)); > > + > > +uint64_t getisar0() { > > + uint64_t isar0; > > + > > + __asm__("mrs %0,id_aa64isar0_el1" : "=r"(isar0)); > > + return isar0; > > +} > > + > > +uint64_t getMIDR(void) > > + __asm__(GOSYM_PREFIX "internal_1cpu.getMIDR") > > + __attribute__((no_split_stack)); > > + > > +uint64_t getMIDR() { > > + uint64_t MIDR; > > + > > + __asm__("mrs %0,midr_el1" : "=r"(MIDR)); > > + return MIDR; > > +} > > + > > +#endif /* defined(__aarch64__) */ > > > Thanks! > > Committed to mainline. > > Ian
Re: libgo patch committed: Update to Go1.16beta1 release
On Fri, Jan 1, 2021 at 1:32 AM Andreas Schwab wrote: > > --- a/libgo/go/internal/cpu/cpu_gccgo.c > +++ b/libgo/go/internal/cpu/cpu_gccgo.c > @@ -200,3 +200,29 @@ struct queryResult kdsaQuery() { > } > > #endif /* defined(__s390x__) */ > + > +#ifdef __aarch64__ > + > +uint64_t getisar0(void) > + __asm__(GOSYM_PREFIX "internal_1cpu.getisar0") > + __attribute__((no_split_stack)); > + > +uint64_t getisar0() { > + uint64_t isar0; > + > + __asm__("mrs %0,id_aa64isar0_el1" : "=r"(isar0)); > + return isar0; > +} > + > +uint64_t getMIDR(void) > + __asm__(GOSYM_PREFIX "internal_1cpu.getMIDR") > + __attribute__((no_split_stack)); > + > +uint64_t getMIDR() { > + uint64_t MIDR; > + > + __asm__("mrs %0,midr_el1" : "=r"(MIDR)); > + return MIDR; > +} > + > +#endif /* defined(__aarch64__) */ Thanks! Committed to mainline. Ian
Re: libgo patch committed: Update to Go1.16beta1 release
On Thu, Dec 31, 2020 at 11:48 AM Rainer Orth wrote: > > > I've committed a patch to update libgo to the Go 1.16beta1 release. > > > > This patch does not include support for the new //go:embed directive > > that will be available in Go 1.16.1 (https://golang.org/issue/41191) > > Support for that requires compiler changes, which will come later. > > > > As usual with these big updates, I have not included the complete > > changes in this e-mail message, only changes that are gccgo-specific. > > > > Testing this requires some changes to gotools. > > > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > > to mainline. > > this broke Solaris bootstrap: > > * On i386-pc-solaris2.11: > > /vol/gcc/src/hg/master/local/libgo/go/runtime/os_gccgo.go:43:12: error: > reference to undefined name 'startupRandomData' >43 | if startupRandomData != nil { > |^ > /vol/gcc/src/hg/master/local/libgo/go/runtime/os_gccgo.go:44:30: error: > reference to undefined name 'startupRandomData' >44 | n := copy(r, startupRandomData) > | ^ > > startupRandomData is only defined in go/runtime/os_linux.go and relies > on AT_RANDOM in the aux vector which is Linux-only AFAICT. For the > moment, I've just commented that part of the code since it tries > /dev/urandom next. This problem should be fixed by this patch. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 0b9ef8be40b8ec530e46779a694e3b115b8e685d diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 6039cbc15f5..e51285c7214 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -6857530fb1662c05a3ce754df2bd9fa5acd3a35b +fa161cb71880cf80ef53fb4bf35dba8ee01af648 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/os_linux.go b/libgo/go/runtime/os_linux.go index 0eebdfa8004..627b6d6d43c 100644 --- a/libgo/go/runtime/os_linux.go +++ b/libgo/go/runtime/os_linux.go @@ -178,10 +178,6 @@ func sysargs(argc int32, argv **byte) { sysauxv(buf[:]) } -// startupRandomData holds random bytes initialized at startup. These come from -// the ELF AT_RANDOM auxiliary vector. -var startupRandomData []byte - func sysauxv(auxv []uintptr) int { var i int for ; auxv[i] != _AT_NULL; i += 2 { diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go index 2e550151245..023dac38ec2 100644 --- a/libgo/go/runtime/runtime2.go +++ b/libgo/go/runtime/runtime2.go @@ -885,6 +885,10 @@ type forcegcstate struct { idle uint32 } +// startupRandomData holds random bytes initialized at startup. These come from +// the ELF AT_RANDOM auxiliary vector. +var startupRandomData []byte + // extendRandom extends the random numbers in r[:n] to the whole slice r. // Treats n<0 as n==0. func extendRandom(r []byte, n int) {
Re: libgo patch committed: Update to Go1.16beta1 release
On Thu, Dec 31, 2020 at 7:40 AM Matthias Klose wrote: > > On 12/31/20 12:14 AM, Ian Lance Taylor via Gcc-patches wrote: > > I've committed a patch to update libgo to the Go 1.16beta1 release. > > > > This patch does not include support for the new //go:embed directive > > that will be available in Go 1.16.1 (https://golang.org/issue/41191) > > Support for that requires compiler changes, which will come later. > > > > As usual with these big updates, I have not included the complete > > changes in this e-mail message, only changes that are gccgo-specific. > > > > Testing this requires some changes to gotools. > > > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > > to mainline. > > also breaks the s390x 32bit multilib build (s390). > > ../../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to > undefined name 'doinit' > 123 | doinit() > | ^ The problems building the internal/cpu and golang.org/x/sys/cpu packages on less common architectures should be fixed by this patch. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 47fbf21eab3fd5bdda530149d9c956a29e587e36 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index fc5ef4498dd..6039cbc15f5 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -47bdc8bb36f16f9d1dec72df5dd6b45d7b0b0725 +6857530fb1662c05a3ce754df2bd9fa5acd3a35b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_other.go b/libgo/go/golang.org/x/sys/cpu/cpu_other.go new file mode 100644 index 000..d8bb8119f3f --- /dev/null +++ b/libgo/go/golang.org/x/sys/cpu/cpu_other.go @@ -0,0 +1,23 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !386 +// +build !amd64 +// +build !amd64p32 +// +build !arm +// +build !arm64 +// +build !mips +// +build !mipsle +// +build !mips64 +// +build !mips64le +// +build !ppc64 +// +build !ppc64le +// +build !riscv +// +build !riscv64 +// +build !s390x +// +build !wasm + +package cpu + +func initOptions() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_other_arch.go b/libgo/go/golang.org/x/sys/cpu/cpu_other_arch.go new file mode 100644 index 000..aef0a82a8ef --- /dev/null +++ b/libgo/go/golang.org/x/sys/cpu/cpu_other_arch.go @@ -0,0 +1,20 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !aix +// +build !linux +// +build !zos + +// +build !386 +// +build !amd64 +// +build !amd64p32 +// +build !arm +// +build !arm64 +// +build !mips64 +// +build !mips64le +// +build !wasm + +package cpu + +func archInit() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_riscv.go b/libgo/go/golang.org/x/sys/cpu/cpu_riscv.go index 891cb98b455..e229457fa38 100644 --- a/libgo/go/golang.org/x/sys/cpu/cpu_riscv.go +++ b/libgo/go/golang.org/x/sys/cpu/cpu_riscv.go @@ -5,3 +5,5 @@ // +build riscv package cpu + +func initOptions() {} diff --git a/libgo/go/internal/cpu/cpu_amd64p32.go b/libgo/go/internal/cpu/cpu_amd64p32.go new file mode 100644 index 000..a6cff4f096e --- /dev/null +++ b/libgo/go/internal/cpu/cpu_amd64p32.go @@ -0,0 +1,7 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const GOARCH = "amd64p32" diff --git a/libgo/go/internal/cpu/cpu_other.go b/libgo/go/internal/cpu/cpu_other.go new file mode 100644 index 000..d0f1f2e2150 --- /dev/null +++ b/libgo/go/internal/cpu/cpu_other.go @@ -0,0 +1,21 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !386 +// +build !amd64 +// +build !amd64p32 +// +build !arm +// +build !arm64 +// +build !mips64 +// +build !mips64le +// +build !ppc +// +build !ppc64 +// +build !ppc64le +// +build !riscv64 +// +build !s390x + +package cpu + +func doinit() { +} diff --git a/libgo/go/internal/cpu/cpu_ppc64x_aix.go b/libgo/go/internal/cpu/cpu_ppc64x_aix.go index b840b823bae..a932684baf2 100644 --- a/libgo/go/internal/cpu/cpu_ppc64x_aix.go +++ b/libgo/go/internal/cpu/cpu_ppc64x_aix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build ppc64 ppc64le +// +build ppc ppc64 ppc64le package cpu diff --git a/libgo/go/internal/cpu/cpu_ppc64x_linux.go b/libgo/go/internal/cpu/cpu_ppc64x_linux.go index 73b191436df..068a799781a 100644 --- a/libgo/go/internal/cpu/cpu_ppc64x_linux.go +++ b/libgo/go/internal/cpu/cpu_ppc64x_linux.go @@ -2,7 +2,7 @@ // Use of this source code is governed by
Re: libgo patch committed: Update to Go1.16beta1 release
../../../../libgo/go/golang.org/x/sys/cpu/cpu.go:200:9: error: reference to undefined name ‘initOptions’ 200 | initOptions() | ^ make[2]: *** [golang.org/x/sys/cpu.lo] Error 1 Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: libgo patch committed: Update to Go1.16beta1 release
../../../libgo/go/internal/cpu/cpu_ppcx.go:13:5: error: redefinition of 'HWCap' 13 | var HWCap uint | ^ ../../../libgo/go/internal/cpu/cpu_ppc64x_linux.go:12:5: note: previous definition of 'HWCap' was here 12 | var HWCap uint | ^ ../../../libgo/go/internal/cpu/cpu_ppcx.go:14:5: error: redefinition of 'HWCap2' 14 | var HWCap2 uint | ^ ../../../libgo/go/internal/cpu/cpu_ppc64x_linux.go:13:5: note: previous definition of 'HWCap2' was here 13 | var HWCap2 uint | ^ make[4]: *** [internal/cpu.lo] Error 1 Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: libgo patch committed: Update to Go1.16beta1 release
On 12/31/20 12:14 AM, Ian Lance Taylor via Gcc-patches wrote: > I've committed a patch to update libgo to the Go 1.16beta1 release. > > This patch does not include support for the new //go:embed directive > that will be available in Go 1.16.1 (https://golang.org/issue/41191) > Support for that requires compiler changes, which will come later. > > As usual with these big updates, I have not included the complete > changes in this e-mail message, only changes that are gccgo-specific. > > Testing this requires some changes to gotools. > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > to mainline. ../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined name 'doinit' 123 | doinit() | ^ also on sparc64, and most likely on the 32bit multilib. Until now I didn't find any build which is surviving this patch. Let's hope that 2021 gets a better ... Matthias
Re: libgo patch committed: Update to Go1.16beta1 release
--- a/libgo/go/internal/cpu/cpu_gccgo.c +++ b/libgo/go/internal/cpu/cpu_gccgo.c @@ -200,3 +200,29 @@ struct queryResult kdsaQuery() { } #endif /* defined(__s390x__) */ + +#ifdef __aarch64__ + +uint64_t getisar0(void) + __asm__(GOSYM_PREFIX "internal_1cpu.getisar0") + __attribute__((no_split_stack)); + +uint64_t getisar0() { + uint64_t isar0; + + __asm__("mrs %0,id_aa64isar0_el1" : "=r"(isar0)); + return isar0; +} + +uint64_t getMIDR(void) + __asm__(GOSYM_PREFIX "internal_1cpu.getMIDR") + __attribute__((no_split_stack)); + +uint64_t getMIDR() { + uint64_t MIDR; + + __asm__("mrs %0,midr_el1" : "=r"(MIDR)); + return MIDR; +} + +#endif /* defined(__aarch64__) */ -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: libgo patch committed: Update to Go1.16beta1 release
On aarch64: /usr/aarch64-suse-linux/bin/ld: ../aarch64-suse-linux/libgo/.libs/libgo.so: undefined reference to `internal_1cpu.getMIDR' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:831: test2json] Error 1 Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: libgo patch committed: Update to Go1.16beta1 release
Hi Ian, > I've committed a patch to update libgo to the Go 1.16beta1 release. > > This patch does not include support for the new //go:embed directive > that will be available in Go 1.16.1 (https://golang.org/issue/41191) > Support for that requires compiler changes, which will come later. > > As usual with these big updates, I have not included the complete > changes in this e-mail message, only changes that are gccgo-specific. > > Testing this requires some changes to gotools. > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > to mainline. this broke Solaris bootstrap: * On i386-pc-solaris2.11: /vol/gcc/src/hg/master/local/libgo/go/runtime/os_gccgo.go:43:12: error: reference to undefined name 'startupRandomData' 43 | if startupRandomData != nil { |^ /vol/gcc/src/hg/master/local/libgo/go/runtime/os_gccgo.go:44:30: error: reference to undefined name 'startupRandomData' 44 | n := copy(r, startupRandomData) | ^ startupRandomData is only defined in go/runtime/os_linux.go and relies on AT_RANDOM in the aux vector which is Linux-only AFAICT. For the moment, I've just commented that part of the code since it tries /dev/urandom next. One could also use getentropy instead. * sparc-sun-solaris2.11 is worse: /vol/gcc/src/hg/master/local/libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined name 'doinit' 123 | doinit() | ^ /vol/gcc/src/hg/master/local/libgo/go/golang.org/x/sys/cpu/cpu.go:199:9: error: reference to undefined name ‘archInit’ 199 | archInit() | ^ /vol/gcc/src/hg/master/local/libgo/go/golang.org/x/sys/cpu/cpu.go:200:9: error: reference to undefined name ‘initOptions’ 200 | initOptions() | ^ I've used dummy implementations to get along for now. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: libgo patch committed: Update to Go1.16beta1 release
On 12/31/20 12:14 AM, Ian Lance Taylor via Gcc-patches wrote: > I've committed a patch to update libgo to the Go 1.16beta1 release. > > This patch does not include support for the new //go:embed directive > that will be available in Go 1.16.1 (https://golang.org/issue/41191) > Support for that requires compiler changes, which will come later. > > As usual with these big updates, I have not included the complete > changes in this e-mail message, only changes that are gccgo-specific. > > Testing this requires some changes to gotools. > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > to mainline. also breaks the s390x 32bit multilib build (s390). ../../../../src/libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined name 'doinit' 123 | doinit() | ^
Re: libgo patch committed: Update to Go1.16beta1 release
On Dez 31 2020, Andreas Schwab wrote: > I'm getting this error in ia64: > > ../../../libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined > name 'doinit' > 123 | doinit() > | ^ > make[4]: *** [internal/cpu.lo] Error 1 ../../../libgo/go/golang.org/x/sys/cpu/cpu.go:200:9: error: reference to undefined name ‘initOptions’ 200 | initOptions() | ^ make[4]: *** [golang.org/x/sys/cpu.lo] Error 1 Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: libgo patch committed: Update to Go1.16beta1 release
On 12/31/20 11:36 AM, Matthias Klose wrote: > On 12/31/20 11:12 AM, Andreas Schwab wrote: >> I'm getting this error in ia64: >> >> ../../../libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined >> name 'doinit' >> 123 | doinit() >> | ^ >> make[4]: *** [internal/cpu.lo] Error 1 >> >> Andreas. >> > > also on x32, or with the x32 multilib target. fixed for x32 with the attached patch Matthias --- a/libgo/go/internal/cpu/cpu_no_name.go +++ b/libgo/go/internal/cpu/cpu_no_name.go @@ -4,6 +4,7 @@ // +build !386 // +build !amd64 +// +build !amd64p32 package cpu --- a/libgo/go/internal/cpu/cpu_x86.go +++ b/libgo/go/internal/cpu/cpu_x86.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64 +// +build 386 amd64 amd64p32 package cpu @@ -56,7 +56,7 @@ func doinit() { {Name: "ssse3", Feature: }, // These capabilities should always be enabled on amd64: - {Name: "sse2", Feature: , Required: GOARCH == "amd64"}, + {Name: "sse2", Feature: , Required: GOARCH == "amd64" || GOARCH == "amd64p32"}, } maxID, _, _, _ := cpuid(0, 0) --- /dev/null +++ b/libgo/go/internal/cpu/cpu_amd64p32.go @@ -0,0 +1,7 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const GOARCH = "amd64p32"
Re: libgo patch committed: Update to Go1.16beta1 release
On 12/31/20 11:12 AM, Andreas Schwab wrote: > I'm getting this error in ia64: > > ../../../libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined > name 'doinit' > 123 | doinit() > | ^ > make[4]: *** [internal/cpu.lo] Error 1 > > Andreas. > also on x32, or with the x32 multilib target.
Re: libgo patch committed: Update to Go1.16beta1 release
I'm getting this error in ia64: ../../../libgo/go/internal/cpu/cpu.go:123:9: error: reference to undefined name 'doinit' 123 | doinit() | ^ make[4]: *** [internal/cpu.lo] Error 1 Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
libgo patch committed: Update to Go1.16beta1 release
I've committed a patch to update libgo to the Go 1.16beta1 release. This patch does not include support for the new //go:embed directive that will be available in Go 1.16.1 (https://golang.org/issue/41191) Support for that requires compiler changes, which will come later. As usual with these big updates, I have not included the complete changes in this e-mail message, only changes that are gccgo-specific. Testing this requires some changes to gotools. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian * 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. 0c4cf80ab72765e5e1984f7d228822b945541915 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 1e461f06e95..fc5ef4498dd 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d67579759e1769c08148304b2d378ec0b05637d6 +47bdc8bb36f16f9d1dec72df5dd6b45d7b0b0725 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 1b8702e98bb..3bbccb96c28 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -101,7 +101,7 @@ MOSTLYCLEANFILES = \ mostlyclean-local: if test -d check-go-dir; then chmod -R u+w check-go-dir; fi - rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir \ + rm -rf check-go-dir cgo-test-dir carchive-test-dir \ check-vet-dir gocache-test if NATIVE @@ -210,6 +210,11 @@ check-go-tool: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc if test -d check-go-dir; then chmod -R u+w check-go-dir; fi rm -rf check-go-dir cmd_go-testlog $(MKDIR_P) check-go-dir/src/cmd/go + cp $(libgosrcdir)/go.mod check-go-dir/src/ + cp $(cmdsrcdir)/go.mod check-go-dir/src/cmd/ + $(MKDIR_P) check-go-dir/src/vendor check-go-dir/src/cmd/vendor + cp $(libgosrcdir)/vendor/modules.txt check-go-dir/src/vendor/ + cp $(libgosrcdir)/cmd/vendor/modules.txt check-go-dir/src/cmd/vendor/ cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/ cp -r $(cmdsrcdir)/go/internal check-go-dir/src/cmd/go/ cp $(libgodir)/zdefaultcc.go check-go-dir/src/cmd/go/internal/cfg/ @@ -234,8 +239,7 @@ check-go-tool: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc # but the runtime tests use the go tool heavily, so testing # here too will catch more problems. check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc - rm -rf check-runtime-dir runtime-testlog - $(MKDIR_P) check-runtime-dir + rm -f runtime-testlog @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ export LD_LIBRARY_PATH; \ @@ -256,6 +260,7 @@ check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf cgo-test-dir cgo-testlog $(MKDIR_P) cgo-test-dir/misc/cgo + echo 'module misc' > cgo-test-dir/misc/go.mod cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ echo "cd cgo-test-dir/misc/cgo/test && $(ECHO_ENV) GOTRACEBACK=2 $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > cgo-testlog @@ -270,6 +275,7 @@ check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf carchive-test-dir carchive-testlog $(MKDIR_P) carchive-test-dir/misc/cgo + echo 'module misc' > carchive-test-dir/misc/go.mod cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > carchive-testlog @@ -283,6 +289,11 @@ check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check check-vet: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf check-vet-dir cmd_vet-testlog $(MKDIR_P) check-vet-dir/src/cmd/internal check-vet-dir/src/cmd/vendor/golang.org/x + cp $(libgosrcdir)/go.mod check-vet-dir/src/ + cp $(cmdsrcdir)/go.mod check-vet-dir/src/cmd/ + $(MKDIR_P) check-vet-dir/src/vendor check-vet-dir/src/cmd/vendor + cp $(libgosrcdir)/vendor/modules.txt check-vet-dir/src/vendor/ + cp $(libgosrcdir)/cmd/vendor/modules.txt
libgo patch committed: Add a success field to the sudog structure
This libgo patch adds a success field to the sudog structure used to manage select statements. This is a step toward enabling some compiler changes as part of upgrading to the Go 1.16beta1 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 3b2d8145a4c349058d76ce299ea7eea605572004 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a7df8433403..bb537f152b9 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d0e56e82bb298268ec0f306fef99a715c892d4a7 +eca96e39cb895805b617e0e1f184f893ed3e46bb The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/chan.go b/libgo/go/runtime/chan.go index 8e104f14140..1b20aff6ea3 100644 --- a/libgo/go/runtime/chan.go +++ b/libgo/go/runtime/chan.go @@ -285,18 +285,19 @@ func chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool { } gp.waiting = nil gp.activeStackChans = false - if gp.param == nil { - if c.closed == 0 { - throw("chansend: spurious wakeup") - } - panic(plainError("send on closed channel")) - } + closed := !mysg.success gp.param = nil if mysg.releasetime > 0 { blockevent(mysg.releasetime-t0, 2) } mysg.c = nil releaseSudog(mysg) + if closed { + if c.closed == 0 { + throw("chansend: spurious wakeup") + } + panic(plainError("send on closed channel")) + } return true } @@ -333,6 +334,7 @@ func send(c *hchan, sg *sudog, ep unsafe.Pointer, unlockf func(), skip int) { gp := sg.g unlockf() gp.param = unsafe.Pointer(sg) + sg.success = true if sg.releasetime != 0 { sg.releasetime = cputicks() } @@ -406,7 +408,8 @@ func closechan(c *hchan) { sg.releasetime = cputicks() } gp := sg.g - gp.param = nil + gp.param = unsafe.Pointer(sg) + sg.success = false if raceenabled { raceacquireg(gp, c.raceaddr()) } @@ -424,7 +427,8 @@ func closechan(c *hchan) { sg.releasetime = cputicks() } gp := sg.g - gp.param = nil + gp.param = unsafe.Pointer(sg) + sg.success = false if raceenabled { raceacquireg(gp, c.raceaddr()) } @@ -607,11 +611,11 @@ func chanrecv(c *hchan, ep unsafe.Pointer, block bool) (selected, received bool) if mysg.releasetime > 0 { blockevent(mysg.releasetime-t0, 2) } - closed := gp.param == nil + success := mysg.success gp.param = nil mysg.c = nil releaseSudog(mysg) - return true, !closed + return true, success } // recv processes a receive operation on a full channel c. @@ -664,6 +668,7 @@ func recv(c *hchan, sg *sudog, ep unsafe.Pointer, unlockf func(), skip int) { gp := sg.g unlockf() gp.param = unsafe.Pointer(sg) + sg.success = true if sg.releasetime != 0 { sg.releasetime = cputicks() } diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go index bf3fbac14c8..f30d1bcde6e 100644 --- a/libgo/go/runtime/runtime2.go +++ b/libgo/go/runtime/runtime2.go @@ -354,6 +354,12 @@ type sudog struct { // g.selectDone must be CAS'd to win the wake-up race. isSelect bool + // success indicates whether communication over channel c + // succeeded. It is true if the goroutine was awoken because a + // value was delivered over channel c, and false if awoken + // because c was closed. + success bool + parent *sudog // semaRoot binary tree waitlink *sudog // g.waiting list or semaRoot waittail *sudog // semaRoot diff --git a/libgo/go/runtime/select.go b/libgo/go/runtime/select.go index d5087fbc045..c31aa344b55 100644 --- a/libgo/go/runtime/select.go +++ b/libgo/go/runtime/select.go @@ -235,10 +235,10 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { nextp **sudog ) -loop: // pass 1 - look for something already waiting var casi int var cas *scase + var caseSuccess bool var caseReleaseTime int64 = -1 var recvOK bool for _, casei := range pollorder { @@ -335,6 +335,7 @@ loop: // We singly-linked up the SudoGs in lock order. casi = -1 cas = nil + caseSuccess = false sglist = gp.waiting // Clear all elem before unlinking from gp.waiting. for sg1 := gp.waiting; sg1 != nil; sg1 = sg1.waitlink { @@
libgo patch committed: Omit nil-channel cases from selectgo order slices
This patch to libgo omits the nil-channel cases from the order slices used in the selectgo function. This is a simplification for future work. This is being brought in here as part of updating to the Go 1.16beta1 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 48357ce4f22c8298ea5fb01d6873bc7bf56180e5 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index bfc7856cce5..a7df8433403 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -c8456995b0118a92820c6c1d8f996d4b1adf55c2 +d0e56e82bb298268ec0f306fef99a715c892d4a7 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/select.go b/libgo/go/runtime/select.go index 81e00ec5a4e..d5087fbc045 100644 --- a/libgo/go/runtime/select.go +++ b/libgo/go/runtime/select.go @@ -41,7 +41,7 @@ func sellock(scases []scase, lockorder []uint16) { var c *hchan for _, o := range lockorder { c0 := scases[o].c - if c0 != nil && c0 != c { + if c0 != c { c = c0 lock() } @@ -57,11 +57,8 @@ func selunlock(scases []scase, lockorder []uint16) { // the G that calls select runnable again and schedules it for execution. // When the G runs on another M, it locks all the locks and frees sel. // Now if the first M touches sel, it will access freed memory. - for i := len(scases) - 1; i >= 0; i-- { + for i := len(lockorder) - 1; i >= 0; i-- { c := scases[lockorder[i]].c - if c == nil { - break - } if i > 0 && c == scases[lockorder[i-1]].c { continue // will unlock it on the next iteration } @@ -138,15 +135,6 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { pollorder := order1[:ncases:ncases] lockorder := order1[ncases:][:ncases:ncases] - // Replace send/receive cases involving nil channels with - // caseNil so logic below can assume non-nil channel. - for i := range scases { - cas := [i] - if cas.c == nil && cas.kind != caseDefault { - *cas = scase{} - } - } - var t0 int64 if blockprofilerate > 0 { t0 = cputicks() @@ -166,15 +154,31 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { } // generate permuted order - for i := 1; i < ncases; i++ { - j := fastrandn(uint32(i + 1)) - pollorder[i] = pollorder[j] + dfli := -1 + norder := 0 + for i := range scases { + cas := [i] + + // Omit cases without channels from the poll and lock orders. + if cas.c == nil { + if cas.kind == caseDefault { + dfli = i + } + cas.elem = nil // allow GC + continue + } + + j := fastrandn(uint32(norder + 1)) + pollorder[norder] = pollorder[j] pollorder[j] = uint16(i) + norder++ } + pollorder = pollorder[:norder] + lockorder = lockorder[:norder] // sort the cases by Hchan address to get the locking order. // simple heap sort, to guarantee n log n time and constant stack footprint. - for i := 0; i < ncases; i++ { + for i := range lockorder { j := i // Start with the pollorder to permute cases on the same channel. c := scases[pollorder[i]].c @@ -185,7 +189,7 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { } lockorder[j] = pollorder[i] } - for i := ncases - 1; i >= 0; i-- { + for i := len(lockorder) - 1; i >= 0; i-- { o := lockorder[i] c := scases[o].c lockorder[i] = lockorder[0] @@ -209,7 +213,7 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { } if debugSelect { - for i := 0; i+1 < ncases; i++ { + for i := 0; i+1 < len(lockorder); i++ { if scases[lockorder[i]].c.sortkey() > scases[lockorder[i+1]].c.sortkey() { print("i=", i, " x=", lockorder[i], " y=", lockorder[i+1], "\n") throw("select: broken sort") @@ -233,21 +237,16 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { loop: // pass 1 - look for something already waiting - var dfli int - var dfl *scase var casi int var cas *scase var caseReleaseTime int64 = -1 var recvOK bool -
libgo patch committed: Update to Go 1.15.6 release
This patch updates libgo to the Go 1.15.6 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 7a75590577dd3da6ab5091097cc9b80f02615360 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 619f1c001f0..dc2682d95d1 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -f4069d94a25893afc9f2fcf641359366f3ede017 +0d0b423739b2fee9788cb6cb8af9ced29375e545 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index b753907837d..e95c59a132d 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -c53315d6cf1b4bfea6ff356b4a1524778c683bb9 +9b955d2d3fcff6a5bc8bce7bafdc4c634a28e95b The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index 701454707cd..7b6d7469626 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.15.5 +go1.15.6 diff --git a/libgo/go/cmd/go/internal/work/exec.go b/libgo/go/cmd/go/internal/work/exec.go index 4f689438d1d..3898b2047c3 100644 --- a/libgo/go/cmd/go/internal/work/exec.go +++ b/libgo/go/cmd/go/internal/work/exec.go @@ -2778,6 +2778,21 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo idx = bytes.Index(src, []byte(cgoLdflag)) } } + + // We expect to find the contents of cgoLDFLAGS in flags. + if len(cgoLDFLAGS) > 0 { + outer: + for i := range flags { + for j, f := range cgoLDFLAGS { + if f != flags[i+j] { + continue outer + } + } + flags = append(flags[:i], flags[i+len(cgoLDFLAGS):]...) + break + } + } + if err := checkLinkerFlags("LDFLAGS", "go:cgo_ldflag", flags); err != nil { return nil, nil, err } diff --git a/libgo/go/internal/poll/copy_file_range_linux.go b/libgo/go/internal/poll/copy_file_range_linux.go index 09de299ff71..fc34aef4cba 100644 --- a/libgo/go/internal/poll/copy_file_range_linux.go +++ b/libgo/go/internal/poll/copy_file_range_linux.go @@ -10,15 +10,61 @@ import ( "syscall" ) -var copyFileRangeSupported int32 = 1 // accessed atomically +var copyFileRangeSupported int32 = -1 // accessed atomically const maxCopyFileRangeRound = 1 << 30 +func kernelVersion() (major int, minor int) { + var uname syscall.Utsname + if err := syscall.Uname(); err != nil { + return + } + + rl := uname.Release + var values [2]int + vi := 0 + value := 0 + for _, c := range rl { + if '0' <= c && c <= '9' { + value = (value * 10) + int(c-'0') + } else { + // Note that we're assuming N.N.N here. If we see anything else we are likely to + // mis-parse it. + values[vi] = value + vi++ + if vi >= len(values) { + break + } + value = 0 + } + } + switch vi { + case 0: + return 0, 0 + case 1: + return values[0], 0 + case 2: + return values[0], values[1] + } + return +} + // CopyFileRange copies at most remain bytes of data from src to dst, using // the copy_file_range system call. dst and src must refer to regular files. func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err error) { - if atomic.LoadInt32() == 0 { + if supported := atomic.LoadInt32(); supported == 0 { return 0, false, nil + } else if supported == -1 { + major, minor := kernelVersion() + if major > 5 || (major == 5 && minor >= 3) { + atomic.StoreInt32(, 1) + } else { + // copy_file_range(2) is broken in various ways on kernels older than 5.3, + // see issue #42400 and + // https://man7.org/linux/man-pages/man2/copy_file_range.2.html#VERSIONS + atomic.StoreInt32(, 0) + return 0, false, nil + } } for remain > 0 { max := remain @@ -41,7 +87,7 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err // use copy_file_range(2) again. atomic.StoreInt32(, 0)
libgo patch committed: Update type descriptor name in fieldtrack C code
This libgo patch updates the type descriptor name in the 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. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 4ae5e581336d9e113b61cf7d014d49bf0cd037f3 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index cd1a3961a06..019aafdde9a 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -b3a0b068f7fa2d65ba781271b2c0479d103b7d7b +342e5f0b349553a69d7c99a18162ae2a1e6e5775 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/runtime/go-fieldtrack.c b/libgo/runtime/go-fieldtrack.c index 22f091be3f4..80be27ca5e3 100644 --- a/libgo/runtime/go-fieldtrack.c +++ b/libgo/runtime/go-fieldtrack.c @@ -31,7 +31,7 @@ extern void *mapassign (const struct maptype *, void *hmap, const void *key) // The type descriptor for map[string] bool. */ extern const char map_string_bool[] __attribute__ ((weak)); extern const char map_string_bool[] - __asm__ (GOSYM_PREFIX "type..map.6string.7bool"); + __asm__ (GOSYM_PREFIX "type..map_6string_7bool"); void runtime_Fieldtrack (void *) __asm__ (GOSYM_PREFIX "runtime.Fieldtrack");
libgo patch committed: Don't define CacheLinePadSize for mips64x
This libgo patch changes the internal/cpu package to not define CacheLinePadSize for mips64x. For libgo the definition always comes from the generated file cpugen.go. This fixes GCC PR 98041. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian eafb46ce90c23efd22c61d941face060bb9f11f3 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index eec3d0708e5..45f62b3bec5 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -84506e0f6bf282765856cb5aeb17124222f73042 +2cc5c746ddfbaeb731f10f2232b9a488df12b71e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/internal/cpu/cpu_mips64x.go b/libgo/go/internal/cpu/cpu_mips64x.go index 0c4794a70ac..af10a5071ea 100644 --- a/libgo/go/internal/cpu/cpu_mips64x.go +++ b/libgo/go/internal/cpu/cpu_mips64x.go @@ -6,8 +6,6 @@ package cpu -const CacheLinePadSize = 32 - // This is initialized by archauxv and should not be changed after it is // initialized. var HWCap uint
libgo patch committed: Define SO_RCVTIMEO on 32-bit GNU/Linux
This libgo patch defines SO_RCVTIMEO on 32-bit GNU/Linux. It was not being defined before because it is defined as a conditional expression that is too complicated for -fdump-go-spec to handle. This fixes https://golang.org/issue/42872. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian e848a83f46f15280ad654f05545cc5ec4f5b8e50 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 41246030f13..e8cf468d8fc 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -45461eeba1db1a3b4194dc8ecc331c0e92f5ad4c +be1738f1fff0e817d921ed568791f9b0585a6982 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index deac5ce8d67..b32a0266b71 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -194,6 +194,7 @@ fi # Networking constants. egrep '^const _(AF|ARPHRD|ETH|IN|SOCK|SOL|SO|IPPROTO|TCP|IP|IPV6)_' gen-sysinfo.go | + grep -v '_val =' | sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} grep '^const _SOMAXCONN' gen-sysinfo.go | sed -e 's/^\(const \)_\(SOMAXCONN[^= ]*\)\(.*\)$/\1\2 = _\2/' \ @@ -213,6 +214,14 @@ for m in SOCK_CLOEXEC SOCK_NONBLOCK; do fi done +# On 32-bit GNU/Linux the expression for SO_RCVTIMEO is too complicated +# for -fdump-go-spec. +if ! grep '^const SO_RCVTIMEO ' ${OUT} >/dev/null 2>&1; then + if grep '^const _SO_RCVTIMEO_val' ${OUT} >/dev/null 2>&1; then +echo 'const SO_RCVTIMEO = _SO_RCVTIMEO_val' >> ${OUT} + fi +fi + # The syscall package requires AF_LOCAL. if ! grep '^const AF_LOCAL ' ${OUT} >/dev/null 2>&1; then if grep '^const AF_UNIX ' ${OUT} >/dev/null 2>&1; then diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c index 7086381a14c..a060ea867a5 100644 --- a/libgo/sysinfo.c +++ b/libgo/sysinfo.c @@ -337,6 +337,9 @@ enum { #ifdef BIOCVERSION BIOCVERSION_val = BIOCVERSION, #endif +#ifdef SO_RCVTIMEO + SO_RCVTIMEO_val = SO_RCVTIMEO, +#endif }; // SIOCGIFMTU can't be added in the above enum as it might
libgo patch committed: Update to Go 1.15.5 release
This patch updates libgo to the Go 1.15.5 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 6c458bbaaa54755de5b25e5a844186893b2b8568 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9545a598738..37374d55853 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -b483d0e0a289ba5fcdbd0388cbc75393367ca870 +36a7b789130b415c2fe7f8e3fc62ffbca265e3aa The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index ad239c92fa9..b753907837d 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -0e953add9656c32a788e06438cd7b533e968b7f8 +c53315d6cf1b4bfea6ff356b4a1524778c683bb9 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index baff2224d62..701454707cd 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.15.4 +go1.15.5 diff --git a/libgo/go/cmd/cgo/out.go b/libgo/go/cmd/cgo/out.go index 05441398d7a..1c143d7aa38 100644 --- a/libgo/go/cmd/cgo/out.go +++ b/libgo/go/cmd/cgo/out.go @@ -341,6 +341,8 @@ func dynimport(obj string) { if s.Version != "" { targ += "#" + s.Version } + checkImportSymName(s.Name) + checkImportSymName(targ) fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s.Name, targ, s.Library) } lib, _ := f.ImportedLibraries() @@ -356,6 +358,7 @@ func dynimport(obj string) { if len(s) > 0 && s[0] == '_' { s = s[1:] } + checkImportSymName(s) fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s, s, "") } lib, _ := f.ImportedLibraries() @@ -370,6 +373,8 @@ func dynimport(obj string) { for _, s := range sym { ss := strings.Split(s, ":") name := strings.Split(ss[0], "@")[0] + checkImportSymName(name) + checkImportSymName(ss[0]) fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", name, ss[0], strings.ToLower(ss[1])) } return @@ -387,6 +392,7 @@ func dynimport(obj string) { // Go symbols. continue } + checkImportSymName(s.Name) fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s.Name, s.Name, s.Library) } lib, err := f.ImportedLibraries() @@ -402,6 +408,23 @@ func dynimport(obj string) { fatalf("cannot parse %s as ELF, Mach-O, PE or XCOFF", obj) } +// checkImportSymName checks a symbol name we are going to emit as part +// of a //go:cgo_import_dynamic pragma. These names come from object +// files, so they may be corrupt. We are going to emit them unquoted, +// so while they don't need to be valid symbol names (and in some cases, +// involving symbol versions, they won't be) they must contain only +// graphic characters and must not contain Go comments. +func checkImportSymName(s string) { + for _, c := range s { + if !unicode.IsGraphic(c) || unicode.IsSpace(c) { + fatalf("dynamic symbol %q contains unsupported character", s) + } + } + if strings.Index(s, "//") >= 0 || strings.Index(s, "/*") >= 0 { + fatalf("dynamic symbol %q contains Go comment") + } +} + // Construct a gcc struct matching the gc argument frame. // Assumes that in gcc, char is 1 byte, short 2 bytes, int 4 bytes, long long 8 bytes. // These assumptions are checked by the gccProlog. diff --git a/libgo/go/cmd/go/internal/work/exec.go b/libgo/go/cmd/go/internal/work/exec.go index 65f3011adfa..4f689438d1d 100644 --- a/libgo/go/cmd/go/internal/work/exec.go +++ b/libgo/go/cmd/go/internal/work/exec.go @@ -2723,6 +2723,66 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo noCompiler() } + // Double check the //go:cgo_ldflag comments in the generated files. + // The compiler only permits such comments in files whose base name + // starts with "_cgo_". Make sure that the comments in those files + // are safe. This is a backstop against people somehow smuggling + // such a comment into a file generated by cgo. + if cfg.BuildToolchainName == "gc" && !cfg.BuildN { + var flags []string + for _, f := range outGo { + if !strings.HasPrefix(filepath.Base(f), "_cgo_") { + continue +
libgo patch committed: Update gofrontend mangling checks
This libgo patch updates the gofrontend mangling checks, in preparation for changing the mangling scheme again. 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 This is for https://golang.org/issue/37272 and https://golang.org/issue/41862. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 7690ac52d5c30b74b90818740872cd5c4680a2aa diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e62578fc781..1f3c25ce710 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -893fa057e36ae6c9b2ac5ffdf74634c35b3489c6 +c948c2d770122932a05b62f653efa2c51f72d3ae The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/check-packages.txt b/libgo/check-packages.txt index efa7d191180..da77e84517e 100644 --- a/libgo/check-packages.txt +++ b/libgo/check-packages.txt @@ -22,6 +22,7 @@ cmd/go/internal/work cmd/internal/buildid cmd/internal/edit cmd/internal/objabi +cmd/internal/pkgpath cmd/internal/test2json compress/bzip2 compress/flate diff --git a/libgo/go/cmd/cgo/main.go b/libgo/go/cmd/cgo/main.go index 7fc2508021b..4952118b1f8 100644 --- a/libgo/go/cmd/cgo/main.go +++ b/libgo/go/cmd/cgo/main.go @@ -244,8 +244,7 @@ var exportHeader = flag.String("exportheader", "", "where to write export header var gccgo = flag.Bool("gccgo", false, "generate files for use with gccgo") var gccgoprefix = flag.String("gccgoprefix", "", "-fgo-prefix option used with gccgo") var gccgopkgpath = flag.String("gccgopkgpath", "", "-fgo-pkgpath option used with gccgo") -var gccgoMangleCheckDone bool -var gccgoNewmanglingInEffect bool +var gccgoMangler func(string) string var importRuntimeCgo = flag.Bool("import_runtime_cgo", true, "import runtime/cgo in generated code") var importSyscall = flag.Bool("import_syscall", true, "import syscall in generated code") var goarch, goos string diff --git a/libgo/go/cmd/cgo/out.go b/libgo/go/cmd/cgo/out.go index dd03f7d67a5..2ab8425999f 100644 --- a/libgo/go/cmd/cgo/out.go +++ b/libgo/go/cmd/cgo/out.go @@ -6,6 +6,7 @@ package main import ( "bytes" + "cmd/internal/pkgpath" "debug/elf" "debug/macho" "debug/pe" @@ -15,7 +16,6 @@ import ( "go/token" "internal/xcoff" "io" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -1286,112 +1286,24 @@ func (p *Package) writeExportHeader(fgcch io.Writer) { fmt.Fprintf(fgcch, "%s\n", p.gccExportHeaderProlog()) } -// gccgoUsesNewMangling reports whether gccgo uses the new collision-free -// packagepath mangling scheme (see determineGccgoManglingScheme for more -// info). -func gccgoUsesNewMangling() bool { - if !gccgoMangleCheckDone { - gccgoNewmanglingInEffect = determineGccgoManglingScheme() - gccgoMangleCheckDone = true - } - return gccgoNewmanglingInEffect -} - -const mangleCheckCode = ` -package läufer -func Run(x int) int { - return 1 -} -` - -// determineGccgoManglingScheme performs a runtime test to see which -// flavor of packagepath mangling gccgo is using. Older versions of -// gccgo use a simple mangling scheme where there can be collisions -// between packages whose paths are different but mangle to the same -// string. More recent versions of gccgo use a new mangler that avoids -// these collisions. Return value is whether gccgo uses the new mangling. -func determineGccgoManglingScheme() bool { - - // Emit a small Go file for gccgo to compile. - filepat := "*_gccgo_manglecheck.go" - var f *os.File - var err error - if f, err = ioutil.TempFile(*objDir, filepat); err != nil { - fatalf("%v", err) - } - gofilename := f.Name() - defer os.Remove(gofilename) - - if err = ioutil.WriteFile(gofilename, []byte(mangleCheckCode), 0666); err != nil { - fatalf("%v", err) - } - - // Compile with gccgo, capturing generated assembly. - gccgocmd := os.Getenv("GCCGO") - if gccgocmd == "" { - gpath, gerr := exec.LookPath("gccgo") - if gerr != nil { - fatalf("unable to locate gccgo: %v", gerr) - } - gccgocmd = gpath - } - cmd := exec.Command(gccgocmd, "-S", "-o", "-", gofilename) - buf, cerr := cmd.CombinedOutput() - if cerr != nil { - fatalf("%s", cerr) - } - - // New mangling: expect go.l..u00e4ufer.Run -
libgo patch committed: Update to Go 1.15.4 release
This patch updates libgo to the 1.15.4 release. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 8815a8e97f8d0ee4066e737152c8198a80e9fe32 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 149f20077e3..e62578fc781 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -ae20684902b82883d3d65f2cde0894c7cb3b995b +893fa057e36ae6c9b2ac5ffdf74634c35b3489c6 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/MERGE b/libgo/MERGE index 4b158c05c6e..ad239c92fa9 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -1984ee00048b63eacd2155cd6d74a2d13e998272 +0e953add9656c32a788e06438cd7b533e968b7f8 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/VERSION b/libgo/VERSION index 93c7b2d3d78..baff2224d62 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.15.3 +go1.15.4 diff --git a/libgo/go/cmd/go/internal/modfetch/coderepo_test.go b/libgo/go/cmd/go/internal/modfetch/coderepo_test.go index f69c193b86c..9a0cd7dba69 100644 --- a/libgo/go/cmd/go/internal/modfetch/coderepo_test.go +++ b/libgo/go/cmd/go/internal/modfetch/coderepo_test.go @@ -655,11 +655,6 @@ var codeRepoVersionsTests = []struct { path: "swtch.com/testmod", versions: []string{"v1.0.0", "v1.1.1"}, }, - { - vcs: "git", - path: "gopkg.in/russross/blackfriday.v2", - versions: []string{"v2.0.0", "v2.0.1"}, - }, { vcs: "git", path: "gopkg.in/natefinch/lumberjack.v2", diff --git a/libgo/go/compress/flate/deflate_test.go b/libgo/go/compress/flate/deflate_test.go index 3362d256cf4..8a22b8e6f92 100644 --- a/libgo/go/compress/flate/deflate_test.go +++ b/libgo/go/compress/flate/deflate_test.go @@ -11,6 +11,7 @@ import ( "internal/testenv" "io" "io/ioutil" + "math/rand" "reflect" "runtime/debug" "sync" @@ -896,6 +897,62 @@ func TestBestSpeedMaxMatchOffset(t *testing.T) { } } +func TestBestSpeedShiftOffsets(t *testing.T) { + // Test if shiftoffsets properly preserves matches and resets out-of-range matches + // seen in https://github.com/golang/go/issues/4142 + enc := newDeflateFast() + + // testData may not generate internal matches. + testData := make([]byte, 32) + rng := rand.New(rand.NewSource(0)) + for i := range testData { + testData[i] = byte(rng.Uint32()) + } + + // Encode the testdata with clean state. + // Second part should pick up matches from the first block. + wantFirstTokens := len(enc.encode(nil, testData)) + wantSecondTokens := len(enc.encode(nil, testData)) + + if wantFirstTokens <= wantSecondTokens { + t.Fatalf("test needs matches between inputs to be generated") + } + // Forward the current indicator to before wraparound. + enc.cur = bufferReset - int32(len(testData)) + + // Part 1 before wrap, should match clean state. + got := len(enc.encode(nil, testData)) + if wantFirstTokens != got { + t.Errorf("got %d, want %d tokens", got, wantFirstTokens) + } + + // Verify we are about to wrap. + if enc.cur != bufferReset { + t.Errorf("got %d, want e.cur to be at bufferReset (%d)", enc.cur, bufferReset) + } + + // Part 2 should match clean state as well even if wrapped. + got = len(enc.encode(nil, testData)) + if wantSecondTokens != got { + t.Errorf("got %d, want %d token", got, wantSecondTokens) + } + + // Verify that we wrapped. + if enc.cur >= bufferReset { + t.Errorf("want e.cur to be < bufferReset (%d), got %d", bufferReset, enc.cur) + } + + // Forward the current buffer, leaving the matches at the bottom. + enc.cur = bufferReset + enc.shiftOffsets() + + // Ensure that no matches were picked up. + got = len(enc.encode(nil, testData)) + if wantFirstTokens != got { + t.Errorf("got %d, want %d tokens", got, wantFirstTokens) + } +} + func TestMaxStackSize(t *testing.T) { // This test must not run in parallel with other tests as debug.SetMaxStack // affects all goroutines. diff --git a/libgo/go/compress/flate/deflatefast.go b/libgo/go/compress/flate/deflatefast.go index 24f8be9d5db..6aa439f13d9 100644 --- a/libgo/go/compress/flate/deflatefast.go +++ b/libgo/go/compress/flate/deflatefast.go @@ -270,6 +270,7 @@ func (e *deflateFast) matchLen(s, t int32, src []byte) int32 { func (e *deflateFast) reset() { e.prev = e.prev[:0] // Bump the offset, so all matches will fail distance check. + // Nothing should be >= e.cur in
libgo patch committed: Support NetBSD versioned symbols
This libgo patch by Nikhil Benesch adds support for NetBSD 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 Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian gotools/: * Makefile.am (check-runtime): Add runtime_linknames.go to --extrafiles. * Makefile.in: Regenerate. d05f6f2c8d3ee3d9cafe0d5da37814ff5443886d diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 45aafaab5c5..149f20077e3 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -88a25df9133e9a1fc28a00b08ee30d7e5ab2cdbb +ae20684902b82883d3d65f2cde0894c7cb3b995b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 47adf9bafeb..1b8702e98bb 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -241,14 +241,14 @@ check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc export LD_LIBRARY_PATH; \ GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ - files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ + files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ echo "$(ECHO_ENV) GC='$(abs_builddir)/check-gccgo -fgo-compiling-runtime' GOARCH=$${GOARCH} GOOS=$${GOOS} $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles='$${files}' $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > runtime-testlog $(CHECK_ENV) \ GC="$${GCCGO} -fgo-compiling-runtime"; \ export GC; \ GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ - files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ + files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v >> runtime-testlog 2>&1 || echo "--- $${fl}: go test runtime (0.00s)" >> runtime-testlog grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 26e83850435..f7a163e4a84 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -574,6 +574,48 @@ s-gccgosizes: Makefile goarch.sh $(SHELL) $(srcdir)/mvifdiff.sh gccgosizes.go.tmp gccgosizes.go $(STAMP) $@ +os_linknames.go: s-os_linknames; @true +s-os_linknames: os-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/*.go + rm -f os_linknames.go.tmp + $(AWK) -f $(srcdir)/mklinknames.awk -v package=os `cat os-list` > os_linknames.go.tmp + $(SHELL) $(srcdir)/mvifdiff.sh os_linknames.go.tmp os_linknames.go + $(STAMP) $@ + +os-list: s-os-list; @true +s-os-list: Makefile $(srcdir)/go/os/*.go + rm -f os-list.tmp + $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os > os-list.tmp + $(SHELL) $(srcdir)/mvifdiff.sh os-list.tmp os-list + $(STAMP) $@ + +os_user_linknames.go: s-os_user_linknames; @true +s-os_user_linknames: os-user-list gen-sysinfo.go
Re: libgo patch committed: Additional BSD-specific syscall wrappers
On Wed, Oct 28, 2020 at 2:53 AM Rainer Orth wrote: > > > This libgo patch by Nikhil Benesch imports 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. Boostrapped and ran Go testsuite on x86_64-pc-linux-gnu. > > Committed to mainline. > > this patch broke Solaris bootstrap: > > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_solaris_largefile.go:12:1: > error: redefinition of 'ReadDirent' >12 | func ReadDirent(fd int, buf []byte) (n int, err error) { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_bsd.go:27:1: note: > previous definition of 'ReadDirent' was here >27 | func ReadDirent(fd int, buf []byte) (n int, err error) { > | ^ > libcalls.go:2320:1: error: redefinition of 'raw_ptrace' > 2320 | func raw_ptrace(request int, pid int, addr uintptr, data uintptr) > (err Errno) { > | ^ > libcalls.go:383:1: note: previous definition of 'raw_ptrace' was here > 383 | func raw_ptrace(request int, pid int, addr uintptr, data uintptr) > (err Errno) { > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_bsd.go:33:16: error: > reference to undefined name 'Getdirentries' >33 | return Getdirentries(fd, buf, base) > |^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_bsd.go:33:9: error: not > enough arguments to return >33 | return Getdirentries(fd, buf, base) > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_bsd.go:69:21: error: > reference to undefined name 'nametomib' >69 | mib, err := nametomib(name) > | ^ > /vol/gcc/src/hg/master/local/libgo/go/syscall/libcall_bsd.go:98:21: error: > reference to undefined name 'nametomib' >98 | mib, err := nametomib(name) > | ^ > libcalls.go:2321:85: error: argument 4 has incompatible type > 2321 | _r := c_ptrace(_C_int(request), Pid_t(pid), > (*byte)(unsafe.Pointer(addr)), (*byte)(unsafe.Pointer(data))) > | > ^ > make[4]: *** [Makefile:2912: syscall.lo] Error 1 > > Of the functions used there, ptrace (32-bit only) is already handled and > sysctl, paccept and flock don't exist on Solaris. Only pipe2 does > exist, but it's only in Solaris 11.4 and Illumos, not Solaris 11.3, so > better left off for now. > > Fixed by removing the solaris build tag. Thanks, yes, using the solaris build tag there was a clear mistake. Committed this patch. Ian 757c0310a69055e89e6abdf40acfd3de07ab927f diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 1f65809fc81..45aafaab5c5 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -be0d2cc2df9f98d967c242594838f86362dae2e7 +88a25df9133e9a1fc28a00b08ee30d7e5ab2cdbb The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/libcall_bsd.go b/libgo/go/syscall/libcall_bsd.go index f13d3bcbe16..1dd957c4531 100644 --- a/libgo/go/syscall/libcall_bsd.go +++ b/libgo/go/syscall/libcall_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd netbsd openbsd solaris +// +build darwin dragonfly freebsd netbsd openbsd // BSD library calls.