From patchwork Thu Aug 22 03:57:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 268939 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D46532C00B3 for ; Thu, 22 Aug 2013 13:58:04 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=N4s/dPH+DR1q6e1UV9k9Aa8vJuYzAQrWiIu4ZPElopbzdnXKxr Q3ZdFYFYCithrjQOmTLleRJHVoF4uT4jkss3d1mC0/DtWOaXgkkKOJ4naIA4vs+i PpZyVdKpKTEovLtli4sf5GThAjDrfk7AtICtCZfwQxXXHrkOrvljVzvL0= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=oaSv0MPTYW5DNPBxXBG6LvZ7hH0=; b=rK+jKDr/Rqhu85G26pBo EdPrwz40+vin7WzQdxPn5nesfeRncV22zBOTwx+fnhWKlgRo49ChdbSHHlOgjxHh 93hSuBq1DZZJr4GBfl4QdJI+uMBtPeGR1x+6IMQVaJQJISY6xCec+bDIq+e85s3E TZ4P4uAWa17Oit8tuibWqVs= Received: (qmail 6101 invoked by alias); 22 Aug 2013 03:57:58 -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 6085 invoked by uid 89); 22 Aug 2013 03:57:58 -0000 X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.2 Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 22 Aug 2013 03:57:57 +0000 Received: by mail-pa0-f48.google.com with SMTP id kp13so1587375pab.7 for ; Wed, 21 Aug 2013 20:57:56 -0700 (PDT) X-Received: by 10.66.248.198 with SMTP id yo6mr3036714pac.143.1377143876065; Wed, 21 Aug 2013 20:57:56 -0700 (PDT) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id iu7sm11822594pbc.45.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 20:57:55 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 969A8EA00C7; Thu, 22 Aug 2013 13:27:50 +0930 (CST) Date: Thu, 22 Aug 2013 13:27:50 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: powerpc64le multilibs and multiarch dir Message-ID: <20130822035750.GO3430@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) This patch corrects the powerpc64le-linux multiarch directory, adds opposite-endian multilibs, and chooses non-multiarch os dirs for the new multilibs. For multiarch, powerpc64le-linux now will use powerpc64le-linux-gnu. Given a typical big-endian native toolchain with os dirs /lib and /lib64, we'll use /lible and /lib64le if supporting little-endian as well. If you happen to use /lib and /lib32, then the little-endian variants are /lible and /lib32le. For completeness I also support building big-endian multilibs on a little-endian host. All of this is done with a dose of "make" string manipulation functions guaranteed to make your eye glaze over, but there are just too many combinations of different configurations to simply enumerate them all. I use ':=' assignment for the multilib make variables because you can't have a recursively evaluated variable (ie. one assigned with '=') reference itself, as is done with MULTILIB_OSDIRNAMES, and we may as well use the same for all the multilib vars. I also remove fPIC from MULTILIB_EXTRA_OPTS because -fPIC is already added where necessary by the library Makefiles. Also, MULTILIB_EXTRA_OPTS is only for options that apply to the non-default multilibs. It isn't used for the default multilib, so this isn't the place to put options common to all multilibs. (I've been building gcc with this particular change for years.) Bootstrapped and regression tested powerpc64-linux. OK for mainline and 4.8? * config.gcc (powerpc*-*-linux*): Add support for little-endian multilibs to big-endian target and vice versa. * config/rs6000/t-linux64: Use := assignment on all vars. (MULTILIB_EXTRA_OPTS): Remove fPIC. (MULTILIB_OSDIRNAMES): Specify using mapping from multilib_options. * config/rs6000/t-linux64le: New file. * config/rs6000/t-linux64bele: New file. * config/rs6000/t-linux64lebe: New file. Index: gcc/config.gcc =================================================================== --- gcc/config.gcc (revision 201834) +++ gcc/config.gcc (working copy) @@ -2139,7 +2139,7 @@ tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" case ${target} in powerpc*le-*-*) - tm_file="${tm_file} rs6000/sysv4le.h" ;; + tm_file="${tm_file} rs6000/sysv4le.h" ;; esac maybe_biarch=yes case ${target} in @@ -2162,6 +2162,19 @@ fi tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h" tmake_file="$tmake_file rs6000/t-linux64" + case ${target} in + powerpc*le-*-*) + tmake_file="$tmake_file rs6000/t-linux64le" + case ${enable_targets} in + all | *powerpc64-* | *powerpc-*) + tmake_file="$tmake_file rs6000/t-linux64lebe" ;; + esac ;; + *) + case ${enable_targets} in + all | *powerpc64le-* | *powerpcle-*) + tmake_file="$tmake_file rs6000/t-linux64bele" ;; + esac ;; + esac extra_options="${extra_options} rs6000/linux64.opt" ;; *) Index: gcc/config/rs6000/t-linux64 =================================================================== --- gcc/config/rs6000/t-linux64 (revision 201834) +++ gcc/config/rs6000/t-linux64 (working copy) @@ -25,8 +25,8 @@ # it doesn't tell anything about the 32bit libraries on those systems. Set # MULTILIB_OSDIRNAMES according to what is found on the target. -MULTILIB_OPTIONS = m64/m32 -MULTILIB_DIRNAMES = 64 32 -MULTILIB_EXTRA_OPTS = fPIC -MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:powerpc64-linux-gnu) -MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) +MULTILIB_OPTIONS := m64/m32 +MULTILIB_DIRNAMES := 64 32 +MULTILIB_EXTRA_OPTS := +MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) +MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) Index: gcc/config/rs6000/t-linux64le =================================================================== --- gcc/config/rs6000/t-linux64le (revision 0) +++ gcc/config/rs6000/t-linux64le (revision 0) @@ -0,0 +1,3 @@ +#rs6000/t-linux64le + +MULTILIB_OSDIRNAMES = $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) Index: gcc/config/rs6000/t-linux64bele =================================================================== --- gcc/config/rs6000/t-linux64bele (revision 0) +++ gcc/config/rs6000/t-linux64bele (revision 0) @@ -0,0 +1,7 @@ +#rs6000/t-linux64end + +MULTILIB_OPTIONS += mlittle +MULTILIB_DIRNAMES += le +MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)))))) +MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES))) +MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} Index: gcc/config/rs6000/t-linux64lebe =================================================================== --- gcc/config/rs6000/t-linux64lebe (revision 0) +++ gcc/config/rs6000/t-linux64lebe (revision 0) @@ -0,0 +1,7 @@ +#rs6000/t-linux64leend + +MULTILIB_OPTIONS += mbig +MULTILIB_DIRNAMES += be +MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES)))))) +MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES))) +MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}