From 303e4c21e7c9ddd98c577051f5c477f11a5c06ec Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Mon, 7 Feb 2005 07:59:34 +0000 Subject: [PATCH] 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. --- bfd/ChangeLog | 8 ++++ bfd/elf32-frv.c | 49 ++++++++++++++++------- ld/testsuite/ChangeLog | 4 ++ ld/testsuite/ld-frv/fdpic-shared-8-fail.d | 2 +- 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 03eb8d8d506..32ba92eee9d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2005-02-07 Alexandre Oliva + + * 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 * aoutx.h (NAME(aout,find_nearest_line)): Correct case for N_SO diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 6bb3e204700..009507a074c 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. @@ -1019,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) @@ -1525,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 { @@ -1667,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; @@ -1844,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; } @@ -1951,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; } @@ -2878,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; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 6ca476aa6b6..cfc219261de 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-02-07 Alexandre Oliva + + * ld-frv/fdpic-shared-8-fail.d: Tweak error messages. + 2005-02-07 Hans-Peter Nilsson * ld-cris/libdso-13.d: Adjust for being identified as warning. diff --git a/ld/testsuite/ld-frv/fdpic-shared-8-fail.d b/ld/testsuite/ld-frv/fdpic-shared-8-fail.d index 7f16a426434..08472cd1556 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-8-fail.d +++ b/ld/testsuite/ld-frv/fdpic-shared-8-fail.d @@ -3,4 +3,4 @@ #objdump: -DR -j .text -j .data -j .got -j .plt #as: -mfdpic #ld: -shared -#error: nonzero addend +#error: (nonzero addend|may have caused) -- 2.30.2