* elf32-arm.c (STUB_ENTRY_NAME): Define.
[deliverable/binutils-gdb.git] / bfd / elf32-frv.c
index 6ce1b9f1143df64dade724d57d892d7846d80791..fab71ad90e4a4090257597fad13b2dc95caa5f78 100644 (file)
@@ -1397,7 +1397,8 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
        dynindx = entry->d.h->dynindx;
       else
        {
-         if (sec->output_section
+         if (sec
+             && sec->output_section
              && ! bfd_is_abs_section (sec->output_section)
              && ! bfd_is_und_section (sec->output_section))
            dynindx = elf_section_data (sec->output_section)->dynindx;
@@ -1679,8 +1680,9 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
             of the section.  For a non-local function, it's
             disregarded.  */
          lowword = ad;
-         if (entry->symndx == -1 && entry->d.h->dynindx != -1
-             && entry->d.h->dynindx == idx)
+         if (sec == NULL
+             || (entry->symndx == -1 && entry->d.h->dynindx != -1
+                 && entry->d.h->dynindx == idx))
            highword = 0;
          else
            highword = _frvfdpic_osec_to_segment
@@ -2726,7 +2728,14 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
     check_segment[2];
   int silence_segment_error = !(info->shared || info->pie);
   unsigned long insn;
+  static bfd_boolean ef_frv_pic_flag_set = FALSE;
 
+  if (! ef_frv_pic_flag_set && IS_FDPIC (output_bfd))
+    {
+      elf_elfheader (output_bfd)->e_flags |= EF_FRV_PIC;
+      ef_frv_pic_flag_set = TRUE;
+    }
+  
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
   relend     = relocs + input_section->reloc_count;
@@ -3983,7 +3992,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          if (!silence_segment_error && (info->shared || info->pie))
            return FALSE;
-         elf_elfheader (output_bfd)->e_flags |= EF_FRV_PIC;
+         /* PR 6446: EF_FRV_PIC should be cleared if
+            there are any inter-segment relocations.  */
+         elf_elfheader (output_bfd)->e_flags &= ~ EF_FRV_PIC;
        }
 
       switch (r_type)
This page took 0.024116 seconds and 4 git commands to generate.