This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Consolidate .comm and .lcomm code
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Cc: Jie Zhang <zhangjie at magima dot com dot cn>
- Date: Sat, 13 Dec 2003 19:27:58 +1030
- Subject: Re: Consolidate .comm and .lcomm code
- References: <20031213081305.GH8167@bubble.sa.bigpond.net.au>
And this is the reason I started looking at .comm and .lcomm. Fixes
http://sources.redhat.com/ml/binutils/2002-08/msg00207.html
* read.c (s_lcomm_internal): Make global.
* read.h (s_lcomm_internal): Declare.
* config/obj-elf.c (elf_pseudo_table): Handle lcomm.
(obj_elf_lcomm): New function.
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.72
diff -u -p -r1.72 read.c
--- gas/read.c 13 Dec 2003 08:23:01 -0000 1.72
+++ gas/read.c 13 Dec 2003 08:45:17 -0000
@@ -2022,7 +2022,7 @@ parse_align (int align_bytes)
(alignment as a power of 2), or 2 if this was a ".bss" directive
with alignment in bytes. */
-static symbolS *
+symbolS *
s_lcomm_internal (int needs_align, symbolS *symbolP, addressT size)
{
addressT align = 0;
Index: gas/read.h
===================================================================
RCS file: /cvs/src/src/gas/read.h,v
retrieving revision 1.20
diff -u -p -r1.20 read.h
--- gas/read.h 13 Dec 2003 08:23:02 -0000 1.20
+++ gas/read.h 13 Dec 2003 08:45:17 -0000
@@ -142,6 +142,7 @@ extern void s_align_ptwo (int);
extern void bss_alloc (symbolS *, addressT, int);
extern offsetT parse_align (int);
extern symbolS *s_comm_internal (int, symbolS *(*) (int, symbolS *, addressT));
+extern symbolS *s_lcomm_internal (int, symbolS *, addressT);
extern void s_app_file_string (char *);
extern void s_app_file (int);
extern void s_app_line (int);
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.77
diff -u -p -r1.77 obj-elf.c
--- gas/config/obj-elf.c 13 Dec 2003 08:23:05 -0000 1.77
+++ gas/config/obj-elf.c 13 Dec 2003 08:45:18 -0000
@@ -85,12 +85,14 @@ static void obj_elf_symver PARAMS ((int)
static void obj_elf_subsection PARAMS ((int));
static void obj_elf_popsection PARAMS ((int));
static void obj_elf_tls_common PARAMS ((int));
+static void obj_elf_lcomm (int);
static const pseudo_typeS elf_pseudo_table[] =
{
{"comm", obj_elf_common, 0},
{"common", obj_elf_common, 1},
{"ident", obj_elf_ident, 0},
+ {"lcomm", obj_elf_lcomm, 0},
{"local", obj_elf_local, 0},
{"previous", obj_elf_previous, 0},
{"section", obj_elf_section, 0},
@@ -382,6 +384,15 @@ obj_elf_tls_common (ignore)
}
static void
+obj_elf_lcomm (int ignore ATTRIBUTE_UNUSED)
+{
+ symbolS *symbolP = s_comm_internal (0, s_lcomm_internal);
+
+ if (symbolP)
+ symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
+}
+
+static void
obj_elf_local (ignore)
int ignore ATTRIBUTE_UNUSED;
{
--
Alan Modra
IBM OzLabs - Linux Technology Centre