summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-10-16 14:42:15 +0000
committerNick Clifton <nickc@redhat.com>2007-10-16 14:42:15 +0000
commite9284017c2c2ddce214c383a65548061b54cc29e (patch)
treeaebf013e1437cd2ecf8a2ad5b24b2222e8a95f92 /gas
parenta8e174a69dcd52cd3ff6f887c5feb75c58b8e159 (diff)
downloadbinutils-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')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/obj-elf.c27
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/all/string.d9
-rw-r--r--gas/testsuite/gas/all/string.s3
-rw-r--r--gas/testsuite/gas/elf/type.e1
-rw-r--r--gas/testsuite/gas/elf/type.s2
7 files changed, 47 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8cf8f04f98..1e7e6391d9 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 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)
;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 1acc54c1e3..b1b06681f3 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 da6177d27c..b8bfd846cc 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 80743bb700..6565a71ab8 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 97742e854e..50a49ab957 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 fdb76467e2..11f75bf53c 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