[PATCH] ia64 .xdata directives

Jan Beulich JBeulich@novell.com
Tue Feb 1 16:13:00 GMT 2005


The .xdata family of directives wasn't compatible with those of ias:
gas
required a quoted string as first argument, ias wants a bare section
name.
Further, once again a couple of memory leaks resulted from the use of
demand_copy_C_string. Finally, no .xdata16 directives existed, even
though
data16 pseudo-ops had been added at some point.

Built and tested on ia64-unknown-linux-gnu.

Jan

gas/
2005-02-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (parse_section_name): Handle non-quoted
first
	argument.
	(dot_xdata): Free section name after use.
	(dot_float_cons): Likewise.
	(dot_xstringer): Likewise.
	(dot_xdata_ua): Likewise.
	(dot_float_cons_ua): Likewise.
	(md_pseudo_table): Add xdata16 and xdata16.ua.

---
/home/jbeulich/src/binutils/mainline/2005-02-01/gas/config/tc-ia64.c	2005-02-01
16:15:58.000000000 +0100
+++ 2005-02-01/gas/config/tc-ia64.c	2005-02-01 16:58:40.556094873
+0100
@@ -4671,13 +4671,22 @@ parse_section_name ()
   int len;
 
   SKIP_WHITESPACE ();
-  if (*input_line_pointer != '"')
+  if (*input_line_pointer == '"')
+      name = demand_copy_C_string (&len);
+  else
     {
-      as_bad ("Missing section name");
-      ignore_rest_of_line ();
-      return 0;
+      char *start = input_line_pointer;
+      char c = get_symbol_end ();
+
+      if (input_line_pointer == start)
+	{
+	  as_bad ("Missing section name");
+	  ignore_rest_of_line ();
+	  return 0;
+	}
+      name = obstack_copy (&notes, start, input_line_pointer - start +
1);
+      *input_line_pointer = c;
     }
-  name = demand_copy_C_string (&len);
   if (!name)
     {
       ignore_rest_of_line ();
@@ -4704,6 +4713,7 @@ dot_xdata (size)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   cons (size);
   obj_elf_previous (0);
   md.keep_pending_output = 0;
@@ -4758,6 +4768,7 @@ dot_xfloat_cons (kind)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   stmt_float_cons (kind);
   obj_elf_previous (0);
   md.keep_pending_output = 0;
@@ -4773,6 +4784,7 @@ dot_xstringer (zero)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   stringer (zero);
   obj_elf_previous (0);
   md.keep_pending_output = 0;
@@ -4789,6 +4801,7 @@ dot_xdata_ua (size)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   md.auto_align = 0;
   cons (size);
   md.auto_align = saved_auto_align;
@@ -4807,6 +4820,7 @@ dot_xfloat_cons_ua (kind)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   md.auto_align = 0;
   stmt_float_cons (kind);
   md.auto_align = saved_auto_align;
@@ -5217,6 +5231,7 @@ const pseudo_typeS md_pseudo_table[] =
     { "xdata2", dot_xdata, 2 },
     { "xdata4", dot_xdata, 4 },
     { "xdata8", dot_xdata, 8 },
+    { "xdata16", dot_xdata, 16 },
     { "xreal4", dot_xfloat_cons, 'f' },
     { "xreal8", dot_xfloat_cons, 'd' },
     { "xreal10", dot_xfloat_cons, 'x' },
@@ -5228,6 +5243,7 @@ const pseudo_typeS md_pseudo_table[] =
     { "xdata2.ua", dot_xdata_ua, 2 },
     { "xdata4.ua", dot_xdata_ua, 4 },
     { "xdata8.ua", dot_xdata_ua, 8 },
+    { "xdata16.ua", dot_xdata_ua, 16 },
     { "xreal4.ua", dot_xfloat_cons_ua, 'f' },
     { "xreal8.ua", dot_xfloat_cons_ua, 'd' },
     { "xreal10.ua", dot_xfloat_cons_ua, 'x' },

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-mainline-ia64-xdata.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050201/403040c4/attachment.ksh>


More information about the Binutils mailing list