From cc1bc22af7e433b5cfca0907e069ffbeb8a29660 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 21 Feb 2005 08:39:53 +0000 Subject: [PATCH] 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. --- gas/ChangeLog | 8 ++++++++ gas/doc/internals.texi | 5 +++++ gas/read.c | 26 ++++++++++++++++++++++++++ ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-elf/exclude1.s | 2 +- ld/testsuite/ld-elfvsb/hidden2.s | 2 +- 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index f92c3d6..7abba5e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ 2005-02-21 Alan Modra + * 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. + +2005-02-21 Alan Modra + * input-file.c (input_file_open): Rearrange to avoid warning. 2005-02-19 Alan Modra diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index e0fb749..8cfd33e 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -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}. diff --git a/gas/read.c b/gas/read.c index 807f410..c86b7d7 100644 --- a/gas/read.c +++ b/gas/read.c @@ -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=.byte, 2=.word, 4=.long. */ return; } +#ifdef TC_ADDRESS_BYTES + if (nbytes == 0) + nbytes = TC_ADDRESS_BYTES (); +#endif + #ifdef md_cons_align md_cons_align (nbytes); #endif diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 5148685..85ef563 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2005-02-21 Alan Modra + * ld-elf/exclude1.s: Use ".dc.a". + * ld-elfvsb/hidden2.s: Likewise. + +2005-02-21 Alan Modra + * ld-elf/warn1.d: Specify -Ttext. * ld-scripts/align.exp (align2a, align2b: Don't run on aout targets. * ld-scripts/align2.t: Discard all but .text and .data. diff --git a/ld/testsuite/ld-elf/exclude1.s b/ld/testsuite/ld-elf/exclude1.s index 515d078..99efc7e 100644 --- a/ld/testsuite/ld-elf/exclude1.s +++ b/ld/testsuite/ld-elf/exclude1.s @@ -1,4 +1,4 @@ .globl include_sym .data include_sym: - .long exclude_sym + .dc.a exclude_sym diff --git a/ld/testsuite/ld-elfvsb/hidden2.s b/ld/testsuite/ld-elfvsb/hidden2.s index b4a2e92..beb123b 100644 --- a/ld/testsuite/ld-elfvsb/hidden2.s +++ b/ld/testsuite/ld-elfvsb/hidden2.s @@ -1,4 +1,4 @@ .data .hidden foo .global foo - .long foo + .dc.a foo -- 2.7.4