diff options
96 files changed, 351 insertions, 334 deletions
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 8c4d4f7..1213a15 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -801,7 +801,6 @@ mips_relocate_section (bfd *output_bfd, bool gp_undefined; struct external_reloc *ext_rel; struct external_reloc *ext_rel_end; - unsigned int i; bool got_lo; struct internal_reloc lo_int_rel; bfd_size_type amt; @@ -861,7 +860,7 @@ mips_relocate_section (bfd *output_bfd, ext_rel = (struct external_reloc *) external_relocs; ext_rel_end = ext_rel + input_section->reloc_count; - for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++) + for (; ext_rel < ext_rel_end; ext_rel++) { struct internal_reloc int_rel; bool use_lo = false; diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 5af11cf..c02e34e 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -3273,10 +3273,9 @@ extern asection _bfd_elf_large_com_section; link, we remove such relocations. Otherwise, we just want the section contents zeroed and avoid any special processing. */ #define RELOC_AGAINST_DISCARDED_SECTION(info, input_bfd, input_section, \ - rel, count, relend, \ + rel, count, relend, rnone, \ howto, index, contents) \ { \ - int i_; \ _bfd_clear_contents (howto, input_bfd, input_section, \ contents, rel[index].r_offset); \ \ @@ -3288,30 +3287,25 @@ extern asection _bfd_elf_large_com_section; && ((input_section->flags & SEC_DEBUGGING) != 0 \ || elf_section_type (input_section) == SHT_GNU_SFRAME)) \ { \ - Elf_Internal_Shdr *rel_hdr; \ + Elf_Internal_Shdr *rel_hdr \ + = _bfd_elf_single_rel_hdr (input_section->output_section); \ \ - rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \ + rel_hdr->sh_size -= rel_hdr->sh_entsize; \ + rel_hdr = _bfd_elf_single_rel_hdr (input_section); \ + rel_hdr->sh_size -= rel_hdr->sh_entsize; \ \ - /* Avoid empty output section. */ \ - if (rel_hdr->sh_size > rel_hdr->sh_entsize) \ - { \ - rel_hdr->sh_size -= rel_hdr->sh_entsize; \ - rel_hdr = _bfd_elf_single_rel_hdr (input_section); \ - rel_hdr->sh_size -= rel_hdr->sh_entsize; \ + memmove (rel, rel + count, \ + (relend - rel - count) * sizeof (*rel)); \ \ - memmove (rel, rel + count, \ - (relend - rel - count) * sizeof (*rel)); \ - \ - input_section->reloc_count -= count; \ - relend -= count; \ - rel--; \ - continue; \ - } \ + input_section->reloc_count -= count; \ + relend -= count; \ + rel--; \ + continue; \ } \ \ - for (i_ = 0; i_ < count; i_++) \ + for (int i_ = 0; i_ < count; i_++) \ { \ - rel[i_].r_info = 0; \ + rel[i_].r_info = rnone; \ rel[i_].r_addend = 0; \ } \ rel += count - 1; \ diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 246e335..ca9a92e 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -390,7 +390,8 @@ mn10200_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MN10200_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 3aeaa06..ba99386 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -2101,7 +2101,8 @@ mn10300_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MN10300_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index 0a6e665..a78516d 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -1947,6 +1947,18 @@ elf_arc_relocate_section (bfd * output_bfd, return false; } + if (wrel != rel) + { + Elf_Internal_Shdr *rel_hdr; + size_t deleted = rel - wrel; + + rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); + rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; + rel_hdr = _bfd_elf_single_rel_hdr (input_section); + rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; + input_section->reloc_count -= deleted; + } + return true; } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index c913f2b..e4376f0 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -6527,16 +6527,15 @@ elf32_arm_size_stubs (bfd *output_bfd, while (1) { bfd *input_bfd; - unsigned int bfd_indx; asection *stub_sec; enum elf32_arm_stub_type stub_type; bool stub_changed = false; unsigned prev_num_a8_fixes = num_a8_fixes; num_a8_fixes = 0; - for (input_bfd = info->input_bfds, bfd_indx = 0; + for (input_bfd = info->input_bfds; input_bfd != NULL; - input_bfd = input_bfd->link.next, bfd_indx++) + input_bfd = input_bfd->link.next) { Elf_Internal_Shdr *symtab_hdr; asection *section; @@ -13379,7 +13378,8 @@ elf32_arm_relocate_section (bfd * output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_ARM_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index a98f181..6653e4d 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1474,7 +1474,8 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_AVR_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 7ac95a0..249c6b5 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1376,7 +1376,6 @@ bfin_relocate_section (bfd * output_bfd, asection *sgot; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - int i = 0; dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -1387,7 +1386,7 @@ bfin_relocate_section (bfd * output_bfd, rel = relocs; relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++, i++) + for (; rel < relend; rel++) { int r_type; reloc_howto_type *howto; @@ -1442,7 +1441,8 @@ bfin_relocate_section (bfd * output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_BFIN_UNUSED0, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; @@ -2583,7 +2583,8 @@ bfinfdpic_relocate_section (bfd * output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_BFIN_UNUSED0, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 68ac71f..fc2e2d4 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -1384,7 +1384,8 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_CR16_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 306d3e7..285c6c7 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -1129,7 +1129,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_CRIS_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c index 3516ef7..d2bc1f7 100644 --- a/bfd/elf32-crx.c +++ b/bfd/elf32-crx.c @@ -879,7 +879,8 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_CRX_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 47a6389..2a08659 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -3446,13 +3446,12 @@ elf32_csky_size_stubs (bfd *output_bfd, while (1) { bfd *input_bfd; - unsigned int bfd_indx; asection *stub_sec; bool stub_changed = false; - for (input_bfd = info->input_bfds, bfd_indx = 0; + for (input_bfd = info->input_bfds; input_bfd != NULL; - input_bfd = input_bfd->link.next, bfd_indx++) + input_bfd = input_bfd->link.next) { Elf_Internal_Shdr *symtab_hdr; asection *section; @@ -4381,8 +4380,8 @@ csky_elf_relocate_section (bfd * output_bfd, else #endif RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, - contents); + rel, 1, relend, R_CKCORE_NONE, + howto, 0, contents); } if (bfd_link_relocatable (info)) diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index e8df171..5474f57 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -470,7 +470,8 @@ elf32_d10v_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_D10V_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c index fe2250f..ea60ce4 100644 --- a/bfd/elf32-epiphany.c +++ b/bfd/elf32-epiphany.c @@ -533,7 +533,8 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_EPIPHANY_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 5c5dfd7..d0ca4e8 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -565,7 +565,8 @@ fr30_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_FR30_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index b129086..0423540 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -2753,7 +2753,8 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_FRV_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-ft32.c b/bfd/elf32-ft32.c index fb0e990..6ca1755 100644 --- a/bfd/elf32-ft32.c +++ b/bfd/elf32-ft32.c @@ -403,7 +403,8 @@ ft32_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_FT32_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index a428e07..e183577 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -480,7 +480,8 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_H8_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 759912d..80b89fa 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -3594,7 +3594,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (sym_sec != NULL && discarded_section (sym_sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rela, 1, relend, + rela, 1, relend, R_PARISC_NONE, elf_hppa_howto_table + r_type, 0, contents); diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index b417cb0..abe26e4 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -3600,14 +3600,6 @@ elf_i386_relocate_section (bfd *output_bfd, rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; - if (rel_hdr->sh_size == 0) - { - /* It is too late to remove an empty reloc section. Leave - one NONE reloc. - ??? What is wrong with an empty section??? */ - rel_hdr->sh_size = rel_hdr->sh_entsize; - deleted -= 1; - } rel_hdr = _bfd_elf_single_rel_hdr (input_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; input_section->reloc_count -= deleted; diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index 0d08247..5c28a06 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1448,7 +1448,8 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_IP2K_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index b53188e..11d6e1e 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -642,7 +642,8 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_IQ2000_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 45264d6..b36e92d 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -794,7 +794,8 @@ lm32_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_LM32_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index 890a0ac..8f6881b 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -485,7 +485,8 @@ m32c_elf_relocate_section if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_M32C_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 022b0ac..49cc5fc 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -2354,7 +2354,8 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_M32R_NONE, + howto, 0, contents); if (bfd_link_relocatable (info) && !use_rel) { diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 7929d55..7e8e038 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -1015,7 +1015,8 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_M68HC11_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index d7387d9..84ad64a 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -3500,7 +3500,8 @@ elf_m68k_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_68K_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 0a65276..2d4e7a9 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -480,7 +480,8 @@ mcore_elf_relocate_section (bfd * output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MCORE_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c index 300e057..0188fd0 100644 --- a/bfd/elf32-mep.c +++ b/bfd/elf32-mep.c @@ -489,7 +489,8 @@ mep_elf_relocate_section if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MEP_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 9959a1f..0e6cfd8 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1383,44 +1383,6 @@ metag_final_link_relocate (reloc_howto_type *howto, return r; } -/* This is defined because R_METAG_NONE != 0... - See RELOC_AGAINST_DISCARDED_SECTION for details. */ -#define METAG_RELOC_AGAINST_DISCARDED_SECTION(info, input_bfd, input_section, \ - rel, relend, howto, contents) \ - { \ - _bfd_clear_contents (howto, input_bfd, input_section, \ - contents, rel->r_offset); \ - \ - if (bfd_link_relocatable (info) \ - && (input_section->flags & SEC_DEBUGGING)) \ - { \ - /* Only remove relocations in debug sections since other \ - sections may require relocations. */ \ - Elf_Internal_Shdr *rel_hdr; \ - \ - rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \ - \ - /* Avoid empty output section. */ \ - if (rel_hdr->sh_size > rel_hdr->sh_entsize) \ - { \ - rel_hdr->sh_size -= rel_hdr->sh_entsize; \ - rel_hdr = _bfd_elf_single_rel_hdr (input_section); \ - rel_hdr->sh_size -= rel_hdr->sh_entsize; \ - \ - memmove (rel, rel + 1, (relend - rel) * sizeof (*rel)); \ - \ - input_section->reloc_count--; \ - relend--; \ - rel--; \ - continue; \ - } \ - } \ - \ - rel->r_info = R_METAG_NONE; \ - rel->r_addend = 0; \ - continue; \ - } - /* Relocate a META ELF section. The RELOCATE_SECTION function is called by the new ELF backend linker @@ -1529,8 +1491,9 @@ elf_metag_relocate_section (bfd *output_bfd, } if (sec != NULL && discarded_section (sec)) - METAG_RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, relend, howto, contents); + RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, + rel, 1, relend, R_METAG_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 57c37c5..db7ed46 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -1765,7 +1765,6 @@ microblaze_elf_relax_section (bfd *abfd, Elf_Internal_Rela *irel, *irelend; bfd_byte *contents = NULL; bfd_byte *free_contents = NULL; - int rel_count; unsigned int shndx; size_t i, sym_index; asection *o; @@ -1818,8 +1817,7 @@ microblaze_elf_relax_section (bfd *abfd, goto error_return; irelend = internal_relocs + sec->reloc_count; - rel_count = 0; - for (irel = internal_relocs; irel < irelend; irel++, rel_count++) + for (irel = internal_relocs; irel < irelend; irel++) { bfd_vma symval; if ((ELF32_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL) @@ -1935,10 +1933,9 @@ microblaze_elf_relax_section (bfd *abfd, if (sdata->relax_count > 0) { shndx = _bfd_elf_section_from_bfd_section (abfd, sec); - rel_count = 0; sdata->relax[sdata->relax_count].addr = sec->size; - for (irel = internal_relocs; irel < irelend; irel++, rel_count++) + for (irel = internal_relocs; irel < irelend; irel++) { bfd_vma nraddr; diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index 949a8ed..d2a95f5 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -259,7 +259,8 @@ moxie_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MOXIE_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 7709965..3b356bf 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -1477,7 +1477,8 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MSP430_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index ed4acef..b1ba28b 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -363,7 +363,8 @@ mt_elf_relocate_section if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MT_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 3627b30..bcd7c42 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -4344,7 +4344,6 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *symtab_hdr; asection *sgot; char *local_tls_type; - unsigned long symndx; bfd_vma *local_tlsdesc_gotent; if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) @@ -4386,8 +4385,8 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, sgot = elf_hash_table (info)->sgot; local_tls_type = elf32_nds32_local_got_tls_type (ibfd); local_tlsdesc_gotent = elf32_nds32_local_tlsdesc_gotent (ibfd); - for (symndx = 0; local_got < end_local_got; - ++local_got, ++local_tls_type, ++local_tlsdesc_gotent, ++symndx) + for (; local_got < end_local_got; + ++local_got, ++local_tls_type, ++local_tlsdesc_gotent) { if (*local_got > 0) { diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index bdee1f1..b17a872 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -1407,7 +1407,8 @@ or1k_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_OR1K_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index f17effd..3fd9f28 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -9142,15 +9142,6 @@ ppc_elf_relocate_section (bfd *output_bfd, rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; - if (rel_hdr->sh_size == 0) - { - /* It is too late to remove an empty reloc section. Leave - one NONE reloc. - ??? What is wrong with an empty section??? */ - rel_hdr->sh_size = rel_hdr->sh_entsize; - deleted -= 1; - wrel++; - } relend = wrel; rel_hdr = _bfd_elf_single_rel_hdr (input_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c index 586519a..45a86be 100644 --- a/bfd/elf32-pru.c +++ b/bfd/elf32-pru.c @@ -750,7 +750,8 @@ pru_elf32_relocate_section (bfd *output_bfd, if (sec && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_PRU_NONE, + howto, 0, contents); /* Nothing more to do unless this is a final link. */ if (bfd_link_relocatable (info)) diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index c0b8850..e2ea6b1 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -772,7 +772,8 @@ rl78_elf_relocate_section if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_RL78_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index 219c838..d8a2236 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -652,7 +652,8 @@ rx_elf_relocate_section if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_RX_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 470335c..40fcb53 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -2145,7 +2145,8 @@ elf_s390_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_390_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 63a1854..57bf04d 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -2671,7 +2671,8 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_SCORE_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 4482155..cbbff13 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -2447,7 +2447,8 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_SCORE_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index abb7f5e..d3f3a56 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -3697,7 +3697,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_SH_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index 919b839..de051e4 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -4938,7 +4938,8 @@ spu_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_SPU_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 0adab1a..cc204c2 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -2220,7 +2220,8 @@ elf32_tic6x_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_C6000_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index 6f90172..3e3a068 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -2607,7 +2607,8 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_TILEPRO_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 0c52389..2774481 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -2253,7 +2253,8 @@ v850_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_V850_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 9d1fee8..4cb69ad 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1304,7 +1304,8 @@ elf_vax_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_VAX_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c index 8e8fb75..cf36702 100644 --- a/bfd/elf32-visium.c +++ b/bfd/elf32-visium.c @@ -615,17 +615,9 @@ visium_elf_relocate_section (bfd *output_bfd, } if (sec != NULL && discarded_section (sec)) - { - /* For relocs against symbols from removed linkonce sections, - or sections discarded by a linker script, we just want the - section contents zeroed. Avoid any special processing. */ - _bfd_clear_contents (howto, input_bfd, input_section, - contents, rel->r_offset); - - rel->r_info = 0; - rel->r_addend = 0; - continue; - } + RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, + rel, 1, relend, R_VISIUM_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 3fe619d..5cee2f3 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -824,7 +824,8 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_XSTORMY16_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index f9c006c..6f8a4fa7 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -2617,7 +2617,8 @@ elf_xtensa_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_XTENSA_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf32-z80.c b/bfd/elf32-z80.c index 3134017..8751633 100644 --- a/bfd/elf32-z80.c +++ b/bfd/elf32-z80.c @@ -441,7 +441,8 @@ z80_elf_relocate_section (bfd *output_bfd, reloc_howto_type *howto; howto = z80_rtype_to_howto (input_bfd, r_type); RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_Z80_NONE, + howto, 0, contents); } if (bfd_link_relocatable (info)) diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index b3570ce..55aebca 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -4093,7 +4093,7 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, + rel, 1, relend, R_ALPHA_NONE, elf64_alpha_howto_table + r_type, 0, contents); @@ -4300,7 +4300,8 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_ALPHA_NONE, + howto, 0, contents); addend = rel->r_addend; value += addend; diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c index 43ae6fe..c9be282 100644 --- a/bfd/elf64-bpf.c +++ b/bfd/elf64-bpf.c @@ -241,7 +241,8 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_BPF_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 3f5a3fe..7b80603 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -3865,7 +3865,8 @@ elf64_hppa_relocate_section (bfd *output_bfd, if (sym_sec != NULL && discarded_section (sym_sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_PARISC_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 87cc16d..822b263 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -3518,7 +3518,8 @@ elf64_ia64_relocate_section (bfd *output_bfd, section contents zeroed. Avoid any special processing. */ if (sym_sec != NULL && discarded_section (sym_sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_IA64_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 1b5a65d..bb83507 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -1426,7 +1426,8 @@ mmix_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_MMIX_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) { diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 3e768dc..e6c90a6 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -13819,15 +13819,14 @@ ppc64_elf_size_stubs (struct bfd_link_info *info) while (1) { bfd *input_bfd; - unsigned int bfd_indx; struct map_stub *group; htab->stub_iteration += 1; htab->relr_count = 0; - for (input_bfd = info->input_bfds, bfd_indx = 0; + for (input_bfd = info->input_bfds; input_bfd != NULL; - input_bfd = input_bfd->link.next, bfd_indx++) + input_bfd = input_bfd->link.next) { Elf_Internal_Shdr *symtab_hdr; asection *section; @@ -18083,14 +18082,6 @@ ppc64_elf_relocate_section (bfd *output_bfd, rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; - if (rel_hdr->sh_size == 0) - { - /* It is too late to remove an empty reloc section. Leave - one NONE reloc. - ??? What is wrong with an empty section??? */ - rel_hdr->sh_size = rel_hdr->sh_entsize; - deleted -= 1; - } rel_hdr = _bfd_elf_single_rel_hdr (input_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; input_section->reloc_count -= deleted; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index a79cc47..6ae62a9 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2386,7 +2386,8 @@ elf_s390_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_390_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index ebd2eb4..b6f97b5 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -5099,14 +5099,6 @@ elf_x86_64_relocate_section (bfd *output_bfd, rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; - if (rel_hdr->sh_size == 0) - { - /* It is too late to remove an empty reloc section. Leave - one NONE reloc. - ??? What is wrong with an empty section??? */ - rel_hdr->sh_size = rel_hdr->sh_entsize; - deleted -= 1; - } rel_hdr = _bfd_elf_single_rel_hdr (input_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; input_section->reloc_count -= deleted; diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 9e98215d..cec579c 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -7059,7 +7059,8 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_AARCH64_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; @@ -8464,10 +8465,9 @@ elfNN_aarch64_modify_headers (bfd *abfd, struct bfd_link_info *info) { struct elf_segment_map *m; - unsigned int segment_count = 0; Elf_Internal_Phdr *p; - for (m = elf_seg_map (abfd); m != NULL; m = m->next, segment_count++) + for (m = elf_seg_map (abfd); m != NULL; m = m->next) { /* We are only interested in the memory tag segment that will be dumped to a core file. If we have no memory tags or this isn't a core file we diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 075b344..685a37f 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -3911,7 +3911,8 @@ elfNN_ia64_relocate_section (bfd *output_bfd, if (sym_sec != NULL && discarded_section (sym_sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_IA64_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c index 31dd7a5..0634ad3 100644 --- a/bfd/elfnn-kvx.c +++ b/bfd/elfnn-kvx.c @@ -2541,7 +2541,8 @@ elfNN_kvx_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_KVX_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index 46fafb3..1ddea2f 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -3403,8 +3403,9 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, name = loongarch_sym_name (input_bfd, h, sym); if (sec != NULL && discarded_section (sec)) - RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, - 1, relend, howto, 0, contents); + RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, + rel, 1, relend, R_LARCH_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 2fd0129..9f4bc0a 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -2510,7 +2510,8 @@ riscv_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_RISCV_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 3c38f51..a171af5 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -10480,7 +10480,7 @@ mips_reloc_against_discarded_section (bfd *output_bfd, do { RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - (*rel), count, (*relend), + (*rel), count, (*relend), R_MIPS_NONE, howto, i, contents); } while (0); diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 3d89a5f..f0b3795 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -2892,7 +2892,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_SPARC_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index afa9e86..1854e69 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -2894,7 +2894,8 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_TILEGX_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; diff --git a/bfd/version.h b/bfd/version.h index 877f9a5..c33770d 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20250717 +#define BFD_VERSION_DATE 20250720 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index 99bc1bd..f2d1108 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -119,7 +119,6 @@ const size_t md_longopts_size = sizeof (md_longopts); static void l_cons (int nbytes) { - int c; expressionS exp; #ifdef md_flush_pending_output @@ -141,7 +140,6 @@ l_cons (int nbytes) md_cons_align (nbytes); #endif - c = 0; do { unsigned int bits_available = BITS_PER_CHAR * nbytes; @@ -236,7 +234,6 @@ l_cons (int nbytes) if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c')) code_label = 1; emit_expr (&exp, nbytes); - ++c; if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c')) { input_line_pointer +=3; diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index 1eb4702..fe54d21 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -896,7 +896,6 @@ md_assemble (char *str) for (;;) { const char *errmsg = NULL; - int op_idx; char *hold; int extra_shift = 0; @@ -906,9 +905,9 @@ md_assemble (char *str) next_opindex = 0; insn = opcode->opcode; extension = 0; - for (op_idx = 1, opindex_ptr = opcode->operands; + for (opindex_ptr = opcode->operands; *opindex_ptr != 0; - opindex_ptr++, op_idx++) + opindex_ptr++) { const struct mn10200_operand *operand; expressionS ex; diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index f73c3bf..176910d 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -344,15 +344,10 @@ v850_comm (int area) int old_subsec; char *pfrag; int align; - flagword applicable; old_sec = now_seg; old_subsec = now_subseg; - applicable = bfd_applicable_section_flags (stdoutput); - - applicable &= SEC_ALLOC; - switch (area) { case SCOMMON_SECTION: diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index 0823ecd..4a7829f 100644 --- a/gas/config/tc-xgate.c +++ b/gas/config/tc-xgate.c @@ -1123,7 +1123,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[]) unsigned short oper_mask = 0; int operand_bit_length = 0; unsigned int operand = 0; - char n_operand_bits = 0; char first_operand_equals_second = 0; int i = 0; char c = 0; @@ -1139,7 +1138,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[]) { oper_mask <<= 1; oper_mask += 1; - n_operand_bits++; } } diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index 2980cff..83a732f 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -1032,7 +1032,6 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE { unsigned char *output_ptr = buffer; int c; - int nibble; unsigned int *class_ptr; frag_wane (frag_now); @@ -1044,7 +1043,7 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE memset (buffer, 0, sizeof (buffer)); class_ptr = this_try->byte_info; - for (nibble = 0; (c = *class_ptr++); nibble++) + while ((c = *class_ptr++) != 0) { switch (c & CLASS_MASK) diff --git a/gas/ecoff.c b/gas/ecoff.c index 7411595..97b9093 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -3606,7 +3606,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, efdr_t *file; proc_t *proc; unsigned long c; - long iline; long totcount; lineno_list_t first; lineno_list_t *local_first_lineno = first_lineno; @@ -3620,7 +3619,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, proc = NULL; last = NULL; c = offset; - iline = 0; totcount = 0; /* FIXME? Now that MIPS embedded-PIC is gone, it may be safe to @@ -3800,7 +3798,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, ++c; } - ++iline; last = l; } @@ -764,19 +764,19 @@ assemble_one (char *line) /* Make sure this hasn't pushed the locked sequence past the bundle size. */ valueT bundle_size = pending_bundle_size (bundle_lock_frag); - if (bundle_size > 1U << bundle_align_p2) + if (bundle_size > (valueT) 1 << bundle_align_p2) as_bad (_ (".bundle_lock sequence at %" PRIu64 " bytes, " - "but .bundle_align_mode limit is %u bytes"), - (uint64_t) bundle_size, 1U << bundle_align_p2); + "but .bundle_align_mode limit is %" PRIu64 " bytes"), + (uint64_t) bundle_size, (uint64_t) 1 << bundle_align_p2); } else if (bundle_align_p2 > 0) { valueT insn_size = pending_bundle_size (insn_start_frag); - if (insn_size > 1U << bundle_align_p2) + if (insn_size > (valueT) 1 << bundle_align_p2) as_bad (_("single instruction is %" PRIu64 " bytes long, " - "but .bundle_align_mode limit is %u bytes"), - (uint64_t) insn_size, 1U << bundle_align_p2); + "but .bundle_align_mode limit is %" PRIu64 " bytes"), + (uint64_t) insn_size, (uint64_t) 1 << bundle_align_p2); finish_bundle (insn_start_frag, insn_size); } @@ -6786,10 +6786,10 @@ s_bundle_unlock (int arg ATTRIBUTE_UNUSED) size = pending_bundle_size (bundle_lock_frag); - if (size > 1U << bundle_align_p2) + if (size > (valueT) 1 << bundle_align_p2) as_bad (_(".bundle_lock sequence is %" PRIu64 " bytes, " - "but bundle size is only %u bytes"), - (uint64_t) size, 1u << bundle_align_p2); + "but bundle size is only %" PRIu64 " bytes"), + (uint64_t) size, (uint64_t) 1 << bundle_align_p2); else finish_bundle (bundle_lock_frag, size); diff --git a/gas/write.c b/gas/write.c index 455dc44..c56ad28 100644 --- a/gas/write.c +++ b/gas/write.c @@ -2242,7 +2242,7 @@ write_object_file (void) char *table_ptr; addressT table_addr; addressT from_addr, to_addr; - int n, m; + int n; subseg_change (lie->seg, lie->subseg); fragP = lie->dispfrag; @@ -2267,9 +2267,9 @@ write_object_file (void) table_ptr += md_short_jump_size; table_addr += md_short_jump_size; - for (m = 0; + for (; lie && lie->dispfrag == fragP; - m++, lie = lie->next_broken_word) + lie = lie->next_broken_word) { if (lie->added == 2) continue; diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 35b770f..2bbaf14 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -27659,6 +27659,16 @@ or a prompt that does not. @item set prompt @var{newprompt} Directs @value{GDBN} to use @var{newprompt} as its prompt string henceforth. +For example, this will set a blue-colored ``(gdb)'' prompt: + +@smallexample +set prompt \001\033[0;34m\002(gdb)\001\033[0m\002 +@end smallexample + +It uses @samp{\001} and @samp{\002} to begin and end a sequence of +non-printing characters, to make sure they're not counted in the string +length. + @kindex show prompt @item show prompt Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}} diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 6d439b0..f5b8523 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -4163,6 +4163,20 @@ riscv_gnu_triplet_regexp (struct gdbarch *gdbarch) return "riscv(32|64)?"; } +/* Implement the "print_insn" gdbarch method. */ + +static int +riscv_print_insn (bfd_vma addr, struct disassemble_info *info) +{ + /* Initialize the BFD section to enable ISA string detection depending on the + object in scope. */ + struct obj_section *s = find_pc_section (addr); + if (s != nullptr) + info->section = s->the_bfd_section; + + return default_print_insn (addr, info); +} + /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ @@ -4429,6 +4443,9 @@ riscv_gdbarch_init (struct gdbarch_info info, disassembler_options_riscv ()); set_gdbarch_disassembler_options (gdbarch, &riscv_disassembler_options); + /* Disassembler print_insn. */ + set_gdbarch_print_insn (gdbarch, riscv_print_insn); + /* SystemTap Support. */ set_gdbarch_stap_is_single_operand (gdbarch, riscv_stap_is_single_operand); set_gdbarch_stap_register_indirection_prefixes diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c index 03b868c..0fb2904 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c @@ -16,9 +16,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> +#include <stdlib.h> + +extern void test_call (void); + +void +unreachable (void) +{ + abort (); +} void setup_alarm (void) { alarm (300); } + +int +main () +{ + setup_alarm (); + test_call (); + unreachable (); + return 0; +} diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S index 78a6859..20a8eb7 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S @@ -18,33 +18,12 @@ handling. */ .text - - .global main -main: - nop - - callq setup_alarm - - nop - -/***********************************************/ - -/* test call/ret */ - .global test_call test_call: call test_call - nop + call unreachable .global test_ret_end test_ret_end: nop -/***********************************************/ - -/* all done */ - -done: - mov $0,%rdi - call exit - hlt .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c index 03b868c..0fb2904 100644 --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c @@ -16,9 +16,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> +#include <stdlib.h> + +extern void test_call (void); + +void +unreachable (void) +{ + abort (); +} void setup_alarm (void) { alarm (300); } + +int +main () +{ + setup_alarm (); + test_call (); + unreachable (); + return 0; +} diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S index 466e50c..20a8eb7 100644 --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S @@ -18,33 +18,12 @@ handling. */ .text - - .global main -main: - nop - - call setup_alarm - - nop - -/***********************************************/ - -/* test call/ret */ - .global test_call test_call: call test_call - nop + call unreachable .global test_ret_end test_ret_end: nop -/***********************************************/ - -/* all done */ - -done: - pushl $0 - call exit - hlt .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp index 53bf642..fce6d67 100644 --- a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp +++ b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp @@ -31,7 +31,7 @@ proc prepare_test {has_cfi} { "${objcallerfile}" \ object [list {additional_flags=-fomit-frame-pointer \ -funwind-tables -fasynchronous-unwind-tables}]] != "" } { - untested "couldn't compile with cfi" + untested "couldn't compile" return false } } else { @@ -41,7 +41,7 @@ proc prepare_test {has_cfi} { object [list {additional_flags=-fomit-frame-pointer \ -fno-unwind-tables \ -fno-asynchronous-unwind-tables}]] != "" } { - untested "couldn't compile without cfi" + untested "couldn't compile" return false } } @@ -54,15 +54,12 @@ proc prepare_test {has_cfi} { clean_restart "$binfile-${extension}" - with_test_prefix "${extension}" { - - if ![runto callback] then { - fail "has_cfi=$has_cfi: Can't run to callback" - return false - } - gdb_test_no_output "maint frame-unwinder disable ARCH" - return true + if ![runto callback] then { + fail "has_cfi=$has_cfi: Can't run to callback" + return false } + gdb_test_no_output "maint frame-unwinder disable ARCH" + return true } if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \ @@ -72,15 +69,45 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \ return } -if { [prepare_test false] } { - gdb_test "bt" \ +proc_with_prefix no-cfi {} { + if { ![prepare_test false] } { + return + } + + set re_msg \ + [string_list_to_regexp \ + "Required frame unwinder may have been disabled," \ + " see 'maint info frame-unwinders'"] + set hs {[^\r\n]} + set re_bt_line "#0\\s+[string_to_regexp {callback ()}] $hs+" + set re_bt_no_filters \ [multi_line \ - "\[^\r\n\]+Required frame unwinder may have been disabled, \[^\r\n\]+" \ - "#0\\s+callback \\(\\) \[^\r\n\]+"] \ - "verify unwind fail without CFI" + $re_bt_line \ + $re_msg] + gdb_test "bt -no-filters" \ + $re_bt_no_filters \ + "verify no-filters unwind fail" + + # Flush frame cache to retrigger the message. + gdb_test "maint flush register-cache" \ + [string_to_regexp "Register cache flushed."] + + # This output may occur when we run into the message while applying the + # frame filters. + set re_bt \ + [multi_line \ + $hs+$re_msg \ + $re_bt_line] + gdb_test "bt" \ + "($re_bt|$re_bt_no_filters)" \ + "verify unwind fail" } -if { [prepare_test true] } { +proc_with_prefix cfi {} { + if { ![prepare_test true] } { + return + } + if { [istarget "arm*-*-*"] } { setup_kfail backtrace/31950 *-*-* } @@ -89,6 +116,12 @@ if { [prepare_test true] } { # #1 0x00000000004004e9 in caller () # #2 0x00000000004004cd in main () at ... gdb_test "bt" \ - "#0 +callback $text\r\n#1 $text in caller $text\r\n#2 $text in main $text" \ - "Verify unwinding works based only on CFI information" + [multi_line \ + "#0 +callback $text" \ + "#1 $text in caller $text" \ + "#2 $text in main $text"] \ + "Verify unwinding works" } + +no-cfi +cfi diff --git a/gdb/testsuite/gdb.base/break-dbg.exp b/gdb/testsuite/gdb.base/break-dbg.exp index 3652b8e..a7c7d92 100644 --- a/gdb/testsuite/gdb.base/break-dbg.exp +++ b/gdb/testsuite/gdb.base/break-dbg.exp @@ -46,7 +46,17 @@ gdb_test "catch load" "^Catchpoint $decimal \\(load\\)" gdb_test "catch unload" "^Catchpoint $decimal \\(unload\\)" gdb_test "catch signal" "^Catchpoint $decimal \\(standard signals\\)" -gdb_test "catch syscall" "^Catchpoint $decimal \\(any syscall\\)" + +set re_warning_xml_disabled \ + [string_to_regexp \ + [join \ + [list \ + "warning: Can not parse XML syscalls information;" \ + "XML support was disabled at compile time."]]] +gdb_test "catch syscall" \ + [multi_line \ + "^($re_warning_xml_disabled" \ + ")?Catchpoint $decimal [string_to_regexp {(any syscall)}]"] gdb_test "watch -l global_var" "\[Ww]atchpoint $decimal: -location global_var" diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 503671b..47efb64 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -859,7 +859,7 @@ proc previous_line_is_ok { str } { # For lines that don't match this pattern, we cannot comment on # where the style reset should occur, so lets just claim the line # is fine. - if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } { + if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } { return true } @@ -923,8 +923,14 @@ proc test_pagination_prompt_styling {} { } } + if { $desired_width < [string length $::pagination_prompt_str] + 2 } { + # Avoid readline wrapping after printing the pagination prompt. + return + } + # Now setup the screen width. - gdb_test_no_output "set width $desired_width" + gdb_test_no_output "set width $desired_width" \ + "set width to desired width" # Re-run 'info files'. Check that the content before any # pagination prompt correctly disables styling. diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp index 8e0b61d..e4bce7f 100644 --- a/gdb/testsuite/gdb.cp/static-print-quit.exp +++ b/gdb/testsuite/gdb.cp/static-print-quit.exp @@ -27,32 +27,17 @@ clean_restart $testfile.o gdb_test_no_output "set width 80" gdb_test_no_output "set height 2" -set test "print c - <return>" -gdb_test_multiple "print c" $test { - -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n--Type <RET>" { - pass $test +gdb_test_multiple "print c" "" { + -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n$pagination_prompt$" { + pass $gdb_test_name } - -re "\r\n--Type <RET>" { + -re "\r\n$pagination_prompt$" { # gdb-7.1 did not crash with this testcase but it had the same bug. untested "bug does not reproduce" return 0 } } -set test "print c - q <return>" -gdb_test_multiple "" $test { - -re " for more, q to quit, " { - pass $test - } -} - -set test "print c - remainder" -gdb_test_multiple "" $test { - -re "c to continue without paging--$" { - pass $test - } -} - gdb_test "q" ".*" # Now the obstack is uninitialized. Exercise it. diff --git a/gdb/testsuite/gdb.multi/pending-bp.exp b/gdb/testsuite/gdb.multi/pending-bp.exp index 1cd1cfb..2458cd7 100644 --- a/gdb/testsuite/gdb.multi/pending-bp.exp +++ b/gdb/testsuite/gdb.multi/pending-bp.exp @@ -328,5 +328,7 @@ proc_with_prefix py_test_clear_thread {} { # Run all the tests. test_no_inf_display test_pending_toggle -py_test_toggle_thread -py_test_clear_thread +if { [allow_python_tests] } { + py_test_toggle_thread + py_test_clear_thread +} diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index 5ac5712..1fa3c73 100644 --- a/gdb/testsuite/gdb.python/py-cmd.exp +++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -278,13 +278,7 @@ gdb_test_multiline "input multi-line-output command" \ set test "verify pagination from test_multiline" gdb_test_multiple "test_multiline" $test { - -re "--Type <RET>" { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 6b2f671..96977df 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -152,13 +152,7 @@ gdb_test_no_output "set height $lines" set test "verify pagination beforehand" gdb_test_multiple "python print (\"\\n\" * $lines)" $test { - -re "--Type <RET>" { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } @@ -168,13 +162,7 @@ gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=T set test "verify pagination afterwards" gdb_test_multiple "python print (\"\\n\" * $lines)" $test { - -re "--Type <RET>" { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 777d64d..8d94d6b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -287,10 +287,13 @@ if {![info exists gdb_prompt]} { set gdb_prompt "\\(gdb\\)" } -# A regexp that matches the pagination prompt. -set pagination_prompt \ +# The pagination prompt. +set pagination_prompt_str \ "--Type <RET> for more, q to quit, c to continue without paging--" +# A regexp that matches the pagination prompt. +set pagination_prompt [string_to_regexp $pagination_prompt_str] + # The variable fullname_syntax_POSIX is a regexp which matches a POSIX # absolute path ie. /foo/ set fullname_syntax_POSIX {/[^\n]*/} @@ -9990,6 +9993,10 @@ proc gdb_stdin_log_init { } { set logfile [standard_output_file_with_gdb_instance gdb.in] set in_file [open $logfile w] + + verbose -log "" + verbose -log "Starting logfile: $logfile" + verbose -log "" } # Write to the file for logging gdb input. diff --git a/gprofng/src/Stabs.cc b/gprofng/src/Stabs.cc index 116316e..20bdf8b 100644 --- a/gprofng/src/Stabs.cc +++ b/gprofng/src/Stabs.cc @@ -1546,7 +1546,7 @@ Stabs::readSymSec (Elf *elf, bool is_dynamic) switch (GELF_ST_TYPE (Sym.st_info)) { case STT_FUNC: - if (Sym.st_size == 0 || ELF_ST_BIND (Sym.st_info) == STB_WEAK) + if (Sym.st_size == 0) break; if (Sym.st_shndx == 0) { diff --git a/ld/testsuite/ld-elf/linkonce1.d b/ld/testsuite/ld-elf/linkonce1.d index e4f9a70..3920f25 100644 --- a/ld/testsuite/ld-elf/linkonce1.d +++ b/ld/testsuite/ld-elf/linkonce1.d @@ -2,11 +2,10 @@ #source: linkonce1b.s #ld: -r #objdump: -r +#notarget: [is_generic] .*: file format .* #... -RELOCATION RECORDS FOR \[.debug_frame\]: -OFFSET[ ]+TYPE[ ]+VALUE[ ]* -.*(NONE|unused|UNUSED).*\*ABS\* +RELOCATION RECORDS FOR \[.debug_frame\]: \(none\) #pass diff --git a/ld/testsuite/ld-elf/linkonce3.d b/ld/testsuite/ld-elf/linkonce3.d new file mode 100644 index 0000000..25306d2 --- /dev/null +++ b/ld/testsuite/ld-elf/linkonce3.d @@ -0,0 +1,13 @@ +#source: linkonce1a.s +#source: linkonce1b.s +#ld: -r +#objdump: -r +#target: [is_generic] + +.*: file format .* +#... +RELOCATION RECORDS FOR \[.debug_frame\]: +OFFSET[ ]+TYPE[ ]+VALUE[ ]* +.*(NONE|unused|UNUSED).*\*ABS\* + +#pass diff --git a/ld/testsuite/ld-elf/no-section-header.exp b/ld/testsuite/ld-elf/no-section-header.exp index 2a4575b..7461fdd 100644 --- a/ld/testsuite/ld-elf/no-section-header.exp +++ b/ld/testsuite/ld-elf/no-section-header.exp @@ -21,7 +21,7 @@ # Written by H.J. Lu (hongjiu.lu@intel.com) # -if { ![is_elf_format] } { +if { ![istarget *-*-gnu*] } { return } |