From patchwork Fri May 8 20:18:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38944 X-Patchwork-Delegate: fweimer@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 949FC3945C1A; Fri, 8 May 2020 20:18:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 949FC3945C1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1588969113; bh=oJ0yd8BhNSXtvX/jtwg/CD6+hXwkj9ElWyhpii38hQo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=am0t7aWB7od1nj1mhJj5bHKMD+41yAvQPhE1VzJVxdOKnubdIRKmF94J4teGEymYP xhTPOhvvhwxDNFp5Td9HDmYTh+l5++79jYPI5SKr42zizewBMKH7J7RxKzko+w0FGP Ku1AS7tiJk2AVGEs7tv6J0jFprID5PfS6pcSkXO8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id D165E393BC3D for ; Fri, 8 May 2020 20:18:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D165E393BC3D Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 048K64Ds148335 for ; Fri, 8 May 2020 16:18:21 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 30vtw5yjyv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 08 May 2020 16:18:21 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 048KG7Sb020047 for ; Fri, 8 May 2020 20:18:20 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma04dal.us.ibm.com with ESMTP id 30s0g7sueq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 08 May 2020 20:18:20 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 048KIKj031457746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 8 May 2020 20:18:20 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15F2AAC05E for ; Fri, 8 May 2020 20:18:20 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DABCAAC059 for ; Fri, 8 May 2020 20:18:19 +0000 (GMT) Received: from brokenarrow.ibmuc.com (unknown [9.85.134.106]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP for ; Fri, 8 May 2020 20:18:19 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH] powerpc: Automatic CPU detection in preconfigure Date: Fri, 8 May 2020 15:18:19 -0500 Message-Id: <20200508201819.13622-1-murphyp@linux.vnet.ibm.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-08_18:2020-05-08, 2020-05-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=869 priorityscore=1501 suspectscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005080165 X-Spam-Status: No, score=-20.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Paul E. Murphy via Libc-alpha" From: "Paul E. Murphy" Reply-To: "Paul E. Murphy" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Followup from ---8<--- Added a check to detect the CPU value in preconfigure, so that glibc is built with the correct --with-cpu value. And move existing checks into preconfigure.ac. Co-Authored-By: Carlos Eduardo Seo Co-Authored-By: Tulio Magno Quites Machado Filho --- sysdeps/powerpc/preconfigure | 42 +++++++++++++++++++++++--- sysdeps/powerpc/preconfigure.ac | 52 +++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 sysdeps/powerpc/preconfigure.ac diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure index a0ea745bb4..3543886d64 100644 --- a/sysdeps/powerpc/preconfigure +++ b/sysdeps/powerpc/preconfigure @@ -1,4 +1,5 @@ -# preconfigure fragment for powerpc. +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! + # Local preconfigure fragment for sysdeps/powerpc case "$machine" in powerpc64le) @@ -16,10 +17,43 @@ powerpc*) # We can't use AC_MSG_ERROR here. # The parent script is in the middle of printing the # "checking for sysdeps preconfigure fragments" line. - echo >&2 - echo "Host system type $host is no longer supported." >&2 - exit 1 + as_fn_error $? "Host system type $host is no longer supported." "$LINENO" 5 ;; esac ;; 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 + 4??|4??fp) + submachine=${archcpu%fp} + # The submachine is now inferred. However the generic submachine + # check will not respect the soft/hard fp choice. Fill the cache + # to skip the unneeded check which unconditionally sets + # -m{cpu,arch}=${submachine}. + if ${libc_cv_cc_submachine+:} false; then : + $as_echo_n "(cached) " >&6 +else + libc_cv_cc_submachine="" +fi + + ;; + a2|970|power*) + submachine=${archcpu} + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CPU not identified; using default" >&5 +$as_echo "$as_me: WARNING: CPU not identified; using default" >&2;} + ;; + esac +fi diff --git a/sysdeps/powerpc/preconfigure.ac b/sysdeps/powerpc/preconfigure.ac new file mode 100644 index 0000000000..5912efff47 --- /dev/null +++ b/sysdeps/powerpc/preconfigure.ac @@ -0,0 +1,52 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/powerpc + +case "$machine" in +powerpc64le) + base_machine=powerpc machine=powerpc/powerpc64/le + ;; +powerpc64*) + base_machine=powerpc machine=powerpc/powerpc64/be + ;; +powerpc*) + base_machine=powerpc machine=powerpc/powerpc32 + with_fp_cond="!defined __NO_FPRS__" + case "$host_os" in + *gnuspe*) + # SPE support was dropped in glibc 2.30. + # We can't use AC_MSG_ERROR here. + # The parent script is in the middle of printing the + # "checking for sysdeps preconfigure fragments" line. + AC_MSG_ERROR([Host system type $host is no longer supported.]) + ;; + esac + ;; +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 + AC_MSG_NOTICE([--with-cpu not set. Trying to detect CPU.]) + 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 + 4??|4??fp) + submachine=${archcpu%fp} + # The submachine is now inferred. However the generic submachine + # check will not respect the soft/hard fp choice. Fill the cache + # to skip the unneeded check which unconditionally sets + # -m{cpu,arch}=${submachine}. + AC_CACHE_VAL(libc_cv_cc_submachine,libc_cv_cc_submachine="") + ;; + a2|970|power*) + submachine=${archcpu} + ;; + *) + AC_WARN([CPU not identified; using default]) + ;; + esac +fi