arc: Don't generate dynamic relocation for non SEC_ALLOC sections
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Jun 2020 16:09:40 +0000 (09:09 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Jun 2020 16:10:03 +0000 (09:10 -0700)
Don't generate dynamic relocations for non SEC_ALLOC sections because
run-time loader won't process them.

* elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
relocations for non SEC_ALLOC sections.

bfd/ChangeLog
bfd/elf32-arc.c

index 436eb5a2c7730673aa966f9a14d14dc0cdfea78f..a10deb893d0fa6510933062f0529f3998c69211b 100644 (file)
@@ -8,6 +8,11 @@
        * i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
        * libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
 
+2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
+       relocations for non SEC_ALLOC sections.
+
 2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elf-bfd.h (_bfd_elf_maybe_set_textrel): New
index 774d3e793db2b5ec24d98561b054b40811f58088..06ee60ac409760286d98b6b9febf32260a9866f2 100644 (file)
@@ -1782,6 +1782,7 @@ elf_arc_relocate_section (bfd *                     output_bfd,
          case R_ARC_PC32:
          case R_ARC_32_PCREL:
            if (bfd_link_pic (info)
+               && (input_section->flags & SEC_ALLOC) != 0
                && (!IS_ARC_PCREL_TYPE (r_type)
                    || (h != NULL
                        && h->dynindx != -1