* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Handle compound
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
index 5af924c4c601da6bf5b0c64b28cc162f5ffb163a..a016d473c26550dc921ad4b2f56244044479c83e 100644 (file)
@@ -2408,10 +2408,11 @@ extern asection _bfd_elf_large_com_section;
    link, we remove such relocations.  Otherwise, we just want the
    section contents zeroed and avoid any special processing.  */
 #define RELOC_AGAINST_DISCARDED_SECTION(info, input_bfd, input_section,        \
-                                       rel, relend, howto, contents)   \
+                                       rel, count, relend,             \
+                                       howto, index, contents)         \
   {                                                                    \
     _bfd_clear_contents (howto, input_bfd, input_section,              \
-                        contents + rel->r_offset);                     \
+                        contents + rel[index].r_offset);               \
                                                                        \
     if (info->relocatable                                              \
        && (input_section->flags & SEC_DEBUGGING))                      \
@@ -2423,23 +2424,28 @@ extern asection _bfd_elf_large_com_section;
        rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
                                                                        \
        /* Avoid empty output section.  */                              \
-       if (rel_hdr->sh_size > rel_hdr->sh_entsize)                     \
+       if (rel_hdr->sh_size > count * rel_hdr->sh_entsize)             \
          {                                                             \
-           rel_hdr->sh_size -= rel_hdr->sh_entsize;                    \
+           rel_hdr->sh_size -= count * rel_hdr->sh_entsize;            \
            rel_hdr = _bfd_elf_single_rel_hdr (input_section);          \
-           rel_hdr->sh_size -= rel_hdr->sh_entsize;                    \
+           rel_hdr->sh_size -= count * rel_hdr->sh_entsize;            \
                                                                        \
-           memmove (rel, rel + 1, (relend - rel - 1) * sizeof (*rel)); \
+           memmove (rel, rel + count,                                  \
+                    (relend - rel - count) * sizeof (*rel));           \
                                                                        \
-           input_section->reloc_count--;                               \
-           relend--;                                                   \
+           input_section->reloc_count -= count;                        \
+           relend -= count;                                            \
            rel--;                                                      \
            continue;                                                   \
          }                                                             \
       }                                                                        \
                                                                        \
-    rel->r_info = 0;                                                   \
-    rel->r_addend = 0;                                                 \
+    for (i = 0; i < count; i++)                                                \
+      {                                                                        \
+       rel[i].r_info = 0;                                              \
+       rel[i].r_addend = 0;                                            \
+      }                                                                        \
+    rel += count - 1;                                                  \
     continue;                                                          \
   }
 
This page took 0.037689 seconds and 4 git commands to generate.