public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com
Subject: Re: Making generic ld testcases pass on more targets
Date: Mon, 21 Feb 2005 15:51:00 -0000	[thread overview]
Message-ID: <20050221083707.GH3780@bubble.modra.org> (raw)
In-Reply-To: <Pine.BSF.4.58.0502162227530.69054@dair.pair.com>

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;
 }
 \f
+#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

      reply	other threads:[~2005-02-21  8:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-16 14:15 Alan Modra
2005-02-16 17:03 ` Nick Clifton
2005-02-16 18:48   ` Alan Modra
2005-02-16 19:48     ` Nick Clifton
2005-02-17  7:44 ` Hans-Peter Nilsson
2005-02-17 12:26   ` Hans-Peter Nilsson
2005-02-17 12:58   ` Alan Modra
2005-02-17 13:02     ` Hans-Peter Nilsson
2005-02-21 15:51       ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050221083707.GH3780@bubble.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).