From patchwork Wed Jan 16 15:57:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: minux.ma@gmail.com X-Patchwork-Id: 212583 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]) by ozlabs.org (Postfix) with SMTP id 665D02C0087 for ; Thu, 17 Jan 2013 02:57:50 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358956670; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Reply-To:Message-ID:Date:Subject:From:To:Cc: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=AlzJoDq RLAxgnw1fJfrgv21RCPs=; b=vLWjce6Ks/1bt9s+OZwXvVQKv2ZtHGlfXFCcUqt cKdZ4sVHwS056a/5bsT/xakU3Cu14CPy4sQ2n4BFbnxdmDF7HkEgFJ4Wi6gLkZBP 2BsfQRpHxZu5H+5t8ResGvXFJC5dW0tnafDAd+xIl72ccDWcDwHmFizOw32nHPrk xH1o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:X-Received:Reply-To:X-Google-Appengine-App-Id:X-Google-Appengine-App-Id-Alias:Message-ID:Date:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NGT/Xih6xqfvWaNXTmBfjvhNg1iGiKvcAqxH+rvnpetfy7r4yqlgQP9Q1brPd3 obaRRjGj+7lwyXVaOEPr1YzgFHnbNcUv55hH1Ebi7JoWg8lxL7vb75o0A5DEjlFo QIiQ+AK+w5awcwwnT1QXvPxjtZLHWIqBj/A9/2BnX6HUs=; Received: (qmail 11709 invoked by alias); 16 Jan 2013 15:57:37 -0000 Received: (qmail 11582 invoked by uid 22791); 16 Jan 2013 15:57:34 -0000 X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL, BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, KHOP_RCVD_UNTRUST, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vc0-f198.google.com (HELO mail-vc0-f198.google.com) (209.85.220.198) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Jan 2013 15:57:25 +0000 Received: by mail-vc0-f198.google.com with SMTP id m8so1554vcd.1 for ; Wed, 16 Jan 2013 07:57:24 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.58.31.38 with SMTP id x6mr487334veh.11.1358351844528; Wed, 16 Jan 2013 07:57:24 -0800 (PST) Reply-To: minux.ma@gmail.com, iant@golang.org, gcc-patches@gcc.gnu.org, reply@codereview-hr.appspotmail.com X-Google-Appengine-App-Id: s~codereview-hr X-Google-Appengine-App-Id-Alias: codereview-hr Message-ID: <089e013a2a6a2c555004d369efff@google.com> Date: Wed, 16 Jan 2013 15:57:24 +0000 Subject: Re: [PATCH] gcc/go/gospec.c: fix static linking of Go programs (issue 7130047) From: minux.ma@gmail.com To: iant@golang.org Cc: gcc-patches@gcc.gnu.org, reply@codereview-hr.appspotmail.com 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 Reviewers: iant, Message: please take another look. Description: 2013-01-16 Shenghou Ma * gospec.c: pass -u pthread_create to linker when static linking. Please review this at https://codereview.appspot.com/7130047/ Affected files: M gcc/go/gospec.c Index: gcc/go/gospec.c =================================================================== --- gcc/go/gospec.c (revision 195240) +++ gcc/go/gospec.c (working copy) @@ -227,7 +227,7 @@ #endif /* Make sure to have room for the trailing NULL argument. */ - num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 5; + num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10; new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args); i = 0; @@ -381,6 +381,20 @@ generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER, &new_decoded_options[j++]); +#ifdef TARGET_CAN_SPLIT_STACK + /* libgcc wraps pthread_create to support split stack, however, due to + relative ordering of -lpthread and -lgcc, we can't just mark + __real_pthread_create in libgcc as non-weak. But we need to link in + pthread_create from pthread if we are statically linking, so we work- + around by passing -u pthread_create to to the linker. */ + if (static_link) + { + generate_option (OPT_Wl_, "-u,pthread_create", 1, CL_DRIVER, + &new_decoded_options[j]); + j++; + } +#endif + *in_decoded_options_count = j; *in_decoded_options = new_decoded_options; *in_added_libraries = added_libraries;