default:
abort ();
}
+ if ((elf_elfheader (abfd)->e_flags & EF_ARC_MACH) == EF_ARC_CPU_GENERIC)
+ elf_elfheader (abfd)->e_flags |= val;
- elf_elfheader (abfd)->e_flags &= ~EF_ARC_MACH;
- elf_elfheader (abfd)->e_flags |= val;
elf_elfheader (abfd)->e_machine = emf;
+
/* Record whatever is the current syscall ABI version. */
elf_elfheader (abfd)->e_flags |= E_ARC_OSABI_CURRENT;
}
}
else if (is_reloc_for_PLT (howto))
{
+ /* Fail if it is linking for PIE and the symbol is
+ undefined. */
+ if (bfd_link_executable (info)
+ && !(*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd, input_section,
+ rel->r_offset, TRUE))
+ {
+ return FALSE;
+ }
reloc_data.sym_value = h->plt.offset;
reloc_data.sym_section = htab->splt;
reloc_data.should_relocate = TRUE;
}
- else if (!(*info->callbacks->undefined_symbol)
+ else if (!bfd_link_pic (info)
+ && !(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
- rel->r_offset,!bfd_link_pic (info)))
+ rel->r_offset, TRUE))
{
return FALSE;
}
case R_ARC_32_ME:
case R_ARC_PC32:
case R_ARC_32_PCREL:
- if (bfd_link_pic (info)
+ if (bfd_link_pic (info) && !bfd_link_pie (info)
&& ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
|| (h != NULL
&& h->dynindx != -1
else
{
BFD_ASSERT (h->dynindx != -1);
+
+ /* This type of dynamic relocation cannot be created
+ for code sections. */
+ BFD_ASSERT ((input_section->flags & SEC_CODE) == 0);
+
if ((input_section->flags & SEC_ALLOC) != 0)
relocate = FALSE;
else
/* FALLTHROUGH */
case R_ARC_PC32:
case R_ARC_32_PCREL:
- if (bfd_link_pic (info)
+ if (bfd_link_pic (info) && !bfd_link_pie (info)
&& ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
|| (h != NULL
&& h->dynindx != -1