From patchwork Wed Feb 8 13:13:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 19173 X-Patchwork-Delegate: joseph@codesourcery.com Received: (qmail 21205 invoked by alias); 8 Feb 2017 13:14:15 -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 21192 invoked by uid 89); 8 Feb 2017 13:14:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.9 required=5.0 tests=AWL, BAYES_40, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=eduardo, Eduardo, Seo, with_cpu X-HELO: mx0a-001b2d01.pphosted.com From: "Tulio Magno Quites Machado Filho" To: libc-alpha@sourceware.org Cc: fweimer@redhat.com, Carlos Eduardo Seo Subject: [PATCH] powerpc: Automatic CPU detection in preconfigure Date: Wed, 8 Feb 2017 11:13:23 -0200 In-Reply-To: <5707A01A.7060901@redhat.com> References: <5707A01A.7060901@redhat.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020813-0032-0000-0000-0000053C31D7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020813-0033-0000-0000-000011BE5C66 Message-Id: <1486559603-13798-1-git-send-email-tuliom@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-08_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702080129 From: Carlos Eduardo Seo Added a check to detect the CPU value in preconfigure, so that glibc is built with the correct --with-cpu value. 2017-02-08 Carlos Eduardo Seo Tulio Magno Quites Machado Filho * sysdeps/powerpc/preconfigure: Automatically configure --with-cpu value based on compiler target cpu. --- sysdeps/powerpc/preconfigure | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure index 0c6fdde..e269616 100644 --- a/sysdeps/powerpc/preconfigure +++ b/sysdeps/powerpc/preconfigure @@ -15,3 +15,39 @@ 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. +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=`echo "int foo () { return 0; }" \ + | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ + | grep -E "\.ascii.*mcpu" | sed "s/.*mcpu=\(.*\)\"/\1/"` + + # Set --with-cpu as appropriate. + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. + case "$archcpu" in + 405|405fp) + submachine="405" + ;; + 440|440fp) + submachine="440" + ;; + 476|476fp) + submachine="476" + ;; + e500mc|e500mc64) + submachine="e500" + ;; + a2|464|970|power*) + submachine=${archcpu} + ;; + *) + 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