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]
Other format: [Raw text]

[patch] bfd/*.c: Fix formatting.


Hi,

Attached is a patch to fix formatting.  Committed as obvious.

Kazu Hirata

2002-11-11  Kazu Hirata  <kazu@cs.umass.edu>

	* coff-h8300.c: Fix formatting.
	* elf32-h8300.c: Likewise.
	* reloc16.c: Likewise.

Index: coff-h8300.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-h8300.c,v
retrieving revision 1.12
diff -u -r1.12 coff-h8300.c
--- coff-h8300.c	4 Apr 2002 19:53:35 -0000	1.12
+++ coff-h8300.c	11 Nov 2002 05:02:26 -0000
@@ -87,8 +87,7 @@
    the generic linker hash table, not the COFF backend linker hash
    table!  We use this to attach additional data structures we
    need while linking on the h8300.  */
-struct h8300_coff_link_hash_table
-{
+struct h8300_coff_link_hash_table {
   /* The main hash table.  */
   struct generic_link_hash_table root;
 
@@ -135,7 +134,7 @@
 
   /* Call the allocation method of the superclass.  */
   ret = ((struct funcvec_hash_entry *)
-         bfd_hash_newfunc ((struct bfd_hash_entry *) ret, gen_table, string));
+	 bfd_hash_newfunc ((struct bfd_hash_entry *) ret, gen_table, string));
 
   if (ret == NULL)
     return NULL;
@@ -165,8 +164,8 @@
      struct funcvec_hash_table *table;
      bfd *abfd;
      struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
-                                                struct bfd_hash_table *,
-                                                const char *));
+						struct bfd_hash_table *,
+						const char *));
 {
   /* Initialize our local fields, then call the generic initialization
      routine.  */
@@ -232,8 +231,7 @@
   return bfd_reloc_ok;
 }
 
-static reloc_howto_type howto_table[] =
-{
+static reloc_howto_type howto_table[] = {
   HOWTO (R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, special, "8", false, 0x000000ff, 0x000000ff, false),
   HOWTO (R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, special, "16", false, 0x0000ffff, 0x0000ffff, false),
   HOWTO (R_RELLONG, 0, 2, 32, false, 0, complain_overflow_bitfield, special, "32", false, 0xffffffff, 0xffffffff, false),
@@ -270,9 +268,9 @@
 /* Turn a howto into a reloc number.  */
 
 #define SELECT_RELOC(x,howto) \
-  { x.r_type = select_reloc(howto); }
+  { x.r_type = select_reloc (howto); }
 
-#define BADMAG(x) (H8300BADMAG(x) && H8300HBADMAG(x) && H8300SBADMAG(x))
+#define BADMAG(x) (H8300BADMAG (x) && H8300HBADMAG (x) && H8300SBADMAG (x))
 #define H8300 1			/* Customize coffcode.h */
 #define __A_MAGIC_SET__
 
@@ -365,15 +363,15 @@
     }
 }
 
-#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
+#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry)
 
 /* Perform any necessary magic to the addend in a reloc entry.  */
 
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
- cache_ptr->addend =  ext_reloc.r_offset;
+ cache_ptr->addend = ext_reloc.r_offset;
 
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
- reloc_processing(relent, reloc, symbols, abfd, section)
+ reloc_processing (relent, reloc, symbols, abfd, section)
 
 static void
 reloc_processing (relent, reloc, symbols, abfd, section)
@@ -483,7 +481,7 @@
       /* If the distance is within -128..+128 inclusive, then we can relax
 	 this jump.  +128 is valid since the target will move two bytes
 	 closer if we do relax this branch.  */
-      if ((int)gap >= -128 && (int)gap <= 128 )
+      if ((int) gap >= -128 && (int) gap <= 128)
 	{
 	  /* It's possible we may be able to eliminate this branch entirely;
 	     if the previous instruction is a branch around this instruction,
@@ -546,7 +544,7 @@
       /* If the distance is within -128..+128 inclusive, then we can relax
 	 this jump.  +128 is valid since the target will move two bytes
 	 closer if we do relax this branch.  */
-      if ((int)gap >= -128 && (int)gap <= 128 )
+      if ((int) gap >= -128 && (int) gap <= 128)
 	{
 	  /* Change the reloc type.  */
 	  reloc->howto = howto_table + 15;
@@ -736,7 +734,7 @@
       /* Sanity check.  */
       if (value <= 0xff
 	  || (value >= 0x0000ff00 && value <= 0x0000ffff)
-  	  || (value >= 0x00ffff00 && value <= 0x00ffffff)
+	  || (value >= 0x00ffff00 && value <= 0x00ffffff)
 	  || (value >= 0xffffff00 && value <= 0xffffffff))
 	{
 	  /* Everything looks OK.  Apply the relocation and update the
@@ -804,7 +802,7 @@
 
 	  /* Fix the opcode.  For all the move insns, we simply
 	     need to turn off bit 0x20 in the previous byte.  */
-          data[dst_address - 1] &= ~0x20;
+	  data[dst_address - 1] &= ~0x20;
 	  dst_address += 2;
 	  src_address += 4;
 	}
@@ -815,7 +813,7 @@
 		  reloc->howto->name, reloc->addend, input_section->owner,
 		  input_section, reloc->address)))
 	    abort ();
-        }
+	}
       break;
 
     /* A 16bit absolute branch that is now an 8-bit pc-relative branch.  */
@@ -912,14 +910,14 @@
 	  abort ();
 	}
 
-	/* Output the target.  */
-	bfd_put_8 (abfd, gap, data + dst_address - 1);
+      /* Output the target.  */
+      bfd_put_8 (abfd, gap, data + dst_address - 1);
 
-	/* We don't advance dst_address -- the 8bit reloc is applied at
-	   dst_address - 1, so the next insn should begin at dst_address.  */
-	src_address += 2;
+      /* We don't advance dst_address -- the 8bit reloc is applied at
+	 dst_address - 1, so the next insn should begin at dst_address.  */
+      src_address += 2;
 
-	break;
+      break;
 
     /* Similarly for a 24bit absolute that is now 8 bits.  */
     case R_JMPL2:
Index: elf32-h8300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-h8300.c,v
retrieving revision 1.16
diff -u -r1.16 elf32-h8300.c
--- elf32-h8300.c	11 Sep 2002 19:19:11 -0000	1.16
+++ elf32-h8300.c	11 Nov 2002 05:02:28 -0000
@@ -61,8 +61,7 @@
 /* This does not include any relocation information, but should be
    good enough for GDB or objdump to read the file.  */
 
-static reloc_howto_type h8_elf_howto_table[] =
-{
+static reloc_howto_type h8_elf_howto_table[] = {
 #define R_H8_NONE_X 0
   HOWTO (R_H8_NONE,		/* type */
 	 0,			/* rightshift */
@@ -221,16 +220,14 @@
 
 /* This structure is used to map BFD reloc codes to H8 ELF relocs.  */
 
-struct elf_reloc_map
-{
+struct elf_reloc_map {
   bfd_reloc_code_real_type bfd_reloc_val;
   unsigned char howto_index;
 };
 
 /* An array mapping BFD reloc codes to SH ELF relocs.  */
 
-static const struct elf_reloc_map h8_reloc_map[] =
-{
+static const struct elf_reloc_map h8_reloc_map[] = {
   { BFD_RELOC_NONE, R_H8_NONE_X },
   { BFD_RELOC_32, R_H8_DIR32_X },
   { BFD_RELOC_16, R_H8_DIR16_X },
@@ -271,7 +268,7 @@
 
   r = ELF32_R_TYPE (elf_reloc->r_info);
   for (i = 0; i < sizeof (h8_elf_howto_table) / sizeof (reloc_howto_type); i++)
-    if (h8_elf_howto_table[i].type== r)
+    if (h8_elf_howto_table[i].type == r)
       {
 	bfd_reloc->howto = &h8_elf_howto_table[i];
 	return;
@@ -870,11 +867,10 @@
 			  = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
 					  ELF32_R_TYPE (R_H8_NONE));
 
-		        last_reloc->r_info
+			last_reloc->r_info
 			  = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
-					ELF32_R_TYPE (R_H8_PCREL8));
-		        last_reloc->r_addend = irel->r_addend;
-
+					  ELF32_R_TYPE (R_H8_PCREL8));
+			last_reloc->r_addend = irel->r_addend;
 
 			code = bfd_get_8 (abfd,
 					  contents + last_reloc->r_offset - 1);
@@ -938,18 +934,18 @@
 	    /* If the distance is within -126..+130 inclusive, then we can
 	       relax this jump.  +130 is valid since the target will move
 	       two bytes closer if we do relax this branch.  */
-	    if ((int)gap >= -126 && (int)gap <= 130)
+	    if ((int) gap >= -126 && (int) gap <= 130)
 	      {
-	        unsigned char code;
+		unsigned char code;
 
-	        /* Note that we've changed the relocs, section contents,
+		/* Note that we've changed the relocs, section contents,
 		   etc.  */
-	        elf_section_data (sec)->relocs = internal_relocs;
-	        elf_section_data (sec)->this_hdr.contents = contents;
+		elf_section_data (sec)->relocs = internal_relocs;
+		elf_section_data (sec)->this_hdr.contents = contents;
 		symtab_hdr->contents = (unsigned char *) isymbuf;
 
-	        /* Get the opcode.  */
-	        code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
+		/* Get the opcode.  */
+		code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
 
 		if (code == 0x58)
 		  {
@@ -967,18 +963,18 @@
 		  abort ();
 
 		/* Fix the relocation's type.  */
-	        irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
 					     R_H8_PCREL8);
-	        irel->r_offset--;
+		irel->r_offset--;
 
-	        /* Delete two bytes of data.  */
-	        if (!elf32_h8_relax_delete_bytes (abfd, sec,
+		/* Delete two bytes of data.  */
+		if (!elf32_h8_relax_delete_bytes (abfd, sec,
 						  irel->r_offset + 1, 2))
 		  goto error_return;
 
-	        /* That will change things, so, we should relax again.
+		/* That will change things, so, we should relax again.
 		   Note that this is not required, and it may be slow.  */
-	        *again = true;
+		*again = true;
 	      }
 	    break;
 	  }
@@ -990,53 +986,53 @@
 	    bfd_vma value = symval + irel->r_addend;
 
 	    if ((bfd_get_mach (abfd) == bfd_mach_h8300
-	         && value >= 0xff00
-	         && value <= 0xffff)
-	        || ((bfd_get_mach (abfd) == bfd_mach_h8300h
+		 && value >= 0xff00
+		 && value <= 0xffff)
+		|| ((bfd_get_mach (abfd) == bfd_mach_h8300h
 		     || bfd_get_mach (abfd) == bfd_mach_h8300s)
 		    && value >= 0xffff00
 		    && value <= 0xffffff))
 	      {
-	        unsigned char code;
+		unsigned char code;
 
-	        /* Note that we've changed the relocs, section contents,
+		/* Note that we've changed the relocs, section contents,
 		   etc.  */
-	        elf_section_data (sec)->relocs = internal_relocs;
-	        elf_section_data (sec)->this_hdr.contents = contents;
+		elf_section_data (sec)->relocs = internal_relocs;
+		elf_section_data (sec)->this_hdr.contents = contents;
 		symtab_hdr->contents = (unsigned char *) isymbuf;
 
-	        /* Get the opcode.  */
-	        code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
+		/* Get the opcode.  */
+		code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
 
-	        /* Sanity check.  */
-	        if (code != 0x6a)
+		/* Sanity check.  */
+		if (code != 0x6a)
 		  abort ();
 
-	        code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
+		code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
 
-	        if ((code & 0xf0) == 0x00)
+		if ((code & 0xf0) == 0x00)
 		  bfd_put_8 (abfd,
 			     (code & 0xf) | 0x20,
-			      contents + irel->r_offset - 2);
-	        else if ((code & 0xf0) == 0x80)
+			     contents + irel->r_offset - 2);
+		else if ((code & 0xf0) == 0x80)
 		  bfd_put_8 (abfd,
 			     (code & 0xf) | 0x30,
-			      contents + irel->r_offset - 2);
-	        else
+			     contents + irel->r_offset - 2);
+		else
 		  abort ();
 
-	        /* Fix the relocation's type.  */
-	        irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+		/* Fix the relocation's type.  */
+		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
 					     R_H8_DIR8);
 
-	        /* Delete two bytes of data.  */
-	        if (!elf32_h8_relax_delete_bytes (abfd, sec,
+		/* Delete two bytes of data.  */
+		if (!elf32_h8_relax_delete_bytes (abfd, sec,
 						  irel->r_offset + 1, 2))
 		  goto error_return;
 
-	        /* That will change things, so, we should relax again.
+		/* That will change things, so, we should relax again.
 		   Note that this is not required, and it may be slow.  */
-	        *again = true;
+		*again = true;
 	      }
 	    break;
 	  }
@@ -1048,52 +1044,52 @@
 	    bfd_vma value = symval + irel->r_addend;
 
 	    if ((bfd_get_mach (abfd) == bfd_mach_h8300
-	         && value >= 0xff00
-	         && value <= 0xffff)
-	        || ((bfd_get_mach (abfd) == bfd_mach_h8300h
+		 && value >= 0xff00
+		 && value <= 0xffff)
+		|| ((bfd_get_mach (abfd) == bfd_mach_h8300h
 		     || bfd_get_mach (abfd) == bfd_mach_h8300s)
 		    && value >= 0xffff00
 		    && value <= 0xffffff))
 	      {
-	        unsigned char code;
+		unsigned char code;
 
-	        /* Note that we've changed the relocs, section contents,
+		/* Note that we've changed the relocs, section contents,
 		   etc.  */
-	        elf_section_data (sec)->relocs = internal_relocs;
-	        elf_section_data (sec)->this_hdr.contents = contents;
+		elf_section_data (sec)->relocs = internal_relocs;
+		elf_section_data (sec)->this_hdr.contents = contents;
 		symtab_hdr->contents = (unsigned char *) isymbuf;
 
-	        /* Get the opcode.  */
-	        code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
+		/* Get the opcode.  */
+		code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
 
-	        /* Sanity check.  */
-	        if (code != 0x6a)
+		/* Sanity check.  */
+		if (code != 0x6a)
 		  abort ();
 
-	        code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
+		code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
 
-	        if ((code & 0xf0) == 0x00)
+		if ((code & 0xf0) == 0x00)
 		  bfd_put_8 (abfd,
 			     (code & 0xf) | 0x20,
-			      contents + irel->r_offset - 2);
-	        else if ((code & 0xf0) == 0x80)
+			     contents + irel->r_offset - 2);
+		else if ((code & 0xf0) == 0x80)
 		  bfd_put_8 (abfd,
 			     (code & 0xf) | 0x30,
-			      contents + irel->r_offset - 2);
-	        else
+			     contents + irel->r_offset - 2);
+		else
 		  abort ();
 
-	        /* Fix the relocation's type.  */
-	        irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+		/* Fix the relocation's type.  */
+		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
 					     R_H8_DIR8);
 
-	        /* Delete two bytes of data.  */
-	        if (!elf32_h8_relax_delete_bytes (abfd, sec, irel->r_offset, 2))
+		/* Delete two bytes of data.  */
+		if (!elf32_h8_relax_delete_bytes (abfd, sec, irel->r_offset, 2))
 		  goto error_return;
 
-	        /* That will change things, so, we should relax again.
+		/* That will change things, so, we should relax again.
 		   Note that this is not required, and it may be slow.  */
-	        *again = true;
+		*again = true;
 	      }
 	  }
 
@@ -1107,34 +1103,34 @@
 
 	    if (value <= 0x7fff || value >= 0xff8000)
 	      {
-	        unsigned char code;
+		unsigned char code;
 
-	        /* Note that we've changed the relocs, section contents,
+		/* Note that we've changed the relocs, section contents,
 		   etc.  */
-	        elf_section_data (sec)->relocs = internal_relocs;
-	        elf_section_data (sec)->this_hdr.contents = contents;
+		elf_section_data (sec)->relocs = internal_relocs;
+		elf_section_data (sec)->this_hdr.contents = contents;
 		symtab_hdr->contents = (unsigned char *) isymbuf;
 
-	        /* Get the opcode.  */
-	        code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
+		/* Get the opcode.  */
+		code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
 
-	        /* We just need to turn off bit 0x20.  */
-	        code &= ~0x20;
+		/* We just need to turn off bit 0x20.  */
+		code &= ~0x20;
 
-	        bfd_put_8 (abfd, code, contents + irel->r_offset - 1);
+		bfd_put_8 (abfd, code, contents + irel->r_offset - 1);
 
-	        /* Fix the relocation's type.  */
-	        irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+		/* Fix the relocation's type.  */
+		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
 					     R_H8_DIR16A8);
 
-	        /* Delete two bytes of data.  */
-	        if (!elf32_h8_relax_delete_bytes (abfd, sec,
+		/* Delete two bytes of data.  */
+		if (!elf32_h8_relax_delete_bytes (abfd, sec,
 						  irel->r_offset + 1, 2))
 		  goto error_return;
 
-	        /* That will change things, so, we should relax again.
+		/* That will change things, so, we should relax again.
 		   Note that this is not required, and it may be slow.  */
-	        *again = true;
+		*again = true;
 	      }
 	    break;
 	  }
Index: reloc16.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc16.c,v
retrieving revision 1.7
diff -u -r1.7 reloc16.c
--- reloc16.c	7 Jun 2002 15:04:48 -0000	1.7
+++ reloc16.c	11 Nov 2002 05:02:28 -0000
@@ -199,30 +199,31 @@
       shrinks = (unsigned *) bfd_zmalloc (amt);
 
       /* Loop until nothing changes in this section.  */
-      do {
-	arelent **parent;
-	unsigned int i;
-	long j;
-
-	another_pass = 0;
-
-	for (i = 0, parent = reloc_vector; *parent; parent++, i++)
-	  {
-	    /* Let the target/machine dependent code examine each reloc
-	       in this section and attempt to shrink it.  */
-	    shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
-						shrinks[i], link_info);
-
-	    /* If it shrunk, note it in the shrinks array and set up for
-	       another pass.  */
-	    if (shrink != shrinks[i])
-	      {
-	        another_pass = 1;
-		for (j = i + 1; j <= reloc_count; j++)
-		  shrinks[j] += shrink - shrinks[i];
-	      }
-	  }
-      }
+      do
+	{
+	  arelent **parent;
+	  unsigned int i;
+	  long j;
+
+	  another_pass = 0;
+
+	  for (i = 0, parent = reloc_vector; *parent; parent++, i++)
+	    {
+	      /* Let the target/machine dependent code examine each reloc
+		 in this section and attempt to shrink it.  */
+	      shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
+						  shrinks[i], link_info);
+
+	      /* If it shrunk, note it in the shrinks array and set up for
+		 another pass.  */
+	      if (shrink != shrinks[i])
+		{
+		  another_pass = 1;
+		  for (j = i + 1; j <= reloc_count; j++)
+		    shrinks[j] += shrink - shrinks[i];
+		}
+	    }
+	}
       while (another_pass);
 
       shrink = shrinks[reloc_count];
@@ -235,12 +236,12 @@
 }
 
 bfd_byte *
-bfd_coff_reloc16_get_relocated_section_contents(in_abfd,
-						link_info,
-						link_order,
-						data,
-						relocateable,
-						symbols)
+bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
+						 link_info,
+						 link_order,
+						 data,
+						 relocateable,
+						 symbols)
      bfd *in_abfd;
      struct bfd_link_info *link_info;
      struct bfd_link_order *link_order;
@@ -266,11 +267,11 @@
 						       symbols);
 
   /* Read in the section.  */
-  if (!bfd_get_section_contents(input_bfd,
-				input_section,
-				data,
-				(bfd_vma) 0,
-				input_section->_raw_size))
+  if (!bfd_get_section_contents (input_bfd,
+				 input_section,
+				 data,
+				 (bfd_vma) 0,
+				 input_section->_raw_size))
     return NULL;
 
   reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);


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