From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gc0Kv-0008CW-Ls for qemu-devel@nongnu.org; Mon, 23 Oct 2006 09:59:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gc0Ks-00085x-7K for qemu-devel@nongnu.org; Mon, 23 Oct 2006 09:59:29 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gc0Kr-00085R-Vz for qemu-devel@nongnu.org; Mon, 23 Oct 2006 09:59:26 -0400 Received: from [64.78.21.128] (helo=mis011-1.exch011.intermedia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gc0Ks-0004Oa-1O for qemu-devel@nongnu.org; Mon, 23 Oct 2006 09:59:26 -0400 Message-ID: <453CCAAF.9080904@qumranet.com> Date: Mon, 23 Oct 2006 15:59:11 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] qemu vs gcc4 References: <45391B22.1050608@palmsource.com> <56d259a00610230116p33e13e32i9b82f1e8f0871f27@mail.gmail.com> <200610231320.08914.paul@codesourcery.com> In-Reply-To: <200610231320.08914.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: paul@codesourcery.com Cc: qemu-devel@nongnu.org Paul Brook wrote: > On Monday 23 October 2006 09:16, Martin Guy wrote: > >>> Now, gcc4 can produce code with several return instructions (with no >>> option to turn that of, as far as I understand). You cannot cut them out, >>> and therefore you cannot chain the simple functions. >>> >> ...unless you also map return instructions within the generated >> functions into branches to the soon-to-be-dropped final "return"? Not >> that I know anything about qemu internals mind u... >> > > That's exactly what my gcc4 hacks do. > > It gets complicated because a x86 uses variable length insn encodings so you > don't know where insn boundaries are, and a jmp instruction is larger than a > ret instruction so it's not always possible to do a straight replacement. > how about void some_generated_instruction(u32 a1, u32 s2) { // code asm volatile ( "" ); } that will force the code to fall through to the null asm code, avoiding premature returns. if the code uses 'return' explicitly, turn it to a goto just before the 'asm volatile'. -- error compiling committee.c: too many arguments to function