From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56303 invoked by alias); 11 Dec 2018 20:51:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 56291 invoked by uid 89); 11 Dec 2018 20:51:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:D*ubuntu.com, enter X-HELO: mail-lj1-f179.google.com Received: from mail-lj1-f179.google.com (HELO mail-lj1-f179.google.com) (209.85.208.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Dec 2018 20:51:18 +0000 Received: by mail-lj1-f179.google.com with SMTP id k15-v6so14276537ljc.8 for ; Tue, 11 Dec 2018 12:51:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VHxUkZUytOZUCANdDj35ZjzjYCB7vCxnwRrCpegJLbA=; b=g3iJXEBJ7oSmWwY1FGhS67x6GsljUCmg461HtXUtYqSY+1Cq7RJWMaDaVZ1PsvqqaS uqD5RZLDXr2N+TkZfFD2Dllr/tsuO5jekU2obiM5aE/4IA4yhc+hBax9SgDFAUK5OKlc 4wOkQ+/QBUTPb9r2Th6RlrL8rGPGFSxI7Xi+6guxSXOn0uLa/ckxmvb4EiPIinOVgO/3 ovniIgRVD4D+vTaon/rG/GDwB+nwIrtWjbkPLb5Cw1v5JFujKkkMi3vO/Y0oag7NctEh L+1R2zS2q+yLi3p7c9KTictSnlaSbCx4hUDZja4ydNcmpQj3Vb0UO1dtwOiySQJNIHgj 7jvQ== MIME-Version: 1.0 References: <75551ca3-e964-cdfa-0a65-2f9b1b34fcb7@ubuntu.com> In-Reply-To: <75551ca3-e964-cdfa-0a65-2f9b1b34fcb7@ubuntu.com> From: Ian Lance Taylor Date: Tue, 11 Dec 2018 20:51:00 -0000 Message-ID: Subject: Re: [gofrontend-dev] Re: libgo patch committed: Add precise stack scan support To: Matthias Klose Cc: Cherry Zhang , gcc-patches , gofrontend-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-12/txt/msg00742.txt.bz2 On Tue, Dec 11, 2018 at 6:52 AM Matthias Klose wrote: > > On 10.12.18 16:54, Cherry Zhang wrote: > > On Mon, Dec 10, 2018 at 1:41 AM Matthias Klose wrote: > > > >> On 06.12.18 00:09, Ian Lance Taylor wrote: > >>> This libgo patch by Cherry Zhang adds support for precise stack > >>> scanning to the Go runtime. This uses per-function stack maps stored > >>> in the exception tables in the language-specific data area. The > >>> compiler needs to generate these stack maps; currently this is only > >>> done by a version of LLVM, not by GCC. Each safepoint in a function > >>> is associated with a (real or dummy) landing pad, and its "type info" > >>> in the exception table is a pointer to the stack map. When a stack is > >>> scanned, the stack map is found by the stack unwinding code. > >>> > >>> For precise stack scan we need to unwind the stack. There are three > >> cases: > >>> > >>> - If a goroutine is scanning its own stack, it can unwind the stack > >>> and scan the frames. > >>> > >>> - If a goroutine is scanning another, stopped, goroutine, it cannot > >>> directly unwind the target stack. We handle this by switching > >>> (runtime.gogo) to the target g, letting it unwind and scan the stack, > >>> and switch back. > >>> > >>> - If we are scanning a goroutine that is blocked in a syscall, we send > >>> a signal to the target goroutine's thread, and let the signal handler > >>> unwind and scan the stack. Extra care is needed as this races with > >>> enter/exit syscall. > >>> > >>> Currently this is only implemented on GNU/Linux. > >>> > >>> Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed > >>> to mainline. > >> > >> this broke the libgo build on ARM32: > >> > >> ../../../src/libgo/runtime/go-unwind.c: In function > >> 'scanstackwithmap_callback': > >> ../../../src/libgo/runtime/go-unwind.c:754:18: error: '_URC_NORMAL_STOP' > >> undeclared (first use in this function) > >> 754 | return _URC_NORMAL_STOP; > >> | ^~~~~~~~~~~~~~~~ > >> ../../../src/libgo/runtime/go-unwind.c:754:18: note: each undeclared > >> identifier > >> is reported only once for each function i > >> t appears in > >> ../../../src/libgo/runtime/go-unwind.c: In function > >> 'probestackmaps_callback': > >> ../../../src/libgo/runtime/go-unwind.c:802:10: error: '_URC_NORMAL_STOP' > >> undeclared (first use in this function) > >> 802 | return _URC_NORMAL_STOP; > >> | ^~~~~~~~~~~~~~~~ > >> ../../../src/libgo/runtime/go-unwind.c:803:1: warning: control reaches end > >> of > >> non-void function [-Wreturn-type] > >> 803 | } > >> | ^ > >> make[6]: *** [Makefile:1474: runtime/go-unwind.lo] Error 1 > >> make[6]: Leaving directory > >> '/<>/build/arm-linux-gnueabihf/libgo' > >> > >> > > Hell Matthias, > > > > Thank you for the report. And sorry about the breakage. Does > > https://go-review.googlesource.com/c/gofrontend/+/153417 (or the patch > > below) fix ARM32 build? I don't have an ARM32 machine at hand to test. > > this fixes the build. > > currently running the testsuite, almost every test case core dumps on > arm-linux-gnueabihf I committed Cherry's patch to trunk, since it looks reasonable to me. Cherry, Matthias, let me know if you figure out why programs are failing. Ian