[PATCH] Minor fixes for gas (ecoff)

Thiemo Seufer ica2_ts@csv.ica.uni-stuttgart.de
Tue May 1 04:29:00 GMT 2001


amodra@one.net.au wrote:
>On Fri, Apr 13, 2001 at 11:49:49PM +0200, Thiemo Seufer wrote:
>> This patch adds for gas:
>>  - dependency checking of te-hppa64.h and te-hppalinux64.h
>>  - variable initialization in itbl-ops.c:itbl_assemble
>>  - cosmetic fixes to reduce compilation noise for ecoff
>
>Thank you.  Would you please resend the patch with some fixes and 
>ChangeLog entries, and I'll install it.
>
>> @@ -3688,7 +3688,7 @@
>>    align = backend->debug_align;
>>    if ((offset & (align - 1)) != 0)
>>      {
>> -      unsigned long add;
>> +      long add;
>>  
>>        add = align - (offset & (align - 1));
>>        if (*bufend - (*buf + offset) < add)
>
>This changes program behaviour.  What if *bufend - (*buf + offset) == -1
>Maybe that can't happen, but I'd be happier if you leave `add' as
>unsigned long, and cast the expression.
>
>> @@ -4446,7 +4446,7 @@
>>  	      aux_end = aux_ptr + aux_cnt;
>>  	      for (; aux_ptr < aux_end; aux_ptr++)
>>  		{
>> -		  if (*bufend - (char *) aux_out < sizeof (union aux_ext))
>> +		  if (*bufend - (char *) aux_out < (int) sizeof (union aux_ext))
>>  		    aux_out = ((union aux_ext *)
>>  			       ecoff_add_bytes (buf, bufend,
>>  						(char *) aux_out,
>
>Same sort of potential problem here.

Changed accordingly below.


Thiemo


2001-05-01  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	* gas/Makefile.am: Dependency checking of te-hppa64.h and
	te-hppalinux64.h
	* gas/config/obj-ecoff.c(obj_pseudo_table): Fix
	terminating entry.
	(n_names): Cast away type mismatch.
	(ecoff_sec_sym_ok_for_reloc): Add unused attribute.
	(obj_ecoff_frob_symbol): Likewise.
	* gas/configure.in: remove duplicate mips-*-ecoff*) entry.
	* gas/ecoff.c: (add_file): Add unused attribute.
	(ecoff_directive_begin): Likewise.
	(ecoff_directive_bend): Likewise.
	(ecoff_directive_def): Likewise.
	(ecoff_directive_dim): Likewise.
	(ecoff_directive_scl): Likewise.
	(ecoff_directive_size): Likewise.
	(ecoff_directive_type): Likewise.
	(ecoff_directive_tag): Likewise.
	(ecoff_directive_val): Likewise.
	(ecoff_directive_endef): Likewise.
	(ecoff_directive_end): Likewise.
	(ecoff_directive_ent): Likewise.
	(ecoff_directive_extern): Likewise.
	(ecoff_directive_file): Likewise.
	(ecoff_directive_fmask): Likewise.
	(ecoff_directive_frame): Likewise.
	(ecoff_directive_mask): Likewise.
	(ecoff_directive_loc): Likewise.
	(mark_stabs): Likewise.
	(ecoff_stab):  Likewise.
	(ecoff_frob_symbol): Cast away type mismatch.
	(ecoff_padding_adjust): Likewise.
	(ecoff_build_symbols): Likewise.
	(ecoff_build_procs): Likewise.
	(ecoff_build_aux): Likewise.
	(ecoff_build_strings): Likewise.
	(ecoff_build_fdr): Likewise.
	(ecoff_build_debug): Likewise.
	* gas/itbl-ops.c (itbl_assemble): Variable initialization.


diff -BurPX ../src/binutils-exclude src-orig/gas/Makefile.am src/gas/Makefile.am
--- src-orig/gas/Makefile.am	Sun Apr  8 22:43:56 2001
+++ src/gas/Makefile.am	Mon Apr 30 12:29:28 2001
@@ -343,6 +343,8 @@
 	config/te-go32.h \
 	config/te-hp300.h \
 	config/te-hppa.h \
+	config/te-hppa64.h \
+	config/te-hppalinux64.h \
 	config/te-i386aix.h \
 	config/te-ia64aix.h \
 	config/te-ic960.h \
diff -BurPX ../src/binutils-exclude src-orig/gas/config/obj-ecoff.c src/gas/config/obj-ecoff.c
--- src-orig/gas/config/obj-ecoff.c	Wed Mar 14 17:03:16 2001
+++ src/gas/config/obj-ecoff.c	Mon Apr 30 12:29:28 2001
@@ -95,7 +95,7 @@
   { "verstamp",	s_ignore,		0 },
 
   /* Sentinel.  */
-  { NULL }
+  { NULL,	s_ignore,		0 }
 };
 
 /* Swap out the symbols and debugging information for BFD.  */
@@ -141,7 +141,7 @@
     /* bss segment */
     ".sbss", ".bss",
   };
-#define n_names (sizeof (names) / sizeof (names[0]))
+#define n_names ((int)(sizeof (names) / sizeof (names[0])))
 
   addr = 0;
   {
@@ -272,7 +272,7 @@
 
 static int
 ecoff_sec_sym_ok_for_reloc (sec)
-     asection *sec;
+     asection *sec ATTRIBUTE_UNUSED;
 {
   return 1;
 }
@@ -280,7 +280,7 @@
 static void
 obj_ecoff_frob_symbol (sym, puntp)
      symbolS *sym;
-     int *puntp;
+     int *puntp ATTRIBUTE_UNUSED;
 {
   ecoff_frob_symbol (sym);
 }
diff -urNX binutils-exclude src-orig/gas/configure.in src/gas/configure.in
--- src-orig/gas/configure.in	Sun Apr  8 22:43:56 2001
+++ src/gas/configure.in	Thu Apr 12 04:55:11 2001
@@ -339,7 +339,6 @@
       mips-*-ultrix*)       fmt=ecoff endian=little ;;
       mips-*-osf*)          fmt=ecoff endian=little ;;
       mips-*-ecoff*)        fmt=ecoff ;;
-      mips-*-ecoff*)        fmt=ecoff ;;
       mips-*-pe*)           fmt=coff endian=little em=pe ;;
       mips-*-irix6*)	    fmt=elf ;;
       mips-*-irix5*)        fmt=elf ;;
diff -BurPX ../src/binutils-exclude src-orig/gas/ecoff.c src/gas/ecoff.c
--- src-orig/gas/ecoff.c	Wed Mar 14 17:03:08 2001
+++ src/gas/ecoff.c	Mon Apr 30 13:03:33 2001
@@ -2190,7 +2190,7 @@
 static void
 add_file (file_name, indx, fake)
      const char *file_name;		/* file name */
-     int indx;
+     int indx ATTRIBUTE_UNUSED;
      int fake;
 {
   register int first_ch;
@@ -2426,7 +2426,7 @@
 
 void
 ecoff_directive_begin (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char name_end;
@@ -2464,7 +2464,7 @@
 
 void
 ecoff_directive_bend (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char name_end;
@@ -2523,7 +2523,7 @@
 
 void
 ecoff_directive_def (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char name_end;
@@ -2569,7 +2569,7 @@
 
 void
 ecoff_directive_dim (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int dimens[N_TQ];
   int i;
@@ -2619,7 +2619,7 @@
 
 void
 ecoff_directive_scl (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   long val;
 
@@ -2644,7 +2644,7 @@
 
 void
 ecoff_directive_size (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int sizes[N_TQ];
   int i;
@@ -2694,7 +2694,7 @@
 
 void
 ecoff_directive_type (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   long val;
   tq_t *tq_ptr;
@@ -2763,7 +2763,7 @@
 
 void
 ecoff_directive_tag (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char name_end;
@@ -2791,7 +2791,7 @@
 
 void
 ecoff_directive_val (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   expressionS exp;
 
@@ -2826,7 +2826,7 @@
 
 void
 ecoff_directive_endef (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   symint_t indx;
@@ -3006,7 +3006,7 @@
 
 void
 ecoff_directive_end (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char name_end;
@@ -3063,7 +3063,7 @@
 
 void
 ecoff_directive_ent (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   char name_end;
@@ -3116,7 +3116,7 @@
 
 void
 ecoff_directive_extern (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   char *name;
   int c;
@@ -3141,7 +3141,7 @@
 
 void
 ecoff_directive_file (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int indx;
   char *name;
@@ -3168,7 +3168,7 @@
 
 void
 ecoff_directive_fmask (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   long val;
 
@@ -3197,7 +3197,7 @@
 
 void
 ecoff_directive_frame (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   long val;
 
@@ -3238,7 +3238,7 @@
 
 void
 ecoff_directive_mask (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   long val;
 
@@ -3267,7 +3267,7 @@
 
 void
 ecoff_directive_loc (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   lineno_list_t *list;
   symint_t lineno;
@@ -3364,7 +3364,7 @@
 
 static void
 mark_stabs (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   if (! stabs_seen)
     {
@@ -3461,7 +3461,7 @@
 
 void
 ecoff_stab (sec, what, string, type, other, desc)
-     segT sec;
+     segT sec ATTRIBUTE_UNUSED;
      int what;
      const char *string;
      int type;
@@ -3620,7 +3620,7 @@
 {
   if (S_IS_COMMON (sym)
       && S_GET_VALUE (sym) > 0
-      && S_GET_VALUE (sym) <= bfd_get_gp_size (stdoutput))
+      && S_GET_VALUE (sym) <= (unsigned) bfd_get_gp_size (stdoutput))
     {
       static asection scom_section;
       static asymbol scom_symbol;
@@ -3691,7 +3691,7 @@
       unsigned long add;
 
       add = align - (offset & (align - 1));
-      if (*bufend - (*buf + offset) < add)
+      if ((unsigned long) (*bufend - (*buf + offset)) < add)
 	(void) ecoff_add_bytes (buf, bufend, *buf + offset, add);
       memset (*buf + offset, 0, add);
       offset += add;
@@ -4085,7 +4085,7 @@
 
 			      s = symbol_get_obj (as_sym)->ecoff_extern_size;
 			      if (s == 0
-				  || s > bfd_get_gp_size (stdoutput))
+				  || s > (unsigned) bfd_get_gp_size (stdoutput))
 				sc = sc_Undefined;
 			      else
 				{
@@ -4100,7 +4100,7 @@
 			    {
 			      if (S_GET_VALUE (as_sym) > 0
 				  && (S_GET_VALUE (as_sym)
-				      <= bfd_get_gp_size (stdoutput)))
+				      <= (unsigned) bfd_get_gp_size (stdoutput)))
 				sc = sc_SCommon;
 			      else
 				sc = sc_Common;
@@ -4255,7 +4255,7 @@
 
 		  if (local)
 		    {
-		      if (*bufend - sym_out < external_sym_size)
+		      if ((bfd_size_type)(*bufend - sym_out) < external_sym_size)
 			sym_out = ecoff_add_bytes (buf, bufend,
 						   sym_out,
 						   external_sym_size);
@@ -4373,7 +4373,7 @@
 		      first = 0;
 		    }
 		  proc_ptr->pdr.adr = adr - fil_ptr->fdr.adr;
-		  if (*bufend - pdr_out < external_pdr_size)
+		  if ((bfd_size_type)(*bufend - pdr_out) < external_pdr_size)
 		    pdr_out = ecoff_add_bytes (buf, bufend,
 					       pdr_out,
 					       external_pdr_size);
@@ -4446,7 +4446,8 @@
 	      aux_end = aux_ptr + aux_cnt;
 	      for (; aux_ptr < aux_end; aux_ptr++)
 		{
-		  if (*bufend - (char *) aux_out < sizeof (union aux_ext))
+		  if ((unsigned long) (*bufend - (char *) aux_out)
+		      < sizeof (union aux_ext))
 		    aux_out = ((union aux_ext *)
 			       ecoff_add_bytes (buf, bufend,
 						(char *) aux_out,
@@ -4531,7 +4532,7 @@
       else
 	str_cnt = vp->objects_per_page;
 
-      if (*bufend - str_out < str_cnt)
+      if ((unsigned long)(*bufend - str_out) < str_cnt)
 	str_out = ecoff_add_bytes (buf, bufend, str_out, str_cnt);
 
       memcpy (str_out, str_link->datum->byte, str_cnt);
@@ -4622,7 +4623,7 @@
       fil_end = fil_ptr + fil_cnt;
       for (; fil_ptr < fil_end; fil_ptr++)
 	{
-	  if (*bufend - fdr_out < external_fdr_size)
+	  if ((bfd_size_type)(*bufend - fdr_out) < external_fdr_size)
 	    fdr_out = ecoff_add_bytes (buf, bufend, fdr_out,
 				       external_fdr_size);
 	  (*swap_fdr_out) (stdoutput, &fil_ptr->fdr, fdr_out);
@@ -4772,7 +4773,7 @@
      space at this point.  */
   hdr->ipdMax = proc_cnt;
   hdr->cbPdOffset = offset;
-  if (bufend - (buf + offset) < proc_cnt * external_pdr_size)
+  if ((bfd_size_type)(bufend - (buf + offset)) < proc_cnt * external_pdr_size)
     (void) ecoff_add_bytes (&buf, &bufend, buf + offset,
 			    proc_cnt * external_pdr_size);
   offset += proc_cnt * external_pdr_size;
diff -BurPX ../src/binutils-exclude src-orig/gas/itbl-ops.c src/gas/itbl-ops.c
--- src-orig/gas/itbl-ops.c	Wed Mar 14 17:03:08 2001
+++ src/gas/itbl-ops.c	Mon Apr 30 12:29:28 2001
@@ -500,7 +500,7 @@
 itbl_assemble (char *name, char *s)
 {
   unsigned long opcode;
-  struct itbl_entry *e;
+  struct itbl_entry *e = NULL;
   struct itbl_field *f;
   char *n;
   int processor;



More information about the Binutils mailing list