From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9062 invoked by alias); 29 Sep 2010 09:52:50 -0000 Received: (qmail 9046 invoked by uid 22791); 29 Sep 2010 09:52:48 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cam-admin0.cambridge.arm.com (HELO cam-admin0.cambridge.arm.com) (217.140.96.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Sep 2010 09:52:44 +0000 Received: from cam-owa1.Emea.Arm.com (cam-owa1.emea.arm.com [10.1.255.62]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id o8T9nUF9019200; Wed, 29 Sep 2010 10:49:30 +0100 (BST) Received: from [10.1.67.34] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 29 Sep 2010 10:52:37 +0100 Subject: Re: [rfa] Fix software-watchpoint failures by adding epilogue detection From: Richard Earnshaw To: Daniel Jacobowitz Cc: Ulrich Weigand , gdb-patches@sourceware.org In-Reply-To: <20100928163216.GH6886@caradoc.them.org> References: <20100928151529.GG6886@caradoc.them.org> <201009281604.o8SG4Eng031035@d12av02.megacenter.de.ibm.com> <20100928163216.GH6886@caradoc.them.org> Content-Type: text/plain Date: Wed, 29 Sep 2010 15:24:00 -0000 Message-Id: <1285753957.22518.82.camel@e102346-lin.cambridge.arm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00485.txt.bz2 On Tue, 2010-09-28 at 12:32 -0400, Daniel Jacobowitz wrote: > On Tue, Sep 28, 2010 at 06:04:14PM +0200, Ulrich Weigand wrote: > > I'm wondering how "bx lr" could be an indirect call; for a call, > > lr would have to point to the return address, so it couldn't also > > contain the target address ... Am I missing something here? > > Bah, you are correct. Poor choice of example. bx ip is a better > example; that can be an indirect call, a return, or a tail call. > > > As far as I can see, GCC never uses bx with any other register but > > lr to implement a return instruction. Do you know whether this is > > also true for other compilers? If so, maybe the easiest fix would > > be to change this back to only accepting "bx lr". > > Sorry, I don't know :-( Does GCC also only use lr for an indirect > tail call? I can't tell - I couldn't get GCC to issue an indirect > tail call. But I did get this out of RealView: > You can never use LR for an indirect tailcall as it must contain the return address from the outer function (at least, in any ABI compliant code). The mcount code does something a bit funky here, but that's a special case.