bfd/ChangeLog:

* elf32-frv.c (FRVFDPIC_SYM_LOCAL): Remove special handling for
*ABS*/*UND* sections.
(elf32_frv_relocate_section): Move zero-addend-required error...
(_frv_emit_got_relocs_plt_entries): ... here.  Report error for
missing needed TLS section.
ld/testsuite/ChangeLog:
* ld-frv/fdpic-shared-8-fail.d: Tweak error messages.
This commit is contained in:
Alexandre Oliva
2005-02-07 07:59:34 +00:00
parent 7e990d8e52
commit 303e4c21e7
4 changed files with 47 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2005-02-07 Alexandre Oliva <aoliva@redhat.com>
* elf32-frv.c (FRVFDPIC_SYM_LOCAL): Remove special handling for
*ABS*/*UND* sections.
(elf32_frv_relocate_section): Move zero-addend-required error...
(_frv_emit_got_relocs_plt_entries): ... here. Report error for
missing needed TLS section.
2005-02-07 Hans-Peter Nilsson <hp@axis.com> 2005-02-07 Hans-Peter Nilsson <hp@axis.com>
* aoutx.h (NAME(aout,find_nearest_line)): Correct case for N_SO * aoutx.h (NAME(aout,find_nearest_line)): Correct case for N_SO

View File

@ -1,5 +1,5 @@
/* FRV-specific support for 32-bit ELF. /* 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. This file is part of BFD, the Binary File Descriptor library.
@ -1019,15 +1019,7 @@ frvfdpic_elf_link_hash_table_create (bfd *abfd)
its function descriptor must be assigned by the dynamic linker. */ its function descriptor must be assigned by the dynamic linker. */
#define FRVFDPIC_SYM_LOCAL(INFO, H) \ #define FRVFDPIC_SYM_LOCAL(INFO, H) \
(_bfd_elf_symbol_refs_local_p ((H), (INFO), 1) \ (_bfd_elf_symbol_refs_local_p ((H), (INFO), 1) \
|| ! elf_hash_table (INFO)->dynamic_sections_created \ || ! 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))
#define FRVFDPIC_FUNCDESC_LOCAL(INFO, H) \ #define FRVFDPIC_FUNCDESC_LOCAL(INFO, H) \
((H)->dynindx == -1 || ! elf_hash_table (INFO)->dynamic_sections_created) ((H)->dynindx == -1 || ! elf_hash_table (INFO)->dynamic_sections_created)
@ -1525,7 +1517,14 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
idx = dynindx; idx = dynindx;
ad = addend; ad = addend;
if (ad) 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 else
{ {
@ -1667,7 +1666,14 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
else if (entry->lazyplt) else if (entry->lazyplt)
{ {
if (ad) 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; fd_lazy_rel_offset = ofst;
@ -1844,6 +1850,13 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
&& (bfd_is_abs_section (sec) && (bfd_is_abs_section (sec)
|| bfd_is_und_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; idx = elf_section_data (elf_hash_table (info)->tls_sec)->dynindx;
ad += FRVFDPIC_TLS_BIAS; ad += FRVFDPIC_TLS_BIAS;
} }
@ -1951,6 +1964,13 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
&& (bfd_is_abs_section (sec) && (bfd_is_abs_section (sec)
|| bfd_is_und_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; idx = elf_section_data (elf_hash_table (info)->tls_sec)->dynindx;
ad += FRVFDPIC_TLS_BIAS; ad += FRVFDPIC_TLS_BIAS;
} }
@ -2878,10 +2898,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
rel->r_addend)) rel->r_addend))
{ {
(*_bfd_error_handler) (*_bfd_error_handler)
(_("%B: relocation at `%A+0x%x' references symbol `%s' with nonzero addend"), (_("%B(%A+0x%x): relocation to `%s+%x' may have caused the error above"),
input_bfd, input_section, rel->r_offset, name); input_bfd, input_section, rel->r_offset, name, rel->r_addend);
return FALSE; return FALSE;
} }
break; break;

View File

@ -1,3 +1,7 @@
2005-02-07 Alexandre Oliva <aoliva@redhat.com>
* ld-frv/fdpic-shared-8-fail.d: Tweak error messages.
2005-02-07 Hans-Peter Nilsson <hp@axis.com> 2005-02-07 Hans-Peter Nilsson <hp@axis.com>
* ld-cris/libdso-13.d: Adjust for being identified as warning. * ld-cris/libdso-13.d: Adjust for being identified as warning.

View File

@ -3,4 +3,4 @@
#objdump: -DR -j .text -j .data -j .got -j .plt #objdump: -DR -j .text -j .data -j .got -j .plt
#as: -mfdpic #as: -mfdpic
#ld: -shared #ld: -shared
#error: nonzero addend #error: (nonzero addend|may have caused)