warning fixes

Alan Modra amodra@bigpond.net.au
Fri May 9 11:32:00 GMT 2003


Fix various warnings, some of which were real problems.

bfd/ChangeLog
	* cpu-arm.c (arm_check_note): Warning fix.
	* elf32-iq2000.c (iq2000_elf_check_relocs): Warning fixes.  Arrange
	to keep relocs if edited.
	(iq2000_elf_print_private_bfd_data): Return TRUE.
	* elfxx-ia64.c (elfNN_ia64_relax_section): Use ELFNN_R_SYM, not
	ELF64_R_SYM.
	(elfNN_ia64_relax_ldxmov): Warning fix.
	* xtensa-isa.c (xtensa_add_isa): Warning fix.
	* xtensa-modules.c (get_num_opcodes): Warning fix.

include/ChangeLog
	* xtensa-isa-internal.h (struct xtensa_isa_module_struct): Remove
	const on gen_num_opcodes_fn return type.

opcodes/ChangeLog
	* i386-dis.c (print_insn): Test intel_syntax against (char) -1 in
	case char is unsigned.

Index: bfd/cpu-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-arm.c,v
retrieving revision 1.10
diff -u -p -r1.10 cpu-arm.c
--- bfd/cpu-arm.c	1 Apr 2003 13:08:05 -0000	1.10
+++ bfd/cpu-arm.c	9 May 2003 11:18:47 -0000
@@ -260,7 +260,7 @@ arm_check_note (abfd, buffer, buffer_siz
     }
   else
     { 
-      if (namesz != (strlen (expected_name) + 1 + 3) & ~3)
+      if (namesz != ((strlen (expected_name) + 1 + 3) & ~3))
 	return FALSE;
       
       if (strcmp (descr, expected_name) != 0)
Index: bfd/elf32-iq2000.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-iq2000.c,v
retrieving revision 1.1
diff -u -p -r1.1 elf32-iq2000.c
--- bfd/elf32-iq2000.c	3 Jan 2003 21:12:27 -0000	1.1
+++ bfd/elf32-iq2000.c	9 May 2003 11:18:52 -0000
@@ -454,8 +454,9 @@ iq2000_elf_check_relocs (abfd, info, sec
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
-  Elf_Internal_Rela *rel;
-  Elf_Internal_Rela *rel_end;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+  bfd_boolean changed = FALSE;
   
   if (info->relocateable)
     return TRUE;
@@ -499,10 +500,20 @@ iq2000_elf_check_relocs (abfd, info, sec
 	  if (memcmp (sec->name, ".debug", 6) == 0
 	      || memcmp (sec->name, ".stab", 5) == 0
 	      || memcmp (sec->name, ".eh_frame", 9) == 0)
-	    rel->r_info = ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG);
+	    {
+	      ((Elf_Internal_Rela *) rel)->r_info
+		= ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG);
+	      changed = TRUE;
+	    }
 	  break;
 	}
     }
+
+  if (changed)
+    /* Note that we've changed relocs, otherwise if !info->keep_memory
+       we'll free the relocs and lose our changes.  */
+    (const Elf_Internal_Rela *) (elf_section_data (sec)->relocs) = relocs;
+
   return TRUE;
 }
 
@@ -929,6 +940,7 @@ iq2000_elf_print_private_bfd_data (abfd,
     }
 
   fputc ('\n', file);
+  return TRUE;
 }
 
 static
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.81
diff -u -p -r1.81 elfxx-ia64.c
--- bfd/elfxx-ia64.c	9 May 2003 02:27:09 -0000	1.81
+++ bfd/elfxx-ia64.c	9 May 2003 11:19:00 -0000
@@ -796,7 +796,7 @@ elfNN_ia64_relax_section (abfd, sec, lin
 		goto error_return;
 	    }
 
-	  isym = isymbuf + ELF64_R_SYM (irel->r_info);
+	  isym = isymbuf + ELFNN_R_SYM (irel->r_info);
 	  if (isym->st_shndx == SHN_UNDEF)
 	    continue;	/* We can't do anthing with undefined symbols.  */
 	  else if (isym->st_shndx == SHN_ABS)
@@ -1089,7 +1089,7 @@ elfNN_ia64_relax_ldxmov (abfd, contents,
     case 0: shift =  5; break;
     case 1: shift = 14; off += 3; break;
     case 2: shift = 23; off += 6; break;
-    case 3:
+    default:
       abort ();
     }
 
Index: bfd/xtensa-isa.c
===================================================================
RCS file: /cvs/src/src/bfd/xtensa-isa.c,v
retrieving revision 1.1
diff -u -p -r1.1 xtensa-isa.c
--- bfd/xtensa-isa.c	1 Apr 2003 15:50:27 -0000	1.1
+++ bfd/xtensa-isa.c	9 May 2003 11:19:00 -0000
@@ -159,7 +159,7 @@ configuration.\n"
 static int
 xtensa_add_isa (xtensa_isa_internal *isa, libisa_module_specifier libisa)
 {
-  const int (*get_num_opcodes_fn) (void);
+  int (*get_num_opcodes_fn) (void);
   struct config_struct *(*get_config_table_fn) (void);
   xtensa_opcode_internal **(*get_opcodes_fn) (void);
   int (*decode_insn_fn) (const xtensa_insnbuf);
Index: bfd/xtensa-modules.c
===================================================================
RCS file: /cvs/src/src/bfd/xtensa-modules.c,v
retrieving revision 1.2
diff -u -p -r1.2 xtensa-modules.c
--- bfd/xtensa-modules.c	2 Apr 2003 16:53:44 -0000	1.2
+++ bfd/xtensa-modules.c	9 May 2003 11:19:01 -0000
@@ -41,7 +41,7 @@ tie_undo_reloc_l (uint32 offset, uint32 
 }
 
 xtensa_opcode_internal** get_opcodes (void);
-const int get_num_opcodes (void);
+int get_num_opcodes (void);
 int decode_insn (const xtensa_insnbuf);
 int interface_version (void);
 
@@ -5463,7 +5463,7 @@ get_opcodes (void)
   return &opcodes[0];
 }
 
-const int
+int
 get_num_opcodes (void)
 {
   return 149;
Index: include/xtensa-isa-internal.h
===================================================================
RCS file: /cvs/src/src/include/xtensa-isa-internal.h,v
retrieving revision 1.1
diff -u -p -r1.1 xtensa-isa-internal.h
--- include/xtensa-isa-internal.h	1 Apr 2003 15:50:30 -0000	1.1
+++ include/xtensa-isa-internal.h	9 May 2003 11:19:21 -0000
@@ -104,7 +104,7 @@ typedef struct xtensa_isa_internal_struc
 
 typedef struct xtensa_isa_module_struct
 {
-  const int (*get_num_opcodes_fn) (void);
+  int (*get_num_opcodes_fn) (void);
   xtensa_opcode_internal **(*get_opcodes_fn) (void);
   int (*decode_insn_fn) (const xtensa_insnbuf);
   struct config_struct *(*get_config_table_fn) (void);
Index: opcodes/i386-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i386-dis.c,v
retrieving revision 1.38
diff -u -p -r1.38 i386-dis.c
--- opcodes/i386-dis.c	22 Mar 2003 18:56:45 -0000	1.38
+++ opcodes/i386-dis.c	9 May 2003 11:19:49 -0000
@@ -1891,7 +1891,7 @@ print_insn (pc, info)
   mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
 		|| info->mach == bfd_mach_x86_64);
 
-  if (intel_syntax == -1)
+  if (intel_syntax == (char) -1)
     intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
 		    || info->mach == bfd_mach_x86_64_intel_syntax);
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list