From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4543 invoked by alias); 14 Jul 2010 08:50:38 -0000 Received: (qmail 4509 invoked by uid 22791); 14 Jul 2010 08:50:35 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_MIME_NO_TEXT,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Jul 2010 08:50:30 +0000 Received: (qmail 10209 invoked from network); 14 Jul 2010 08:50:27 -0000 Received: from unknown (HELO dirichlet.schwinge.homeip.net) (thomas@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Jul 2010 08:50:27 -0000 From: Thomas Schwinge To: binutils@sourceware.org Cc: Jan Kratochvil , Andrew Stubbs , gdb@sourceware.org, macro@codesourcery.com, nathan@codesourcery.com Subject: Re: MIPS: 64-bit DWARF References: <4BE16915.7080501@codesourcery.com> <20100505143213.GA4735@caradoc.them.org> <4BE187D8.4050804@codesourcery.com> <20100507132310.GA6374@host0.dyn.jankratochvil.net> <87sk431a3j.fsf@dirichlet.schwinge.homeip.net> <87fwzxvslw.fsf_-_@dirichlet.schwinge.homeip.net> Date: Wed, 14 Jul 2010 08:50:00 -0000 In-Reply-To: <87fwzxvslw.fsf_-_@dirichlet.schwinge.homeip.net> (Thomas Schwinge's message of "Tue, 06 Jul 2010 11:59:07 +0200") Message-ID: <87eif6v450.fsf@dirichlet.schwinge.homeip.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00042.txt.bz2 --=-=-= Content-Transfer-Encoding: quoted-printable Content-length: 5047 Hello! This is about switching MIPS from 64-bit to 32-bit DWARF format (as other architectures are doing), for the benefit of prelink. On 2010-07-06 09:59, I wrote: > On 2010-07-01 15:43, I wrote: >> On 2010-05-07 13:23, Jan Kratochvil wrote: >>> On Wed, 05 May 2010 16:59:36 +0200, Andrew Stubbs wrote: >>>> > prelink includes code to manipulate the contents of the debug info. >>> [...] >>>> Maybe prelink has failed to relocate the debug info in this case? >>> >>> The attached patch should fix it. >>> >>> Although SHT_MIPS_DWARF value should be recognized only for e_machine as >>> EM_MIPS or EM_MIPS_RS3_LE or EM_MIPS_X? Or are there some other rules? >> >>> --- prelink/src/dso.c-orig 2010-04-13 16:41:15.000000000 +0200 >>> +++ prelink/src/dso.c 2010-05-07 15:16:25.000000000 +0200 >>> @@ -1381,6 +1381,7 @@ adjust_dso (DSO *dso, GElf_Addr start, G >>> switch (dso->shdr[i].sh_type) >>> { >>> case SHT_PROGBITS: >>> + case SHT_MIPS_DWARF: >>> name =3D strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name); >>> if (strcmp (name, ".stab") =3D=3D 0 >>> && adjust_stabs (dso, i, start, adjust)) >> >> Unfortunately, this patch causes the following regression for about every >> test of the prelink testsuite, in -mabi=3D64 configurations (only): >> >> mips-wrs-linux-gnu-prelink -c ./prelink.conf -C ./prelink.cache --ld= -library-path=3D. --dynamic-linker=3D./ld.so.1 -vm ./reloc1 >> Laying out 4 libraries in virtual address space 0000005800000000-000= 0009800000000 >> Assigned virtual address space slots for libraries: >> ./ld.so.1 0000005= 800000000-0000005800032328 >> ./libc.so.6 0000005= 800040000-00000058001cbdb0 >> ./reloc1lib1.so 0000005= 8001d0000-00000058001e0b10 >> ./reloc1lib2.so 0000005= 8001f0000-00000058002009d0 >> Prelinking /scratch/thomas/issue8927/obj/test-4.3a-294-mips-wrs-linu= x-gnu/host-i686-pc-linux-gnu/mabi_64/prelink.d/ld-2.8.so >> mips-wrs-linux-gnu-prelink: /scratch/thomas/issue8927/obj/test-4.3a-= 294-mips-wrs-linux-gnu/host-i686-pc-linux-gnu/mabi_64/prelink.d/ld-2.8.so: = 64-bit DWARF not supported > > This happens when processing .debug_lines, which is generated by GAS. > > prelink does not support the 64-bit DWARF format. From a quick glance, > GDB does, see dwarf2read.c:read_initial_length. > > MIPS is, per gas/config/tc-mips, the only architecture to override > DWARF2_FORMAT (which defaults to 32-bit), and thus possibly can emit > 64-bit DWARF code, which it actually does for -mabi=3D64, see > tc-mips.c:mips_dwarf2_format. > > In this 64-bit > DWARF format support has originally been added. > > What's our way forward? Can we switch MIPS back to only using the 32-bit > DWARF format (save the IRIX case)? Do we need to extend prelink? > > As I understand the GCC code, it always uses the 32-bit DWARF format, > even for MIPS 64-bit ABIs. Here is the patch that I tested for (a non-HEAD version of) binutils. This makes prelink happy, and there are no regressions in the GDB testsuite. (Anything else to test?) I left in the 64-bit stuff for TE_IRIX, as I have no idea about it. Index: gas/config/tc-mips.c =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 --- gas/config/tc-mips.c (revision 291480) +++ gas/config/tc-mips.c (working copy) @@ -15499,20 +15499,16 @@ #endif } =20 +#ifdef TE_IRIX enum dwarf2_format mips_dwarf2_format (void) { if (HAVE_64BIT_SYMBOLS) - { -#ifdef TE_IRIX - return dwarf2_format_64bit_irix; -#else - return dwarf2_format_64bit; -#endif - } + return dwarf2_format_64bit_irix; else return dwarf2_format_32bit; } +#endif =20 int mips_dwarf2_addr_size (void) Index: gas/config/tc-mips.h =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 --- gas/config/tc-mips.h (revision 291480) +++ gas/config/tc-mips.h (working copy) @@ -165,9 +165,13 @@ extern void mips_enable_auto_align (void); #define md_elf_section_change_hook() mips_enable_auto_align() =20 +#ifdef TE_IRIX enum dwarf2_format; extern enum dwarf2_format mips_dwarf2_format (void); -#define DWARF2_FORMAT() mips_dwarf2_format () +# define DWARF2_FORMAT() mips_dwarf2_format () +#else +/* Use GAS' defaults. */ +#endif =20 extern int mips_dwarf2_addr_size (void); #define DWARF2_ADDR_SIZE(bfd) mips_dwarf2_addr_size () Is this approach OK, or is there a real reason to have 64-bit DWARF format on MIPS? If it's OK, then I'll port the patch to binutils HEAD ((unused) asection * added to DWARF2_FORMAT). Regards, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 197 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkw9eksACgkQC9ZuxbdEiFi7rgCgxF0D30VozM6wEZtiwHv6SrNJ 2rIAoOZyEqzkMHTksDVcLb2OjaWYXM8W =S9q4 -----END PGP SIGNATURE----- --=-=-=--