From patchwork Mon Feb 3 11:50:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 316132 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 1E1AA2C0091 for ; Mon, 3 Feb 2014 22:51:05 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=igW5VGylwJQrl3pdJQFXtI+ibVJZi4+SUVeuPtVwcju GyxKw5hU0cDg72qaI0RLdj5hH4nke1d15di+R1xbLTOdRp2l7OoOPFF5BooqEA6y LKHq34nW1QUuff8yZJhVJTQx/n8cqvPLEUbJ0WpUcquBtkq7gEQUKKjZhajk87L4 = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=hgyPTKFU9iITPpiCTS5NORjXp8U=; b=tgINxG5mieI5Wp5eK +n+i5tyUzosbbH0LVYRiCKtIZmCQUgRg74EmqEhUwOdIrQo46veXnTlcmExrCo/k v/rWUpVov0d5FzpXEwLYw2r8BSPLcIJguwjxd7Mxy0LUw9LxlN2TFtYSEts0gLG5 kMaFkB4/tCZ3XmuMsCkgEJmK4c= Received: (qmail 24155 invoked by alias); 3 Feb 2014 11:50:57 -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 24146 invoked by uid 89); 3 Feb 2014 11:50:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Feb 2014 11:50:55 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 03 Feb 2014 11:50:52 +0000 Received: from [10.1.208.24] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 3 Feb 2014 11:50:50 +0000 Message-ID: <52EF829A.9010808@arm.com> Date: Mon, 03 Feb 2014 11:50:50 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: GCC Patches CC: rth@redhat.com Subject: [PATCH][RFC][libatomic] Override -mcpu option for arm linux ifunc targets X-MC-Unique: 114020311505212801 X-IsSubscribed: yes Hi all, There is a slight issue with the libatomic Makefile for arm linux ifunc targets. It adds an explicity -march=armv7-a option to the command line to enable building the exclusive instruction variants in libatomic. However, if the multilib machinery tries to add an -mcpu option that conflicts with the -march one (such as -mcpu=cortex-a15) gcc will give a warning about incompatible -march and -mcpu options, causing the -Werror build to fail. A workaround here is to override the -mcpu option as well as the -march one. This patch does that by adding an EXTRA_OVERRIDE variable and setting it to -mcpu=cortex-a9 under the same conditions as when -march=armv7-a is selected, so that it's added only when -march=armv70a is added. Can someone see a better way of achieving this? If this is acceptable, ok to commit? Build and test arm-none-linux-gnueabi with --enable-gnu-indirect-function Bootstrap on x86 with --enable-gnu-indirect-function Thanks, Kyrill 2014-02-03 Kyrylo Tkachov * Makefile.in: Override -mcpu option when building arm linux ifunc targets. diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in index 46e60c9..b51910a 100644 --- a/libatomic/Makefile.in +++ b/libatomic/Makefile.in @@ -297,7 +297,7 @@ PAT_BASE = $(word 1,$(PAT_SPLIT)) PAT_N = $(word 2,$(PAT_SPLIT)) PAT_S = $(word 3,$(PAT_SPLIT)) IFUNC_DEF = -DIFUNC_ALT=$(PAT_S) -IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS)) +IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS)) $(word $(PAT_S),$(EXTRA_OVERRIDE)) M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo M_SIZE = -DN=$(PAT_N) M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT)) @@ -313,7 +313,13 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \ _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \ $(am__append_3) +# For ARM, the -march option by itself conflicts with any -mcpu option that +# we might end up passing to the build, causing an error. +# Therefore we override the -mcpu option as well. +# This shouldn't affect tuning much because the affected code is mostly +# in inline assembly anyway. @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a -DHAVE_KERNEL64 +@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@EXTRA_OVERRIDE = -mcpu=cortex-a9 @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586 @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES)