From 8684e216c83d214d6f896cacb420a2a7699e6690 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 13 Mar 2000 20:46:07 +0000 Subject: [PATCH] * read.c (TC_IMPLICIT_LCOMM_ALIGNMENT): New default-definition. (s_lcomm_internal): Use it. * doc/internals.texi (CPU backend): Document it. * config/obj-evax.h (TC_IMPLICIT_LCOMM_ALIGNMENT): Set to 2**3 bytes. --- gas/ChangeLog | 8 ++++++++ gas/config/obj-evax.h | 4 +++- gas/doc/internals.texi | 10 ++++++++++ gas/read.c | 35 ++++++++++++++++++++--------------- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 83d680a2e6c..a238d8ae81a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +Sat Mar 11 00:01:39 2000 Hans-Peter Nilsson + + * read.c (TC_IMPLICIT_LCOMM_ALIGNMENT): New default-definition. + (s_lcomm_internal): Use it. + * doc/internals.texi (CPU backend): Document it. + * config/obj-evax.h (TC_IMPLICIT_LCOMM_ALIGNMENT): Set to 2**3 + bytes. + 2000-03-10 Geoffrey Keating * config/tc-mips.c (mips_ip): Don't put stuff in .rodata diff --git a/gas/config/obj-evax.h b/gas/config/obj-evax.h index 1d9db19f41b..745b1feff97 100644 --- a/gas/config/obj-evax.h +++ b/gas/config/obj-evax.h @@ -1,5 +1,5 @@ /* This file is obj-evax.h - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 2000 Free Software Foundation, Inc. Contributed by Klaus Kämpf (kkaempf@progis.de) of proGIS Software, Aachen, Germany. @@ -85,6 +85,8 @@ typedef void *object_headers; #define LKP_S_K_SIZE 16 +#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 3 + /* * Local Variables: * comment-column: 0 diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 6fbc9bba658..1e05131df7a 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1059,6 +1059,16 @@ upon the number of bytes that the alignment will skip. You may define this macro to do special handling for an alignment directive. GAS will call it at the end of the assembly. +@item TC_IMPLICIT_LCOMM_ALIGNMENT (@var{size}, @var{p2var}) +@cindex TC_IMPLICIT_LCOMM_ALIGNMENT +An @code{.lcomm} directive with no explicit alignment parameter will use this +macro to set @var{p2var} to the alignment that a request for @var{size} bytes +will have. The alignment is expressed as a power of two. If no alignment +should take place, the macro definition should do nothing. Some targets define +a @code{.bss} directive that is also affected by this macro. The default +definition will set @var{p2var} to the truncated power of two of sizes up to +eight bytes. + @item md_flush_pending_output @cindex md_flush_pending_output If you define this macro, GAS will call it each time it skips any space because of a diff --git a/gas/read.c b/gas/read.c index 71dae8e42e8..b8afe1c2e24 100644 --- a/gas/read.c +++ b/gas/read.c @@ -53,6 +53,21 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define TC_START_LABEL(x,y) (x==':') #endif +/* Set by the object-format or the target. */ +#ifndef TC_IMPLICIT_LCOMM_ALIGNMENT +#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \ + do { \ + if ((SIZE) >= 8) \ + (P2VAR) = 3; \ + else if ((SIZE) >= 4) \ + (P2VAR) = 2; \ + else if ((SIZE) >= 2) \ + (P2VAR) = 1; \ + else \ + (P2VAR) = 0; \ + } while (0) +#endif + /* The NOP_OPCODE is for the alignment fill value. * fill it a nop instruction so that the disassembler does not choke * on it @@ -1973,24 +1988,14 @@ s_lcomm_internal (needs_align, bytes_p) } } #endif + if (!needs_align) { - /* FIXME. This needs to be machine independent. */ - if (temp >= 8) - align = 3; - else if (temp >= 4) - align = 2; - else if (temp >= 2) - align = 1; - else - align = 0; - -#ifdef OBJ_EVAX - /* FIXME: This needs to be done in a more general fashion. */ - align = 3; -#endif + TC_IMPLICIT_LCOMM_ALIGNMENT (temp, align); - record_alignment(bss_seg, align); + /* Still zero unless TC_IMPLICIT_LCOMM_ALIGNMENT set it. */ + if (align) + record_alignment(bss_seg, align); } if (needs_align) -- 2.30.2