From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8003 invoked by alias); 22 Jan 2013 10:28:57 -0000 Received: (qmail 7995 invoked by uid 22791); 22 Jan 2013 10:28:56 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,MIME_CHARSET_FARAWAY,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from usmamail.tilera.com (HELO USMAMAIL.TILERA.COM) (12.216.194.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Jan 2013 10:28:50 +0000 Received: from [10.200.0.56] (124.207.145.166) by USMAExch2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server (TLS) id 14.0.694.0; Tue, 22 Jan 2013 05:28:48 -0500 Message-ID: <50FE69DB.6090802@tilera.com> Date: Tue, 22 Jan 2013 10:28:00 -0000 From: Jiong Wang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Joel Brobecker CC: , Walter Lee Subject: Re: [RFC/TileGX 1/6] fix args alignment bug References: <50F9148F.3010602@tilera.com> <20130118131358.GE3564@adacore.com> <50F9638C.4020005@tilera.com> In-Reply-To: <50F9638C.4020005@tilera.com> Content-Type: text/plain; charset="gb18030"; format=flowed Content-Transfer-Encoding: 8bit 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: 2013-01/txt/msg00520.txt.bz2 ÓÚ 2013/1/18 23:00, Jiong Wang дµÀ: > Hi Joel, > > thanks for your careful review > >>> - /* Loop backwards through arguments to determine stack >>> alignment. */ >>> - alignlen = 0; >>> - >>> - for (j = nargs - 1; j >= i; j--) >>> - { >>> - typelen = TYPE_LENGTH (value_enclosing_type (args[j])); >>> - alignlen += (typelen + 3) & (~3); >>> - } >>> - >>> - if (alignlen & 0x4) >>> - stack_dest -= 4; >> Do you have any hint as to why this code was written the way it was? >> It doesn't seem like the type of code that would be added by accident. >> Did Jeff (the apparent author) misunderstand the ABI? > > actually, these these copied from our tilepro target which is a > pure 32bit target, and the > compiler for that target is not gcc initially. so there maybe some > historic reason for those code. > > but for tilegx, the ABI is actually very clear, 10 regs for > arguments, then push on stack. > > so I just delete them, gdb works ok on both daily usage and dejagnu >> >>> typelen = TYPE_LENGTH (value_enclosing_type (args[j])); >>> - slacklen = ((typelen + 3) & (~3)) - typelen; >>> + slacklen = ((typelen + 7) & (~7)) - typelen; >> This is a detail, but can you use utils.c:align_up, in this case? >> (I find those midly more readable than these incantations, but >> it's OK if you prefer the code to stay as is). > thanks, I change to align_up to reuse existing helper function >> >>> /* Add 2 words for linkage space to the stack. */ >>> - stack_dest = stack_dest - 8; >>> - write_memory (stack_dest, two_zero_words, 8); >>> + stack_dest = stack_dest - 16; >>> + write_memory (stack_dest, four_zero_words, 16); >> It looks like you need to adjust the comment as well. > > fixed. > > is this new 01-revise.patch ok for this issue? > Ping, are this and the other updated tilegx patches OK? Thanks, Jiong