#define check_relocs_failed sec_flg1
static bfd_boolean
-elf_x86_64_need_pic (bfd *input_bfd, asection *sec,
+elf_x86_64_need_pic (struct bfd_link_info *info,
+ bfd *input_bfd, asection *sec,
struct elf_link_hash_entry *h,
Elf_Internal_Shdr *symtab_hdr,
Elf_Internal_Sym *isym,
const char *v = "";
const char *und = "";
const char *pic = "";
+ const char *object;
const char *name;
if (h)
pic = _("; recompile with -fPIC");
}
+ if (bfd_link_dll (info))
+ object = _("a shared object");
+ else if (bfd_link_pie (info))
+ object = _("a PIE object");
+ else
+ object = _("a PDE object");
+
/* xgettext:c-format */
_bfd_error_handler (_("%B: relocation %s against %s%s`%s' can "
- "not be used when making a shared object%s"),
- input_bfd, howto->name, und, v, name, pic);
+ "not be used when making %s%s"),
+ input_bfd, howto->name, und, v, name,
+ object, pic);
bfd_set_error (bfd_error_bad_value);
sec->check_relocs_failed = 1;
return FALSE;
case R_X86_64_TPOFF32:
if (!bfd_link_executable (info) && ABI_64_P (abfd))
- return elf_x86_64_need_pic (abfd, sec, h, symtab_hdr, isym,
+ return elf_x86_64_need_pic (info, abfd, sec, h, symtab_hdr, isym,
&x86_64_elf_howto_table[r_type]);
if (eh != NULL)
eh->has_got_reloc = 1;
&& !h->def_regular
&& h->def_dynamic
&& (sec->flags & SEC_READONLY) == 0)))
- return elf_x86_64_need_pic (abfd, sec, h, symtab_hdr, isym,
+ return elf_x86_64_need_pic (info, abfd, sec, h, symtab_hdr, isym,
&x86_64_elf_howto_table[r_type]);
/* Fall through. */
}
if (fail)
- return elf_x86_64_need_pic (input_bfd, input_section,
+ return elf_x86_64_need_pic (info, input_bfd, input_section,
h, NULL, NULL, howto);
}
/* Fall through. */