From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3480 invoked by alias); 18 Jun 2006 05:51:24 -0000 Received: (qmail 3470 invoked by uid 22791); 18 Jun 2006 05:51:23 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 18 Jun 2006 05:51:21 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k5I5o0vW003397; Sun, 18 Jun 2006 07:50:00 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6) with ESMTP id k5I5o0O7025046; Sun, 18 Jun 2006 07:50:00 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6/Submit) id k5I5o0ni009268; Sun, 18 Jun 2006 07:50:00 +0200 (CEST) Date: Sun, 18 Jun 2006 05:51:00 -0000 Message-Id: <200606180550.k5I5o0ni009268@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: nathan@codesourcery.com CC: gdb-patches@sourceware.org, schwab@suse.de In-reply-to: <44897213.3070309@codesourcery.com> (message from Nathan Sidwell on Fri, 09 Jun 2006 14:05:23 +0100) Subject: Re: [m68k] return values References: <44897213.3070309@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00255.txt.bz2 > Date: Fri, 09 Jun 2006 14:05:23 +0100 > From: Nathan Sidwell > > this is a reworking of my recent return value patch. this patch > just contains changes to select which register contains a pointer > value, and how structure return values are located. OK, I see your problem now. The uCLinux ABI is quite different from the normal Linux ABI, and different from the "standard" embedded ABI too. If I read the GCC code correctly, on uCLinux you end up with: #undef PCC_STATIC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 1 #define M68K_STRUCT_VALUE_REGNUM 8 #define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0) whereas normal Linux has #undef PCC_STATIC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 0 #define M68K_STRUCT_VALUE_REGNUM 9 #define FUNCTION_VALUE(VALTYPE, FUNC) m68k_function_value (VALTYPE, FUNC) This means that on uCLinux: * Small structures are returned in memory. * Pointer return values are returned in %d0. * The memory for returning structures is passed in %a0. whereas on normal Linux: * Small structures are returned in registers (%d0/%d1 or %fp0). * Pointer return values are returned in %a0. * The memory for returning structures is passed in %a1. I hope you can distinguish your uCLinux binaries from normal Linux binaries, otherwise there is no way out of this mess. You'll then need to initialize the uCLinux gdbarch vector with something like: static void m68k_uclinux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ... /* uCLinux uses its own calling convention, where all return values are stored in %d0/%d1 and structures are returned in memory at the address passed in %a0. */ tdep->struct_value_regnum = M68K_A0_REGNUM; tdep->struct_return = pcc_struct_return; ... }