Blame 0002-NFC-debugedit-Move-code-from-edit_dwarf2-to-edit_inf.patch

DistroBaker 6ff1af
From de119ea9797f3ccfa3842e3926b6ea8198607207 Mon Sep 17 00:00:00 2001
DistroBaker 6ff1af
From: Jan Kratochvil <jan.kratochvil@redhat.com>
DistroBaker 6ff1af
Date: Sat, 1 Aug 2020 10:43:12 +0200
DistroBaker 6ff1af
Subject: [PATCH 2/6] [NFC] debugedit: Move code from edit_dwarf2() to
DistroBaker 6ff1af
 edit_info().
DistroBaker 6ff1af
DistroBaker 6ff1af
---
DistroBaker 6ff1af
 tools/debugedit.c | 672 +++++++++++++++++++++++-----------------------
DistroBaker 6ff1af
 1 file changed, 343 insertions(+), 329 deletions(-)
DistroBaker 6ff1af
DistroBaker 6ff1af
diff --git a/tools/debugedit.c b/tools/debugedit.c
DistroBaker 6ff1af
index a351adec8..cad0cc349 100644
DistroBaker 6ff1af
--- a/tools/debugedit.c
DistroBaker 6ff1af
+++ b/tools/debugedit.c
DistroBaker 6ff1af
@@ -1964,6 +1964,106 @@ line_rel_cmp (const void *a, const void *b)
DistroBaker 6ff1af
   return 0;
DistroBaker 6ff1af
 }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
+static int
DistroBaker 6ff1af
+edit_info (DSO *dso, int phase)
DistroBaker 6ff1af
+{
DistroBaker 6ff1af
+  unsigned char *ptr, *endcu, *endsec;
DistroBaker 6ff1af
+  uint32_t value;
DistroBaker 6ff1af
+  htab_t abbrev;
DistroBaker 6ff1af
+  struct abbrev_tag tag, *t;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+  ptr = debug_sections[DEBUG_INFO].data;
DistroBaker 6ff1af
+  setup_relbuf(dso, &debug_sections[DEBUG_INFO], &reltype);
DistroBaker 6ff1af
+  endsec = ptr + debug_sections[DEBUG_INFO].size;
DistroBaker 6ff1af
+  while (ptr < endsec)
DistroBaker 6ff1af
+    {
DistroBaker 6ff1af
+      if (ptr + 11 > endsec)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  error (0, 0, "%s: .debug_info CU header too small",
DistroBaker 6ff1af
+		 dso->filename);
DistroBaker 6ff1af
+	  return 1;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      endcu = ptr + 4;
DistroBaker 6ff1af
+      endcu += read_32 (ptr);
DistroBaker 6ff1af
+      if (endcu == ptr + 0xffffffff)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  error (0, 0, "%s: 64-bit DWARF not supported", dso->filename);
DistroBaker 6ff1af
+	  return 1;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      if (endcu > endsec)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  error (0, 0, "%s: .debug_info too small", dso->filename);
DistroBaker 6ff1af
+	  return 1;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      cu_version = read_16 (ptr);
DistroBaker 6ff1af
+      if (cu_version != 2 && cu_version != 3 && cu_version != 4)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
DistroBaker 6ff1af
+		 cu_version);
DistroBaker 6ff1af
+	  return 1;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      value = read_32_relocated (ptr);
DistroBaker 6ff1af
+      if (value >= debug_sections[DEBUG_ABBREV].size)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  if (debug_sections[DEBUG_ABBREV].data == NULL)
DistroBaker 6ff1af
+	    error (0, 0, "%s: .debug_abbrev not present", dso->filename);
DistroBaker 6ff1af
+	  else
DistroBaker 6ff1af
+	    error (0, 0, "%s: DWARF CU abbrev offset too large",
DistroBaker 6ff1af
+		   dso->filename);
DistroBaker 6ff1af
+	  return 1;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      if (ptr_size == 0)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  ptr_size = read_8 (ptr);
DistroBaker 6ff1af
+	  if (ptr_size != 4 && ptr_size != 8)
DistroBaker 6ff1af
+	    {
DistroBaker 6ff1af
+	      error (0, 0, "%s: Invalid DWARF pointer size %d",
DistroBaker 6ff1af
+		     dso->filename, ptr_size);
DistroBaker 6ff1af
+	      return 1;
DistroBaker 6ff1af
+	    }
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+      else if (read_8 (ptr) != ptr_size)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  error (0, 0, "%s: DWARF pointer size differs between CUs",
DistroBaker 6ff1af
+		 dso->filename);
DistroBaker 6ff1af
+	  return 1;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      abbrev = read_abbrev (dso,
DistroBaker 6ff1af
+			    debug_sections[DEBUG_ABBREV].data + value);
DistroBaker 6ff1af
+      if (abbrev == NULL)
DistroBaker 6ff1af
+	return 1;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      while (ptr < endcu)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  tag.entry = read_uleb128 (ptr);
DistroBaker 6ff1af
+	  if (tag.entry == 0)
DistroBaker 6ff1af
+	    continue;
DistroBaker 6ff1af
+	  t = htab_find_with_hash (abbrev, &tag, tag.entry);
DistroBaker 6ff1af
+	  if (t == NULL)
DistroBaker 6ff1af
+	    {
DistroBaker 6ff1af
+	      error (0, 0, "%s: Could not find DWARF abbreviation %d",
DistroBaker 6ff1af
+		     dso->filename, tag.entry);
DistroBaker 6ff1af
+	      htab_delete (abbrev);
DistroBaker 6ff1af
+	      return 1;
DistroBaker 6ff1af
+	    }
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+	  ptr = edit_attributes (dso, ptr, t, phase);
DistroBaker 6ff1af
+	  if (ptr == NULL)
DistroBaker 6ff1af
+	    break;
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      htab_delete (abbrev);
DistroBaker 6ff1af
+    }
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+  return 0;
DistroBaker 6ff1af
+}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
 static int
DistroBaker 6ff1af
 edit_dwarf2 (DSO *dso)
DistroBaker 6ff1af
 {
DistroBaker 6ff1af
@@ -2100,385 +2200,299 @@ edit_dwarf2 (DSO *dso)
DistroBaker 6ff1af
       return 1;
DistroBaker 6ff1af
     }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-  if (debug_sections[DEBUG_INFO].data != NULL)
DistroBaker 6ff1af
+  if (debug_sections[DEBUG_INFO].data == NULL)
DistroBaker 6ff1af
+    return 0;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+  unsigned char *ptr, *endcu, *endsec;
DistroBaker 6ff1af
+  uint32_t value;
DistroBaker 6ff1af
+  htab_t abbrev;
DistroBaker 6ff1af
+  struct abbrev_tag tag, *t;
DistroBaker 6ff1af
+  int phase;
DistroBaker 6ff1af
+  bool info_rel_updated = false;
DistroBaker 6ff1af
+  bool macro_rel_updated = false;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+  for (phase = 0; phase < 2; phase++)
DistroBaker 6ff1af
     {
DistroBaker 6ff1af
-      unsigned char *ptr, *endcu, *endsec;
DistroBaker 6ff1af
-      uint32_t value;
DistroBaker 6ff1af
-      htab_t abbrev;
DistroBaker 6ff1af
-      struct abbrev_tag tag, *t;
DistroBaker 6ff1af
-      int phase;
DistroBaker 6ff1af
-      bool info_rel_updated = false;
DistroBaker 6ff1af
-      bool macro_rel_updated = false;
DistroBaker 6ff1af
+      /* If we don't need to update anyhing, skip phase 1. */
DistroBaker 6ff1af
+      if (phase == 1
DistroBaker 6ff1af
+	  && !need_strp_update
DistroBaker 6ff1af
+	  && !need_string_replacement
DistroBaker 6ff1af
+	  && !need_stmt_update)
DistroBaker 6ff1af
+	break;
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-      for (phase = 0; phase < 2; phase++)
DistroBaker 6ff1af
+      rel_updated = false;
DistroBaker 6ff1af
+      if (edit_info (dso, phase))
DistroBaker 6ff1af
+       return 1;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      /* Remember whether any .debug_info relocations might need
DistroBaker 6ff1af
+	 to be updated. */
DistroBaker 6ff1af
+      info_rel_updated = rel_updated;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+      /* We might have to recalculate/rewrite the debug_line
DistroBaker 6ff1af
+	 section.  We need to do that before going into phase one
DistroBaker 6ff1af
+	 so we have all new offsets.  We do this separately from
DistroBaker 6ff1af
+	 scanning the dirs/file names because the DW_AT_stmt_lists
DistroBaker 6ff1af
+	 might not be in order or skip some padding we might have
DistroBaker 6ff1af
+	 to (re)move. */
DistroBaker 6ff1af
+      if (phase == 0 && need_stmt_update)
DistroBaker 6ff1af
 	{
DistroBaker 6ff1af
-	  /* If we don't need to update anyhing, skip phase 1. */
DistroBaker 6ff1af
-	  if (phase == 1
DistroBaker 6ff1af
-	      && !need_strp_update
DistroBaker 6ff1af
-	      && !need_string_replacement
DistroBaker 6ff1af
-	      && !need_stmt_update)
DistroBaker 6ff1af
-	    break;
DistroBaker 6ff1af
+	  edit_dwarf2_line (dso);
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	  ptr = debug_sections[DEBUG_INFO].data;
DistroBaker 6ff1af
-	  setup_relbuf(dso, &debug_sections[DEBUG_INFO], &reltype);
DistroBaker 6ff1af
-	  rel_updated = false;
DistroBaker 6ff1af
-	  endsec = ptr + debug_sections[DEBUG_INFO].size;
DistroBaker 6ff1af
-	  while (ptr < endsec)
DistroBaker 6ff1af
+	  /* The line table programs will be moved
DistroBaker 6ff1af
+	     forward/backwards a bit in the new data. Update the
DistroBaker 6ff1af
+	     debug_line relocations to the new offsets. */
DistroBaker 6ff1af
+	  int rndx = debug_sections[DEBUG_LINE].relsec;
DistroBaker 6ff1af
+	  if (rndx != 0)
DistroBaker 6ff1af
 	    {
DistroBaker 6ff1af
-	      if (ptr + 11 > endsec)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  error (0, 0, "%s: .debug_info CU header too small",
DistroBaker 6ff1af
-			 dso->filename);
DistroBaker 6ff1af
-		  return 1;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      endcu = ptr + 4;
DistroBaker 6ff1af
-	      endcu += read_32 (ptr);
DistroBaker 6ff1af
-	      if (endcu == ptr + 0xffffffff)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  error (0, 0, "%s: 64-bit DWARF not supported", dso->filename);
DistroBaker 6ff1af
-		  return 1;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      if (endcu > endsec)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  error (0, 0, "%s: .debug_info too small", dso->filename);
DistroBaker 6ff1af
-		  return 1;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      cu_version = read_16 (ptr);
DistroBaker 6ff1af
-	      if (cu_version != 2 && cu_version != 3 && cu_version != 4)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
DistroBaker 6ff1af
-			 cu_version);
DistroBaker 6ff1af
-		  return 1;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      value = read_32_relocated (ptr);
DistroBaker 6ff1af
-	      if (value >= debug_sections[DEBUG_ABBREV].size)
DistroBaker 6ff1af
+	      LINE_REL *rbuf;
DistroBaker 6ff1af
+	      size_t rels;
DistroBaker 6ff1af
+	      Elf_Data *rdata = elf_getdata (dso->scn[rndx], NULL);
DistroBaker 6ff1af
+	      int rtype = dso->shdr[rndx].sh_type;
DistroBaker 6ff1af
+	      rels = dso->shdr[rndx].sh_size / dso->shdr[rndx].sh_entsize;
DistroBaker 6ff1af
+	      rbuf = malloc (rels * sizeof (LINE_REL));
DistroBaker 6ff1af
+	      if (rbuf == NULL)
DistroBaker 6ff1af
+		error (1, errno, "%s: Could not allocate line relocations",
DistroBaker 6ff1af
+		       dso->filename);
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+	      /* Sort them by offset into section. */
DistroBaker 6ff1af
+	      for (size_t i = 0; i < rels; i++)
DistroBaker 6ff1af
 		{
DistroBaker 6ff1af
-		  if (debug_sections[DEBUG_ABBREV].data == NULL)
DistroBaker 6ff1af
-		    error (0, 0, "%s: .debug_abbrev not present", dso->filename);
DistroBaker 6ff1af
+		  if (rtype == SHT_RELA)
DistroBaker 6ff1af
+		    {
DistroBaker 6ff1af
+		      GElf_Rela rela;
DistroBaker 6ff1af
+		      if (gelf_getrela (rdata, i, &rela) == NULL)
DistroBaker 6ff1af
+			error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
+			       elf_errmsg (-1));
DistroBaker 6ff1af
+		      rbuf[i].r_offset = rela.r_offset;
DistroBaker 6ff1af
+		      rbuf[i].ndx = i;
DistroBaker 6ff1af
+		    }
DistroBaker 6ff1af
 		  else
DistroBaker 6ff1af
-		    error (0, 0, "%s: DWARF CU abbrev offset too large",
DistroBaker 6ff1af
-			   dso->filename);
DistroBaker 6ff1af
-		  return 1;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      if (ptr_size == 0)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  ptr_size = read_8 (ptr);
DistroBaker 6ff1af
-		  if (ptr_size != 4 && ptr_size != 8)
DistroBaker 6ff1af
 		    {
DistroBaker 6ff1af
-		      error (0, 0, "%s: Invalid DWARF pointer size %d",
DistroBaker 6ff1af
-			     dso->filename, ptr_size);
DistroBaker 6ff1af
-		      return 1;
DistroBaker 6ff1af
+		      GElf_Rel rel;
DistroBaker 6ff1af
+		      if (gelf_getrel (rdata, i, &rel) == NULL)
DistroBaker 6ff1af
+			error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
+			       elf_errmsg (-1));
DistroBaker 6ff1af
+		      rbuf[i].r_offset = rel.r_offset;
DistroBaker 6ff1af
+		      rbuf[i].ndx = i;
DistroBaker 6ff1af
 		    }
DistroBaker 6ff1af
 		}
DistroBaker 6ff1af
-	      else if (read_8 (ptr) != ptr_size)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  error (0, 0, "%s: DWARF pointer size differs between CUs",
DistroBaker 6ff1af
-			 dso->filename);
DistroBaker 6ff1af
-		  return 1;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
+	      qsort (rbuf, rels, sizeof (LINE_REL), line_rel_cmp);
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	      abbrev = read_abbrev (dso,
DistroBaker 6ff1af
-				    debug_sections[DEBUG_ABBREV].data + value);
DistroBaker 6ff1af
-	      if (abbrev == NULL)
DistroBaker 6ff1af
-		return 1;
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      while (ptr < endcu)
DistroBaker 6ff1af
+	      size_t lndx = 0;
DistroBaker 6ff1af
+	      for (size_t i = 0; i < rels; i++)
DistroBaker 6ff1af
 		{
DistroBaker 6ff1af
-		  tag.entry = read_uleb128 (ptr);
DistroBaker 6ff1af
-		  if (tag.entry == 0)
DistroBaker 6ff1af
-		    continue;
DistroBaker 6ff1af
-		  t = htab_find_with_hash (abbrev, &tag, tag.entry);
DistroBaker 6ff1af
-		  if (t == NULL)
DistroBaker 6ff1af
+		  /* These relocations only happen in ET_REL files
DistroBaker 6ff1af
+		     and are section offsets. */
DistroBaker 6ff1af
+		  GElf_Addr r_offset;
DistroBaker 6ff1af
+		  size_t ndx = rbuf[i].ndx;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+		  GElf_Rel rel;
DistroBaker 6ff1af
+		  GElf_Rela rela;
DistroBaker 6ff1af
+		  if (rtype == SHT_RELA)
DistroBaker 6ff1af
 		    {
DistroBaker 6ff1af
-		      error (0, 0, "%s: Could not find DWARF abbreviation %d",
DistroBaker 6ff1af
-			     dso->filename, tag.entry);
DistroBaker 6ff1af
-		      htab_delete (abbrev);
DistroBaker 6ff1af
-		      return 1;
DistroBaker 6ff1af
+		      if (gelf_getrela (rdata, ndx, &rela) == NULL)
DistroBaker 6ff1af
+			error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
+			       elf_errmsg (-1));
DistroBaker 6ff1af
+		      r_offset = rela.r_offset;
DistroBaker 6ff1af
+		    }
DistroBaker 6ff1af
+		  else
DistroBaker 6ff1af
+		    {
DistroBaker 6ff1af
+		      if (gelf_getrel (rdata, ndx, &rel) == NULL)
DistroBaker 6ff1af
+			error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
+			       elf_errmsg (-1));
DistroBaker 6ff1af
+		      r_offset = rel.r_offset;
DistroBaker 6ff1af
 		    }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-		  ptr = edit_attributes (dso, ptr, t, phase);
DistroBaker 6ff1af
-		  if (ptr == NULL)
DistroBaker 6ff1af
-		    break;
DistroBaker 6ff1af
-		}
DistroBaker 6ff1af
+		  while (lndx < dso->lines.used
DistroBaker 6ff1af
+			 && r_offset > (dso->lines.table[lndx].old_idx
DistroBaker 6ff1af
+					+ 4
DistroBaker 6ff1af
+					+ dso->lines.table[lndx].unit_length))
DistroBaker 6ff1af
+		    lndx++;
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	      htab_delete (abbrev);
DistroBaker 6ff1af
-	    }
DistroBaker 6ff1af
+		  if (lndx >= dso->lines.used)
DistroBaker 6ff1af
+		    error (1, 0,
DistroBaker 6ff1af
+			   ".debug_line relocation offset out of range");
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	  /* Remember whether any .debug_info relocations might need
DistroBaker 6ff1af
-	     to be updated. */
DistroBaker 6ff1af
-	  info_rel_updated = rel_updated;
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	  /* We might have to recalculate/rewrite the debug_line
DistroBaker 6ff1af
-	     section.  We need to do that before going into phase one
DistroBaker 6ff1af
-	     so we have all new offsets.  We do this separately from
DistroBaker 6ff1af
-	     scanning the dirs/file names because the DW_AT_stmt_lists
DistroBaker 6ff1af
-	     might not be in order or skip some padding we might have
DistroBaker 6ff1af
-	     to (re)move. */
DistroBaker 6ff1af
-	  if (phase == 0 && need_stmt_update)
DistroBaker 6ff1af
-	    {
DistroBaker 6ff1af
-	      edit_dwarf2_line (dso);
DistroBaker 6ff1af
+		  /* Offset (pointing into the line program) moves
DistroBaker 6ff1af
+		     from old to new index including the header
DistroBaker 6ff1af
+		     size diff. */
DistroBaker 6ff1af
+		  r_offset += (ssize_t)((dso->lines.table[lndx].new_idx
DistroBaker 6ff1af
+					 - dso->lines.table[lndx].old_idx)
DistroBaker 6ff1af
+					+ dso->lines.table[lndx].size_diff);
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	      /* The line table programs will be moved
DistroBaker 6ff1af
-		 forward/backwards a bit in the new data. Update the
DistroBaker 6ff1af
-		 debug_line relocations to the new offsets. */
DistroBaker 6ff1af
-	      int rndx = debug_sections[DEBUG_LINE].relsec;
DistroBaker 6ff1af
-	      if (rndx != 0)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  LINE_REL *rbuf;
DistroBaker 6ff1af
-		  size_t rels;
DistroBaker 6ff1af
-		  Elf_Data *rdata = elf_getdata (dso->scn[rndx], NULL);
DistroBaker 6ff1af
-		  int rtype = dso->shdr[rndx].sh_type;
DistroBaker 6ff1af
-		  rels = dso->shdr[rndx].sh_size / dso->shdr[rndx].sh_entsize;
DistroBaker 6ff1af
-		  rbuf = malloc (rels * sizeof (LINE_REL));
DistroBaker 6ff1af
-		  if (rbuf == NULL)
DistroBaker 6ff1af
-		    error (1, errno, "%s: Could not allocate line relocations",
DistroBaker 6ff1af
-			   dso->filename);
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		  /* Sort them by offset into section. */
DistroBaker 6ff1af
-		  for (size_t i = 0; i < rels; i++)
DistroBaker 6ff1af
+		  if (rtype == SHT_RELA)
DistroBaker 6ff1af
 		    {
DistroBaker 6ff1af
-		      if (rtype == SHT_RELA)
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  GElf_Rela rela;
DistroBaker 6ff1af
-			  if (gelf_getrela (rdata, i, &rela) == NULL)
DistroBaker 6ff1af
-			    error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
-				   elf_errmsg (-1));
DistroBaker 6ff1af
-			  rbuf[i].r_offset = rela.r_offset;
DistroBaker 6ff1af
-			  rbuf[i].ndx = i;
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
-		      else
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  GElf_Rel rel;
DistroBaker 6ff1af
-			  if (gelf_getrel (rdata, i, &rel) == NULL)
DistroBaker 6ff1af
-			    error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
-				   elf_errmsg (-1));
DistroBaker 6ff1af
-			  rbuf[i].r_offset = rel.r_offset;
DistroBaker 6ff1af
-			  rbuf[i].ndx = i;
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
+		      rela.r_offset = r_offset;
DistroBaker 6ff1af
+		      if (gelf_update_rela (rdata, ndx, &rela) == 0)
DistroBaker 6ff1af
+			error (1, 0, "Couldn't update relocation: %s",
DistroBaker 6ff1af
+			       elf_errmsg (-1));
DistroBaker 6ff1af
 		    }
DistroBaker 6ff1af
-		  qsort (rbuf, rels, sizeof (LINE_REL), line_rel_cmp);
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		  size_t lndx = 0;
DistroBaker 6ff1af
-		  for (size_t i = 0; i < rels; i++)
DistroBaker 6ff1af
+		  else
DistroBaker 6ff1af
 		    {
DistroBaker 6ff1af
-		      /* These relocations only happen in ET_REL files
DistroBaker 6ff1af
-			 and are section offsets. */
DistroBaker 6ff1af
-		      GElf_Addr r_offset;
DistroBaker 6ff1af
-		      size_t ndx = rbuf[i].ndx;
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		      GElf_Rel rel;
DistroBaker 6ff1af
-		      GElf_Rela rela;
DistroBaker 6ff1af
-		      if (rtype == SHT_RELA)
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  if (gelf_getrela (rdata, ndx, &rela) == NULL)
DistroBaker 6ff1af
-			    error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
-				   elf_errmsg (-1));
DistroBaker 6ff1af
-			  r_offset = rela.r_offset;
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
-		      else
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  if (gelf_getrel (rdata, ndx, &rel) == NULL)
DistroBaker 6ff1af
-			    error (1, 0, "Couldn't get relocation: %s",
DistroBaker 6ff1af
-				   elf_errmsg (-1));
DistroBaker 6ff1af
-			  r_offset = rel.r_offset;
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		      while (lndx < dso->lines.used
DistroBaker 6ff1af
-			     && r_offset > (dso->lines.table[lndx].old_idx
DistroBaker 6ff1af
-					    + 4
DistroBaker 6ff1af
-					    + dso->lines.table[lndx].unit_length))
DistroBaker 6ff1af
-			lndx++;
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		      if (lndx >= dso->lines.used)
DistroBaker 6ff1af
-			error (1, 0,
DistroBaker 6ff1af
-			       ".debug_line relocation offset out of range");
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		      /* Offset (pointing into the line program) moves
DistroBaker 6ff1af
-			 from old to new index including the header
DistroBaker 6ff1af
-			 size diff. */
DistroBaker 6ff1af
-		      r_offset += (ssize_t)((dso->lines.table[lndx].new_idx
DistroBaker 6ff1af
-					     - dso->lines.table[lndx].old_idx)
DistroBaker 6ff1af
-					    + dso->lines.table[lndx].size_diff);
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		      if (rtype == SHT_RELA)
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  rela.r_offset = r_offset;
DistroBaker 6ff1af
-			  if (gelf_update_rela (rdata, ndx, &rela) == 0)
DistroBaker 6ff1af
-			    error (1, 0, "Couldn't update relocation: %s",
DistroBaker 6ff1af
-				   elf_errmsg (-1));
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
-		      else
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  rel.r_offset = r_offset;
DistroBaker 6ff1af
-			  if (gelf_update_rel (rdata, ndx, &rel) == 0)
DistroBaker 6ff1af
-			    error (1, 0, "Couldn't update relocation: %s",
DistroBaker 6ff1af
-				   elf_errmsg (-1));
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
+		      rel.r_offset = r_offset;
DistroBaker 6ff1af
+		      if (gelf_update_rel (rdata, ndx, &rel) == 0)
DistroBaker 6ff1af
+			error (1, 0, "Couldn't update relocation: %s",
DistroBaker 6ff1af
+			       elf_errmsg (-1));
DistroBaker 6ff1af
 		    }
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-		  elf_flagdata (rdata, ELF_C_SET, ELF_F_DIRTY);
DistroBaker 6ff1af
-		  free (rbuf);
DistroBaker 6ff1af
 		}
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+	      elf_flagdata (rdata, ELF_C_SET, ELF_F_DIRTY);
DistroBaker 6ff1af
+	      free (rbuf);
DistroBaker 6ff1af
 	    }
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	  /* The .debug_macro section also contains offsets into the
DistroBaker 6ff1af
-	     .debug_str section and references to the .debug_line
DistroBaker 6ff1af
-	     tables, so we need to update those as well if we update
DistroBaker 6ff1af
-	     the strings or the stmts.  */
DistroBaker 6ff1af
-	  if ((need_strp_update || need_stmt_update)
DistroBaker 6ff1af
-	      && debug_sections[DEBUG_MACRO].data)
DistroBaker 6ff1af
+      /* The .debug_macro section also contains offsets into the
DistroBaker 6ff1af
+	 .debug_str section and references to the .debug_line
DistroBaker 6ff1af
+	 tables, so we need to update those as well if we update
DistroBaker 6ff1af
+	 the strings or the stmts.  */
DistroBaker 6ff1af
+      if ((need_strp_update || need_stmt_update)
DistroBaker 6ff1af
+	  && debug_sections[DEBUG_MACRO].data)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  /* There might be multiple (COMDAT) .debug_macro sections.  */
DistroBaker 6ff1af
+	  struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
DistroBaker 6ff1af
+	  while (macro_sec != NULL)
DistroBaker 6ff1af
 	    {
DistroBaker 6ff1af
-	      /* There might be multiple (COMDAT) .debug_macro sections.  */
DistroBaker 6ff1af
-	      struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
DistroBaker 6ff1af
-	      while (macro_sec != NULL)
DistroBaker 6ff1af
-		{
DistroBaker 6ff1af
-		  setup_relbuf(dso, macro_sec, &reltype);
DistroBaker 6ff1af
-		  rel_updated = false;
DistroBaker 6ff1af
+	      setup_relbuf(dso, macro_sec, &reltype);
DistroBaker 6ff1af
+	      rel_updated = false;
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-		  ptr = macro_sec->data;
DistroBaker 6ff1af
-		  endsec = ptr + macro_sec->size;
DistroBaker 6ff1af
-		  int op = 0, macro_version, macro_flags;
DistroBaker 6ff1af
-		  int offset_len = 4, line_offset = 0;
DistroBaker 6ff1af
+	      ptr = macro_sec->data;
DistroBaker 6ff1af
+	      endsec = ptr + macro_sec->size;
DistroBaker 6ff1af
+	      int op = 0, macro_version, macro_flags;
DistroBaker 6ff1af
+	      int offset_len = 4, line_offset = 0;
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-		  while (ptr < endsec)
DistroBaker 6ff1af
+	      while (ptr < endsec)
DistroBaker 6ff1af
+		{
DistroBaker 6ff1af
+		  if (!op)
DistroBaker 6ff1af
 		    {
DistroBaker 6ff1af
-		      if (!op)
DistroBaker 6ff1af
-			{
DistroBaker 6ff1af
-			  macro_version = read_16 (ptr);
DistroBaker 6ff1af
-			  macro_flags = read_8 (ptr);
DistroBaker 6ff1af
-			  if (macro_version < 4 || macro_version > 5)
DistroBaker 6ff1af
-			    error (1, 0, "unhandled .debug_macro version: %d",
DistroBaker 6ff1af
-				   macro_version);
DistroBaker 6ff1af
-			  if ((macro_flags & ~2) != 0)
DistroBaker 6ff1af
-			    error (1, 0, "unhandled .debug_macro flags: 0x%x",
DistroBaker 6ff1af
-				   macro_flags);
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-			  offset_len = (macro_flags & 0x01) ? 8 : 4;
DistroBaker 6ff1af
-			  line_offset = (macro_flags & 0x02) ? 1 : 0;
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-			  if (offset_len != 4)
DistroBaker 6ff1af
-			    error (0, 1,
DistroBaker 6ff1af
-				   "Cannot handle 8 byte macro offsets: %s",
DistroBaker 6ff1af
-				   dso->filename);
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-			  /* Update the line_offset if it is there.  */
DistroBaker 6ff1af
-			  if (line_offset)
DistroBaker 6ff1af
-			    {
DistroBaker 6ff1af
-			      if (phase == 0)
DistroBaker 6ff1af
-				ptr += offset_len;
DistroBaker 6ff1af
-			      else
DistroBaker 6ff1af
-				{
DistroBaker 6ff1af
-				  size_t idx, new_idx;
DistroBaker 6ff1af
-				  idx = do_read_32_relocated (ptr);
DistroBaker 6ff1af
-				  new_idx = find_new_list_offs (&dso->lines,
DistroBaker 6ff1af
-								idx);
DistroBaker 6ff1af
-				  write_32_relocated (ptr, new_idx);
DistroBaker 6ff1af
-				}
DistroBaker 6ff1af
-			    }
DistroBaker 6ff1af
-			}
DistroBaker 6ff1af
+		      macro_version = read_16 (ptr);
DistroBaker 6ff1af
+		      macro_flags = read_8 (ptr);
DistroBaker 6ff1af
+		      if (macro_version < 4 || macro_version > 5)
DistroBaker 6ff1af
+			error (1, 0, "unhandled .debug_macro version: %d",
DistroBaker 6ff1af
+			       macro_version);
DistroBaker 6ff1af
+		      if ((macro_flags & ~2) != 0)
DistroBaker 6ff1af
+			error (1, 0, "unhandled .debug_macro flags: 0x%x",
DistroBaker 6ff1af
+			       macro_flags);
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+		      offset_len = (macro_flags & 0x01) ? 8 : 4;
DistroBaker 6ff1af
+		      line_offset = (macro_flags & 0x02) ? 1 : 0;
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+		      if (offset_len != 4)
DistroBaker 6ff1af
+			error (0, 1,
DistroBaker 6ff1af
+			       "Cannot handle 8 byte macro offsets: %s",
DistroBaker 6ff1af
+			       dso->filename);
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-		      op = read_8 (ptr);
DistroBaker 6ff1af
-		      if (!op)
DistroBaker 6ff1af
-			continue;
DistroBaker 6ff1af
-		      switch(op)
DistroBaker 6ff1af
+		      /* Update the line_offset if it is there.  */
DistroBaker 6ff1af
+		      if (line_offset)
DistroBaker 6ff1af
 			{
DistroBaker 6ff1af
-			case DW_MACRO_GNU_define:
DistroBaker 6ff1af
-			case DW_MACRO_GNU_undef:
DistroBaker 6ff1af
-			  read_uleb128 (ptr);
DistroBaker 6ff1af
-			  ptr = ((unsigned char *) strchr ((char *) ptr, '\0')
DistroBaker 6ff1af
-				 + 1);
DistroBaker 6ff1af
-			  break;
DistroBaker 6ff1af
-			case DW_MACRO_GNU_start_file:
DistroBaker 6ff1af
-			  read_uleb128 (ptr);
DistroBaker 6ff1af
-			  read_uleb128 (ptr);
DistroBaker 6ff1af
-			  break;
DistroBaker 6ff1af
-			case DW_MACRO_GNU_end_file:
DistroBaker 6ff1af
-			  break;
DistroBaker 6ff1af
-			case DW_MACRO_GNU_define_indirect:
DistroBaker 6ff1af
-			case DW_MACRO_GNU_undef_indirect:
DistroBaker 6ff1af
-			  read_uleb128 (ptr);
DistroBaker 6ff1af
 			  if (phase == 0)
DistroBaker 6ff1af
-			    {
DistroBaker 6ff1af
-			      size_t idx = read_32_relocated (ptr);
DistroBaker 6ff1af
-			      record_existing_string_entry_idx (&dso->strings,
DistroBaker 6ff1af
-								idx);
DistroBaker 6ff1af
-			    }
DistroBaker 6ff1af
+			    ptr += offset_len;
DistroBaker 6ff1af
 			  else
DistroBaker 6ff1af
 			    {
DistroBaker 6ff1af
-			      struct stridxentry *entry;
DistroBaker 6ff1af
 			      size_t idx, new_idx;
DistroBaker 6ff1af
 			      idx = do_read_32_relocated (ptr);
DistroBaker 6ff1af
-			      entry = string_find_entry (&dso->strings, idx);
DistroBaker 6ff1af
-			      new_idx = strent_offset (entry->entry);
DistroBaker 6ff1af
+			      new_idx = find_new_list_offs (&dso->lines,
DistroBaker 6ff1af
+							    idx);
DistroBaker 6ff1af
 			      write_32_relocated (ptr, new_idx);
DistroBaker 6ff1af
 			    }
DistroBaker 6ff1af
-			  break;
DistroBaker 6ff1af
-			case DW_MACRO_GNU_transparent_include:
DistroBaker 6ff1af
-			  ptr += offset_len;
DistroBaker 6ff1af
-			  break;
DistroBaker 6ff1af
-			default:
DistroBaker 6ff1af
-			  error (1, 0, "Unhandled DW_MACRO op 0x%x", op);
DistroBaker 6ff1af
-			  break;
DistroBaker 6ff1af
 			}
DistroBaker 6ff1af
 		    }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-		  if (rel_updated)
DistroBaker 6ff1af
-		    macro_rel_updated = true;
DistroBaker 6ff1af
-		  macro_sec = macro_sec->next;
DistroBaker 6ff1af
+		  op = read_8 (ptr);
DistroBaker 6ff1af
+		  if (!op)
DistroBaker 6ff1af
+		    continue;
DistroBaker 6ff1af
+		  switch(op)
DistroBaker 6ff1af
+		    {
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_define:
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_undef:
DistroBaker 6ff1af
+		      read_uleb128 (ptr);
DistroBaker 6ff1af
+		      ptr = ((unsigned char *) strchr ((char *) ptr, '\0')
DistroBaker 6ff1af
+			     + 1);
DistroBaker 6ff1af
+		      break;
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_start_file:
DistroBaker 6ff1af
+		      read_uleb128 (ptr);
DistroBaker 6ff1af
+		      read_uleb128 (ptr);
DistroBaker 6ff1af
+		      break;
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_end_file:
DistroBaker 6ff1af
+		      break;
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_define_indirect:
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_undef_indirect:
DistroBaker 6ff1af
+		      read_uleb128 (ptr);
DistroBaker 6ff1af
+		      if (phase == 0)
DistroBaker 6ff1af
+			{
DistroBaker 6ff1af
+			  size_t idx = read_32_relocated (ptr);
DistroBaker 6ff1af
+			  record_existing_string_entry_idx (&dso->strings,
DistroBaker 6ff1af
+							    idx);
DistroBaker 6ff1af
+			}
DistroBaker 6ff1af
+		      else
DistroBaker 6ff1af
+			{
DistroBaker 6ff1af
+			  struct stridxentry *entry;
DistroBaker 6ff1af
+			  size_t idx, new_idx;
DistroBaker 6ff1af
+			  idx = do_read_32_relocated (ptr);
DistroBaker 6ff1af
+			  entry = string_find_entry (&dso->strings, idx);
DistroBaker 6ff1af
+			  new_idx = strent_offset (entry->entry);
DistroBaker 6ff1af
+			  write_32_relocated (ptr, new_idx);
DistroBaker 6ff1af
+			}
DistroBaker 6ff1af
+		      break;
DistroBaker 6ff1af
+		    case DW_MACRO_GNU_transparent_include:
DistroBaker 6ff1af
+		      ptr += offset_len;
DistroBaker 6ff1af
+		      break;
DistroBaker 6ff1af
+		    default:
DistroBaker 6ff1af
+		      error (1, 0, "Unhandled DW_MACRO op 0x%x", op);
DistroBaker 6ff1af
+		      break;
DistroBaker 6ff1af
+		    }
DistroBaker 6ff1af
 		}
DistroBaker 6ff1af
-	    }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-	  /* Same for the debug_str section. Make sure everything is
DistroBaker 6ff1af
-	     in place for phase 1 updating of debug_info
DistroBaker 6ff1af
-	     references. */
DistroBaker 6ff1af
-	  if (phase == 0 && need_strp_update)
DistroBaker 6ff1af
-	    {
DistroBaker 6ff1af
-	      Strtab *strtab = dso->strings.str_tab;
DistroBaker 6ff1af
-	      Elf_Data *strdata = debug_sections[DEBUG_STR].elf_data;
DistroBaker 6ff1af
-	      int strndx = debug_sections[DEBUG_STR].sec;
DistroBaker 6ff1af
-	      Elf_Scn *strscn = dso->scn[strndx];
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      /* Out with the old. */
DistroBaker 6ff1af
-	      strdata->d_size = 0;
DistroBaker 6ff1af
-	      /* In with the new. */
DistroBaker 6ff1af
-	      strdata = elf_newdata (strscn);
DistroBaker 6ff1af
-
DistroBaker 6ff1af
-	      /* We really should check whether we had enough memory,
DistroBaker 6ff1af
-		 but the old ebl version will just abort on out of
DistroBaker 6ff1af
-		 memory... */
DistroBaker 6ff1af
-	      strtab_finalize (strtab, strdata);
DistroBaker 6ff1af
-	      debug_sections[DEBUG_STR].size = strdata->d_size;
DistroBaker 6ff1af
-	      dso->strings.str_buf = strdata->d_buf;
DistroBaker 6ff1af
+	      if (rel_updated)
DistroBaker 6ff1af
+		macro_rel_updated = true;
DistroBaker 6ff1af
+	      macro_sec = macro_sec->next;
DistroBaker 6ff1af
 	    }
DistroBaker 6ff1af
+	}
DistroBaker 6ff1af
 
DistroBaker 6ff1af
+      /* Same for the debug_str section. Make sure everything is
DistroBaker 6ff1af
+	 in place for phase 1 updating of debug_info
DistroBaker 6ff1af
+	 references. */
DistroBaker 6ff1af
+      if (phase == 0 && need_strp_update)
DistroBaker 6ff1af
+	{
DistroBaker 6ff1af
+	  Strtab *strtab = dso->strings.str_tab;
DistroBaker 6ff1af
+	  Elf_Data *strdata = debug_sections[DEBUG_STR].elf_data;
DistroBaker 6ff1af
+	  int strndx = debug_sections[DEBUG_STR].sec;
DistroBaker 6ff1af
+	  Elf_Scn *strscn = dso->scn[strndx];
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+	  /* Out with the old. */
DistroBaker 6ff1af
+	  strdata->d_size = 0;
DistroBaker 6ff1af
+	  /* In with the new. */
DistroBaker 6ff1af
+	  strdata = elf_newdata (strscn);
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+	  /* We really should check whether we had enough memory,
DistroBaker 6ff1af
+	     but the old ebl version will just abort on out of
DistroBaker 6ff1af
+	     memory... */
DistroBaker 6ff1af
+	  strtab_finalize (strtab, strdata);
DistroBaker 6ff1af
+	  debug_sections[DEBUG_STR].size = strdata->d_size;
DistroBaker 6ff1af
+	  dso->strings.str_buf = strdata->d_buf;
DistroBaker 6ff1af
 	}
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-      /* After phase 1 we might have rewritten the debug_info with
DistroBaker 6ff1af
-	 new strp, strings and/or linep offsets.  */
DistroBaker 6ff1af
-      if (need_strp_update || need_string_replacement || need_stmt_update)
DistroBaker 6ff1af
-	dirty_section (DEBUG_INFO);
DistroBaker 6ff1af
-      if (need_strp_update || need_stmt_update)
DistroBaker 6ff1af
-	dirty_section (DEBUG_MACRO);
DistroBaker 6ff1af
-      if (need_stmt_update)
DistroBaker 6ff1af
-	dirty_section (DEBUG_LINE);
DistroBaker 6ff1af
+    }
DistroBaker 6ff1af
+
DistroBaker 6ff1af
+  /* After phase 1 we might have rewritten the debug_info with
DistroBaker 6ff1af
+     new strp, strings and/or linep offsets.  */
DistroBaker 6ff1af
+  if (need_strp_update || need_string_replacement || need_stmt_update)
DistroBaker 6ff1af
+    dirty_section (DEBUG_INFO);
DistroBaker 6ff1af
+  if (need_strp_update || need_stmt_update)
DistroBaker 6ff1af
+    dirty_section (DEBUG_MACRO);
DistroBaker 6ff1af
+  if (need_stmt_update)
DistroBaker 6ff1af
+    dirty_section (DEBUG_LINE);
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-      /* Update any relocations addends we might have touched. */
DistroBaker 6ff1af
-      if (info_rel_updated)
DistroBaker 6ff1af
-	update_rela_data (dso, &debug_sections[DEBUG_INFO]);
DistroBaker 6ff1af
+  /* Update any relocations addends we might have touched. */
DistroBaker 6ff1af
+  if (info_rel_updated)
DistroBaker 6ff1af
+    update_rela_data (dso, &debug_sections[DEBUG_INFO]);
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-      if (macro_rel_updated)
DistroBaker 6ff1af
+  if (macro_rel_updated)
DistroBaker 6ff1af
+    {
DistroBaker 6ff1af
+      struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
DistroBaker 6ff1af
+      while (macro_sec != NULL)
DistroBaker 6ff1af
 	{
DistroBaker 6ff1af
-	  struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
DistroBaker 6ff1af
-	  while (macro_sec != NULL)
DistroBaker 6ff1af
-	    {
DistroBaker 6ff1af
-	      update_rela_data (dso, macro_sec);
DistroBaker 6ff1af
-	      macro_sec = macro_sec->next;
DistroBaker 6ff1af
-	    }
DistroBaker 6ff1af
+	  update_rela_data (dso, macro_sec);
DistroBaker 6ff1af
+	  macro_sec = macro_sec->next;
DistroBaker 6ff1af
 	}
DistroBaker 6ff1af
     }
DistroBaker 6ff1af
 
DistroBaker 6ff1af
-- 
DistroBaker 6ff1af
2.18.4
DistroBaker 6ff1af