RL78: Ski0p dynamic section checks if the sections have not been created

Nick Clifton nickc@redhat.com
Mon Jun 10 11:55:00 GMT 2013


Hi DJ,

  The patch below fixes a couple of problems with the
  el78_elf_finish_dynamic_sections functions.  The first was that the
  check was being run even if the dynamic sections had not been
  created.  The second was that the checks were being run only when
  relaxation had been run, instead of only when relaxation had not been
  run.

  OK to apply ?

Cheers
  Nick

bfd/ChangeLog
2013-06-10  Nick Clifton  <nickc@redhat.com>

	* elf32-rl78.c (rl78_elf_finish_dynamic_sections): Only run if the
	dynamic sections have been created and relaxation has not been run.

Index: bfd/elf32-rl78.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-rl78.c,v
retrieving revision 1.14
diff -u -3 -p -r1.14 elf32-rl78.c
--- bfd/elf32-rl78.c	2 Apr 2013 23:29:51 -0000	1.14
+++ bfd/elf32-rl78.c	10 Jun 2013 11:51:35 -0000
@@ -1270,24 +1270,28 @@ rl78_elf_finish_dynamic_sections (bfd *a
   bfd *dynobj;
   asection *splt;
 
+  if (!elf_hash_table (info)->dynamic_sections_created)
+    return TRUE;
+
   /* As an extra sanity check, verify that all plt entries have been
      filled in.  However, relaxing might have changed the relocs so
      that some plt entries don't get filled in, so we have to skip
      this check if we're relaxing.  Unfortunately, check_relocs is
      called before relaxation.  */
 
-  if (info->relax_trip > 0)
+  if (info->relax_trip > 0) 
+    return TRUE;
+
+  if ((dynobj = elf_hash_table (info)->dynobj) != NULL
+      && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
     {
-      if ((dynobj = elf_hash_table (info)->dynobj) != NULL
-	  && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
+      bfd_byte *contents = splt->contents;
+      unsigned int i, size = splt->size;
+
+      for (i = 0; i < size; i += 4)
 	{
-	  bfd_byte *contents = splt->contents;
-	  unsigned int i, size = splt->size;
-	  for (i = 0; i < size; i += 4)
-	    {
-	      unsigned int x = bfd_get_32 (dynobj, contents + i);
-	      BFD_ASSERT (x != 0);
-	    }
+	  unsigned int x = bfd_get_32 (dynobj, contents + i);
+	  BFD_ASSERT (x != 0);
 	}
     }
 



More information about the Binutils mailing list