diff options
author | Bob Wilson <bob.wilson@acm.org> | 2003-07-24 00:13:42 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@acm.org> | 2003-07-24 00:13:42 +0000 |
commit | b536dc1e255dd86c8d25a969069dd21ea0ac6b35 (patch) | |
tree | 3f79f7f29529027d262e5424fa81b33d3f36ee20 | |
parent | f330c8387c52052896dc17735afed62fa4b933df (diff) | |
download | binutils-gdb-b536dc1e255dd86c8d25a969069dd21ea0ac6b35.tar.gz |
* elf32-xtensa.c (plt_reloc_count): Fix typo in comment.
(elf_xtensa_size_dynamic_sections): Use elf_discarded_section.
(elf_xtensa_combine_prop_entries): Avoid returning non-zero without
first printing an error message.
(elf_xtensa_finish_dynamic_sections): Likewise.
(elf_xtensa_discard_info_for_section): Adjust size of .got.loc when
discarding literal table entries.
(elf_xtensa_merge_private_bfd_data): Remove newline from error message.
(elf_xtensa_do_asm_simplify): Likewise.
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/elf32-xtensa.c | 44 |
2 files changed, 43 insertions, 13 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d599c4097f7..a6938f898d2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2003-07-23 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (plt_reloc_count): Fix typo in comment. + (elf_xtensa_size_dynamic_sections): Use elf_discarded_section. + (elf_xtensa_combine_prop_entries): Avoid returning non-zero without + first printing an error message. + (elf_xtensa_finish_dynamic_sections): Likewise. + (elf_xtensa_discard_info_for_section): Adjust size of .got.loc when + discarding literal table entries. + (elf_xtensa_merge_private_bfd_data): Remove newline from error message. + (elf_xtensa_do_asm_simplify): Likewise. + 2003-07-23 Stephane Carrez <stcarrez@nerim.fr> * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Avoid crash when diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 867832f0860..364e681a767 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -233,7 +233,7 @@ typedef struct xtensa_relax_info_struct xtensa_relax_info; The actual PLT code must be split into multiple sections and all the sections have to be created before size_dynamic_sections, where we figure out the exact number of PLT entries that will be - needed. It is OK is this count is an overestimate, e.g., some + needed. It is OK if this count is an overestimate, e.g., some relocations may be removed by GC. */ static int plt_reloc_count = 0; @@ -1264,12 +1264,9 @@ elf_xtensa_size_dynamic_sections (output_bfd, info) continue; for (s = abfd->sections; s != NULL; s = s->next) { - /* Skip input sections that are being discarded. */ - if (!bfd_is_abs_section (s) - && bfd_is_abs_section (s->output_section)) - continue; - - if (xtensa_is_littable_section (s) && s != spltlittbl) + if (! elf_discarded_section (s) + && xtensa_is_littable_section (s) + && s != spltlittbl) sgotloc->_raw_size += s->_raw_size; } } @@ -2259,7 +2256,11 @@ elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc) sgotloc_size = (sgotloc->_cooked_size != 0 ? sgotloc->_cooked_size : sgotloc->_raw_size); if (sgotloc_size != section_size) - return -1; + { + (*_bfd_error_handler) + ("internal inconsistency in size of .got.loc section"); + return -1; + } contents = (bfd_byte *) bfd_malloc (section_size); table = (property_table_entry *) @@ -2479,8 +2480,7 @@ elf_xtensa_finish_dynamic_sections (output_bfd, info) BFD_ASSERT (! info->relocatable); sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit"); sgotloc = bfd_get_section_by_name (dynobj, ".got.loc"); - if (!sxtlit || !sgotloc) - return FALSE; + BFD_ASSERT (sxtlit && sgotloc); num_xtlit_entries = elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc); if (num_xtlit_entries < 0) @@ -2578,7 +2578,7 @@ elf_xtensa_merge_private_bfd_data (ibfd, obfd) if (out_mach != in_mach) { (*_bfd_error_handler) - ("%s: incompatible machine type. Output is 0x%x. Input is 0x%x\n", + ("%s: incompatible machine type. Output is 0x%x. Input is 0x%x", bfd_archive_filename (ibfd), out_mach, in_mach); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2824,6 +2824,24 @@ elf_xtensa_discard_info_for_section (abfd, cookie, info, sec) sec->_cooked_size = section_size - removed_bytes; /* Also shrink _raw_size. See comments in relax_property_section. */ sec->_raw_size = sec->_cooked_size; + + if (xtensa_is_littable_section (sec)) + { + bfd *dynobj = elf_hash_table (info)->dynobj; + if (dynobj) + { + asection *sgotloc = + bfd_get_section_by_name (dynobj, ".got.loc"); + if (sgotloc) + { + bfd_size_type sgotloc_size = + (sgotloc->_cooked_size ? sgotloc->_cooked_size + : sgotloc->_raw_size); + sgotloc->_cooked_size = sgotloc_size - removed_bytes; + sgotloc->_raw_size = sgotloc_size - removed_bytes; + } + } + } } else { @@ -3102,7 +3120,7 @@ elf_xtensa_do_asm_simplify (contents, address, content_length) if (content_length < address) { (*_bfd_error_handler) - ("Attempt to convert L32R/CALLX to CALL failed\n"); + ("Attempt to convert L32R/CALLX to CALL failed"); return bfd_reloc_other; } @@ -3111,7 +3129,7 @@ elf_xtensa_do_asm_simplify (contents, address, content_length) if (direct_call_opcode == XTENSA_UNDEFINED) { (*_bfd_error_handler) - ("Attempt to convert L32R/CALLX to CALL failed\n"); + ("Attempt to convert L32R/CALLX to CALL failed"); return bfd_reloc_other; } |