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

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

bfd/ChangeLog
bfd/elf32-frv.c

index a10deb893d0fa6510933062f0529f3998c69211b..8aa38938979645c281f1dca47f2f3137aecfdd8b 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-frv.c (elf32_frv_relocate_section): Don't generate
+       dynamic relocations for non SEC_ALLOC sections.
+
 2020-06-03  Gunther Nikl  <gnikl@justmail.de>
 
        * aout64.c (BMAGIC, QMAGIC): Do not define.
index 51ea8fa27ed3e4493caa99a94a7eb2fb1282cb51..83de5e67b5f30f10b2d8f85f156314074b84ae1b 100644 (file)
@@ -2712,7 +2712,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
       const char *name;
       int r_type;
       asection *osec;
-      struct frvfdpic_relocs_info *picrel;
+      struct frvfdpic_relocs_info *picrel = NULL;
       bfd_vma orig_addend = rel->r_addend;
 
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -2806,6 +2806,9 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
        case R_FRV_GETTLSOFF_RELAX:
        case R_FRV_TLSOFF_RELAX:
        case R_FRV_TLSMOFF:
+         if ((input_section->flags & SEC_ALLOC) == 0)
+           break;
+
          if (h != NULL)
            picrel = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info
                                                      (info), input_bfd, h,