From patchwork Wed Apr 29 16:26:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 466180 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 A25571402BC for ; Thu, 30 Apr 2015 02:26:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=fT0O8l1G; dkim-adsp=none (unprotected policy); 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=AyFJnDm8bVdVhU8X BU+TLHnoqEZHK6Tb3il9bxvvXA8eV/n1WBIrhTBnqKPVDVLXJLeBGRFRbST7o9Fg NtnjUCE+cnjV26t27zZKEAd8pkQj3dONt68a+Gc8diiKqA/sM4xYG/4uPARdBmWh a5e7lBlO2A/D/dwTMNWmAhhk75o= 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=EDKaiiYFZRKjWtmqB8WBse Qu84c=; b=fT0O8l1G3pjbLGTXD1toEuuIaUDhxmH1ENm6RgU4icUPrBX75AykAR b3tIjoJT3CDLd2+UHIUX7V0d847GmkiEK4RWhTQDwtEMQfNCrvdf4Ib8/Yp0oiDj W8GafvkwFFhSNXSTeIogOAQDfpXphs0XEt2Ng6YRt24UKnxL1LjI4= Received: (qmail 120744 invoked by alias); 29 Apr 2015 16:26:24 -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 120451 invoked by uid 89); 29 Apr 2015 16:26:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Apr 2015 16:26:23 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YnUoV-0005vT-0S from Thomas_Schwinge@mentor.com ; Wed, 29 Apr 2015 09:26:19 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 29 Apr 2015 17:26:17 +0100 From: Thomas Schwinge To: Bernd Schmidt , CC: Ilya Verbin , Jakub Jelinek , Richard Biener , Kirill Yukhin , Andrey Turetskiy Subject: Re: [PATCH 6/n] OpenMP 4.0 offloading infrastructure: option handling In-Reply-To: <553F89F8.4080609@codesourcery.com> References: <20141011144900.GA16368@msticlxl57.ims.intel.com> <20141013101909.GT10376@tucnak.redhat.com> <20141013103311.GA64058@msticlxl57.ims.intel.com> <87d257ducq.fsf@kepler.schwinge.homeip.net> <87lhjue1lz.fsf@schwinge.name> <87zj7lc9k4.fsf@schwinge.name> <87618hv9j2.fsf@schwinge.name> <553F89F8.4080609@codesourcery.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 29 Apr 2015 18:26:06 +0200 Message-ID: <87iocerjdt.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Tue, 28 Apr 2015 15:24:08 +0200, Bernd Schmidt wrote: > On 04/27/2015 06:08 PM, Thomas Schwinge wrote: > > >>> OK to do the following instead? (Coding style/code copied from > >>> gcc/config/i386/intelmic-mkoffload.c for consistency.) > > Err, was this a question for me? I'm fine with that too. Yes -- you're the nvptx maintainer after all. ;-) Committed in r222583: commit df615909263269988fd9611f8d007902580829d9 Author: tschwinge Date: Wed Apr 29 16:23:26 2015 +0000 [PR libgomp/65099] nvptx mkoffload: pass "-m32" or "-m64" to the compiler ... depending on "-foffload-abi=[...]". Coding style/code copied from gcc/config/i386/intelmic-mkoffload.c for consistency. gcc/ * config/nvptx/mkoffload.c (target_ilp32): New variable. (main): Set it depending on "-foffload-abi=[...]". (compile_native, main): Use it to pass "-m32" or "-m64" to the compiler. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222583 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/nvptx/mkoffload.c | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) Grüße, Thomas diff --git gcc/ChangeLog gcc/ChangeLog index aaa06c3..d7455e4 100644 --- gcc/ChangeLog +++ gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-04-29 Thomas Schwinge + + PR libgomp/65099 + * config/nvptx/mkoffload.c (target_ilp32): New variable. + (main): Set it depending on "-foffload-abi=[...]". + (compile_native, main): Use it to pass "-m32" or "-m64" to the + compiler. + 2015-04-29 Alan Lawrence PR target/65770 diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c index dbc68bc..8687154 100644 --- gcc/config/nvptx/mkoffload.c +++ gcc/config/nvptx/mkoffload.c @@ -126,6 +126,9 @@ static id_map *var_ids, **vars_tail = &var_ids; static const char *ptx_name; static const char *ptx_cfile_name; +/* Shows if we should compile binaries for i386 instead of x86-64. */ +bool target_ilp32 = false; + /* Delete tempfiles. */ /* Unlink a temporary file unless requested otherwise. */ @@ -885,6 +888,7 @@ compile_native (const char *infile, const char *outfile, const char *compiler) struct obstack argv_obstack; obstack_init (&argv_obstack); obstack_ptr_grow (&argv_obstack, compiler); + obstack_ptr_grow (&argv_obstack, target_ilp32 ? "-m32" : "-m64"); obstack_ptr_grow (&argv_obstack, infile); obstack_ptr_grow (&argv_obstack, "-c"); obstack_ptr_grow (&argv_obstack, "-o"); @@ -962,11 +966,23 @@ main (int argc, char **argv) passed with @file. Expand them into argv before processing. */ expandargv (&argc, &argv); + /* Find out whether we should compile binaries for i386 or x86-64. */ + for (int i = argc - 1; i > 0; i--) + if (strncmp (argv[i], "-foffload-abi=", sizeof ("-foffload-abi=") - 1) == 0) + { + if (strstr (argv[i], "ilp32")) + target_ilp32 = true; + else if (!strstr (argv[i], "lp64")) + fatal_error (input_location, + "unrecognizable argument of option -foffload-abi"); + break; + } + struct obstack argv_obstack; obstack_init (&argv_obstack); obstack_ptr_grow (&argv_obstack, driver); obstack_ptr_grow (&argv_obstack, "-xlto"); - obstack_ptr_grow (&argv_obstack, "-m64"); + obstack_ptr_grow (&argv_obstack, target_ilp32 ? "-m32" : "-m64"); obstack_ptr_grow (&argv_obstack, "-S"); for (int ix = 1; ix != argc; ix++)