From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28544 invoked by alias); 21 Feb 2005 08:37:22 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 28384 invoked from network); 21 Feb 2005 08:37:10 -0000 Received: from unknown (HELO gizmo01bw.bigpond.com) (144.140.70.11) by sourceware.org with SMTP; 21 Feb 2005 08:37:10 -0000 Received: (qmail 21008 invoked from network); 21 Feb 2005 08:37:08 -0000 Received: from unknown (HELO bwmam12.bigpond.com) (144.135.24.103) by gizmo01bw.bigpond.com with SMTP; 21 Feb 2005 08:37:08 -0000 Received: from cpe-144-136-221-26.sa.bigpond.net.au ([144.136.221.26]) by bwmam12.bigpond.com(MAM REL_3_4_2a 189/9890387) with SMTP id 9890387; Mon, 21 Feb 2005 18:37:08 +1000 Received: by bubble.modra.org (Postfix, from userid 500) id C635519059D; Mon, 21 Feb 2005 19:07:07 +1030 Date: Mon, 21 Feb 2005 15:51:00 -0000 From: Alan Modra To: binutils@sources.redhat.com Subject: Re: Making generic ld testcases pass on more targets Message-ID: <20050221083707.GH3780@bubble.modra.org> Mail-Followup-To: binutils@sources.redhat.com References: <20050216115635.GR10128@bubble.modra.org> <20050217032220.GU10128@bubble.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-SW-Source: 2005-02/txt/msg00460.txt.bz2 On Wed, Feb 16, 2005 at 10:37:44PM -0500, Hans-Peter Nilsson wrote: > On Thu, 17 Feb 2005, Alan Modra wrote: > > > On Wed, Feb 16, 2005 at 08:31:25PM -0500, Hans-Peter Nilsson wrote: > > > But please make the name less collision-prone. How about > > > ".gnu.dc.a"? > > > > Hmm. Do you know of some other assembler that uses dc.a? > > Nope. But I know of some other that use .dc.C (C=b,w). Sure. We do too. > It just seems painlessly safer to use a unique prefix, now that > we don't *have* to cast *any* doubt whatsoever of colliding with > any pre-existing convention. I mean, why not? I think the GNU tools have evolved far enough that it's reasonable to let other competing toolchains worry about being compatible with us. ;) > > > While you're at it, some fixed-size relocs would be nice too: > > > ".gnu.dc.1" .. ".gnu.dc.4" (and 8 for 64-bitters). > > > > You already have them. Lots of 'em. See read.c potable. > > But still only with the "dc." prefix and similar. Which are perfectly good to use. gas/ * read.c (address_bytes): New function. (TC_ADDRESS_BYTES): Default for BSD_ASSEMBLER to address_bytes. (potable): Add "dc.a". (cons_worker): Handle "dc.a". * doc/internals.texi (TC_ADDRESS_BYTES): Document. ld/testsuite/ * ld-elf/exclude1.s: Use ".dc.a". * ld-elfvsb/hidden2.s: Likewise. Index: gas/read.c =================================================================== RCS file: /cvs/src/src/gas/read.c,v retrieving revision 1.90 diff -u -p -r1.90 read.c --- gas/read.c 19 Feb 2005 08:56:08 -0000 1.90 +++ gas/read.c 21 Feb 2005 06:41:47 -0000 @@ -243,6 +243,24 @@ read_begin (void) lex_type['?'] = 3; } +#ifndef TC_ADDRESS_BYTES +#ifdef BFD_ASSEMBLER +#define TC_ADDRESS_BYTES address_bytes + +static inline int +address_bytes (void) +{ + /* Choose smallest of 1, 2, 4, 8 bytes that is large enough to + contain an address. */ + int n = (stdoutput->arch_info->bits_per_address - 1) / 8; + n |= n >> 1; + n |= n >> 2; + n += 1; + return n; +} +#endif +#endif + /* Set up pseudo-op tables. */ static struct hash_control *po_hash; @@ -263,6 +281,9 @@ static const pseudo_typeS potable[] = { {"common.s", s_mri_common, 1}, {"data", s_data, 0}, {"dc", cons, 2}, +#ifdef TC_ADDRESS_BYTES + {"dc.a", cons, 0}, +#endif {"dc.b", cons, 1}, {"dc.d", float_cons, 'd'}, {"dc.l", cons, 4}, @@ -3335,6 +3356,11 @@ cons_worker (register int nbytes, /* 1=. return; } +#ifdef TC_ADDRESS_BYTES + if (nbytes == 0) + nbytes = TC_ADDRESS_BYTES (); +#endif + #ifdef md_cons_align md_cons_align (nbytes); #endif Index: gas/doc/internals.texi =================================================================== RCS file: /cvs/src/src/gas/doc/internals.texi,v retrieving revision 1.41 diff -u -p -r1.41 internals.texi --- gas/doc/internals.texi 19 Feb 2005 08:56:08 -0000 1.41 +++ gas/doc/internals.texi 21 Feb 2005 06:59:14 -0000 @@ -1114,6 +1114,11 @@ pseudo-op. @cindex TC_CONS_FIX_NEW You may define this macro to generate a fixup for a data allocation pseudo-op. +@item TC_ADDRESS_BYTES +@cindex TC_ADDRESS_BYTES +Define this macro to specify the number of bytes used to store an address. +Used to implement @code{dc.a}. The target must have a reloc for this size. + @item TC_INIT_FIX_DATA (@var{fixp}) @cindex TC_INIT_FIX_DATA A C statement to initialize the target specific fields of fixup @var{fixp}. Index: ld/testsuite/ld-elf/exclude1.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-elf/exclude1.s,v retrieving revision 1.2 diff -u -p -r1.2 exclude1.s --- ld/testsuite/ld-elf/exclude1.s 19 Oct 2004 17:14:38 -0000 1.2 +++ ld/testsuite/ld-elf/exclude1.s 21 Feb 2005 06:14:07 -0000 @@ -1,4 +1,4 @@ .globl include_sym .data include_sym: - .long exclude_sym + .dc.a exclude_sym Index: ld/testsuite/ld-elfvsb/hidden2.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-elfvsb/hidden2.s,v retrieving revision 1.2 diff -u -p -r1.2 hidden2.s --- ld/testsuite/ld-elfvsb/hidden2.s 11 Feb 2005 14:25:13 -0000 1.2 +++ ld/testsuite/ld-elfvsb/hidden2.s 21 Feb 2005 06:14:08 -0000 @@ -1,4 +1,4 @@ .data .hidden foo .global foo - .long foo + .dc.a foo -- Alan Modra IBM OzLabs - Linux Technology Centre