From patchwork Tue Jan 22 16:00:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 214579 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 395342C007C for ; Wed, 23 Jan 2013 03:00:32 +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=1359475233; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:Reply-To:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=OWvIVj8QmXJsrkFbLrNx1keFZsQ=; b=dqCLyqvg35DOBQl y83u7CJVkvetKsznvfGoxPLCWLzTgMnOndvG6w1yjdw5SxwhSHr9Xm1Mdu6GxeMw K6seqYNpDnbwQ1JciVDOJfoulcO7L01crDQ81ZKYtX1aovcWcamkyIhoLhVwG9WK z7ZWolD5fT6kM/C9iluA7YbTclYE= 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:Received:Message-ID:Date:From:Reply-To:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:X-Forwarded-Message-Id:X-MC-Unique:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=gLT1xaSl1YnMXd9dqwqWydbyG7t7ZqTymzgdn2Leu5pVbhKgeWDnDHJmLOr+Kh t37DoYPMIiNapC7FpHUDK20I8XSRkiK7412kRhUYFCG9jNNHsbo+Kfz3LtvLFd02 Xh/EflsanRz6GEyG7I0b4PxUiA8wZ4hzBqEJyhA8rCojA=; Received: (qmail 10032 invoked by alias); 22 Jan 2013 16:00:25 -0000 Received: (qmail 10015 invoked by uid 22791); 22 Jan 2013 16:00:23 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, TW_CP X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Jan 2013 16:00:13 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 22 Jan 2013 16:00:11 +0000 Received: from [10.1.69.70] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 22 Jan 2013 16:00:10 +0000 Message-ID: <50FEB78A.6050709@arm.com> Date: Tue, 22 Jan 2013 16:00:10 +0000 From: Ramana Radhakrishnan Reply-To: ramrad01@arm.com User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org ;" Subject: [RFC] Fix for PR driver/47785 References: <50C9F154.6090007@arm.com> In-Reply-To: <50C9F154.6090007@arm.com> X-Forwarded-Message-Id: <50C9F154.6090007@arm.com> X-MC-Unique: 113012216001101701 X-IsSubscribed: yes 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 Hi, I ran into PR driver/47785 when doing some testing with an option passed to the testsuite and I chose to fix this by putting out COLLECT_AS_OPTIONS as though these are options for the driver by prepending them with a "'-Wa", and suffixing them with a "'" character and additionally providing spaces as duly required. I've chosen a simple implementation. Tested in the past with x86_64-linux-gnu and arm-none-eabi cross tests (with an additional -Wa option passed to the default flags in a site.exp) Thoughts ? Ok for trunk now or should I stage this for 4.9 ? regards, Ramana gcc/ Ramana Radhakrishnan PR driver/47785 * gcc.c (set_collect_as_options): New. (main): Call this. * lto-wrapper.c (run_gcc): Handle COLLECT_AS_OPTIONS. testsuite/ Ramana Radhakrishnan PR driver/47785 * gcc.dg/pr47785.c: New test. diff --git a/gcc/gcc.c b/gcc/gcc.c index 13e93e5..df18317 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -221,6 +221,7 @@ static const char *eval_spec_function (const char *, const char *); static const char *handle_spec_function (const char *); static char *save_string (const char *, int); static void set_collect_gcc_options (void); +static void set_collect_as_options (void); static int do_spec_1 (const char *, int, const char *); static int do_spec_2 (const char *); static void do_option_spec (const char *, const char *); @@ -4047,6 +4048,30 @@ process_command (unsigned int decoded_options_count, infiles[n_infiles].name = 0; } +static void +set_collect_as_options (void) +{ + int ix; + char *opt; + int first_time = TRUE; + /* Build COLLECT_AS_OPTIONS to have all of the options specified to + the compiler. */ + obstack_grow (&collect_obstack, "COLLECT_AS_OPTIONS=", + sizeof ("COLLECT_AS_OPTIONS=") - 1); + + FOR_EACH_VEC_ELT (assembler_options, ix, opt) + { + if (!first_time) + obstack_grow (&collect_obstack, " ", 1); + obstack_grow (&collect_obstack, "\'-Wa,", 5); + obstack_grow (&collect_obstack, opt, strlen (opt)); + obstack_grow (&collect_obstack, "\'", 1); + first_time = FALSE; + } + obstack_grow (&collect_obstack, "\0", 1); + xputenv (XOBFINISH (&collect_obstack, char *)); +} + /* Store switches not filtered out by %