From patchwork Thu Aug 25 15:46:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 1098142 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7PGINpl014347 for ; Thu, 25 Aug 2011 16:18:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753292Ab1HYQSX (ORCPT ); Thu, 25 Aug 2011 12:18:23 -0400 Received: from mail16.primus.ca ([216.254.141.183]:43314 "EHLO mail-02.primus.ca" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752579Ab1HYQSW (ORCPT ); Thu, 25 Aug 2011 12:18:22 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 25 Aug 2011 16:18:24 +0000 (UTC) X-Greylist: delayed 1917 seconds by postgrey-1.27 at vger.kernel.org; Thu, 25 Aug 2011 12:18:22 EDT Received: from luxcom.gta.igs.net ([216.58.85.197] helo=[192.168.0.129]) by mail-02.primus.ca with esmtpa (Exim 4.72) (envelope-from ) id 1Qwc8N-00085v-13; Thu, 25 Aug 2011 11:46:23 -0400 Message-ID: <4E566E6D.8060100@bell.net> Date: Thu, 25 Aug 2011 11:46:53 -0400 From: John David Anglin User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: "Carlos O'Donell" CC: Rolf Eike Beer , linux-parisc Subject: Re: Link error in CMake for HPPA1.1, wrong result for HPPA 2.0 References: <99a9e4b224dc9020d16d0a33fea6096f.squirrel@webmail.sf-mail.de> <4E5656E4.8000102@systemhalted.org> In-Reply-To: <4E5656E4.8000102@systemhalted.org> X-Authenticated: danglin-lux@magma.ca - luxcom.gta.igs.net ([192.168.0.129]) [216.58.85.197] Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On 8/25/2011 10:06 AM, Carlos O'Donell wrote: > On 8/25/2011 6:37 AM, Rolf Eike Beer wrote: >> const&)]+0xbc): cannot reach >> 00004abb__ZNSt8_Rb_treeIN5cmsys6StringESt4pairIKS1_iESt10_Select1stIS4_ESt4lessIS1_ESaIS4_EE8_S_rightEPSt18_Rb_tree_node_base+0, >> recompile with -ffunction-sections > So did you recompile with -ffunction-sections? > > The basic problem is that the linker was unable to insert a jump > to the requested function because it was too far away. Some targets > like hppa have short branch distances and we use intermediate stub > tables to get around that. However, we can't insert stub tables just > anywhere, they need to go between sections. Therefore you need to > break up this object file. I think there is a real bug here but nobody has provided a test case. -ffunction-sections probably won't help. Stub sizes vary depending on whether PIC code or non PIC code is being generated. We need a bigger stub table for PIC C++ code as C++ tends to generate a lot of small routines. I've attached the GCC part of the change. There's also a binutils patch which I can't access at the moment. Dave Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 178012) +++ config/pa/pa.c (working copy) @@ -7385,7 +7385,7 @@ return 24; else { - if (!TARGET_LONG_CALLS && distance < 240000) + if (!TARGET_LONG_CALLS && distance < MAX_PCREL17F_OFFSET) return 8; if (TARGET_LONG_ABS_CALL && !flag_pic) @@ -7598,7 +7598,7 @@ /* pc-relative branch. */ if (!TARGET_LONG_CALLS && ((TARGET_PA_20 && !sibcall && distance < 7600000) - || distance < 240000)) + || distance < MAX_PCREL17F_OFFSET)) length += 8; /* 64-bit plabel sequence. */ @@ -7957,7 +7957,7 @@ if (TARGET_FAST_INDIRECT_CALLS || (!TARGET_PORTABLE_RUNTIME && ((TARGET_PA_20 && !TARGET_SOM && distance < 7600000) - || distance < 240000))) + || distance < MAX_PCREL17F_OFFSET))) return 8; if (flag_pic) Index: config/pa/pa.h =================================================================== --- config/pa/pa.h (revision 178012) +++ config/pa/pa.h (working copy) @@ -1512,3 +1512,12 @@ #undef TARGET_HAVE_TLS #define TARGET_HAVE_TLS true #endif + +/* The maximum offset in bytes for a PA 1.X pc-relative call to the + tail of the preceding stub table. The selected offsets have been + chosen to allow approximately one call stub for every 86 instructions. + A long branch stub is two instructions when not generating PIC code. + More space is allowed for stubs when generating PIC code since HP-UX + and Linux import stubs are seven and four instructions, respectively. */ +#define MAX_PCREL17F_OFFSET \ + (flag_pic ? (TARGET_HPUX ? 198164 : 221312) : 240000)