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 | 504b7d2026f1fbbe912b6f513c069c0d47ba2505 (patch) | |
tree | aa3186b5ab4a002cd64900af269e99d41031d584 /gas | |
parent | 62c018fe4a6de89d710e84b7efffe2462fa435cd (diff) | |
download | gdb-504b7d2026f1fbbe912b6f513c069c0d47ba2505.zip gdb-504b7d2026f1fbbe912b6f513c069c0d47ba2505.tar.gz gdb-504b7d2026f1fbbe912b6f513c069c0d47ba2505.tar.bz2 |
Support the use of the STT_COMMON type. (In source and object files only at the moment)
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 27 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/all/string.d | 9 | ||||
-rw-r--r-- | gas/testsuite/gas/all/string.s | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/type.e | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/type.s | 2 |
7 files changed, 47 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 8cf8f04..1e7e639 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2007-10-16 Nick Clifton <nickc@redhat.com> + + * config/obj-elf.c (obj_elf_type): Accept "common" as a valid + symbol type. + * doc/as.texinfo (.type): Document the types accepted by the + type pseudo op, including "common". + 2007-10-15 Peter Bergner <bergner@vnet.ibm.com> * config/tc-ppc.c (ppc_setup_opcodes): Verify instructions are sorted diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 429b32f..ab1550d 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) ; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 1acc54c..b1b0668 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-10-16 Nick Clifton <nickc@redhat.com> + + * gas/elf/elf.exp: Accept COMMON in readelf's output. + * gas/elf/type.s: Add test of common type. + * gas/elf/type.e: Extend expected output. + 2007-10-11 Nick Clifton <nickc@redhat.com> * gas/elf/elf.exp (run_elf_list_test): Run section6 test. diff --git a/gas/testsuite/gas/all/string.d b/gas/testsuite/gas/all/string.d index da6177d..b8bfd84 100644 --- a/gas/testsuite/gas/all/string.d +++ b/gas/testsuite/gas/all/string.d @@ -4,9 +4,8 @@ .*: .* Contents of section (\.data|\$DATA\$): - 0000 73747238 00000000 00000000 00000000 str8.* - 0010 7374726e 65773800 00000000 00000000 strnew8.* - 0020 (73007400 72003100 36000000 00000000|00730074 00720031 00360000 00000000).* - 0030 (33000000 32000000 00000000 00000000|00000033 00000032 00000000 00000000).* - 0040 (36000000 00000000 34000000 00000000|00000000 00000036 00000000 00000034).* + 0000 7374726e 65773800 00000000 00000000 strnew8.* + 00.. (73007400 72003100 36000000 00000000|00730074 00720031 00360000 00000000).* + 00.. (33000000 32000000 00000000 00000000|00000033 00000032 00000000 00000000).* + 00.. (36000000 00000000 34000000 00000000|00000000 00000036 00000000 00000034).* #pass diff --git a/gas/testsuite/gas/all/string.s b/gas/testsuite/gas/all/string.s index 80743bb..6565a71 100644 --- a/gas/testsuite/gas/all/string.s +++ b/gas/testsuite/gas/all/string.s @@ -1,7 +1,4 @@ .data - .string "str8" - - .balign 16 .string8 "strnew8" .balign 16 diff --git a/gas/testsuite/gas/elf/type.e b/gas/testsuite/gas/elf/type.e index 97742e8..50a49ab 100644 --- a/gas/testsuite/gas/elf/type.e +++ b/gas/testsuite/gas/elf/type.e @@ -2,3 +2,4 @@ .: 0+0 1 OBJECT LOCAL DEFAULT . object .: 0+1 1 TLS LOCAL DEFAULT . tls_object .: 0+2 1 NOTYPE LOCAL DEFAULT . notype + ..: 0+1 1 (COMMON|OBJECT) GLOBAL DEFAULT COM common diff --git a/gas/testsuite/gas/elf/type.s b/gas/testsuite/gas/elf/type.s index fdb7646..11f75bf 100644 --- a/gas/testsuite/gas/elf/type.s +++ b/gas/testsuite/gas/elf/type.s @@ -16,3 +16,5 @@ tls_object: .size notype,1 notype: .byte 0x0 + .comm common, 1 + .type common,STT_COMMON |