From patchwork Fri Aug 13 03:23:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1516513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=KkvNxTwC; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gm87X04RGz9t5m for ; Fri, 13 Aug 2021 13:24:54 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B42E399800A for ; Fri, 13 Aug 2021 03:24:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B42E399800A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1628825091; bh=rR/DLhgg4FcA7ZA/rJhjtpHgSZ0Z+bWDFH6uMKyLQjI=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=KkvNxTwCNGP+GPHRmGdN5Yg531rbcDfJtRCXT8T+TiHw+Ztk5uAtwTViuqPqqonxf +a+rD7ewzG48qA+ophuzlcibxlHpRyBFVIlyu1XYPRe+jGQXn8Y2Px07FCLP+OtJVm cdIb8I8fhFRFlwOAKTJffogDuh0gykMYr4ublvQs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 897463888025 for ; Fri, 13 Aug 2021 03:23:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 897463888025 Received: by mail-ej1-x633.google.com with SMTP id b15so15694336ejg.10 for ; Thu, 12 Aug 2021 20:23:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rR/DLhgg4FcA7ZA/rJhjtpHgSZ0Z+bWDFH6uMKyLQjI=; b=Xu0Q/Be9CCOPlVLVJg9qBTB5KhVpM2TKi5sHesCho5oPAeskI2VmoEKfFXIRGi8Adc GG5hQuXAIw4zoqa6RuThQUuqX/gJd4LaxOkf2odnNTxQ3WOrsNpe//I252nu5dlChPt5 /pLmTeGR/GX/XYODrzhro2o1f4km53U3liM4EnQrvR+ndcDuY5QkJ2v86XUAPlJssFAz vnPI01Q6xvikOdB2Uv13DH3qaIlvnSifuDYJyguU5Bvh+Dd66vS6+4d/ZGtriy6xPRFC KvY3T7Lc2e1GYeLkmEfEIrI7RPh+HJeo1qGIGHWymH/OtcdQpuqQxcdyVU9apgrAowbf Cbww== X-Gm-Message-State: AOAM531xTDW/NKgECLswD9sI09jM191sbTeL3PoOXtswWuEcKQm8Tsvf BRU18e6C1eL8JucgxLe6KV3fGrPj20zqslZCRZ7RUgPQGXY= X-Google-Smtp-Source: ABdhPJx6WwfE59PoiZHIY+YqW7J/5X8ViV6+cOEah/eWoCknLEBufh7qwRjg06D5117bTsJxXXDtkQObZ3OMGB8JtaY= X-Received: by 2002:a17:907:2676:: with SMTP id ci22mr415723ejc.442.1628825027129; Thu, 12 Aug 2021 20:23:47 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 12 Aug 2021 20:23:35 -0700 Message-ID: Subject: libgo patch committed: Update to Go1.17rc2 release To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ian Lance Taylor via Gcc-patches From: Ian Lance Taylor Reply-To: Ian Lance Taylor Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 defaultGOROOTValue() string { return `$(prefix)` }' >> buildcfg.go.tmp + echo 'const defaultGO386 = `sse2`' >> buildcfg.go.tmp + echo 'const defaultGOARM = `5`' >> buildcfg.go.tmp + echo 'const defaultGOMIPS = `hardfloat`' >> buildcfg.go.tmp + echo 'const defaultGOMIPS64 = `hardfloat`' >> buildcfg.go.tmp + echo 'const defaultGOPPC64 = `power8`' >> buildcfg.go.tmp + echo 'const defaultGOEXPERIMENT = `fieldtrack`' >> buildcfg.go.tmp + echo 'const defaultGO_EXTLINK_ENABLED = ``' >> buildcfg.go.tmp + echo 'const defaultGO_LDSO = ``' >> buildcfg.go.tmp + echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> buildcfg.go.tmp + echo 'const defaultGOOS = runtime.GOOS' >> buildcfg.go.tmp + echo 'const defaultGOARCH = runtime.GOARCH' >> buildcfg.go.tmp + $(SHELL) $(srcdir)/mvifdiff.sh buildcfg.go.tmp buildcfg.go + $(STAMP) $@ + objabi.go: s-objabi; @true s-objabi: Makefile rm -f objabi.go.tmp echo "package objabi" > objabi.go.tmp - echo "import \"runtime\"" >> objabi.go.tmp - echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> objabi.go.tmp - echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp - echo 'const defaultGOARM = `5`' >> objabi.go.tmp - echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp - echo 'const defaultGOMIPS64 = `hardfloat`' >> objabi.go.tmp - echo 'const defaultGOPPC64 = `power8`' >> objabi.go.tmp - echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp - echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp - echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp - echo 'const defaultGO_LDSO = ``' >> objabi.go.tmp - echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp - echo 'const goexperiment = ``' >> objabi.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go $(STAMP) $@ @@ -671,7 +676,7 @@ s-zstdpkglist: Makefile libgo-packages.txt echo 'package goroot' > zstdpkglist.go.tmp echo "" >> zstdpkglist.go.tmp echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|golang\.org/[a-z0-9_./]*\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp + echo $(libgo_go_objs) 'unsafe.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|golang\.org/[a-z0-9_./]*\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp echo '}' >> zstdpkglist.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go $(STAMP) $@ @@ -1054,6 +1059,9 @@ internal/cpu.lo.dep: $(extra_go_files_internal_cpu) extra_go_files_golang_org_x_sys_cpu = gcpugen.go golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu) +extra_go_files_internal_buildcfg = buildcfg.go +cmd/internal/buildcfg.lo.dep: $(extra_go_files_internal_buildcfg) + extra_go_files_internal_goroot = zstdpkglist.go internal/goroot.lo.dep: $(extra_go_files_internal_goroot) diff --git a/libgo/VERSION b/libgo/VERSION index e336ec201bf..904eb73bd5c 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.16.5 +go1.17rc2 diff --git a/libgo/check-packages.txt b/libgo/check-packages.txt index 1e549cae4b0..dd8990f10e2 100644 --- a/libgo/check-packages.txt +++ b/libgo/check-packages.txt @@ -43,7 +43,10 @@ crypto/des crypto/dsa crypto/ecdsa crypto/ed25519 +crypto/ed25519/internal/edwards25519 +crypto/ed25519/internal/edwards25519/field crypto/elliptic +crypto/elliptic/internal/fiat crypto/hmac crypto/internal/subtle crypto/md5 @@ -110,6 +113,7 @@ index/suffixarray internal/cpu internal/execabs internal/fmtsort +internal/itoa internal/poll internal/profile internal/reflectlite @@ -139,6 +143,7 @@ net/http/httptest net/http/httptrace net/http/httputil net/http/internal +net/http/internal/ascii net/http/pprof net/internal/socktest net/mail @@ -157,6 +162,7 @@ reflect regexp regexp/syntax runtime +runtime/cgo runtime/debug runtime/internal/atomic runtime/internal/math diff --git a/libgo/configure.ac b/libgo/configure.ac index ebab9d9de3e..1f4f32dae2b 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=19:0:0 +libtool_VERSION=20:0:0 AC_SUBST(libtool_VERSION) AM_ENABLE_MULTILIB(, ..) diff --git a/libgo/go/runtime/os_gccgo.go b/libgo/go/runtime/os_gccgo.go index 65d7aef165a..da12c35d26c 100644 --- a/libgo/go/runtime/os_gccgo.go +++ b/libgo/go/runtime/os_gccgo.go @@ -97,3 +97,11 @@ func setNonblock(fd int32) { fcntlUintptr(uintptr(fd), _F_SETFL, flags|_O_NONBLOCK) } } + +// For gccgo this is in the C code. +func osyield() + +//go:nosplit +func osyield_no_g() { + osyield() +} diff --git a/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go b/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go index 83357fdd5d9..2d07c2db8a4 100644 --- a/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go +++ b/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gccgo // +build gccgo package main diff --git a/libgo/gotool-packages.txt b/libgo/gotool-packages.txt index f28ad6977aa..15c928ff7fb 100644 --- a/libgo/gotool-packages.txt +++ b/libgo/gotool-packages.txt @@ -27,7 +27,6 @@ cmd/go/internal/modinfo cmd/go/internal/modload cmd/go/internal/mvs cmd/go/internal/par -cmd/go/internal/renameio cmd/go/internal/robustio cmd/go/internal/run cmd/go/internal/search @@ -86,6 +85,7 @@ golang.org/x/tools/go/analysis/passes/nilfunc golang.org/x/tools/go/analysis/passes/pkgfact golang.org/x/tools/go/analysis/passes/printf golang.org/x/tools/go/analysis/passes/shift +golang.org/x/tools/go/analysis/passes/sigchanyzer golang.org/x/tools/go/analysis/passes/stdmethods golang.org/x/tools/go/analysis/passes/stringintconv golang.org/x/tools/go/analysis/passes/structtag diff --git a/libgo/libgo-packages.txt b/libgo/libgo-packages.txt index 707def56de7..4fc8c843f02 100644 --- a/libgo/libgo-packages.txt +++ b/libgo/libgo-packages.txt @@ -19,7 +19,9 @@ crypto/dsa crypto/ecdsa crypto/ed25519 crypto/ed25519/internal/edwards25519 +crypto/ed25519/internal/edwards25519/field crypto/elliptic +crypto/elliptic/internal/fiat crypto/hmac crypto/internal/randutil crypto/internal/subtle @@ -69,6 +71,7 @@ go/importer go/internal/gccgoimporter go/internal/gcimporter go/internal/srcimporter +go/internal/typeparams go/parser go/printer go/scanner @@ -110,13 +113,16 @@ image/internal/imageutil image/jpeg image/png index/suffixarray +internal/buildcfg internal/bytealg internal/cfg internal/cpu internal/execabs internal/fmtsort +internal/goexperiment internal/goroot internal/goversion +internal/itoa internal/lazyregexp internal/lazytemplate internal/nettrace @@ -157,6 +163,8 @@ net/http/httptest net/http/httptrace net/http/httputil net/http/internal +net/http/internal/ascii +net/http/internal/testcert net/http/pprof net/internal/socktest net/mail @@ -173,9 +181,12 @@ os/user path path/filepath reflect +reflect/internal/example1 +reflect/internal/example2 regexp regexp/syntax runtime +runtime/cgo runtime/debug runtime/internal/atomic runtime/internal/math diff --git a/libgo/match.sh b/libgo/match.sh index cc15a12c674..bf4f141e04a 100755 --- a/libgo/match.sh +++ b/libgo/match.sh @@ -119,6 +119,11 @@ for f in $gofiles; do 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64 | wasm) tag1=nonmatchingtag ;; + *) + # File name like x_amd64_random.go, where tag1=random. + # Don't match based on tag2. + tag2= + ;; esac case "$tag2" in @@ -151,18 +156,18 @@ for f in $gofiles; do fi match=false ;; - $goos | $goarch | $cgotag | $cmdlinetag | "gccgo" | go1.[0-9] | go1.[0-9][0-9]) + $goos | $goarch | $cgotag | $cmdlinetag | "gccgo" | "goexperiment.fieldtrack" | go1.[0-9] | go1.[0-9][0-9]) match=true ;; - "!"$goos | "!"$goarch | "!"$cgotag | "!"$cmdlinetag | "!gccgo" | "!"go1.[0-9] | "!"go1.1[0-6]) + "!"$goos | "!"$goarch | "!"$cgotag | "!"$cmdlinetag | "!gccgo" | "!goexperiment.fieldtrack" | "!"go1.[0-9] | "!"go1.1[0-7]) ;; *,*) cmatch=true for ctag in `echo $tag | sed -e 's/,/ /g'`; do case $ctag in - $goos | $goarch | $cgotag | $cmdlinetag | "gccgo" | go1.[0-9] | go1.[0-9][0-9]) + $goos | $goarch | $cgotag | $cmdlinetag | "gccgo" | "goexperiment.fieldtrack" | go1.[0-9] | go1.[0-9][0-9]) ;; - "!"$goos | "!"$goarch | "!"$cgotag | "!"$cmdlinetag | "!gccgo" | "!"go1.[0-9] | "!"go1.1[0-6]) + "!"$goos | "!"$goarch | "!"$cgotag | "!"$cmdlinetag | "!gccgo" | "!goexperiment.fieldtrack" | "!"go1.[0-9] | "!"go1.1[0-7]) cmatch=false ;; "!"*) diff --git a/libgo/runtime/go-now.c b/libgo/runtime/go-now.c index 1c02e5220e4..e1dcd180860 100644 --- a/libgo/runtime/go-now.c +++ b/libgo/runtime/go-now.c @@ -8,7 +8,7 @@ #include "runtime.h" -// Return current time. This is the implementation of time.walltime1(). +// Return current time. This is the implementation of runtime.walltime(). struct walltime_ret { @@ -16,7 +16,7 @@ struct walltime_ret int32_t nsec; }; -struct walltime_ret now(void) __asm__ (GOSYM_PREFIX "runtime.walltime1") +struct walltime_ret now(void) __asm__ (GOSYM_PREFIX "runtime.walltime") __attribute__ ((no_split_stack)); struct walltime_ret diff --git a/libgo/runtime/runtime_c.c b/libgo/runtime/runtime_c.c index bc920a5d406..f92bdd43bc9 100644 --- a/libgo/runtime/runtime_c.c +++ b/libgo/runtime/runtime_c.c @@ -199,10 +199,13 @@ getEnd() uintptr getText(void) __asm__ (GOSYM_PREFIX "runtime.getText"); +extern void main_main(void*) + __asm__(GOSYM_PREFIX "main.main"); + uintptr getText(void) { - return (uintptr)(const void *)(getText); + return (uintptr)(const void *)(main_main); } // Return the end of the text segment, assumed to come after the @@ -224,6 +227,24 @@ getEtext(void) return (uintptr)(p); } +// Return the start of the BSS section. + +uintptr getBSS(void) + __asm__ (GOSYM_PREFIX "runtime.getBSS"); + +uintptr +getBSS(void) +{ + const void *p; + + p = __edata; + if (p == NULL) + p = _edata; + if (p == NULL) + p = __bss_start; + return (uintptr)(p); +} + // CPU-specific initialization. // Fetch CPUID info on x86. diff --git a/libgo/runtime/stack.c b/libgo/runtime/stack.c index c78f0c4595b..0c0c30e46ac 100644 --- a/libgo/runtime/stack.c +++ b/libgo/runtime/stack.c @@ -23,7 +23,7 @@ bool runtime_usestackmaps; #pragma GCC optimize ("-fno-optimize-sibling-calls") extern void scanstackblock(uintptr addr, uintptr size, void *gcw) - __asm__("runtime.scanstackblock"); + __asm__(GOSYM_PREFIX "runtime.scanstackblock"); static bool doscanstack1(G*, void*) __attribute__ ((noinline)); @@ -125,3 +125,66 @@ static bool doscanstack1(G *gp, void *gcw) { #endif return true; } + +extern bool onCurrentStack(uintptr p) + __asm__(GOSYM_PREFIX "runtime.onCurrentStack"); + +bool onCurrentStack(uintptr p) +{ +#ifdef USING_SPLIT_STACK + + void* sp; + size_t spsize; + void* next_segment; + void* next_sp; + void* initial_sp; + + sp = __splitstack_find(nil, nil, &spsize, &next_segment, &next_sp, + &initial_sp); + while (sp != nil) { + if (p >= (uintptr)(sp) && p < (uintptr)(sp) + spsize) { + return true; + } + sp = __splitstack_find(next_segment, next_sp, &spsize, + &next_segment, &next_sp, &initial_sp); + } + return false; + +#else + + G* gp; + byte* bottom; + byte* top; + byte* temp; + byte* nextsp2; + byte* initialsp2; + + gp = runtime_g(); + bottom = (byte*)(&p); + top = (byte*)(void*)(gp->gcinitialsp) + gp->gcstacksize; + if ((uintptr)(top) < (uintptr)(bottom)) { + temp = top; + top = bottom; + bottom = temp; + } + if (p >= (uintptr)(bottom) && p < (uintptr)(top)) { + return true; + } + + nextsp2 = secondary_stack_pointer(); + if (nextsp2 != nil) { + initialsp2 = (byte*)(void*)(gp->gcinitialsp2); + if (uintptr(initialsp2) < uintptr(nextsp2)) { + temp = initialsp2; + initialsp2 = nextsp2; + nextsp2 = temp; + } + if (p >= (uintptr)(nextsp2) && p < (uintptr)(initialsp2)) { + return true; + } + } + + return false; + +#endif +} diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 9eda2ccc70d..e0dd16610db 100755 --- a/libgo/testsuite/gotest +++ b/libgo/testsuite/gotest @@ -311,6 +311,11 @@ x) 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64 | wasm) tag1=nonmatchingtag ;; + *) + # File name like x_amd64_random.go, where tag1=random. + # Don't match based on tag2. + tag2= + ;; esac case "$tag2" in @@ -342,18 +347,18 @@ x) fi match=false ;; - $goos | $goarch | cgo | gccgo | go1.[0-9] | go1.[0-9][0-9]) + $goos | $goarch | cgo | gccgo | goexperiment.fieldtrack | go1.[0-9] | go1.[0-9][0-9]) match=true ;; - "!"$goos | "!"$goarch | "!cgo" | "!gccgo" | "!"go1.[0-9] | "!"go1.1[0-6]) + "!"$goos | "!"$goarch | "!cgo" | "!gccgo" | "!goexperiment.fieldtrack" | "!"go1.[0-9] | "!"go1.1[0-7]) ;; *,*) cmatch=true for ctag in `echo $tag | sed -e 's/,/ /g'`; do case $ctag in - $goos | $goarch | cgo | gccgo | go1.[0-9] | go1.[0-9][0-9]) + $goos | $goarch | cgo | gccgo | goexperiment.fieldtrack | go1.[0-9] | go1.[0-9][0-9]) ;; - "!"$goos | "!"$goarch | "!cgo" | "!gccgo" | "!"go1.[0-9] | "!"go1.1[0-6]) + "!"$goos | "!"$goarch | "!cgo" | "!gccgo" | "!goexperiment.fieldtrack" | "!"go1.[0-9] | "!"go1.1[0-7]) cmatch=false ;; "!"*)