From patchwork Thu Mar 2 19:14:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 19423 Received: (qmail 60276 invoked by alias); 2 Mar 2017 19:14:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 60260 invoked by uid 89); 2 Mar 2017 19:14:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=alans, Alans, alan's, Alan's X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Mar 2017 19:14:40 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v22J9agu050604 for ; Thu, 2 Mar 2017 14:14:39 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 28xs8c0b2t-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 02 Mar 2017 14:14:38 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Mar 2017 12:14:36 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 2 Mar 2017 12:14:34 -0700 Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 0E45F19D8047; Thu, 2 Mar 2017 12:13:45 -0700 (MST) Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v22JEXgX44367968; Thu, 2 Mar 2017 19:14:33 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4503F2805A; Thu, 2 Mar 2017 14:14:32 -0500 (EST) Received: from otta.local (unknown [9.85.185.202]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 002212803D; Thu, 2 Mar 2017 14:14:31 -0500 (EST) To: gdb-patches@sourceware.org Cc: Ulrich Weigand , Alan Modra From: Peter Bergner Subject: [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds Date: Thu, 2 Mar 2017 13:14:32 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030219-0012-0000-0000-000013D4FB62 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006710; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00829164; UDB=6.00406470; IPR=6.00606661; BA=6.00005186; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014502; XFM=3.00000012; UTC=2017-03-02 19:14:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030219-0013-0000-0000-00004BE7FCA7 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-02_17:, , 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-1702020001 definitions=main-1703020166 X-IsSubscribed: yes When building trunk on a Ubuntu 16.10 ppc64le system, I see the following linker error building gdb: ppc-linux.o: In function `ppc64_64bit_inferior_p(long)': ppc-linux.c:(.text+0x7c): undefined reference to `.LCTOC0' common-debug.o: In function `debug_printf(char const*, ...)': common-debug.c:(.text+0x20): undefined reference to `.LCTOC0' continuations.o: In function `do_my_continuations(continuation**, int)': continuations.c:(.text+0x1bc): undefined reference to `.LCTOC0' errors.o: In function `warning(char const*, ...)': errors.c:(.text+0x20): undefined reference to `.LCTOC0' errors.o: In function `error(char const*, ...)': errors.c:(.text+0xd4): undefined reference to `.LCTOC0' errors.o:errors.c:(.text+0x14c): more undefined references to `.LCTOC0' follow collect2: error: ld returned 1 exit status Makefile:2222: recipe for target 'gdb' failed make[2]: *** [gdb] Error 1 make[2]: Leaving directory '/home/bergner/binutils/build/binutils-mcmodel/gdb' Makefile:10420: recipe for target 'all-gdb' failed make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory '/home/bergner/binutils/build/binutils-mcmodel' Makefile:849: recipe for target 'all' failed make: *** [all] Error 2 This is caused by a since fixed gcc bug when using -mminimal-toc. The -mminimal-toc option is only used with the small code model, which is all the powerpc64-linux used to have, but with Alan's long ago patch that added -mcmodel={small,medium,large} and medium code model being the default, we don't need to use -mminimal-toc anymore. The following patch replaces -mminimal-toc with -mcmodel=medium. This allows trunk to build again, but also catches people using ancient gcc's and leaves them a comment in the source on how to work around their build problem. Ok for trunk? Peter * config/powerpc/ppc64-linux.mh (MH_FLAGS): Use -mcmodel=medium. diff --git a/gdb/config/powerpc/ppc64-linux.mh b/gdb/config/powerpc/ppc64-linux.mh index 580eb1f..a0b3252 100644 --- a/gdb/config/powerpc/ppc64-linux.mh +++ b/gdb/config/powerpc/ppc64-linux.mh @@ -10,11 +10,13 @@ NATDEPFILES= inf-ptrace.o fork-child.o \ linux-namespaces.o NAT_CDEPS = $(srcdir)/proc-service.list -# The PowerPC has severe limitations on TOC size, and uses them even -# for non-PIC code. GDB overflows those tables when compiling with -# -mfull-toc (the default), so we need to ask GCC to use as few TOC -# entries as possible. -MH_CFLAGS= -mminimal-toc +# With the addition of -mcmodel={small,medium,large} (default=medium), +# PowerPC no longer has a problem with TOC size, so we no longer need +# to ask GCC to use as few TOC entries as possible. +# We explicitly use the -mcmodel=medium option to catch users of older +# compilers. They can work around their build failure by reverting back +# to using the -mminimal-toc option. +MH_CFLAGS= -mcmodel=medium # The dynamically loaded libthread_db needs access to symbols in the # gdb executable.