/* FRV-specific support for 32-bit ELF.
- Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
struct elf_link_hash_entry *h;
bfd_vma relocation;
bfd_reloc_status_type r;
- const char * name = NULL;
+ const char *name;
int r_type;
asection *osec;
struct frvfdpic_relocs_info *picrel;
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
- name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+ if (name == NULL || name[0] == 0)
+ name = bfd_section_name (input_bfd, sec);
}
else
{
h, sec, relocation,
unresolved_reloc, warned);
osec = sec;
+ name = h->root.root.string;
}
- if (sec != NULL && elf_discarded_section (sec))
- {
- /* For relocs against symbols from removed linkonce sections,
- or sections discarded by a linker script, we just want the
- section contents zeroed. Avoid any special processing. */
- _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
- rel->r_info = 0;
- rel->r_addend = 0;
- continue;
- }
+ if (sec != NULL && discarded_section (sec))
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, 1, relend, howto, 0, contents);
if (info->relocatable)
continue;
osec, sym,
rel->r_addend))
{
- (*_bfd_error_handler)
- (_("%B(%A+0x%x): relocation to `%s+%x' may have caused the error above"),
+ info->callbacks->einfo
+ (_("%H: relocation to `%s+%v'"
+ " may have caused the error above\n"),
input_bfd, input_section, rel->r_offset, name, rel->r_addend);
return FALSE;
}
default:
non_fdpic:
picrel = NULL;
- if (h && ! FRVFDPIC_SYM_LOCAL (info, h))
+ if (h
+ && ! FRVFDPIC_SYM_LOCAL (info, h)
+ && _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset) != (bfd_vma) -1)
{
- info->callbacks->warning
- (info, _("relocation references symbol not defined in the module"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: relocation references symbol"
+ " not defined in the module\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
break;
/* Is this a call instruction? */
if ((insn & (unsigned long)0x01fc0000) != 0x003c0000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GETTLSOFF not applied to a call instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GETTLSOFF not applied to a call instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this an lddi instruction? */
if ((insn & (unsigned long)0x01fc0000) != 0x00cc0000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GOTTLSDESC12 not applied to an lddi instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSDESC12"
+ " not applied to an lddi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a sethi instruction? */
if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GOTTLSDESCHI not applied to a sethi instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSDESCHI"
+ " not applied to a sethi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a setlo or setlos instruction? */
if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GOTTLSDESCLO"
- " not applied to a setlo or setlos instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSDESCLO"
+ " not applied to a setlo or setlos instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this an ldd instruction? */
if ((insn & (unsigned long)0x01fc0fc0) != 0x00080140)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_TLSDESC_RELAX not applied to an ldd instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_TLSDESC_RELAX"
+ " not applied to an ldd instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a calll or callil instruction? */
if ((insn & (unsigned long)0x7ff80fc0) != 0x02300000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GETTLSOFF_RELAX"
- " not applied to a calll instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GETTLSOFF_RELAX"
+ " not applied to a calll instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this an ldi instruction? */
if ((insn & (unsigned long)0x01fc0000) != 0x00c80000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GOTTLSOFF12 not applied to an ldi instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSOFF12"
+ " not applied to an ldi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a sethi instruction? */
if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GOTTLSOFFHI not applied to a sethi instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSOFFHI"
+ " not applied to a sethi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a setlo or setlos instruction? */
if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_GOTTLSOFFLO"
- " not applied to a setlo or setlos instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_GOTTLSOFFLO"
+ " not applied to a setlo or setlos instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this an ld instruction? */
if ((insn & (unsigned long)0x01fc0fc0) != 0x00080100)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_TLSOFF_RELAX not applied to an ld instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_TLSOFF_RELAX"
+ " not applied to an ld instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a sethi instruction? */
if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_TLSMOFFHI not applied to a sethi instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_TLSMOFFHI"
+ " not applied to a sethi instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
/* Is this a setlo or setlos instruction? */
if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
{
- r = info->callbacks->warning
- (info,
- _("R_FRV_TLSMOFFLO"
- " not applied to a setlo or setlos instruction"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("R_FRV_TLSMOFFLO"
+ " not applied to a setlo or setlos instruction\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
{
if (addend)
{
- info->callbacks->warning
- (info, _("R_FRV_FUNCDESC references dynamic symbol with nonzero addend"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_FUNCDESC references dynamic symbol"
+ " with nonzero addend\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
dynindx = h->dynindx;
input_section
->output_section))
{
- info->callbacks->warning
- (info,
- _("cannot emit fixups in read-only section"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: cannot emit fixups"
+ " in read-only section\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
input_section
->output_section))
{
- info->callbacks->warning
- (info,
- _("cannot emit dynamic relocations in read-only section"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: cannot emit dynamic relocations"
+ " in read-only section\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
{
if (addend && r_type == R_FRV_FUNCDESC_VALUE)
{
- info->callbacks->warning
- (info, _("R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: R_FRV_FUNCDESC_VALUE"
+ " references dynamic symbol with nonzero addend\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
dynindx = h->dynindx;
input_section
->output_section))
{
- info->callbacks->warning
- (info,
- _("cannot emit fixups in read-only section"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: cannot emit fixups in read-only section\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
if (!h || h->root.type != bfd_link_hash_undefweak)
input_section
->output_section))
{
- info->callbacks->warning
- (info,
- _("cannot emit dynamic relocations in read-only section"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: cannot emit dynamic relocations"
+ " in read-only section\n"),
+ input_bfd, input_section, rel->r_offset);
return FALSE;
}
if (silence_segment_error == 1)
silence_segment_error =
(strlen (input_bfd->filename) == 6
- && strcmp (input_bfd->filename, "crt0.o") == 0)
+ && filename_cmp (input_bfd->filename, "crt0.o") == 0)
|| (strlen (input_bfd->filename) > 6
- && strcmp (input_bfd->filename
- + strlen (input_bfd->filename) - 7,
+ && filename_cmp (input_bfd->filename
+ + strlen (input_bfd->filename) - 7,
"/crt0.o") == 0)
? -1 : 0;
if (!silence_segment_error
&& !(picrel && picrel->symndx == -1
&& picrel->d.h->root.type == bfd_link_hash_undefined))
{
- if (info->shared || info->pie)
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): reloc against `%s': %s"),
- input_bfd, input_section, (long)rel->r_offset, name,
- _("relocation references a different segment"));
- else
- info->callbacks->warning
- (info,
- _("relocation references a different segment"),
- name, input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_("%H: reloc against `%s' references a different segment\n"),
+ input_bfd, input_section, rel->r_offset, name);
}
if (!silence_segment_error && (info->shared || info->pie))
return FALSE;
if (msg)
{
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): reloc against `%s': %s"),
- input_bfd, input_section, (long)rel->r_offset, name, msg);
+ info->callbacks->einfo
+ (_("%H: reloc against `%s': %s\n"),
+ input_bfd, input_section, rel->r_offset, name, msg);
return FALSE;
}
/* Account for relaxation of .eh_frame section. */
for (s = ibfd->sections; s; s = s->next)
- if (s->sec_info_type == ELF_INFO_TYPE_EH_FRAME)
+ if (s->sec_info_type == SEC_INFO_TYPE_EH_FRAME)
{
if (!_frvfdpic_check_discarded_relocs (ibfd, s, info, &changed))
return FALSE;
!= (frvfdpic_gotfixup_section (info)->reloc_count * 4))
{
error:
- (*_bfd_error_handler)
- ("LINKER BUG: .rofixup section size mismatch");
+ info->callbacks->einfo
+ ("LINKER BUG: .rofixup section size mismatch\n");
return FALSE;
}
FALSE, FALSE, TRUE);
if (hend
&& (hend->type == bfd_link_hash_defined
- || hend->type == bfd_link_hash_defweak))
+ || hend->type == bfd_link_hash_defweak)
+ && hend->u.def.section->output_section != NULL)
{
bfd_vma value =
frvfdpic_gotfixup_section (info)->output_section->vma
default:
bad_reloc:
- (*_bfd_error_handler)
- (_("%B: unsupported relocation type %i"),
+ info->callbacks->einfo
+ (_("%B: unsupported relocation type %i\n"),
abfd, ELF32_R_TYPE (rel->r_info));
return FALSE;
}
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
/* `pr_pid' is at offset 24. */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
/* `pr_reg' is at offset 72. */
offset = 72;
return TRUE;
}
#define ELF_ARCH bfd_arch_frv
+#define ELF_TARGET_ID FRV_ELF_DATA
#define ELF_MACHINE_CODE EM_CYGNUS_FRV
#define ELF_MAXPAGESIZE 0x1000