From patchwork Fri Feb 12 22:10:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 582311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8F29D140B97 for ; Sat, 13 Feb 2016 09:10:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=bUI0kgQt; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=Sm8hF+iAdxvMEqD1qi1ikfS+qgtM1qK5j2JZ89RXn4+jo4 W4yVO9SwTL8c3mrOaG7wqFIinFVmJPzG4gzeA5TbWinbGjRAut4t+BVyfLD4zn/z v1+o+AbvXxEbGUV0JVWng4VLXWwW8qC6h3z77YiOSl+8HK3AdXgGtiavdc+6A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=CFtReLBlUwyTA3KNXUpvKt+eTiY=; b=bUI0kgQtglh4HcbqIBhq q8AqoBix30fG+U7aNi7BCC0QC/vmwUXIcyueifPKZehTIrpBHWINkSXWelcGba8O sMabPqqXcOR3MOuZZ0NH19wnl8+9tZdd8tznjwjiC7UITdNiY8AVMjbnkJ1z7Ztg wBrbKuUfLMCQmiM084B0mK8= Received: (qmail 87965 invoked by alias); 12 Feb 2016 22:10:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 87920 invoked by uid 89); 12 Feb 2016 22:10:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=233110, sk:runtime, sk:28a9dfb, Hx-spam-relays-external:209.85.223.177 X-HELO: mail-io0-f177.google.com Received: from mail-io0-f177.google.com (HELO mail-io0-f177.google.com) (209.85.223.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 12 Feb 2016 22:10:16 +0000 Received: by mail-io0-f177.google.com with SMTP id z135so36589110iof.0 for ; Fri, 12 Feb 2016 14:10:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=yFVaQchIENeYWVilQXtMbnsLXwh/jPP7NWb/vti2e5E=; b=DaRkhBVM2NhtGpP5Eiw9EOQJ2iaQHnhwZ+HCcwW0RxKdHmI2sY07V/PNenR+W+C/tl 4FZ8d7sLPn5Cv6I5CBzwxvzX3Zt2/FSAPXsnGfvD+aN7Ea6h/Tx+9RQmnCCC7WlhuytB 20IFvEZfqXFToI0Rs71LJ2LU6LnOPJF22g3SmBvT3a7N1nOgkpXZYpE50gj4a7TXpNNx hAe9xRSPsipCFgyDN9SrK4S0c2AS7fQWy38lUnBNkkvzfqf9Ox+bIcE9lB6DqKOHyHsP GIOpxUcY4R0yextww0dNkynUdAdUJEFYkma8Pin/H9RtKP0DMllUYf1lt2nnBOu7xoaw lMbw== X-Gm-Message-State: AG10YORdUjxtsLpHyoZ4Ana7DaQW2mxcnZP5qUNzxyYaALmoe+nzdqjucsGAeaIvs1x/ehwRJTPrjR4HLPuGLw== MIME-Version: 1.0 X-Received: by 10.107.35.146 with SMTP id j140mr5183226ioj.197.1455315014166; Fri, 12 Feb 2016 14:10:14 -0800 (PST) Received: by 10.107.129.218 with HTTP; Fri, 12 Feb 2016 14:10:14 -0800 (PST) Date: Fri, 12 Feb 2016 14:10:14 -0800 Message-ID: Subject: libgo patch committed: For c-archive, install signal handler synchronously From: Ian Lance Taylor To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch to libgo ports https://golang.org/cl/18150 from the master library to the gccgo runtime. This installs signal handlers synchronously when building a Go archive, rather than potentially racing against the main program. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 233290) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -28a9dfbc3cda0bf7fd4f3fb1506c547f6cdf41a5 +22278c6e8ce3982b09111183bc6addf0184bef1f The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/runtime/go-libmain.c =================================================================== --- libgo/runtime/go-libmain.c (revision 232239) +++ libgo/runtime/go-libmain.c (working copy) @@ -59,6 +59,10 @@ initfn (int argc, char **argv, char** en struct args *a; pthread_t tid; + runtime_isarchive = true; + + runtime_initsig(true); + a = (struct args *) malloc (sizeof *a); if (a == NULL) die ("malloc", errno); @@ -88,8 +92,6 @@ gostart (void *arg) { struct args *a = (struct args *) arg; - runtime_isarchive = true; - if (runtime_isstarted) return NULL; runtime_isstarted = true; Index: libgo/runtime/proc.c =================================================================== --- libgo/runtime/proc.c (revision 233260) +++ libgo/runtime/proc.c (working copy) @@ -1093,7 +1093,7 @@ runtime_mstart(void* mp) runtime_newextram(); runtime_needextram = 0; } - runtime_initsig(); + runtime_initsig(false); } if(m->mstartfn) Index: libgo/runtime/runtime.h =================================================================== --- libgo/runtime/runtime.h (revision 233260) +++ libgo/runtime/runtime.h (working copy) @@ -550,7 +550,7 @@ void* runtime_mal(uintptr); String runtime_gostring(const byte*); String runtime_gostringnocopy(const byte*); void runtime_schedinit(void); -void runtime_initsig(void); +void runtime_initsig(bool); void runtime_sigenable(uint32 sig); void runtime_sigdisable(uint32 sig); void runtime_sigignore(uint32 sig); Index: libgo/runtime/signal_unix.c =================================================================== --- libgo/runtime/signal_unix.c (revision 233110) +++ libgo/runtime/signal_unix.c (working copy) @@ -13,11 +13,16 @@ extern SigTab runtime_sigtab[]; void -runtime_initsig(void) +runtime_initsig(bool preinit) { int32 i; SigTab *t; + // For c-archive/c-shared this is called by go-libmain.c with + // preinit == true. + if(runtime_isarchive && !preinit) + return; + // First call: basic setup. for(i = 0; runtime_sigtab[i].sig != -1; i++) { t = &runtime_sigtab[i]; @@ -37,6 +42,9 @@ runtime_initsig(void) } } + if(runtime_isarchive && (t->flags&SigPanic) == 0) + continue; + t->flags |= SigHandling; runtime_setsig(i, runtime_sighandler, true); }