This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: archives with foreign object files


On Fri, Aug 17, 2001 at 12:50:39PM +0930, Alan Modra wrote:
> 
> Applying, with Thiemo's suggestion re. unnecessary casts.

Hrrm, should have taken more notice of the build.  The casts stop
warnings about unsigned numbers never being less than zero.  I think
some compilers may implement enums as signed, so it's not safe to
simply remove the comparison against bfd_unknown.  I've added a
cast to unsigned int.  And fixed some more warnings.

bfd/ChangeLog
	* coffcode.h (coff_write_object_contents): Add ATTRIBUTE_UNUSED to
	silence warning.
	* coffgen.c (coff_print_symbol): Fix warnings.
	(coff_find_nearest_line): Likewise.
	* cofflink.c (_bfd_coff_link_input_bfd): Likewise.
	* coff-alpha.c (alpha_convert_external_reloc): Likewise.
	* format.c (bfd_check_format_matches): Likewise.
	(bfd_set_format): Likewise.
	* coff-ia64.c: Add missing prototypes.
	* elf64-alpha.c (struct alpha_elf_link_hash_entry): Make addend
	signed to silence warnings.
	(elf64_alpha_relocate_section): Likewise.
	(elf64_alpha_find_reloc_at_ofs): Fix warnings.
	(elf64_alpha_add_symbol_hook): Likewise.
	(elf64_alpha_final_link): Likewise.
	(elf64_alpha_relax_section): Remove redundant assign to info.gotent.
	(elf64_alpha_merge_gots): Add ATTRIBUTE_UNUSED to unused args.
	(elf64_alpha_size_got_sections): Likewise.
	* elfxx-ia64.c: Add missing prototypes.
	(elfNN_ia64_relocate_section): Fix warning.
	(elfNN_ia64_unwind_entry_compare): Make params const.

-- 
Alan Modra

Index: format.c
===================================================================
RCS file: /cvs/src/src/bfd/format.c,v
retrieving revision 1.5
diff -u -p -r1.5 format.c
--- format.c	2001/08/17 03:19:01	1.5
+++ format.c	2001/08/17 08:35:25
@@ -125,8 +125,7 @@ bfd_check_format_matches (abfd, format, 
   int ar_match_index;
 
   if (!bfd_read_p (abfd)
-      || abfd->format < bfd_unknown
-      || abfd->format >= bfd_type_end)
+      || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return false;
@@ -348,8 +347,7 @@ bfd_set_format (abfd, format)
      bfd_format format;
 {
   if (bfd_read_p (abfd)
-      || abfd->format < bfd_unknown
-      || abfd->format >= bfd_type_end)
+      || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return false;
Index: coff-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-alpha.c,v
retrieving revision 1.11
diff -u -p -r1.11 coff-alpha.c
--- coff-alpha.c	2001/05/11 12:23:47	1.11
+++ coff-alpha.c	2001/08/17 08:34:55
@@ -1334,7 +1334,7 @@ alpha_convert_external_reloc (output_bfd
 	  break;
 	}
 
-      if (r_symndx == -1)
+      if (r_symndx == (unsigned long) -1)
 	abort ();
 
       /* Add the section VMA and the symbol value.  */
@@ -1347,7 +1347,7 @@ alpha_convert_external_reloc (output_bfd
       /* Change the symndx value to the right one for
 	 the output BFD.  */
       r_symndx = h->indx;
-      if (r_symndx == -1)
+      if (r_symndx == (unsigned long) -1)
 	{
 	  /* Caller must give an error.  */
 	  r_symndx = 0;
Index: coff-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ia64.c,v
retrieving revision 1.6
diff -u -p -r1.6 coff-ia64.c
--- coff-ia64.c	2001/06/02 15:46:43	1.6
+++ coff-ia64.c	2001/08/17 08:34:55
@@ -52,6 +52,8 @@ static reloc_howto_type howto_table[] =
 /* Return true if this relocation should
    appear in the output .reloc section.  */
 
+static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
+
 static boolean
 in_reloc_p(abfd, howto)
      bfd * abfd ATTRIBUTE_UNUSED;
@@ -62,6 +64,8 @@ in_reloc_p(abfd, howto)
 #endif
 
 #include "coffcode.h"
+
+static const bfd_target *ia64coff_object_p PARAMS ((bfd *));
 
 static const bfd_target *
 ia64coff_object_p (abfd)
Index: coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.59
diff -u -p -r1.59 coffcode.h
--- coffcode.h	2001/06/15 09:03:13	1.59
+++ coffcode.h	2001/08/17 08:34:59
@@ -326,7 +326,7 @@ static boolean coff_set_flags
 static boolean coff_set_arch_mach
   PARAMS ((bfd *, enum bfd_architecture, unsigned long));
 static boolean coff_compute_section_file_positions PARAMS ((bfd *));
-static boolean coff_write_object_contents PARAMS ((bfd *));
+static boolean coff_write_object_contents PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
 static boolean coff_set_section_contents
   PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
 static PTR buy_and_read PARAMS ((bfd *, file_ptr, int, size_t));
Index: coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.22
diff -u -p -r1.22 coffgen.c
--- coffgen.c	2001/06/15 09:03:13	1.22
+++ coffgen.c	2001/08/17 08:35:01
@@ -2106,16 +2106,18 @@ coff_print_symbol (abfd, filep, symbol, 
 		case C_EXT:
 		  if (ISFCN (combined->u.syment.n_type))
 		    {
+		      long next, llnos;
+
+		      if (auxp->fix_end)
+			next = (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
+			       - root);
+		      else
+			next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
+		      llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr;
 		      fprintf (file,
 			       _("AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"),
-			       tagndx,
-			       auxp->u.auxent.x_sym.x_misc.x_fsize,
-			       auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr,
-			       (auxp->fix_end
-				? ((long)
-				   (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
-				    - root))
-				: auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l));
+			       tagndx, auxp->u.auxent.x_sym.x_misc.x_fsize,
+			       llnos, next);
 		      break;
 		    }
 		  /* else fall through */
@@ -2280,7 +2282,7 @@ coff_find_nearest_line (abfd, section, s
 
 	  /* Avoid endless loops on erroneous files by ensuring that
 	     we always move forward in the file.  */
-	  if (p - cof->raw_syments >= p->u.syment.n_value)
+	  if (p >= cof->raw_syments + p->u.syment.n_value)
 	    break;
 
 	  p = cof->raw_syments + p->u.syment.n_value;
Index: cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.25
diff -u -p -r1.25 cofflink.c
--- cofflink.c	2001/08/02 23:05:54	1.25
+++ cofflink.c	2001/08/17 08:35:03
@@ -1829,7 +1829,7 @@ _bfd_coff_link_input_bfd (finfo, input_b
 		 have to write the symbol out twice.  */
 
 	      if (finfo->last_file_index != -1
-		  && finfo->last_file.n_value != (long) output_index)
+		  && finfo->last_file.n_value != (bfd_vma) output_index)
 		{
 		  /* We must correct the value of the last C_FILE
                      entry.  */
Index: elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf64-alpha.c
--- elf64-alpha.c	2001/07/12 04:24:44	1.28
+++ elf64-alpha.c	2001/08/17 08:35:19
@@ -159,7 +159,7 @@ struct alpha_elf_link_hash_entry
     bfd *gotobj;
 
     /* the addend in effect for this entry.  */
-    bfd_vma addend;
+    bfd_signed_vma addend;
 
     /* the .got offset for this entry.  */
     int got_offset;
@@ -1119,7 +1119,8 @@ elf64_alpha_find_reloc_at_ofs (rel, rele
 {
   while (rel < relend)
     {
-      if (rel->r_offset == offset && ELF64_R_TYPE (rel->r_info) == type)
+      if (rel->r_offset == offset
+	  && ELF64_R_TYPE (rel->r_info) == (unsigned int) type)
 	return rel;
       ++rel;
     }
@@ -1615,7 +1616,6 @@ elf64_alpha_relax_section (abfd, sec, li
 	    continue;
 
 	  info.h = h;
-	  info.gotent = gotent;
 	  info.tsec = h->root.root.u.def.section;
 	  info.other = h->root.other;
 	  gotent = h->got_entries;
@@ -1855,7 +1855,7 @@ elf64_alpha_add_symbol_hook (abfd, info,
 {
   if (sym->st_shndx == SHN_COMMON
       && !info->relocateable
-      && sym->st_size <= bfd_get_gp_size (abfd))
+      && sym->st_size <= (unsigned int) bfd_get_gp_size (abfd))
     {
       /* Common symbols less than or equal to -G nn bytes are
 	 automatically put into .sbss.  */
@@ -2963,7 +2963,7 @@ elf64_alpha_merge_gots (a, b)
 static boolean
 elf64_alpha_calc_got_offsets_for_symbol (h, arg)
      struct alpha_elf_link_hash_entry *h;
-     PTR arg;
+     PTR arg ATTRIBUTE_UNUSED;
 {
   struct alpha_elf_got_entry *gotent;
 
@@ -3029,10 +3029,10 @@ elf64_alpha_calc_got_offsets (info)
 
 static boolean
 elf64_alpha_size_got_sections (output_bfd, info)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
-  bfd *i, *got_list, *cur_got_obj;
+  bfd *i, *got_list, *cur_got_obj = NULL;
   int something_changed = 0;
 
   got_list = alpha_elf_hash_table (info)->got_list;
@@ -3428,7 +3428,7 @@ elf64_alpha_relocate_section (output_bfd
       struct alpha_elf_link_hash_entry *h;
       Elf_Internal_Sym *sym;
       bfd_vma relocation;
-      bfd_vma addend;
+      bfd_signed_vma addend;
       bfd_reloc_status_type r;
 
       r_type = ELF64_R_TYPE(rel->r_info);
@@ -4168,7 +4168,7 @@ elf64_alpha_final_link (abfd, info)
 	    {
 	      asection *s;
 	      EXTR esym;
-	      bfd_vma last;
+	      bfd_vma last = 0;
 	      unsigned int i;
 	      static const char * const name[] =
 		{
Index: elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.18
diff -u -p -r1.18 elfxx-ia64.c
--- elfxx-ia64.c	2001/07/12 01:24:14	1.18
+++ elfxx-ia64.c	2001/08/17 08:35:24
@@ -161,6 +161,8 @@ static boolean is_unwind_section_name
   PARAMS ((const char *));
 static boolean elfNN_ia64_section_from_shdr
   PARAMS ((bfd *, ElfNN_Internal_Shdr *, char *));
+static boolean elfNN_ia64_section_flags
+  PARAMS ((flagword *, ElfNN_Internal_Shdr *));
 static boolean elfNN_ia64_fake_sections
   PARAMS ((bfd *abfd, ElfNN_Internal_Shdr *hdr, asection *sec));
 static void elfNN_ia64_final_write_processing
@@ -179,6 +181,8 @@ static boolean elfNN_ia64_aix_link_add_s
   PARAMS ((bfd *abfd, struct bfd_link_info *info));
 static int elfNN_ia64_additional_program_headers
   PARAMS ((bfd *abfd));
+static boolean elfNN_ia64_modify_segment_map
+  PARAMS ((bfd *));
 static boolean elfNN_ia64_is_local_label_name
   PARAMS ((bfd *abfd, const char *name));
 static boolean elfNN_ia64_dynamic_symbol_p
@@ -192,11 +196,19 @@ static struct bfd_hash_entry *elfNN_ia64
 static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
   PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
 	   const char *string));
+static void elfNN_ia64_hash_copy_indirect
+  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+static void elfNN_ia64_hash_hide_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
   PARAMS ((bfd *abfd));
 static struct elfNN_ia64_local_hash_entry *elfNN_ia64_local_hash_lookup
   PARAMS ((struct elfNN_ia64_local_hash_table *table, const char *string,
 	   boolean create, boolean copy));
+static boolean elfNN_ia64_global_dyn_sym_thunk
+  PARAMS ((struct bfd_hash_entry *, PTR));
+static boolean elfNN_ia64_local_dyn_sym_thunk
+  PARAMS ((struct bfd_hash_entry *, PTR));
 static void elfNN_ia64_dyn_sym_traverse
   PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
 	   boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
@@ -265,6 +277,8 @@ static bfd_vma set_pltoff_entry
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
 	   struct elfNN_ia64_dyn_sym_info *dyn_i,
 	   bfd_vma value, boolean));
+static int elfNN_ia64_unwind_entry_compare
+  PARAMS ((const PTR, const PTR));
 static boolean elfNN_ia64_final_link
   PARAMS ((bfd *abfd, struct bfd_link_info *info));
 static boolean elfNN_ia64_relocate_section
@@ -1723,7 +1737,8 @@ get_dyn_sym_info (ia64_info, h, abfd, re
       len += 10;	/* %p slop */
 
       addr_name = alloca (len);
-      sprintf (addr_name, "%p:%lx", (void *) abfd, ELFNN_R_SYM (rel->r_info));
+      sprintf (addr_name, "%p:%lx",
+	       (void *) abfd, (unsigned long) ELFNN_R_SYM (rel->r_info));
 
       /* Collect the canonical entry data for this address.  */
       loc_h = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
@@ -3188,8 +3203,8 @@ static bfd *elfNN_ia64_unwind_entry_comp
 
 static int
 elfNN_ia64_unwind_entry_compare (a, b)
-     PTR a;
-     PTR b;
+     const PTR a;
+     const PTR b;
 {
   bfd_vma av, bv;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]