This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

bfd nits


Fixes for assorted nits, most found when trying to build with -DDEBUG at
the top level to enable gas assertions.  An --enable-targets=all build
still won't work with -DDEBUG, because bfd/elf32-sh-symbian.c
unconditionally does "#define DEBUG 0" and opcodes/frv-opc.c has a line
    { { MNEM, OP (PACK), ' ', OP (DEBUG), 0 } },
with DEBUG being token pasted to form FRV_OPERAND_DEBUG.  Anyone care
enough to fix it?

	* dwarf2.c: Formatting.
	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify
	output section check.
	* elf32-i370.c: Warning fixes inside #ifdef DEBUG.
	* elf32-m32c.c: Similarly.
	* elf32-ppc.c: Similarly.
	* elf32-v850.c: Similarly.
	* nlm32-sparc.c: Similarly.
	* elfcode.h: Similarly.
	(elf_symbol_flags): Delete.
	* elflink.c (elf_link_input_bfd): Comment typo.

Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.87
diff -u -p -r1.87 dwarf2.c
--- bfd/dwarf2.c	11 Mar 2006 15:01:18 -0000	1.87
+++ bfd/dwarf2.c	2 May 2006 00:27:29 -0000
@@ -1625,7 +1625,7 @@ read_rangelist (struct comp_unit *unit, 
       if (low_pc == -1UL && high_pc != -1UL)
 	base_address = high_pc;
       else
-	  arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc);
+	arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc);
     }
 }
 
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.48
diff -u -p -r1.48 elf-eh-frame.c
--- bfd/elf-eh-frame.c	27 Feb 2006 23:07:05 -0000	1.48
+++ bfd/elf-eh-frame.c	2 May 2006 00:27:29 -0000
@@ -390,8 +390,7 @@ _bfd_elf_discard_section_eh_frame
       return FALSE;
     }
 
-  if ((sec->output_section != NULL
-       && bfd_is_abs_section (sec->output_section)))
+  if (bfd_is_abs_section (sec->output_section))
     {
       /* At least one of the sections is being discarded from the
 	 link, so we should just ignore them.  */
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.51
diff -u -p -r1.51 elf32-i370.c
--- bfd/elf32-i370.c	24 Oct 2005 11:18:03 -0000	1.51
+++ bfd/elf32-i370.c	2 May 2006 00:27:29 -0000
@@ -567,7 +567,7 @@ i370_elf_adjust_dynindx (struct elf_link
 
 #ifdef DEBUG
   fprintf (stderr,
-	   "i370_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n",
+	   "i370_elf_adjust_dynindx called, h->dynindx = %ld, *cp = %d\n",
 	   h->dynindx, *cp);
 #endif
 
@@ -1296,7 +1296,7 @@ i370_elf_relocate_section (bfd *output_b
 #ifdef DEBUG
 			  if (indx <= 0)
 			    {
-			      printf ("indx=%d section=%s flags=%08x name=%s\n",
+			      printf ("indx=%ld section=%s flags=%08x name=%s\n",
 				      indx, osec->name, osec->flags,
 				      h->root.root.string);
 			    }
Index: bfd/elf32-m32c.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32c.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-m32c.c
--- bfd/elf32-m32c.c	7 Apr 2006 01:08:34 -0000	1.6
+++ bfd/elf32-m32c.c	2 May 2006 00:27:30 -0000
@@ -40,7 +40,8 @@ static bfd_boolean m32c_elf_check_relocs
   (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
 static bfd_boolean m32c_elf_relax_delete_bytes (bfd *, asection *, bfd_vma, int);
 #ifdef DEBUG
-static char * m32c_get_reloc (long reloc);
+char * m32c_get_reloc (long reloc);
+void dump_symtab (bfd *, void *, void *);
 #endif
 static bfd_boolean m32c_elf_relax_section
 (bfd *abfd, asection *sec, struct bfd_link_info *link_info, bfd_boolean *again);
@@ -936,7 +937,7 @@ m32c_elf_object_p (bfd *abfd)
  
 
 #ifdef DEBUG
-static void
+void
 dump_symtab (bfd * abfd, void *internal_syms, void *external_syms)
 {
   size_t locsymcount;
@@ -977,7 +978,6 @@ dump_symtab (bfd * abfd, void *internal_
 	{
 	case STT_FUNC: st_info_str = "STT_FUNC";
 	case STT_SECTION: st_info_str = "STT_SECTION";
-	case STT_SRELC: st_info_str = "STT_SRELC";
 	case STT_FILE: st_info_str = "STT_FILE";
 	case STT_OBJECT: st_info_str = "STT_OBJECT";
 	case STT_TLS: st_info_str = "STT_TLS";
@@ -1022,7 +1022,7 @@ dump_symtab (bfd * abfd, void *internal_
     free (external_syms);
 }
 
-static char *
+char *
 m32c_get_reloc (long reloc)
 {
   if (0 <= reloc && reloc < R_M32C_max)
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.196
diff -u -p -r1.196 elf32-ppc.c
--- bfd/elf32-ppc.c	17 Mar 2006 06:44:37 -0000	1.196
+++ bfd/elf32-ppc.c	2 May 2006 00:27:34 -0000
@@ -6293,7 +6293,7 @@ ppc_elf_relocate_section (bfd *output_bf
 			  BFD_ASSERT (indx > 0);
 #ifdef DEBUG
 			  if (indx <= 0)
-			    printf ("indx=%d section=%s flags=%08x name=%s\n",
+			    printf ("indx=%ld section=%s flags=%08x name=%s\n",
 				    indx, osec->name, osec->flags,
 				    h->root.root.string);
 #endif
Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.61
diff -u -p -r1.61 elf32-v850.c
--- bfd/elf32-v850.c	8 Jul 2005 00:26:45 -0000	1.61
+++ bfd/elf32-v850.c	2 May 2006 00:27:36 -0000
@@ -33,6 +33,8 @@
 /* Sign-extend a 24-bit number.  */
 #define SEXT24(x)	((((x) & 0xffffff) ^ 0x800000) - 0x800000)
 
+static reloc_howto_type v850_elf_howto_table[];
+
 /* Look through the relocs for a section during the first phase, and
    allocate space in the global offset table or procedure linkage
    table.  */
Index: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.74
diff -u -p -r1.74 elfcode.h
--- bfd/elfcode.h	18 Apr 2006 09:41:36 -0000	1.74
+++ bfd/elfcode.h	2 May 2006 00:27:37 -0000
@@ -139,10 +139,11 @@ Foundation, Inc., 51 Franklin Street - F
 #define LOG_FILE_ALIGN	2
 #endif
 
-#ifdef DEBUG
+#if DEBUG & 2
 static void elf_debug_section (int, Elf_Internal_Shdr *);
+#endif
+#if DEBUG & 1
 static void elf_debug_file (Elf_Internal_Ehdr *);
-static char *elf_symbol_flags (flagword);
 #endif
 
 /* Structure swapping routines */
@@ -545,7 +546,7 @@ elf_object_p (bfd *abfd)
   if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL)
     goto got_wrong_format_error;
 
-  /* As a simple sanity check, verify that the what BFD thinks is the
+  /* As a simple sanity check, verify that what BFD thinks is the
      size of each section header table entry actually matches the size
      recorded in the file, but only if there are any sections.  */
   if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0)
@@ -1450,7 +1451,7 @@ elf_slurp_reloc_table (bfd *abfd,
   return TRUE;
 }
 
-#ifdef DEBUG
+#if DEBUG & 2
 static void
 elf_debug_section (int num, Elf_Internal_Shdr *hdr)
 {
@@ -1476,7 +1477,9 @@ elf_debug_section (int num, Elf_Internal
 	   (long) hdr->sh_entsize);
   fflush (stderr);
 }
+#endif
 
+#if DEBUG & 1
 static void
 elf_debug_file (Elf_Internal_Ehdr *ehdrp)
 {
@@ -1488,77 +1491,6 @@ elf_debug_file (Elf_Internal_Ehdr *ehdrp
   fprintf (stderr, "e_shnum      = %ld\n", (long) ehdrp->e_shnum);
   fprintf (stderr, "e_shentsize  = %ld\n", (long) ehdrp->e_shentsize);
 }
-
-static char *
-elf_symbol_flags (flagword flags)
-{
-  static char buffer[1024];
-
-  buffer[0] = '\0';
-  if (flags & BSF_LOCAL)
-    strcat (buffer, " local");
-
-  if (flags & BSF_GLOBAL)
-    strcat (buffer, " global");
-
-  if (flags & BSF_DEBUGGING)
-    strcat (buffer, " debug");
-
-  if (flags & BSF_FUNCTION)
-    strcat (buffer, " function");
-
-  if (flags & BSF_KEEP)
-    strcat (buffer, " keep");
-
-  if (flags & BSF_KEEP_G)
-    strcat (buffer, " keep_g");
-
-  if (flags & BSF_WEAK)
-    strcat (buffer, " weak");
-
-  if (flags & BSF_SECTION_SYM)
-    strcat (buffer, " section-sym");
-
-  if (flags & BSF_OLD_COMMON)
-    strcat (buffer, " old-common");
-
-  if (flags & BSF_NOT_AT_END)
-    strcat (buffer, " not-at-end");
-
-  if (flags & BSF_CONSTRUCTOR)
-    strcat (buffer, " constructor");
-
-  if (flags & BSF_WARNING)
-    strcat (buffer, " warning");
-
-  if (flags & BSF_INDIRECT)
-    strcat (buffer, " indirect");
-
-  if (flags & BSF_FILE)
-    strcat (buffer, " file");
-
-  if (flags & DYNAMIC)
-    strcat (buffer, " dynamic");
-
-  if (flags & ~(BSF_LOCAL
-		| BSF_GLOBAL
-		| BSF_DEBUGGING
-		| BSF_FUNCTION
-		| BSF_KEEP
-		| BSF_KEEP_G
-		| BSF_WEAK
-		| BSF_SECTION_SYM
-		| BSF_OLD_COMMON
-		| BSF_NOT_AT_END
-		| BSF_CONSTRUCTOR
-		| BSF_WARNING
-		| BSF_INDIRECT
-		| BSF_FILE
-		| BSF_DYNAMIC))
-    strcat (buffer, " unknown-bits");
-
-  return buffer;
-}
 #endif
 
 /* Create a new BFD as if by bfd_openr.  Rather than opening a file,
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.210
diff -u -p -r1.210 elflink.c
--- bfd/elflink.c	5 Apr 2006 13:37:32 -0000	1.210
+++ bfd/elflink.c	2 May 2006 00:27:42 -0000
@@ -7250,7 +7250,7 @@ elf_link_input_bfd (struct elf_final_lin
 		      /* This is a reloc for a deleted entry or somesuch.
 			 Turn it into an R_*_NONE reloc, at the same
 			 offset as the last reloc.  elf_eh_frame.c and
-			 elf_bfd_discard_info rely on reloc offsets
+			 bfd_elf_discard_info rely on reloc offsets
 			 being ordered.  */
 		      irela->r_offset = last_offset;
 		      irela->r_info = 0;
Index: bfd/nlm32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/nlm32-sparc.c,v
retrieving revision 1.15
diff -u -p -r1.15 nlm32-sparc.c
--- bfd/nlm32-sparc.c	4 May 2005 15:53:36 -0000	1.15
+++ bfd/nlm32-sparc.c	2 May 2006 00:27:42 -0000
@@ -123,8 +123,9 @@ nlm_sparc_read_reloc (bfd *abfd,
       }
 
 #ifdef DEBUG
-  fprintf (stderr, "%s:  address = %08lx, addend = %08lx, type = %d, howto = %08lx\n",
-	   __FUNCTION__, rel->address, rel->addend, type, rel->howto);
+  fprintf (stderr, "%s:  address = %08lx, addend = %08lx, type = %u, howto = %p\n",
+	   __FUNCTION__, (unsigned long) rel->address,
+	   (unsigned long) rel->addend, type, rel->howto);
 #endif
   return TRUE;
 
@@ -176,8 +177,9 @@ nlm_sparc_write_reloc (bfd * abfd, asect
   val = bfd_get_section_vma (abfd, sec) + rel->address;
 
 #ifdef DEBUG
-  fprintf (stderr, "%s:  val = %08lx, addend = %08lx, type = %d\n",
-	   __FUNCTION__, val, rel->addend, rel->howto->type);
+  fprintf (stderr, "%s:  val = %08lx, addend = %08lx, type = %u\n",
+	   __FUNCTION__, (unsigned long) val, (unsigned long) rel->addend,
+	   rel->howto->type);
 #endif
   bfd_put_32 (abfd, val, tmp_reloc.offset);
   bfd_put_32 (abfd, rel->addend, tmp_reloc.addend);
@@ -280,8 +282,8 @@ nlm_sparc_write_import (bfd * abfd, asec
     base = 0;
 
 #ifdef DEBUG
-  fprintf (stderr, "%s:  <%x, 1>\n\t",
-	   __FUNCTION__, base + (*rel->sym_ptr_ptr)->value);
+  fprintf (stderr, "%s:  <%lx, 1>\n\t",
+	   __FUNCTION__, (unsigned long) (base + (*rel->sym_ptr_ptr)->value));
 #endif
   bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
   if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
@@ -330,8 +332,8 @@ nlm_sparc_write_export (bfd * abfd, asym
   bfd_byte temp[4];
 
 #ifdef DEBUG
-  fprintf (stderr, "%s: <%x, %d, %s>\n",
-	   __FUNCTION__, value, strlen (sym->name), sym->name);
+  fprintf (stderr, "%s: <%lx, %u, %s>\n",
+	   __FUNCTION__, (unsigned long) value, strlen (sym->name), sym->name);
 #endif
   bfd_put_32 (abfd, value, temp);
   len = strlen (sym->name);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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