X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-frv.c;h=009507a074c632e6b1a019ca519025ddd6aab386;hb=931a3d91abdad3bd53e3562313759c55feea3aac;hp=f97e0b754687158b8322bc11912cee81564726de;hpb=90219bd0f3e7ff1b4988da0ae32a14f813f7cacc;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index f97e0b7546..009507a074 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -1,5 +1,5 @@ /* FRV-specific support for 32-bit ELF. - Copyright 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -846,62 +846,6 @@ static reloc_howto_type elf32_frv_rel_tlsoff_howto = -/* Map BFD reloc types to FRV ELF reloc types. */ -#if 0 -struct frv_reloc_map -{ - unsigned int bfd_reloc_val; - unsigned int frv_reloc_val; -}; - -static const struct frv_reloc_map frv_reloc_map [] = -{ - { BFD_RELOC_NONE, R_FRV_NONE }, - { BFD_RELOC_32, R_FRV_32 }, - { BFD_RELOC_FRV_LABEL16, R_FRV_LABEL16 }, - { BFD_RELOC_FRV_LABEL24, R_FRV_LABEL24 }, - { BFD_RELOC_FRV_LO16, R_FRV_LO16 }, - { BFD_RELOC_FRV_HI16, R_FRV_HI16 }, - { BFD_RELOC_FRV_GPREL12, R_FRV_GPREL12 }, - { BFD_RELOC_FRV_GPRELU12, R_FRV_GPRELU12 }, - { BFD_RELOC_FRV_GPREL32, R_FRV_GPREL32 }, - { BFD_RELOC_FRV_GPRELHI, R_FRV_GPRELHI }, - { BFD_RELOC_FRV_GPRELLO, R_FRV_GPRELLO }, - { BFD_RELOC_FRV_GOT12, R_FRV_GOT12 }, - { BFD_RELOC_FRV_GOTHI, R_FRV_GOTHI }, - { BFD_RELOC_FRV_GOTLO, R_FRV_GOTLO }, - { BFD_RELOC_FRV_FUNCDESC, R_FRV_FUNCDESC }, - { BFD_RELOC_FRV_FUNCDESC_GOT12, R_FRV_FUNCDESC_GOT12 }, - { BFD_RELOC_FRV_FUNCDESC_GOTHI, R_FRV_FUNCDESC_GOTHI }, - { BFD_RELOC_FRV_FUNCDESC_GOTLO, R_FRV_FUNCDESC_GOTLO }, - { BFD_RELOC_FRV_FUNCDESC_VALUE, R_FRV_FUNCDESC_VALUE }, - { BFD_RELOC_FRV_FUNCDESC_GOTOFF12, R_FRV_FUNCDESC_GOTOFF12 }, - { BFD_RELOC_FRV_FUNCDESC_GOTOFFHI, R_FRV_FUNCDESC_GOTOFFHI }, - { BFD_RELOC_FRV_FUNCDESC_GOTOFFLO, R_FRV_FUNCDESC_GOTOFFLO }, - { BFD_RELOC_FRV_GOTOFF12, R_FRV_GOTOFF12 }, - { BFD_RELOC_FRV_GOTOFFHI, R_FRV_GOTOFFHI }, - { BFD_RELOC_FRV_GOTOFFLO, R_FRV_GOTOFFLO }, - { BFD_RELOC_FRV_GETTLSOFF, R_FRV_GETTLSOFF }, - { BFD_RELOC_FRV_TLSDESC_VALUE, R_FRV_TLSDESC_VALUE }, - { BFD_RELOC_FRV_GOTTLSDESC12, R_FRV_GOTTLSDESC12 }, - { BFD_RELOC_FRV_GOTTLSDESCHI, R_FRV_GOTTLSDESCHI }, - { BFD_RELOC_FRV_GOTTLSDESCLO, R_FRV_GOTTLSDESCLO }, - { BFD_RELOC_FRV_TLSMOFF12, R_FRV_TLSMOFF12 }, - { BFD_RELOC_FRV_TLSMOFFHI, R_FRV_TLSMOFFHI }, - { BFD_RELOC_FRV_TLSMOFFLO, R_FRV_TLSMOFFLO }, - { BFD_RELOC_FRV_GOTTLSOFF12, R_FRV_GOTTLSOFF12 }, - { BFD_RELOC_FRV_GOTTLSOFFHI, R_FRV_GOTTLSOFFHI }, - { BFD_RELOC_FRV_GOTTLSOFFLO, R_FRV_GOTTLSOFFLO }, - { BFD_RELOC_FRV_TLSOFF, R_FRV_TLSOFF }, - { BFD_RELOC_FRV_TLSDESC_RELAX, R_FRV_TLSDESC_RELAX }, - { BFD_RELOC_FRV_GETTLSOFF_RELAX, R_FRV_GETTLSOFF_RELAX }, - { BFD_RELOC_FRV_TLSOFF_RELAX, R_FRV_TLSOFF_RELAX }, - { BFD_RELOC_FRV_TLSMOFF, R_FRV_TLSMOFF }, - { BFD_RELOC_VTABLE_INHERIT, R_FRV_GNU_VTINHERIT }, - { BFD_RELOC_VTABLE_ENTRY, R_FRV_GNU_VTENTRY }, -}; -#endif - extern const bfd_target bfd_elf32_frvfdpic_vec; #define IS_FDPIC(bfd) ((bfd)->xvec == &bfd_elf32_frvfdpic_vec) @@ -1075,15 +1019,7 @@ frvfdpic_elf_link_hash_table_create (bfd *abfd) its function descriptor must be assigned by the dynamic linker. */ #define FRVFDPIC_SYM_LOCAL(INFO, H) \ (_bfd_elf_symbol_refs_local_p ((H), (INFO), 1) \ - || ! elf_hash_table (INFO)->dynamic_sections_created \ - /* These two additional alternatives are needed for TLS - relocations, that use *ABS*+offset relocations to refer to the - TLS section of the local module. FIXME: At some point during - linking, the definition section ceases to be regarded as the - absolute section, and starts being regarded as the undefined - section. */ \ - || bfd_is_abs_section ((H)->root.u.def.section) \ - || bfd_is_und_section ((H)->root.u.def.section)) + || ! elf_hash_table (INFO)->dynamic_sections_created) #define FRVFDPIC_FUNCDESC_LOCAL(INFO, H) \ ((H)->dynindx == -1 || ! elf_hash_table (INFO)->dynamic_sections_created) @@ -1322,46 +1258,6 @@ frvfdpic_pic_merge_early_relocs_info (struct frvfdpic_relocs_info *e2, e2->gotoff |= e1->gotoff; e2->call |= e1->call; e2->sym |= e1->sym; - -#if 0 - /* These are set in _frvfdpic_count_got_plt_entries() or later, and this - function is only called in _frvfdpic_resolve_final_relocs_info(), that - runs just before it, so we don't have to worry about the fields - below. */ - - e2->plt |= e1->plt; - e2->privfd |= e1->privfd; - e2->lazyplt |= e1->lazyplt; - e2->done |= e1->done; - - e2->relocs32 += e1->relocs32; - e2->relocsfd += e1->relocsfd; - e2->relocsfdv += e1->relocsfdv; - e2->relocstlsd += e1->relocstlsd; - e2->relocstlsoff += e1->relocstlsoff; - e2->fixups += e1->fixups; - e2->dynrelocs += e1->dynrelocs; - - if (abs (e1->got_entry) < abs (e2->got_entry)) - e2->got_entry = e1->got_entry; - if (abs (e1->fdgot_entry) < abs (e2->fdgot_entry)) - e2->fdgot_entry = e1->fdgot_entry; - if (abs (e1->fd_entry) < abs (e2->fd_entry)) - e2->fd_entry = e1->fd_entry; - - if (e1->plt_entry < e2->plt_entry) - e2->plt_entry = e1->plt_entry; - if (e1->lzplt_entry < e2->lzplt_entry) - e2->lzplt_entry = e1->lzplt_entry; - - if (abs (e1->tlsoff_entry) < abs (e2->tlsoff_entry)) - e2->tlsoff_entry = e1->tlsoff_entry; - if (abs (e1->tlsdesc_entry) < abs (e2->tlsdesc_entry)) - e2->tlsdesc_entry = e1->tlsdesc_entry; - - if (e1->tlsplt_entry < e2->tlsplt_entry) - t2->tlsplt_entry = t1->tlsplt_entry; -#endif } /* Every block of 65535 lazy PLT entries shares a single call to the @@ -1621,7 +1517,14 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, idx = dynindx; ad = addend; if (ad) - return FALSE; + { + (*info->callbacks->reloc_dangerous) + (info, _("relocation requires zero addend"), + elf_hash_table (info)->dynobj, + frvfdpic_got_section (info), + entry->fdgot_entry); + return FALSE; + } } else { @@ -1763,7 +1666,14 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, else if (entry->lazyplt) { if (ad) - return FALSE; + { + (*info->callbacks->reloc_dangerous) + (info, _("relocation requires zero addend"), + elf_hash_table (info)->dynobj, + frvfdpic_got_section (info), + entry->fd_entry); + return FALSE; + } fd_lazy_rel_offset = ofst; @@ -1940,6 +1850,13 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, && (bfd_is_abs_section (sec) || bfd_is_und_section (sec))) { + if (! elf_hash_table (info)->tls_sec) + { + (*info->callbacks->undefined_symbol) + (info, "TLS section", elf_hash_table (info)->dynobj, + frvfdpic_got_section (info), entry->tlsoff_entry, TRUE); + return FALSE; + } idx = elf_section_data (elf_hash_table (info)->tls_sec)->dynindx; ad += FRVFDPIC_TLS_BIAS; } @@ -2047,6 +1964,13 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, && (bfd_is_abs_section (sec) || bfd_is_und_section (sec))) { + if (! elf_hash_table (info)->tls_sec) + { + (*info->callbacks->undefined_symbol) + (info, "TLS section", elf_hash_table (info)->dynobj, + frvfdpic_got_section (info), entry->tlsdesc_entry, TRUE); + return FALSE; + } idx = elf_section_data (elf_hash_table (info)->tls_sec)->dynindx; ad += FRVFDPIC_TLS_BIAS; } @@ -2974,10 +2898,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, rel->r_addend)) { (*_bfd_error_handler) - (_("%B: relocation at `%A+0x%x' references symbol `%s' with nonzero addend"), - input_bfd, input_section, rel->r_offset, name); + (_("%B(%A+0x%x): relocation to `%s+%x' may have caused the error above"), + input_bfd, input_section, rel->r_offset, name, rel->r_addend); return FALSE; - } break; @@ -3581,14 +3504,16 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, break; -#if 0 /* There's nothing to relax in these. */ - case R_FRV_TLSDESC_VALUE: - case R_FRV_TLSOFF: - case R_FRV_TLSMOFF12: - case R_FRV_TLSMOFFHI: - case R_FRV_TLSMOFFLO: - case R_FRV_TLSMOFF: -#endif + /* + There's nothing to relax in these: + R_FRV_TLSDESC_VALUE + R_FRV_TLSOFF + R_FRV_TLSMOFF12 + R_FRV_TLSMOFFHI + R_FRV_TLSMOFFLO + R_FRV_TLSMOFF + */ + default: break; } @@ -4018,8 +3943,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, if (check_segment[0] != check_segment[1] && IS_FDPIC (output_bfd)) { -#if 1 /* If you take this out, remove the #error from fdpic-static-6.d - in the ld testsuite. */ + /* If you take this out, remove the #error from fdpic-static-6.d + in the ld testsuite. */ /* This helps catch problems in GCC while we can't do more than static linking. The idea is to test whether the input file basename is crt0.o only once. */ @@ -4032,7 +3957,6 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, + strlen (input_bfd->filename) - 7, "/crt0.o") == 0) ? -1 : 0; -#endif if (!silence_segment_error /* We don't want duplicate errors for undefined symbols. */ @@ -5226,32 +5150,8 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_) struct frvfdpic_relocs_info *entry = *entryp; struct _frvfdpic_dynamic_got_plt_info *dinfo = info_; -#if 1 if (entry->privfd) BFD_ASSERT (entry->fd_entry); -#else - /* If this symbol requires a local function descriptor, allocate - one. */ - if (entry->privfd && entry->fd_entry == 0) - { - if (dinfo->got12.fdplt) - { - entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); - dinfo->got12.fdplt -= 8; - } - else if (dinfo->gotlos.fdplt) - { - entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); - dinfo->gotlos.fdplt -= 8; - } - else - { - BFD_ASSERT (dinfo->gothilo.fdplt); - entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); - dinfo->gothilo.fdplt -= 8; - } - } -#endif if (entry->plt) {