* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Feb 2002 12:40:32 +0000 (12:40 +0000)
committerJakub Jelinek <jakub@redhat.com>
Tue, 19 Feb 2002 12:40:32 +0000 (12:40 +0000)
absptr -> pcrel optimization for shared libs.
Only create minimal .eh_frame_hdr if absptr FDE encoding in shared
library cannot be converted to pcrel.
(_bfd_elf_eh_frame_section_offset): Return -2 if making absptr
relative.
* elf32-i386.c (elf_i386_relocate_section): If
_bfd_elf_section_offset returned -2, skip, but make sure the
relocation is installed.
* elf32-arm.h (elf32_arm_final_link_relocate): Likewise.
* elf32-cris.c (cris_elf_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Handle
_bfd_elf_section_offset returning -2 the same way as -1.
* elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
* elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME
and BFD_ASSERT.
* elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.

21 files changed:
bfd/ChangeLog
bfd/elf-eh-frame.c
bfd/elf32-arm.h
bfd/elf32-cris.c
bfd/elf32-hppa.c
bfd/elf32-i370.c
bfd/elf32-i386.c
bfd/elf32-m68k.c
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-sparc.c
bfd/elf64-alpha.c
bfd/elf64-mips.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elf64-sh64.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
bfd/elfxx-ia64.c

index bc5c02e2b51fe8fb98fdb9545d2dbfdfeef05d1a..cf986d816250a4c6507d94f3218b9c321b3c128f 100644 (file)
@@ -1,3 +1,35 @@
+2002-02-19  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable
+       absptr -> pcrel optimization for shared libs.
+       Only create minimal .eh_frame_hdr if absptr FDE encoding in shared
+       library cannot be converted to pcrel.
+       (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr
+       relative.
+       * elf32-i386.c (elf_i386_relocate_section): If
+       _bfd_elf_section_offset returned -2, skip, but make sure the
+       relocation is installed.
+       * elf32-arm.h (elf32_arm_final_link_relocate): Likewise.
+       * elf32-cris.c (cris_elf_relocate_section): Likewise.
+       * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+       * elf32-i370.c (i370_elf_relocate_section): Likewise.
+       * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+       * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+       * elf32-s390.c (elf_s390_relocate_section): Likewise.
+       * elf32-sh.c (sh_elf_relocate_section): Likewise.
+       * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+       * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+       * elf64-s390.c (elf_s390_relocate_section): Likewise.
+       * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+       * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+       * elf64-alpha.c (elf64_alpha_relocate_section): Handle
+       _bfd_elf_section_offset returning -2 the same way as -1.
+       * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
+       * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME
+       and BFD_ASSERT.
+       * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
+
 2002-02-18  Tom Rix  <trix@redhat.com>
 
        * xcofflink.c (bfd_xcoff_link_gernate_rtinit): Add -brtl support.
index b479c00f3233886ffb3aab0ab74c0217dc26abf4..20cbfb22c8305a429bcd407168cd0297520b8cd6 100644 (file)
@@ -586,16 +586,12 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
            }
 
          /* For shared libraries, try to get rid of as many RELATIVE relocs
-            as possible.
-            FIXME: For this to work, ELF backends need to perform the
-            relocation if omitting dynamic relocs, not skip it.  */
-          if (0
-             && info->shared
+            as possible.  */
+          if (info->shared
              && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr)
            cie.make_relative = 1;
 
-         if (0
-             && info->shared
+         if (info->shared
              && (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr)
            cie.make_lsda_relative = 1;
 
@@ -636,6 +632,16 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
            }
          else
            {
+             if (info->shared
+                 && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr
+                 && cie.make_relative == 0)
+               {
+                 /* If shared library uses absolute pointers
+                    which we cannot turn into PC relative,
+                    don't create the binary search table,
+                    since it is affected by runtime relocations.  */
+                 hdr_info->table = false;
+               }
              cie_usage_count++;
              hdr_info->fde_count++;
            }
@@ -856,7 +862,7 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
   if (sec_info->entry[mid].make_relative
       && ! sec_info->entry[mid].cie
       && offset == sec_info->entry[mid].offset + 8)
-    return (bfd_vma) -1;
+    return (bfd_vma) -2;
 
   /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need
      for run-time relocation against LSDA field.  */
@@ -865,7 +871,7 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
       && (offset
          == (sec_info->entry[mid].offset + 8
              + sec_info->entry[mid].lsda_offset)))
-    return (bfd_vma) -1;
+    return (bfd_vma) -2;
 
   return (offset + sec_info->entry[mid].new_offset
          - sec_info->entry[mid].offset);
index 8818c64973437ec443fa81e3822f9767ab422556..a452465ead2de0f8a0fc6b5355d96a69eab5dc0b 100644 (file)
@@ -1148,26 +1148,24 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
            }
 
          skip = false;
+         relocate = false;
 
          outrel.r_offset =
            _bfd_elf_section_offset (output_bfd, info, input_section,
                                     rel->r_offset);
          if (outrel.r_offset == (bfd_vma) -1)
            skip = true;
+         else if (outrel.r_offset == (bfd_vma) -2)
+           skip = true, relocate = true;
          outrel.r_offset += (input_section->output_section->vma
                              + input_section->output_offset);
 
          if (skip)
-           {
-             memset (&outrel, 0, sizeof outrel);
-             relocate = false;
-           }
+           memset (&outrel, 0, sizeof outrel);
          else if (r_type == R_ARM_PC24)
            {
              BFD_ASSERT (h != NULL && h->dynindx != -1);
-             if ((input_section->flags & SEC_ALLOC) != 0)
-               relocate = false;
-             else
+             if ((input_section->flags & SEC_ALLOC) == 0)
                relocate = true;
              outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24);
            }
@@ -1184,9 +1182,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
              else
                {
                  BFD_ASSERT (h->dynindx != -1);
-                 if ((input_section->flags & SEC_ALLOC) != 0)
-                   relocate = false;
-                 else
+                 if ((input_section->flags & SEC_ALLOC) == 0)
                    relocate = true;
                  outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32);
                }
index c588adcc48bf18856d81bd4e3e30a84d212b7963..ef8c95193cc7e714149de7e6c04c0f1fe38ddc29 100644 (file)
@@ -1296,20 +1296,20 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                }
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              /* h->dynindx may be -1 if the symbol was marked to
                 become local.  */
              else if (h != NULL
@@ -1318,7 +1318,6 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
                {
                  BFD_ASSERT (h->dynindx != -1);
-                 relocate = false;
                  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = relocation + rel->r_addend;
                }
@@ -1359,7 +1358,6 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                          BFD_ASSERT (indx > 0);
                        }
 
-                     relocate = false;
                      outrel.r_info = ELF32_R_INFO (indx, r_type);
                      outrel.r_addend = relocation + rel->r_addend;
                    }
index ce3a9b85c8a190e18968444a77c8371d1f63db61..5a65dcb1d61ad5a521e4ae48ac91baf2c4bff85e 100644 (file)
@@ -3976,7 +3976,8 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
-             skip = (outrel.r_offset == (bfd_vma) -1);
+             skip = (outrel.r_offset == (bfd_vma) -1
+                     || outrel.r_offset == (bfd_vma) -2);
              outrel.r_offset += (input_section->output_offset
                                  + input_section->output_section->vma);
 
index 5ac43dda75639d85781b83f5c98226c0c6a65113..aa9cd3955a75bced931c1a6c5a5d43d5edb79404 100644 (file)
@@ -1436,7 +1436,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              && r_symndx != 0)
            {
              Elf_Internal_Rela outrel;
-             boolean skip;
+             int skip;
 
 #ifdef DEBUG
              fprintf (stderr,
@@ -1468,13 +1468,14 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  BFD_ASSERT (sreloc != NULL);
                }
 
-             skip = false;
+             skip = 0;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
-             if (outrel.r_offset == (bfd_vma) -1)
-               skip = true;
+             if (outrel.r_offset == (bfd_vma) -1
+                 || outrel.r_offset == (bfd_vma) -2)
+               skip = (int) outrel.r_offset;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
@@ -1549,7 +1550,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              /* This reloc will be computed at runtime, so there's no
                  need to do anything now, unless this is a RELATIVE
                  reloc in an unallocated section.  */
-             if (skip
+             if (skip == -1
                  || (input_section->flags & SEC_ALLOC) != 0
                  || ELF32_R_TYPE (outrel.r_info) != R_I370_RELATIVE)
                continue;
index a1a7b5ca5d2c309fe55f7b0f50b3ff0dbfded078..7e6588c24ed334cb4d63d799ae786fb4696d8ef2 100644 (file)
@@ -2006,20 +2006,20 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                 time.  */
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              else if (h != NULL
                       && h->dynindx != -1
                       && (r_type == R_386_PC32
@@ -2027,11 +2027,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                           || !info->symbolic
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
-
-               {
-                 relocate = false;
-                 outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
-               }
+               outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
              else
                {
                  /* This symbol is local, or marked to become local.  */
index ab7ab452c7e59641be7ab75014aee32cf0a5c355..1fb684472f0d25b847e9a8c8ab6dc86057dff288 100644 (file)
@@ -1654,20 +1654,20 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
                }
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              /* h->dynindx may be -1 if the symbol was marked to
                  become local.  */
              else if (h != NULL
@@ -1676,7 +1676,6 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
                {
                  BFD_ASSERT (h->dynindx != -1);
-                 relocate = false;
                  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = relocation + rel->r_addend;
                }
@@ -1717,7 +1716,6 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
                          BFD_ASSERT (indx > 0);
                        }
 
-                     relocate = false;
                      outrel.r_info = ELF32_R_INFO (indx, r_type);
                      outrel.r_addend = relocation + rel->r_addend;
                    }
index c62c5db213d3184f25b76d54afc5af907bbdad7c..d52e5d2001ea83c19fc6a016071574fc65121ff4 100644 (file)
@@ -6369,6 +6369,9 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
     _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset);
   if (outrel.r_offset == (bfd_vma) -1)
     skip = true;
+  /* FIXME: For -2 runtime relocation needs to be skipped, but
+     properly resolved statically and installed.  */
+  BFD_ASSERT (outrel.r_offset != (bfd_vma) -2);
 
   /* If we've decided to skip this relocation, just output an empty
      record.  Note that R_MIPS_NONE == 0, so that this call to memset
index 4c9ff8297f97d50fff2b3360a36cef9de55d69ab..be6cfabb19508943553f0f2530ddef5af6582b20 100644 (file)
@@ -3152,7 +3152,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          if (info->shared && r_symndx != 0)
            {
              Elf_Internal_Rela outrel;
-             boolean skip;
+             int skip;
 
 #ifdef DEBUG
              fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n",
@@ -3183,13 +3183,14 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  BFD_ASSERT (sreloc != NULL);
                }
 
-             skip = false;
+             skip = 0;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
-             if (outrel.r_offset == (bfd_vma) -1)
-               skip = true;
+             if (outrel.r_offset == (bfd_vma) -1
+                 || outrel.r_offset == (bfd_vma) -2)
+               skip = (int) outrel.r_offset;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
@@ -3260,7 +3261,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              /* This reloc will be computed at runtime, so there's no
                  need to do anything now, unless this is a RELATIVE
                  reloc in an unallocated section.  */
-             if (skip
+             if (skip != -1
                  || (input_section->flags & SEC_ALLOC) != 0
                  || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE)
                continue;
index 0a913ef81f16b7edb9ede9403d9be122a833fb1d..01ce47c3056e31e60aef9db426516a46f6b4ca5b 100644 (file)
@@ -1891,20 +1891,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                 time.  */
 
               skip = false;
+              relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
               outrel.r_offset += (input_section->output_section->vma
                                   + input_section->output_offset);
 
               if (skip)
-                {
-                  memset (&outrel, 0, sizeof outrel);
-                  relocate = false;
-                }
+               memset (&outrel, 0, sizeof outrel);
               else if (h != NULL
                       && h->dynindx != -1
                       && (r_type == R_390_PC16
@@ -1915,7 +1915,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
                 {
-                 relocate = false;
                   outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = rel->r_addend;
                 }
index 6c13404fd05a5241239b924d25e2686f987abd77..d8d4a6aab4d10803bed7c2775dadb264b132c468 100644 (file)
@@ -4419,24 +4419,23 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                }
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              else if (r_type == R_SH_REL32)
                {
                  BFD_ASSERT (h != NULL && h->dynindx != -1);
-                 relocate = false;
                  outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32);
                  outrel.r_addend
                    = bfd_get_32 (input_bfd, contents + rel->r_offset);
@@ -4459,7 +4458,6 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  else
                    {
                      BFD_ASSERT (h->dynindx != -1);
-                     relocate = false;
                      outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32);
                      outrel.r_addend
                        = relocation + bfd_get_32 (input_bfd,
index f0f97464056eda7d58fe278a7ac1640d026d1561..e944f00f6ad6c291b881802b76e799e2c7234fc5 100644 (file)
@@ -1438,7 +1438,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              && (input_section->flags & SEC_ALLOC))
            {
              Elf_Internal_Rela outrel;
-             boolean skip;
+             boolean skip, relocate = false;
 
              /* When generating a shared object, these relocations
                  are copied into the output file to be resolved at run
@@ -1471,6 +1471,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
@@ -1571,7 +1573,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
 
              /* This reloc will be computed at runtime, so there's no
                  need to do anything now.  */
-             continue;
+             if (! relocate)
+               continue;
            }
          break;
 
index 53ac1e79175f91ec0830c36342120f2488bee20a..2c380d6a19b74dae16ec6bedc62ced180fe41c59 100644 (file)
@@ -3671,7 +3671,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
            outrel.r_offset =
              _bfd_elf_section_offset (output_bfd, info, input_section,
                                       rel->r_offset);
-           if (outrel.r_offset != (bfd_vma) -1)
+           if ((outrel.r_offset | 1) != (bfd_vma) -1)
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
            else
index f20d15bc07fa1ecac18391d8fd27ba98aba6c10b..084e08a157b1cfbf58d39e802915c31d6d9f44e9 100644 (file)
@@ -3396,6 +3396,9 @@ mips_elf64_create_dynamic_relocation (output_bfd, info, rel, h, sec,
   outrel[0].r_offset = _bfd_elf_section_offset (output_bfd, info,
                                                input_section,
                                                rel[0].r_offset);
+  /* FIXME: For -2 runtime relocation needs to be skipped, but
+     properly resolved statically and installed.  */
+  BFD_ASSERT (outrel[0].r_offset != (bfd_vma) -2);
 
   /* We begin by assuming that the offset for the dynamic relocation
      is the same as for the original relocation.  We'll adjust this
index 08232a304dd5775f1c5ffc9f0d49901b1b4e07ab..fe46bd53eae5352c9884930c9488a74172e8034e 100644 (file)
@@ -4082,22 +4082,21 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                 time.  */
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
-
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
              outrel.r_addend = addend;
 
              if (skip)
-               {
-                 relocate = false;
-                 memset (&outrel, 0, sizeof outrel);
-               }
+               memset (&outrel, 0, sizeof outrel);
              else if (h != NULL
                       && h->dynindx != -1
                       && !is_opd
@@ -4106,10 +4105,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                           || !info->symbolic
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
-               {
-                 relocate = false;
-                 outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
-               }
+               outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
              else
                {
                  /* This symbol is local, or marked to become local,
index efdf194c996f479e8028176e49266cc45705d470..f296c3e91314cbbd332af10507b5ed2090e1dead 100644 (file)
@@ -1890,21 +1890,21 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                  time.  */
 
               skip = false;
+              relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
 
               outrel.r_offset += (input_section->output_section->vma
                                   + input_section->output_offset);
 
               if (skip)
-                {
-                  memset (&outrel, 0, sizeof outrel);
-                  relocate = false;
-                }
+               memset (&outrel, 0, sizeof outrel);
               else if (h != NULL
                       && h->dynindx != -1
                       && (r_type == R_390_PC16
@@ -1917,7 +1917,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
                 {
-                 relocate = false;
                   outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = rel->r_addend;
                 }
index ab22187e24dadefa123972c464a60c5d196b1964..901bfa5bda6b89821c5be42c8b32130d730280a0 100644 (file)
@@ -1746,6 +1746,7 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
                }
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset
                = _bfd_elf_section_offset (output_bfd, info,
@@ -1753,19 +1754,17 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
 
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -1)
+               skip = true, relocate = true;
              
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              else if (r_type == R_SH_64_PCREL)
                {
                  BFD_ASSERT (h != NULL && h->dynindx != -1);
-                 relocate = false;
                  outrel.r_info = ELF64_R_INFO (h->dynindx, R_SH_64_PCREL);
                  outrel.r_addend = rel->r_addend;
                }
@@ -1785,7 +1784,6 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
                  else
                    {
                      BFD_ASSERT (h->dynindx != -1);
-                     relocate = false;
                      outrel.r_info = ELF64_R_INFO (h->dynindx, R_SH_64);
                      outrel.r_addend = relocation + rel->r_addend;
                    }
index 5cae63aed9cd11f8ed0cc2ae1bcc89ddbb5a2b0a..0f81fa26bf7c608de6756df09abde32b94cb9596 100644 (file)
@@ -2161,7 +2161,7 @@ do_dynreloc:
            case R_SPARC_UA16:
              {
                Elf_Internal_Rela outrel;
-               boolean skip;
+               boolean skip, relocate;
 
                if (sreloc == NULL)
                  {
@@ -2184,12 +2184,15 @@ do_dynreloc:
                  }
 
                skip = false;
+               relocate = false;
 
                outrel.r_offset =
                  _bfd_elf_section_offset (output_bfd, info, input_section,
                                           rel->r_offset);
                if (outrel.r_offset == (bfd_vma) -1)
                  skip = true;
+               else if (outrel.r_offset == (bfd_vma) -2)
+                 skip = true, relocate = true;
 
                outrel.r_offset += (input_section->output_section->vma
                                    + input_section->output_offset);
@@ -2301,7 +2304,8 @@ do_dynreloc:
 
                /* This reloc will be computed at runtime, so there's no
                   need to do anything now.  */
-               continue;
+               if (! relocate)
+                 continue;
              }
            break;
            }
index 4bbbb0871ead7bdd9677af621757aceebf3e96ad..cdd36d1623f387cdb2f28a845fd573941f174048 100644 (file)
@@ -1466,21 +1466,21 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
                }
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rela->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -1)
+               skip = true, relocate = true;
 
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              /* h->dynindx may be -1 if this symbol was marked to
                 become local.  */
              else if (h != NULL
@@ -1489,7 +1489,6 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
                {
                  BFD_ASSERT (h->dynindx != -1);
-                 relocate = false;
                  outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = relocation + rela->r_addend;
                }
@@ -1530,7 +1529,6 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
                          BFD_ASSERT (sindx > 0);
                        }
 
-                     relocate = false;
                      outrel.r_info = ELF64_R_INFO (sindx, r_type);
                      outrel.r_addend = relocation + rela->r_addend;
                    }
index 7c4e1394ec3858f4da877cc9d5bc34d2dde25277..e458477010e455bfa0e60baad76f8341c33d4d2a 100644 (file)
@@ -3107,7 +3107,7 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
   outrel.r_info = ELFNN_R_INFO (dynindx, type);
   outrel.r_addend = addend;
   outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset);
-  if (outrel.r_offset == (bfd_vma) -1)
+  if ((outrel.r_offset | 1) == (bfd_vma) -1)
     {
       /* Run for the hills.  We shouldn't be outputting a relocation
         for this.  So do what everyone else does and output a no-op.  */