[PATCH 01/15] MIPS/GAS: Add .sbss pseudo op

Maciej W. Rozycki macro@linux-mips.org
Sun Oct 3 19:39:00 GMT 2010


Hi,

 While preparing this series of patches it became apparent to me that 
inconsistently with .sdata (and the remaining directives in this class) 
the MIPS target lacks the .sbss operator.  This does not really matter for 
ELF, but for ECOFF it means there's no way to select the .sbss section and 
e.g. set its alignment.  The following change adds the missing operator.  
The immediate effect is it makes it easier to prepare file-format 
independent tests in the testsuite, but obviously some may use it in 
regular software if they still care about an ECOFF target.

 The pseudo op is defined by some other targets already BTW.

2010-10-03  Maciej W. Rozycki  <macro@linux-mips.org>

	gas/
	* config/tc-mips.c (mips_pseudo_table): Add "sbss".
	(s_change_sec): Handle it.

 OK to apply?

  Maciej

binutils-2.20.51-20100925-mips-gas-sbss.patch
Index: binutils-2.20.51/gas/config/tc-mips.c
===================================================================
--- binutils-2.20.51.orig/gas/config/tc-mips.c
+++ binutils-2.20.51/gas/config/tc-mips.c
@@ -1188,6 +1188,9 @@ static const pseudo_typeS mips_pseudo_ta
   {"origin", s_org, 0},
   {"repeat", s_rept, 0},
 
+  /* For MIPS this is non-standard, but we define it for consistency.  */
+  {"sbss", s_change_sec, 'B'},
+
   /* These pseudo-ops are defined in read.c, but must be overridden
      here for one reason or another.  */
   {"align", s_align, 0},
@@ -12644,6 +12647,17 @@ s_change_sec (int sec)
 	}
       demand_empty_rest_of_line ();
       break;
+
+    case 'B':
+      seg = subseg_new (".sbss", (subsegT) get_absolute_expression ());
+      if (IS_ELF)
+	{
+	  bfd_set_section_flags (stdoutput, seg, SEC_ALLOC);
+	  if (strncmp (TARGET_OS, "elf", 3) != 0)
+	    record_alignment (seg, 4);
+	}
+      demand_empty_rest_of_line ();
+      break;
     }
 
   auto_align = 1;



More information about the Binutils mailing list