From patchwork Thu Apr 7 21:31:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cseo X-Patchwork-Id: 607659 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 3qgwlY3Yqnz9t5S for ; Fri, 8 Apr 2016 07:31:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=QF7VrZ31; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:from:subject:message-id:date :mime-version:content-type; q=dns; s=default; b=OcTx3l6EDIAc5l7a cwM78gucaFGMz9B5qcwWCRnQRiotzrEHrYv2g9IymhSEUAlqYQLxKz8Ty06Dn7PK THx69vmbCRxgp/1J9cSy1CPSYkX/+K3+xsiD7Gz2vHSUocnTAdvKi6H7g53hfLCf q+o3GZoWpGakHig9hoF3qX6HmS8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:from:subject:message-id:date :mime-version:content-type; s=default; bh=ToNRIZrRD9W1FE8NN0K20G DgHd8=; b=QF7VrZ31zeiKUAQZqyoLKFKQNCGHi1u6bHkgjotZ/pfv2VxwecmJnd y3SJx5qKkNnvAQHdQZvRO1YA/u2y3xYUT4GTkM04kUWpFU52AXeA/p4g1HX+Ad/p etOrotAshuXr87EH+dpZT91cwm2d/aqdfiBzzpQshumI7q73zWfJ4= Received: (qmail 20081 invoked by alias); 7 Apr 2016 21:31:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 20068 invoked by uid 89); 7 Apr 2016 21:31:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=seo, nov, Nov, Hx-languages-length:2518 X-HELO: e24smtp05.br.ibm.com X-IBM-Helo: d24dlp01.br.ibm.com X-IBM-MailFrom: cseo@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org To: GLIBC Cc: Tulio Magno Quites Machado Filho , Steve Munroe , Andreas Schwab From: Carlos Eduardo Seo Subject: [PATCH-v2] powerpc: Automatic CPU detection in preconfigure Message-ID: <5706D1B7.80500@linux.vnet.ibm.com> Date: Thu, 7 Apr 2016 18:31:35 -0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16040721-0033-0000-0000-000007BA11BC Added a check to detect the CPU value in preconfigure, so that glibc is built with the correct --with-cpu value. This is only done for Power servers. This should address the sort issue pointed by Andreas. Thanks, diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure index 0c6fdde..b0e036c 100644 --- a/sysdeps/powerpc/preconfigure +++ b/sysdeps/powerpc/preconfigure @@ -15,3 +15,35 @@ powerpc*) rm -f conftest.i ;; esac + +# Lets ask the compiler which Power processor we've got, in case the user did +# not choose a --with-cpu value. +# Note if you add patterns here you must ensure that an appropriate directory +# exists in sysdeps/powerpc +if test -z "$with_cpu"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: --with-cpu not set. Trying to detect CPU." >&5 + $as_echo "$as_me: --with-cpu not set. Trying to detect CPU." >&6;} + archcpu=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + grep "#define _ARCH_PWR" | sed "s/^.*PWR//" | sed "s/ 1$//" | + sort -nr | head -n 1 | sed "s/^/_ARCH_PWR/" + +# Set --with-cpu as appropriate. + case "$archcpu" in + _ARCH_PWR5X) + submachine="power5+" + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5 + $as_echo "$as_me: CPU identified as $submachine" >&6;} + ;; + _ARCH_PWR*) + submachine=`echo $archcpu | sed "s/_ARCH_PWR/power/" | + tr '[:upper:]' '[:lower:]'` + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5 + $as_echo "$as_me: CPU identified as $submachine" >&6;} + ;; + *) + submachine="" + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU not identified; using default" >&5 + $as_echo "$as_me: CPU not identified; using default" >&6;} + ;; + esac +fi