This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/cris.h"
FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- TRUE) /* pcrel_offset */
+ TRUE), /* pcrel_offset */
+
+ /* We don't handle these in any special manner and cross-format
+ linking is not supported; just recognize them enough to pass them
+ around. FIXME: do the same for most PIC relocs and add sanity
+ tests to actually refuse gracefully to handle these and PIC
+ relocs for cross-format linking. */
+#define TLSHOWTO32(name) \
+ HOWTO (name, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, \
+ bfd_elf_generic_reloc, #name, FALSE, 0, 0xffffffff, FALSE)
+#define TLSHOWTO16(name) \
+ HOWTO (name, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, \
+ bfd_elf_generic_reloc, #name, FALSE, 0, 0xffff, FALSE)
+
+ TLSHOWTO32 (R_CRIS_32_GOT_GD),
+ TLSHOWTO16 (R_CRIS_16_GOT_GD),
+ TLSHOWTO32 (R_CRIS_32_GD),
+ TLSHOWTO32 (R_CRIS_DTP),
+ TLSHOWTO32 (R_CRIS_32_DTPREL),
+ TLSHOWTO16 (R_CRIS_16_DTPREL),
+ TLSHOWTO32 (R_CRIS_32_GOT_TPREL),
+ TLSHOWTO16 (R_CRIS_16_GOT_TPREL),
+ TLSHOWTO32 (R_CRIS_32_TPREL),
+ TLSHOWTO16 (R_CRIS_16_TPREL),
+ TLSHOWTO32 (R_CRIS_DTPMOD)
};
\f
/* Map BFD reloc types to CRIS ELF reloc types. */
{ BFD_RELOC_CRIS_32_GOTPLT, R_CRIS_32_GOTPLT },
{ BFD_RELOC_CRIS_32_GOTREL, R_CRIS_32_GOTREL },
{ BFD_RELOC_CRIS_32_PLT_GOTREL, R_CRIS_32_PLT_GOTREL },
- { BFD_RELOC_CRIS_32_PLT_PCREL, R_CRIS_32_PLT_PCREL }
+ { BFD_RELOC_CRIS_32_PLT_PCREL, R_CRIS_32_PLT_PCREL },
+ { BFD_RELOC_CRIS_32_GOT_GD, R_CRIS_32_GOT_GD },
+ { BFD_RELOC_CRIS_16_GOT_GD, R_CRIS_16_GOT_GD },
+ { BFD_RELOC_CRIS_32_GD, R_CRIS_32_GD },
+ { BFD_RELOC_CRIS_DTP, R_CRIS_DTP },
+ { BFD_RELOC_CRIS_32_DTPREL, R_CRIS_32_DTPREL },
+ { BFD_RELOC_CRIS_16_DTPREL, R_CRIS_16_DTPREL },
+ { BFD_RELOC_CRIS_32_GOT_TPREL, R_CRIS_32_GOT_TPREL },
+ { BFD_RELOC_CRIS_16_GOT_TPREL, R_CRIS_16_GOT_TPREL },
+ { BFD_RELOC_CRIS_32_TPREL, R_CRIS_32_TPREL },
+ { BFD_RELOC_CRIS_16_TPREL, R_CRIS_16_TPREL },
+ { BFD_RELOC_CRIS_DTPMOD, R_CRIS_DTPMOD }
};
static reloc_howto_type *
asection *sgot;
asection *srelgot;
+ if (info->relocatable)
+ return TRUE;
+
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
return TRUE;
{
bfd *dynobj;
asection *s;
- unsigned int power_of_two;
bfd_size_type plt_entry_size;
dynobj = elf_hash_table (info)->dynobj;
h->needs_copy = 1;
}
- /* Historic precedent: m68k and i386 allow max 8-byte alignment for the
- thing to copy; so do we. */
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (!bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Look through the relocs for a section during the first phase. */
{
bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+ struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
local_got_refcounts = elf_local_got_refcounts (abfd);
sgot = NULL;
srelgot = NULL;
sreloc = NULL;
- if (!elf_bad_symtab (abfd))
- sym_hashes_end -= symtab_hdr->sh_info;
-
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_CRIS_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ BFD_ASSERT (h != NULL);
+ if (h != NULL
+ && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return FALSE;
break;