/* CRIS-specific support for 32-bit ELF.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010 Free Software Foundation, Inc.
+ 2010, 2011 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson, based on elf32-fr30.c
PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22);
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
/* pr_reg */
offset = 70;
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22);
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
/* pr_reg */
offset = 70;
|| r_type == R_CRIS_16_PCREL
|| r_type == R_CRIS_32_PCREL))
relocation = 0;
- else if (!info->relocatable && unresolved_reloc)
+ else if (!info->relocatable && unresolved_reloc
+ && (_bfd_elf_section_offset (output_bfd, info,
+ input_section,
+ rel->r_offset)
+ != (bfd_vma) -1))
{
_bfd_error_handler
(_("%B, section %A: unresolvable relocation %s against symbol `%s'"),
}
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;
- }
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, relend, howto, contents);
if (info->relocatable)
continue;
case R_CRIS_16:
case R_CRIS_32:
if (info->shared
- && r_symndx != 0
+ && r_symndx != STN_UNDEF
&& (input_section->flags & SEC_ALLOC) != 0
&& ((r_type != R_CRIS_8_PCREL
&& r_type != R_CRIS_16_PCREL
{
asection *splt;
asection *sgotplt;
- asection *sgot;
asection *srela;
bfd_vma got_base;
BFD_ASSERT (h->dynindx != -1);
splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got");
sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
srela = bfd_get_section_by_name (dynobj, ".rela.plt");
BFD_ASSERT (splt != NULL && sgotplt != NULL
/* For local symbols, treat these like GOT relocs. */
if (h == NULL)
goto local_got_reloc;
+ else
+ /* For global symbols, adjust the reloc-specific refcount. */
+ elf_cris_hash_entry (h)->gotplt_refcount--;
/* Fall through. */
case R_CRIS_32_PLT_GOTREL:
local_got_refcounts[-1]--;
/* Fall through. */
+ case R_CRIS_8:
+ case R_CRIS_16:
+ case R_CRIS_32:
case R_CRIS_8_PCREL:
case R_CRIS_16_PCREL:
case R_CRIS_32_PCREL:
case R_CRIS_32_PLT_PCREL:
+ /* Negate the increment we did in cris_elf_check_relocs. */
if (h != NULL)
{
if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
{
struct bfd_link_info *info = (struct bfd_link_info *) p;
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link;
+ /* A GOTPLT reloc, when activated, is supposed to be included into
+ the PLT refcount. */
+ BFD_ASSERT (h->gotplt_refcount == 0
+ || h->gotplt_refcount <= h->root.plt.refcount);
/* If nobody wanted a GOTPLT with this symbol, we're done. */
if (h->gotplt_refcount <= 0)
sec,
cris_elf_howto_table[r_type].name);
}
+
+ /* We don't need to handle relocs into sections not going into
+ the "real" output. */
+ if ((sec->flags & SEC_ALLOC) == 0)
+ break;
+
if (h != NULL)
{
h->non_got_ref = 1;
if (! info->shared)
break;
- /* We don't need to handle relocs into sections not going into
- the "real" output. */
- if ((sec->flags & SEC_ALLOC) == 0)
- break;
-
/* We may need to create a reloc section in the dynobj and made room
for this reloc. */
if (sreloc == NULL)
struct elf_cris_pcrel_relocs_copied *s;
struct bfd_link_info *info = (struct bfd_link_info *) inf;
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link;
-
/* If a symbol has been forced local or we have found a regular
definition for the symbolic link case, then we won't be needing
any relocs. */
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link;
-
/* If we're not creating a shared library and have a symbol which is
referred to by .got references, but the symbol is defined locally,
(or rather, not defined by a DSO) then lose the reloc for the .got
}
\f
#define ELF_ARCH bfd_arch_cris
+#define ELF_TARGET_ID CRIS_ELF_DATA
#define ELF_MACHINE_CODE EM_CRIS
#define ELF_MAXPAGESIZE 0x2000