This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
gas patch to make .comm and .lcomm work more consistently
- To: binutils at sourceware dot cygnus dot com
- Subject: gas patch to make .comm and .lcomm work more consistently
- From: Thomas de Lellis <tdel at windriver dot com>
- Date: Thu, 02 Mar 2000 16:01:48 -0800
Greetings!
here's a patch proposal to have assembler pseudo-op .lcomm generate ELF
syms with STT_OBJECT set like the .comm directive does...
regards!
tom
The .comm and .lcomm directives worked somewhat inconsistently in that
an ELF symbol defined using .comm had the STT_OBJECT type flag set
while an ELF symbol defined using .lcomm had STT_NOTYPE set. This
change makes .comm and .lcomm work consistently by having .lcomm
also generate ELF symbols with the STT_OBJECT flag set.
======================================================================
2000-03-02 Thomas de Lellis <tdel@windriver.com>
* config/tc-ppc.c (ppc_elf_lcomm): As obj-elf.c
automatically assigns .comm symbols to be OBJECT
type, .lcomm was modified to do this as well when
OBJ_ELF is defined.
* read.c (s_lcomm_internal): ditto
======================================================================
*** read.c@@/main/3 Mon Oct 4 13:42:57 1999
--- read.c Thu Mar 2 14:21:21 2000
*************** s_lcomm_internal (needs_align, bytes_p)
*** 2094,2099 ****
--- 2094,2103 ----
#ifdef S_SET_SIZE
S_SET_SIZE (symbolP, temp);
#endif
+ #ifdef OBJ_ELF
+ /* obj-elf.c sets object-type for .comm - do it for .lcomm too. */
+ symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
+ #endif
}
else
as_bad (_("Ignoring attempt to re-define symbol `%s'."),
======================================================================
*** tc-ppc.c@@/main/7 Mon Oct 4 13:29:03 1999
--- tc-ppc.c Tue Feb 29 19:51:15 2000
*************** ppc_elf_lcomm(xxx)
*** 1412,1417 ****
--- 1412,1421 ----
*pfrag = 0;
S_SET_SIZE (symbolP, size);
S_SET_SEGMENT (symbolP, bss_section);
+ #ifdef OBJ_ELF
+ /* obj-elf.c sets object-type for .comm - do it for .lcomm too. */
+ symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
+ #endif
subseg_set (old_sec, old_subsec);
demand_empty_rest_of_line ();
}
TESTCASE ==================================================================
> cat a.s
.comm yyyyy,4
.lcomm xxxxx,4
> ./test
FAIL ======================================================================
+ asarm -o a.o a.s
+ objdumparm --syms a.o
a.o: file format elf32-littlearm
SYMBOL TABLE:
00000000 l d .text 00000000
00000000 l d .data 00000000
00000000 l d .bss 00000000
00000000 l .bss 00000004 xxxxx
00000004 O *COM* 00000004 yyyyy
PASS ======================================================================
+ asarm -o a.o a.s
+ objdumparm --syms a.o
a.o: file format elf32-littlearm
SYMBOL TABLE:
00000000 l d .text 00000000
00000000 l d .data 00000000
00000000 l d .bss 00000000
00000000 l O .bss 00000004 xxxxx <<<<<<<< ta DA!
00000004 O *COM* 00000004 yyyyy
===========================================================================
p.s. note: although the arm example is shown, the fix works for other
arch's incl. ppc...