From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10750 invoked by alias); 22 Mar 2012 17:40:43 -0000 Received: (qmail 10582 invoked by uid 22791); 22 Mar 2012 17:40:40 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,SUBJ_OBFU_PUNCT_FEW,TW_GD X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Mar 2012 17:40:21 +0000 Received: from nat-dem.mentorg.com ([195.212.93.2] helo=eu2-mail.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1SAlzn-00039G-Vu from Thomas_Schwinge@mentor.com ; Thu, 22 Mar 2012 10:40:20 -0700 Received: from feldtkeller.schwinge.homeip.net ([172.30.64.78]) by eu2-mail.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 22 Mar 2012 18:40:18 +0100 From: Thomas Schwinge To: gdb-patches@sourceware.org Cc: Kevin Buettner Subject: [SH] gdb.asm/asm-source.exp User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Thu, 22 Mar 2012 17:40:00 -0000 Message-ID: <87ty1gedqk.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: 2012-03/txt/msg00789.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 5019 Hi! On SH, gdb.asm/asm-source.exp currently fails to build as follows: Executing on host: sh-linux-gnu-as [...]/gdb/testsuite/gdb.asm/asmsrc1.= s -I[...]/gdb/testsuite/gdb.asm -I[...]/gdb.d/gdb.asm -gdwarf2 -o asmsrc1.o= (timeout =3D 3600) [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Assembler messages: [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for _sta= rt does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for main= does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for foo3= does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for exit= does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for foos= tatic does not evaluate to a constant assembler exited with status 1 This comes from gdb.asm/sh.inc: 31 comment "subroutine end" 32 .purgem gdbasm_end 33 .macro gdbasm_end name 34 .size \name, .-_foo1 35 .align 1 36 .endm The _foo1 symbol doesn't exist anywhere (and it never has, in gdb.asm's lifetime). This is easily fixed, and makes the tests PASS for sh-elf. (As this code has never been touched since its initial commit in 2003, I wonder for how long this has been broken -- probably ever since? Or what were earlier assembler versions able to make out of that?) gdb/testsuite/ * gdb.asm/sh.inc (gdbasm_end) <.size>: Refer to the function's name. Index: gdb.asm/sh.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/sh.inc,v retrieving revision 1.2 diff -u -p -r1.2 sh.inc --- gdb.asm/sh.inc 7 Mar 2005 21:16:50 -0000 1.2 +++ gdb.asm/sh.inc 22 Mar 2012 17:27:40 -0000 @@ -31,7 +31,7 @@ comment "subroutine end" .purgem gdbasm_end .macro gdbasm_end name - .size \name, .-_foo1 + .size \name, . - \name .align 1 .endm =20 However, that is not enough to make the executable runnable on sh-linux-gnu: it chokes due to the stack pointer setup in gdbasm_startup. There are several ways to address this (see ``diff -u m32r.inc m32r-linux.inc'' for one example); I chose to generalize the code as follows: gdb/testsuite/ * gdb.asm/sh.inc (gdbasm_startup): Only set up the stack pointer if the symbol _stack is defined. Get rid of a hard-coded constant for _stack. Index: gdb.asm/sh.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/sh.inc,v retrieving revision 1.2 diff -u -p -r1.2 sh.inc --- gdb.asm/sh.inc 7 Mar 2005 21:16:50 -0000 1.2 +++ gdb.asm/sh.inc 22 Mar 2012 17:27:40 -0000 @@ -65,13 +65,19 @@ =20 comment "crt0 startup" .macro gdbasm_startup - mov.l .stackaddr,r15 + comment "If there is a _stack symbol, use it for setting up the stack" + comment "pointer. In hosted mode (when there is no _stack symbol)," + comment "the operating system will have initialized it already." + mov.l .stackaddr, r0 + tst r0, r0 + bt .afterstackaddr + mov r0, r15 bra .afterstackaddr nop - nop .align 2 .stackaddr: - .long 196608 ! 0x30000 + .weak _stack + .long _stack .align 1 .afterstackaddr: .endm Now the tests all PASS for both sh-linux-gnu and sh-elf: PASS: gdb.asm/asm-source.exp: f at main PASS: gdb.asm/asm-source.exp: next over macro PASS: gdb.asm/asm-source.exp: step into foo2 PASS: gdb.asm/asm-source.exp: info target PASS: gdb.asm/asm-source.exp: info symbol PASS: gdb.asm/asm-source.exp: list PASS: gdb.asm/asm-source.exp: search PASS: gdb.asm/asm-source.exp: f in foo2 PASS: gdb.asm/asm-source.exp: n in foo2 PASS: gdb.asm/asm-source.exp: bt ALL in foo2 PASS: gdb.asm/asm-source.exp: bt 2 in foo2 PASS: gdb.asm/asm-source.exp: s 2 PASS: gdb.asm/asm-source.exp: n 2 PASS: gdb.asm/asm-source.exp: bt 3 in foo3 PASS: gdb.asm/asm-source.exp: info source asmsrc1.s PASS: gdb.asm/asm-source.exp: finish from foo3 PASS: gdb.asm/asm-source.exp: info source asmsrc2.s PASS: gdb.asm/asm-source.exp: info sources PASS: gdb.asm/asm-source.exp: info line PASS: gdb.asm/asm-source.exp: next over foo3 PASS: gdb.asm/asm-source.exp: return from foo2 PASS: gdb.asm/asm-source.exp: look at global variable PASS: gdb.asm/asm-source.exp: x/i &globalvar PASS: gdb.asm/asm-source.exp: disassem &globalvar, &globalvar+1 PASS: gdb.asm/asm-source.exp: look at static variable PASS: gdb.asm/asm-source.exp: x/i &staticvar PASS: gdb.asm/asm-source.exp: disassem &staticvar, &staticvar+1 PASS: gdb.asm/asm-source.exp: look at static function OK to commit both patches? Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJPa2P0AAoJENuKOtuXzphJAPcIAJW72gQc006aCh7vpfxX6DN3 OEO0ZjS8V/lkg1WyEFWgtnqhE9QbMm5V/Lw+K2+zrxbj82HsstdIa1Sf8CdkFKvl KvxX/oAFtY2nNdhmwTU8SYmLJWsMmdG9YZkvAAUb/6LyDzgeI1pknbYnXhpbEy0R 7KQAOLrhvCdh5S+x8MO7nRsVRTQQ0YnVpmRCN55tZ3up91RwlgkdoZrEZ1giG7R8 Mr0NkKZrRqUDu7Je/OArYDGVRRAU+GL6LdsnPghLtlV7JMsBB+4chCvNtuyg5w6z N8zIceFfrIpdCPUlKRN3ael9eFlQkAXs9KKpOOCYL7BXlYWa1Tn9nvAGbPf5Vpw= =Mujk -----END PGP SIGNATURE----- --=-=-=--