diff options
author | Nick Clifton <nickc@redhat.com> | 2007-10-16 14:42:15 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2007-10-16 14:42:15 +0000 |
commit | e9284017c2c2ddce214c383a65548061b54cc29e (patch) | |
tree | aebf013e1437cd2ecf8a2ad5b24b2222e8a95f92 /gas/config/obj-elf.c | |
parent | a8e174a69dcd52cd3ff6f887c5feb75c58b8e159 (diff) | |
download | binutils-redhat-e9284017c2c2ddce214c383a65548061b54cc29e.tar.gz |
Support the use of the STT_COMMON type. (In source and object files only at the moment)
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r-- | gas/config/obj-elf.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 429b32faca..ab1550df1f 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1587,6 +1587,33 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED) else if (strcmp (typename, "notype") == 0 || strcmp (typename, "STT_NOTYPE") == 0) ; + else if (strcmp (typename, "common") == 0 + || strcmp (typename, "STT_COMMON") == 0) + { + type = BSF_OBJECT; + + if (! S_IS_COMMON (sym)) + { + if (S_IS_VOLATILE (sym)) + { + sym = symbol_clone (sym, 1); + S_SET_SEGMENT (sym, bfd_com_section_ptr); + S_SET_VALUE (sym, 0); + S_SET_EXTERNAL (sym); + symbol_set_frag (sym, &zero_address_frag); + S_CLEAR_VOLATILE (sym); + } + else if (S_IS_DEFINED (sym) || symbol_equated_p (sym)) + as_bad (_("symbol '%s' is already defined"), S_GET_NAME (sym)); + else + { + /* FIXME: Is it safe to just change the section ? */ + S_SET_SEGMENT (sym, bfd_com_section_ptr); + S_SET_VALUE (sym, 0); + S_SET_EXTERNAL (sym); + } + } + } #ifdef md_elf_symbol_type else if ((type = md_elf_symbol_type (typename, sym, elfsym)) != -1) ; |