diff options
author | Ian Lance Taylor <iant@golang.org> | 2023-06-21 11:04:04 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2023-06-21 11:04:04 -0700 |
commit | 97e31a0a2a2d2273687fcdb4e5416aab1a2186e1 (patch) | |
tree | d5c1cae4de436a0fe54a5f0a2a197d309f3d654c /libgo | |
parent | 6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (diff) | |
parent | 577223aebc7acdd31e62b33c1682fe54a622ae27 (diff) | |
download | gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.zip gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.tar.gz gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.tar.bz2 |
Merge from trunk revision 577223aebc7acdd31e62b33c1682fe54a622ae27.
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/Makefile.am | 1 | ||||
-rw-r--r-- | libgo/Makefile.in | 22 | ||||
-rw-r--r-- | libgo/go/internal/fuzz/encoding_test.go | 9 | ||||
-rw-r--r-- | libgo/go/mime/type_test.go | 5 | ||||
-rw-r--r-- | libgo/go/mime/type_unix_test.go | 1 | ||||
-rw-r--r-- | libgo/go/runtime/mem_gccgo.go | 6 | ||||
-rw-r--r-- | libgo/go/syscall/libcall_linux.go | 8 | ||||
-rw-r--r-- | libgo/runtime/go-mmap.c | 21 | ||||
-rw-r--r-- | libgo/runtime/runtime.h | 3 | ||||
-rwxr-xr-x | libgo/testsuite/gotest | 10 |
10 files changed, 66 insertions, 20 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 207d5a9..920f8cc 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/Makefile.in b/libgo/Makefile.in index 0ff6ff4..6176eb5 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -246,15 +246,15 @@ am__objects_4 = runtime/aeshash.lo runtime/go-assert.lo \ runtime/go-construct-map.lo runtime/go-ffi.lo \ runtime/go-fieldtrack.lo runtime/go-matherr.lo \ runtime/go-memclr.lo runtime/go-memmove.lo \ - runtime/go-memequal.lo runtime/go-nanotime.lo \ - runtime/go-now.lo runtime/go-nosys.lo runtime/go-strerror.lo \ - runtime/go-reflect-call.lo runtime/go-setenv.lo \ - runtime/go-signal.lo runtime/go-unsafe-pointer.lo \ - runtime/go-unsetenv.lo runtime/go-unwind.lo \ - runtime/go-varargs.lo runtime/env_posix.lo runtime/panic.lo \ - runtime/print.lo runtime/proc.lo runtime/runtime_c.lo \ - runtime/stack.lo runtime/yield.lo $(am__objects_2) \ - $(am__objects_3) + runtime/go-memequal.lo runtime/go-mmap.lo \ + runtime/go-nanotime.lo runtime/go-now.lo runtime/go-nosys.lo \ + runtime/go-strerror.lo runtime/go-reflect-call.lo \ + runtime/go-setenv.lo runtime/go-signal.lo \ + runtime/go-unsafe-pointer.lo runtime/go-unsetenv.lo \ + runtime/go-unwind.lo runtime/go-varargs.lo \ + runtime/env_posix.lo runtime/panic.lo runtime/print.lo \ + runtime/proc.lo runtime/runtime_c.lo runtime/stack.lo \ + runtime/yield.lo $(am__objects_2) $(am__objects_3) am_libgo_llgo_la_OBJECTS = $(am__objects_4) libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -914,6 +914,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 \ @@ -1385,6 +1386,8 @@ runtime/go-memmove.lo: runtime/$(am__dirstamp) \ runtime/$(DEPDIR)/$(am__dirstamp) runtime/go-memequal.lo: runtime/$(am__dirstamp) \ runtime/$(DEPDIR)/$(am__dirstamp) +runtime/go-mmap.lo: runtime/$(am__dirstamp) \ + runtime/$(DEPDIR)/$(am__dirstamp) runtime/go-nanotime.lo: runtime/$(am__dirstamp) \ runtime/$(DEPDIR)/$(am__dirstamp) runtime/go-now.lo: runtime/$(am__dirstamp) \ @@ -1454,6 +1457,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-memclr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-memequal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-memmove.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-mmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-nanotime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-nosys.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-now.Plo@am__quote@ diff --git a/libgo/go/internal/fuzz/encoding_test.go b/libgo/go/internal/fuzz/encoding_test.go index 8e3800e..53fc5b8 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 == 0x7FF0000000000001 { + t.Skip("skipping signalling NaN test on 386 with gccgo") + } + x1 := math.Float64frombits(u1) b := marshalCorpusFile(x1) diff --git a/libgo/go/mime/type_test.go b/libgo/go/mime/type_test.go index 5e4d25c..5769c6a 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 4d109aa..43db44b 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) diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go index 1e84f4f..e7b51ff 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/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go index 19ae439..03ca726 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 diff --git a/libgo/runtime/go-mmap.c b/libgo/runtime/go-mmap.c new file mode 100644 index 0000000..b2327ba --- /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 <stdint.h> +#include <sys/mman.h> + +/* 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 b3dc4fd..699770d 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -355,9 +355,6 @@ bool runtime_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) diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 0a0a7e1..33c98d8 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 |