diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-06-28 06:42:37 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-06-28 06:42:37 -0700 |
commit | fca72df16a5731e3de8929dbae3bfce6c6c39c33 (patch) | |
tree | 8e53ed867d1d86b54066148d646dfe42c34070f4 | |
parent | 1f93ca376983027cd92080504016dfddfedaf90f (diff) | |
parent | ee0c0c503deffb7baf900ac8e092b18bf8c1528a (diff) | |
download | binutils-gdb-fca72df16a5731e3de8929dbae3bfce6c6c39c33.tar.gz |
Merge remote-tracking branch 'origin/master' into users/hjl/linux/master
80 files changed, 1373 insertions, 295 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 97c1431361b..d8d28afabbf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,73 @@ +2015-06-28 H.J. Lu <hongjiu.lu@intel.com> + + * bfd-in.h (compressed_debug_section_type): Remove + COMPRESS_DEBUG_ZLIB. + * bfd-in2.h : Regenerated. + +2015-06-26 Matthew Fortune <matthew.fortune@imgtec.com> + + * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable + instead of !shared to indicate an application vs shared library. + (_bfd_mips_elf_size_dynamic_sections): Likewise. + (_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL. + (_bfd_mips_elf_get_target_dtag): Likewise. + +2015-06-25 DJ Delorie <dj@redhat.com> + + * elf32-msp430.c (msp430_final_link_relocate): Fix comments. Fix + REL loads to match RELA stores. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + * elf.c (_bfd_elf_compute_section_file_positions): Don't + initialize sh_size for .shstrtab here. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + PR gas/18451 + * elf-bfd.h (elf_sym_strtab): New. + (elf_link_hash_table): Add strtabcount, strtabsize and + strtab. + (_bfd_elf_stringtab_init): Removed. + * elf.c (_bfd_elf_stringtab_init): Removed. + (_bfd_elf_compute_section_file_positions): Replace + bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ + _bfd_stringtab_size with + elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ + _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, + _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get + st_name. + (swap_out_syms): Likewise. + * elflink.c (elf_final_link_info): Replace bfd_strtab_hash + with elf_strtab_hash. Remove symbuf, symbuf_count, + symbuf_size and shndxbuf_size. + (elf_link_flush_output_syms): Removed. + (elf_link_output_sym): Renamed to ... + (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add + with _bfd_elf_strtab_add. Don't flush symbols to the file nor + swap out symbols. + (elf_link_swap_symbols_out): New. + (elf_link_output_extsym): Replace elf_link_output_sym with + elf_link_output_symstrtab. + (elf_link_input_bfd): Likewise. + (elf_final_link_free): Replace _bfd_stringtab_free with + _bfd_elf_strtab_free. Remove symbuf. + (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with + _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, + symbuf_size nor shndxbuf_size. Initialize strtabsize and + strtab. Initialize symshndxbuf to -1 when number of sections + >= 64K. Replace elf_link_output_sym/elf_link_output_sym with + elf_link_output_symstrtab/elf_link_output_symstrtab. Don't + call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize + and elf_link_swap_symbols_out. Replace _bfd_stringtab_size + and _bfd_stringtab_emit with _bfd_elf_strtab_size and + _bfd_elf_strtab_emit. + +2015-06-24 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older + GCC warning. + 2015-06-24 H.J. Lu <hongjiu.lu@intel.com> * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 2e324cdc9e9..ae99d1e3561 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -443,9 +443,8 @@ enum compressed_debug_section_type { COMPRESS_DEBUG_NONE = 0, COMPRESS_DEBUG = 1 << 0, - COMPRESS_DEBUG_ZLIB = COMPRESS_DEBUG | 1 << 1, - COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 2, - COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 3 + COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, + COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 }; /* This structure is used to keep track of stabs in sections diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 2d32c7481b7..35e9d77f347 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -450,9 +450,8 @@ enum compressed_debug_section_type { COMPRESS_DEBUG_NONE = 0, COMPRESS_DEBUG = 1 << 0, - COMPRESS_DEBUG_ZLIB = COMPRESS_DEBUG | 1 << 1, - COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 2, - COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 3 + COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, + COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 }; /* This structure is used to keep track of stabs in sections diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 1127b7ebc12..06a3883086e 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -469,6 +469,13 @@ enum elf_target_id GENERIC_ELF_DATA }; +struct elf_sym_strtab +{ + Elf_Internal_Sym sym; + unsigned long dest_index; + unsigned long destshndx_index; +}; + /* ELF linker hash table. */ struct elf_link_hash_table @@ -512,6 +519,17 @@ struct elf_link_hash_table section. */ struct elf_strtab_hash *dynstr; + /* The number of symbol strings found in the link which must be put + into the .strtab section. */ + bfd_size_type strtabcount; + + /* The array size of the symbol string table, which becomes the + .strtab section. */ + bfd_size_type strtabsize; + + /* The array of strings, which becomes the .strtab section. */ + struct elf_sym_strtab *strtab; + /* The number of buckets in the hash table in the .hash section. This is based on the number of dynamic symbols. */ bfd_size_type bucketcount; @@ -1980,8 +1998,6 @@ extern Elf_Internal_Sym *bfd_sym_from_r_symndx (struct sym_cache *, bfd *, unsigned long); extern asection *bfd_section_from_elf_index (bfd *, unsigned int); -extern struct bfd_strtab_hash *_bfd_elf_stringtab_init - (void); extern struct elf_strtab_hash * _bfd_elf_strtab_init (void); diff --git a/bfd/elf.c b/bfd/elf.c index 47638f4b55f..98460467d0c 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -51,7 +51,7 @@ SECTION static int elf_sort_sections (const void *, const void *); static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *); static bfd_boolean prep_headers (bfd *); -static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ; +static bfd_boolean swap_out_syms (bfd *, struct elf_strtab_hash **, int) ; static bfd_boolean elf_read_notes (bfd *, file_ptr, bfd_size_type) ; static bfd_boolean elf_parse_notes (bfd *abfd, char *buf, size_t size, file_ptr offset); @@ -1610,29 +1610,6 @@ bfd_elf_print_symbol (bfd *abfd, break; } } - -/* Allocate an ELF string table--force the first byte to be zero. */ - -struct bfd_strtab_hash * -_bfd_elf_stringtab_init (void) -{ - struct bfd_strtab_hash *ret; - - ret = _bfd_stringtab_init (); - if (ret != NULL) - { - bfd_size_type loc; - - loc = _bfd_stringtab_add (ret, "", TRUE, FALSE); - BFD_ASSERT (loc == 0 || loc == (bfd_size_type) -1); - if (loc == (bfd_size_type) -1) - { - _bfd_stringtab_free (ret); - ret = NULL; - } - } - return ret; -} /* ELF .o/exec file reading */ @@ -3742,7 +3719,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, const struct elf_backend_data *bed = get_elf_backend_data (abfd); struct fake_section_arg fsargs; bfd_boolean failed; - struct bfd_strtab_hash *strtab = NULL; + struct elf_strtab_hash *strtab = NULL; Elf_Internal_Shdr *shstrtab_hdr; bfd_boolean need_symtab; @@ -3795,7 +3772,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, shstrtab_hdr->sh_type = SHT_STRTAB; shstrtab_hdr->sh_flags = 0; shstrtab_hdr->sh_addr = 0; - shstrtab_hdr->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd)); + /* sh_size is set in _bfd_elf_assign_file_positions_for_non_load. */ shstrtab_hdr->sh_entsize = 0; shstrtab_hdr->sh_link = 0; shstrtab_hdr->sh_info = 0; @@ -3827,9 +3804,9 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, /* Now that we know where the .strtab section goes, write it out. */ if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, strtab)) + || ! _bfd_elf_strtab_emit (abfd, strtab)) return FALSE; - _bfd_stringtab_free (strtab); + _bfd_elf_strtab_free (strtab); } abfd->output_has_begun = TRUE; @@ -7065,18 +7042,21 @@ _bfd_elf_copy_private_symbol_data (bfd *ibfd, static bfd_boolean swap_out_syms (bfd *abfd, - struct bfd_strtab_hash **sttp, + struct elf_strtab_hash **sttp, int relocatable_p) { const struct elf_backend_data *bed; int symcount; asymbol **syms; - struct bfd_strtab_hash *stt; + struct elf_strtab_hash *stt; Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_shndx_hdr; Elf_Internal_Shdr *symstrtab_hdr; + struct elf_sym_strtab *symstrtab; bfd_byte *outbound_syms; bfd_byte *outbound_shndx; + unsigned long outbound_syms_index; + unsigned long outbound_shndx_index; int idx; unsigned int num_locals; bfd_size_type amt; @@ -7086,7 +7066,7 @@ swap_out_syms (bfd *abfd, return FALSE; /* Dump out the symtabs. */ - stt = _bfd_elf_stringtab_init (); + stt = _bfd_elf_strtab_init (); if (stt == NULL) return FALSE; @@ -7102,16 +7082,29 @@ swap_out_syms (bfd *abfd, symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; symstrtab_hdr->sh_type = SHT_STRTAB; + /* Allocate buffer to swap out the .strtab section. */ + symstrtab = (struct elf_sym_strtab *) bfd_malloc ((symcount + 1) + * sizeof (*symstrtab)); + if (symstrtab == NULL) + { + _bfd_elf_strtab_free (stt); + return FALSE; + } + outbound_syms = (bfd_byte *) bfd_alloc2 (abfd, 1 + symcount, bed->s->sizeof_sym); if (outbound_syms == NULL) { - _bfd_stringtab_free (stt); +error_return: + _bfd_elf_strtab_free (stt); + free (symstrtab); return FALSE; } symtab_hdr->contents = outbound_syms; + outbound_syms_index = 0; outbound_shndx = NULL; + outbound_shndx_index = 0; symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; if (symtab_shndx_hdr->sh_name != 0) { @@ -7119,10 +7112,7 @@ swap_out_syms (bfd *abfd, outbound_shndx = (bfd_byte *) bfd_zalloc2 (abfd, 1 + symcount, sizeof (Elf_External_Sym_Shndx)); if (outbound_shndx == NULL) - { - _bfd_stringtab_free (stt); - return FALSE; - } + goto error_return; symtab_shndx_hdr->contents = outbound_shndx; symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; @@ -7142,10 +7132,12 @@ swap_out_syms (bfd *abfd, sym.st_other = 0; sym.st_shndx = SHN_UNDEF; sym.st_target_internal = 0; - bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx); - outbound_syms += bed->s->sizeof_sym; + symstrtab[0].sym = sym; + symstrtab[0].dest_index = outbound_syms_index; + symstrtab[0].destshndx_index = outbound_shndx_index; + outbound_syms_index++; if (outbound_shndx != NULL) - outbound_shndx += sizeof (Elf_External_Sym_Shndx); + outbound_shndx_index++; } name_local_sections @@ -7153,7 +7145,7 @@ swap_out_syms (bfd *abfd, && bed->elf_backend_name_local_section_symbols (abfd)); syms = bfd_get_outsymbols (abfd); - for (idx = 0; idx < symcount; idx++) + for (idx = 0; idx < symcount;) { Elf_Internal_Sym sym; bfd_vma value = syms[idx]->value; @@ -7165,18 +7157,17 @@ swap_out_syms (bfd *abfd, && (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM) { /* Local section symbols have no name. */ - sym.st_name = 0; + sym.st_name = (unsigned long) -1; } else { - sym.st_name = (unsigned long) _bfd_stringtab_add (stt, - syms[idx]->name, - TRUE, FALSE); + /* Call _bfd_elf_strtab_offset after _bfd_elf_strtab_finalize + to get the final offset for st_name. */ + sym.st_name + = (unsigned long) _bfd_elf_strtab_add (stt, syms[idx]->name, + FALSE); if (sym.st_name == (unsigned long) -1) - { - _bfd_stringtab_free (stt); - return FALSE; - } + goto error_return; } type_ptr = elf_symbol_from (abfd, syms[idx]); @@ -7266,8 +7257,7 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), syms[idx]->name ? syms[idx]->name : "<Local sym>", sec->name); bfd_set_error (bfd_error_invalid_operation); - _bfd_stringtab_free (stt); - return FALSE; + goto error_return; } shndx = _bfd_elf_section_from_bfd_section (abfd, sec2); @@ -7353,14 +7343,40 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), sym.st_target_internal = 0; } - bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx); - outbound_syms += bed->s->sizeof_sym; + idx++; + symstrtab[idx].sym = sym; + symstrtab[idx].dest_index = outbound_syms_index; + symstrtab[idx].destshndx_index = outbound_shndx_index; + + outbound_syms_index++; if (outbound_shndx != NULL) - outbound_shndx += sizeof (Elf_External_Sym_Shndx); + outbound_shndx_index++; } + /* Finalize the .strtab section. */ + _bfd_elf_strtab_finalize (stt); + + /* Swap out the .strtab section. */ + for (idx = 0; idx <= symcount; idx++) + { + struct elf_sym_strtab *elfsym = &symstrtab[idx]; + if (elfsym->sym.st_name == (unsigned long) -1) + elfsym->sym.st_name = 0; + else + elfsym->sym.st_name = _bfd_elf_strtab_offset (stt, + elfsym->sym.st_name); + bed->s->swap_symbol_out (abfd, &elfsym->sym, + (outbound_syms + + (elfsym->dest_index + * bed->s->sizeof_sym)), + (outbound_shndx + + (elfsym->destshndx_index + * sizeof (Elf_External_Sym_Shndx)))); + } + free (symstrtab); + *sttp = stt; - symstrtab_hdr->sh_size = _bfd_stringtab_size (stt); + symstrtab_hdr->sh_size = _bfd_elf_strtab_size (stt); symstrtab_hdr->sh_type = SHT_STRTAB; symstrtab_hdr->sh_flags = 0; diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index edd49f7e489..9e6979123f2 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -845,14 +845,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_PCR20_EXT_ODST: - /* [0,4]+[48,16] = ---F ---- FFFF */ + /* [0,4]+[48,16] = ---F ---- ---- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16; - addend |= bfd_get_16 (input_bfd, contents+4); + addend |= bfd_get_16 (input_bfd, contents + 6); srel += addend; } @@ -868,14 +868,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_ABS20_EXT_SRC: - /* [7,4]+[32,16] = -78- FFFF */ + /* [7,4]+[32,16] = -78- ---- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = (bfd_get_16 (input_bfd, contents) & 0x0780) << 9; - addend |= bfd_get_16 (input_bfd, contents+2); + addend |= bfd_get_16 (input_bfd, contents + 4); srel += addend; } else @@ -904,14 +904,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_PCR20_EXT_DST: - /* [0,4]+[32,16] = ---F FFFF */ + /* [0,4]+[32,16] = ---F ---- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16; - addend |= bfd_get_16 (input_bfd, contents+2); + addend |= bfd_get_16 (input_bfd, contents + 4); srel += addend; } else @@ -927,14 +927,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_PCR20_EXT_SRC: - /* [7,4]+32,16] = -78- FFFF */ + /* [7,4]+[32,16] = -78- ---- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = ((bfd_get_16 (input_bfd, contents) & 0x0780) << 9); - addend |= bfd_get_16 (input_bfd, contents+2); + addend |= bfd_get_16 (input_bfd, contents + 4); srel += addend;; } else @@ -961,10 +961,16 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_ABS20_EXT_DST: + /* [0,4]+[32,16] = ---F ---- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) - srel += bfd_get_16 (input_bfd, contents) & 0xf; + { + bfd_vma addend; + addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16; + addend |= bfd_get_16 (input_bfd, contents + 4); + srel += addend; + } else srel += rel->r_addend; bfd_put_16 (input_bfd, (srel & 0xffff), contents + 4); @@ -975,14 +981,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_ABS20_EXT_ODST: - /* [0,4]+[48,16] = ---F ---- FFFF */ + /* [0,4]+[48,16] = ---F ---- ---- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16; - addend |= bfd_get_16 (input_bfd, contents+4); + addend |= bfd_get_16 (input_bfd, contents + 6); srel += addend; } else @@ -995,7 +1001,7 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_ABS20_ADR_SRC: - /* [8,4]+[32,16] = -F-- FFFF */ + /* [8,4]+[16,16] = -F-- FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) @@ -1003,7 +1009,7 @@ msp430_final_link_relocate (reloc_howto_type * howto, bfd_vma addend; addend = ((bfd_get_16 (input_bfd, contents) & 0xf00) << 8); - addend |= bfd_get_16 (input_bfd, contents+2); + addend |= bfd_get_16 (input_bfd, contents + 2); srel += addend; } else @@ -1016,14 +1022,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_ABS20_ADR_DST: - /* [0,4]+[32,16] = ---F FFFF */ + /* [0,4]+[16,16] = ---F FFFF */ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = ((bfd_get_16 (input_bfd, contents) & 0xf) << 16); - addend |= bfd_get_16 (input_bfd, contents+2); + addend |= bfd_get_16 (input_bfd, contents + 2); srel += addend; } else @@ -1058,14 +1064,14 @@ msp430_final_link_relocate (reloc_howto_type * howto, break; case R_MSP430X_PCR20_CALL: - /* [0,4]+[32,16] = ---F FFFF*/ + /* [0,4]+[16,16] = ---F FFFF*/ contents += rel->r_offset; srel = (bfd_signed_vma) relocation; if (is_rel_reloc) { bfd_vma addend; addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16; - addend |= bfd_get_16 (input_bfd, contents+2); + addend |= bfd_get_16 (input_bfd, contents + 2); srel += addend; } else diff --git a/bfd/elflink.c b/bfd/elflink.c index 95209061313..1c0861ba3aa 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7444,7 +7444,7 @@ struct elf_final_link_info /* Output BFD. */ bfd *output_bfd; /* Symbol string table. */ - struct bfd_strtab_hash *symstrtab; + struct elf_strtab_hash *symstrtab; /* .dynsym section. */ asection *dynsym_sec; /* .hash section. */ @@ -7471,16 +7471,8 @@ struct elf_final_link_info /* Array large enough to hold a section pointer for each local symbol of any input BFD. */ asection **sections; - /* Buffer to hold swapped out symbols. */ - bfd_byte *symbuf; - /* And one for symbol section indices. */ + /* Buffer for SHT_SYMTAB_SHNDX section. */ Elf_External_Sym_Shndx *symshndxbuf; - /* Number of swapped out symbols in buffer. */ - size_t symbuf_count; - /* Number of symbols which fit in symbuf. */ - size_t symbuf_size; - /* And same for symshndxbuf. */ - size_t shndxbuf_size; /* Number of STT_FILE syms seen. */ size_t filesym_count; }; @@ -8570,47 +8562,21 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) return ret; } -/* Flush the output symbols to the file. */ - -static bfd_boolean -elf_link_flush_output_syms (struct elf_final_link_info *flinfo, - const struct elf_backend_data *bed) -{ - if (flinfo->symbuf_count > 0) - { - Elf_Internal_Shdr *hdr; - file_ptr pos; - bfd_size_type amt; - - hdr = &elf_tdata (flinfo->output_bfd)->symtab_hdr; - pos = hdr->sh_offset + hdr->sh_size; - amt = flinfo->symbuf_count * bed->s->sizeof_sym; - if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo->symbuf, amt, flinfo->output_bfd) != amt) - return FALSE; - - hdr->sh_size += amt; - flinfo->symbuf_count = 0; - } - - return TRUE; -} - -/* Add a symbol to the output symbol table. */ +/* Add a symbol to the output symbol string table. */ static int -elf_link_output_sym (struct elf_final_link_info *flinfo, - const char *name, - Elf_Internal_Sym *elfsym, - asection *input_sec, - struct elf_link_hash_entry *h) -{ - bfd_byte *dest; - Elf_External_Sym_Shndx *destshndx; +elf_link_output_symstrtab (struct elf_final_link_info *flinfo, + const char *name, + Elf_Internal_Sym *elfsym, + asection *input_sec, + struct elf_link_hash_entry *h) +{ int (*output_symbol_hook) (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *); + struct elf_link_hash_table *hash_table; const struct elf_backend_data *bed; + bfd_size_type strtabsize; BFD_ASSERT (elf_onesymtab (flinfo->output_bfd)); @@ -8623,49 +8589,119 @@ elf_link_output_sym (struct elf_final_link_info *flinfo, return ret; } - if (name == NULL || *name == '\0') - elfsym->st_name = 0; - else if (input_sec->flags & SEC_EXCLUDE) - elfsym->st_name = 0; + if (name == NULL + || *name == '\0' + || (input_sec->flags & SEC_EXCLUDE)) + elfsym->st_name = (unsigned long) -1; else { - elfsym->st_name = (unsigned long) _bfd_stringtab_add (flinfo->symstrtab, - name, TRUE, FALSE); + /* Call _bfd_elf_strtab_offset after _bfd_elf_strtab_finalize + to get the final offset for st_name. */ + elfsym->st_name + = (unsigned long) _bfd_elf_strtab_add (flinfo->symstrtab, + name, FALSE); if (elfsym->st_name == (unsigned long) -1) return 0; } - if (flinfo->symbuf_count >= flinfo->symbuf_size) + hash_table = elf_hash_table (flinfo->info); + strtabsize = hash_table->strtabsize; + if (strtabsize <= hash_table->strtabcount) { - if (! elf_link_flush_output_syms (flinfo, bed)) + strtabsize += strtabsize; + hash_table->strtabsize = strtabsize; + strtabsize *= sizeof (*hash_table->strtab); + hash_table->strtab + = (struct elf_sym_strtab *) bfd_realloc (hash_table->strtab, + strtabsize); + if (hash_table->strtab == NULL) return 0; } + hash_table->strtab[hash_table->strtabcount].sym = *elfsym; + hash_table->strtab[hash_table->strtabcount].dest_index + = hash_table->strtabcount; + hash_table->strtab[hash_table->strtabcount].destshndx_index + = flinfo->symshndxbuf ? bfd_get_symcount (flinfo->output_bfd) : 0; + + bfd_get_symcount (flinfo->output_bfd) += 1; + hash_table->strtabcount += 1; + + return 1; +} + +/* Swap symbols out to the symbol table and flush the output symbols to + the file. */ - dest = flinfo->symbuf + flinfo->symbuf_count * bed->s->sizeof_sym; - destshndx = flinfo->symshndxbuf; - if (destshndx != NULL) +static bfd_boolean +elf_link_swap_symbols_out (struct elf_final_link_info *flinfo) +{ + struct elf_link_hash_table *hash_table = elf_hash_table (flinfo->info); + bfd_size_type amt, i; + const struct elf_backend_data *bed; + bfd_byte *symbuf; + Elf_Internal_Shdr *hdr; + file_ptr pos; + bfd_boolean ret; + + if (!hash_table->strtabcount) + return TRUE; + + BFD_ASSERT (elf_onesymtab (flinfo->output_bfd)); + + bed = get_elf_backend_data (flinfo->output_bfd); + + amt = bed->s->sizeof_sym * hash_table->strtabcount; + symbuf = (bfd_byte *) bfd_malloc (amt); + if (symbuf == NULL) + return FALSE; + + if (flinfo->symshndxbuf) { - if (bfd_get_symcount (flinfo->output_bfd) >= flinfo->shndxbuf_size) + amt = (sizeof (Elf_External_Sym_Shndx) + * (bfd_get_symcount (flinfo->output_bfd))); + flinfo->symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt); + if (flinfo->symshndxbuf == NULL) { - bfd_size_type amt; - - amt = flinfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx); - destshndx = (Elf_External_Sym_Shndx *) bfd_realloc (destshndx, - amt * 2); - if (destshndx == NULL) - return 0; - flinfo->symshndxbuf = destshndx; - memset ((char *) destshndx + amt, 0, amt); - flinfo->shndxbuf_size *= 2; + free (symbuf); + return FALSE; } - destshndx += bfd_get_symcount (flinfo->output_bfd); } - bed->s->swap_symbol_out (flinfo->output_bfd, elfsym, dest, destshndx); - flinfo->symbuf_count += 1; - bfd_get_symcount (flinfo->output_bfd) += 1; + for (i = 0; i < hash_table->strtabcount; i++) + { + struct elf_sym_strtab *elfsym = &hash_table->strtab[i]; + if (elfsym->sym.st_name == (unsigned long) -1) + elfsym->sym.st_name = 0; + else + elfsym->sym.st_name + = (unsigned long) _bfd_elf_strtab_offset (flinfo->symstrtab, + elfsym->sym.st_name); + bed->s->swap_symbol_out (flinfo->output_bfd, &elfsym->sym, + ((bfd_byte *) symbuf + + (elfsym->dest_index + * bed->s->sizeof_sym)), + (flinfo->symshndxbuf + + elfsym->destshndx_index)); + } + + hdr = &elf_tdata (flinfo->output_bfd)->symtab_hdr; + pos = hdr->sh_offset + hdr->sh_size; + amt = hash_table->strtabcount * bed->s->sizeof_sym; + if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0 + && bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt) + { + hdr->sh_size += amt; + ret = TRUE; + } + else + ret = FALSE; - return 1; + free (symbuf); + + free (hash_table->strtab); + hash_table->strtab = NULL; + + return ret; } /* Return TRUE if the dynamic symbol SYM in ABFD is supported. */ @@ -9291,15 +9327,16 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) memset (&fsym, 0, sizeof (fsym)); fsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); fsym.st_shndx = SHN_ABS; - if (!elf_link_output_sym (eoinfo->flinfo, NULL, &fsym, - bfd_und_section_ptr, NULL)) + if (!elf_link_output_symstrtab (eoinfo->flinfo, NULL, &fsym, + bfd_und_section_ptr, NULL)) return FALSE; eoinfo->file_sym_done = TRUE; } indx = bfd_get_symcount (flinfo->output_bfd); - ret = elf_link_output_sym (flinfo, h->root.root.string, &sym, input_sec, h); + ret = elf_link_output_symstrtab (flinfo, h->root.root.string, &sym, + input_sec, h); if (ret == 0) { eoinfo->failed = TRUE; @@ -9593,10 +9630,11 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) memset (&osym, 0, sizeof (osym)); osym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); osym.st_shndx = SHN_ABS; - if (!elf_link_output_sym (flinfo, - (input_bfd->lto_output ? NULL - : input_bfd->filename), - &osym, bfd_abs_section_ptr, NULL)) + if (!elf_link_output_symstrtab (flinfo, + (input_bfd->lto_output ? NULL + : input_bfd->filename), + &osym, bfd_abs_section_ptr, + NULL)) return FALSE; } @@ -9628,7 +9666,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) } indx = bfd_get_symcount (output_bfd); - ret = elf_link_output_sym (flinfo, name, &osym, isec, NULL); + ret = elf_link_output_symstrtab (flinfo, name, &osym, isec, NULL); if (ret == 0) return FALSE; else if (ret == 1) @@ -9711,7 +9749,8 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) sym.st_value += o->output_offset; indx = bfd_get_symcount (output_bfd); - ret = elf_link_output_sym (flinfo, name, &sym, o, NULL); + ret = elf_link_output_symstrtab (flinfo, name, &sym, o, + NULL); if (ret == 0) return FALSE; else if (ret == 1) @@ -10186,8 +10225,9 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) } indx = bfd_get_symcount (output_bfd); - ret = elf_link_output_sym (flinfo, name, &sym, sec, - NULL); + ret = elf_link_output_symstrtab (flinfo, name, + &sym, sec, + NULL); if (ret == 0) return FALSE; else if (ret == 1) @@ -10634,7 +10674,7 @@ elf_final_link_free (bfd *obfd, struct elf_final_link_info *flinfo) asection *o; if (flinfo->symstrtab != NULL) - _bfd_stringtab_free (flinfo->symstrtab); + _bfd_elf_strtab_free (flinfo->symstrtab); if (flinfo->contents != NULL) free (flinfo->contents); if (flinfo->external_relocs != NULL) @@ -10651,8 +10691,6 @@ elf_final_link_free (bfd *obfd, struct elf_final_link_info *flinfo) free (flinfo->indices); if (flinfo->sections != NULL) free (flinfo->sections); - if (flinfo->symbuf != NULL) - free (flinfo->symbuf); if (flinfo->symshndxbuf != NULL) free (flinfo->symshndxbuf); for (o = obfd->sections; o != NULL; o = o->next) @@ -10710,7 +10748,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) flinfo.info = info; flinfo.output_bfd = abfd; - flinfo.symstrtab = _bfd_elf_stringtab_init (); + flinfo.symstrtab = _bfd_elf_strtab_init (); if (flinfo.symstrtab == NULL) return FALSE; @@ -10737,10 +10775,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) flinfo.internal_syms = NULL; flinfo.indices = NULL; flinfo.sections = NULL; - flinfo.symbuf = NULL; flinfo.symshndxbuf = NULL; - flinfo.symbuf_count = 0; - flinfo.shndxbuf_size = 0; flinfo.filesym_count = 0; /* The object attributes have been merged. Remove the input @@ -10972,27 +11007,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* sh_offset is set just below. */ symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align; - /* Allocate a buffer to hold swapped out symbols. This is to avoid - continuously seeking to the right position in the file. */ - if (! info->keep_memory || max_sym_count < 20) - flinfo.symbuf_size = 20; - else - flinfo.symbuf_size = max_sym_count; - amt = flinfo.symbuf_size; - amt *= bed->s->sizeof_sym; - flinfo.symbuf = (bfd_byte *) bfd_malloc (amt); - if (flinfo.symbuf == NULL) + if (max_sym_count < 20) + max_sym_count = 20; + elf_hash_table (info)->strtabsize = max_sym_count; + amt = max_sym_count * sizeof (struct elf_sym_strtab); + elf_hash_table (info)->strtab + = (struct elf_sym_strtab *) bfd_malloc (amt); + if (elf_hash_table (info)->strtab == NULL) goto error_return; - if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF)) - { - /* Wild guess at number of output symbols. realloc'd as needed. */ - amt = 2 * max_sym_count + elf_numsections (abfd) + 1000; - flinfo.shndxbuf_size = amt; - amt *= sizeof (Elf_External_Sym_Shndx); - flinfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt); - if (flinfo.symshndxbuf == NULL) - goto error_return; - } + /* The real buffer will be allocated in elf_link_swap_symbols_out. */ + flinfo.symshndxbuf + = (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF) + ? (Elf_External_Sym_Shndx *) -1 : NULL); if (info->strip != strip_all || emit_relocs) { @@ -11012,8 +11038,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_other = 0; elfsym.st_shndx = SHN_UNDEF; elfsym.st_target_internal = 0; - if (elf_link_output_sym (&flinfo, NULL, &elfsym, bfd_und_section_ptr, - NULL) != 1) + if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, + bfd_und_section_ptr, NULL) != 1) goto error_return; /* Output a symbol for each section. We output these even if we are @@ -11036,7 +11062,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_shndx = i; if (!info->relocatable) elfsym.st_value = o->vma; - if (elf_link_output_sym (&flinfo, NULL, &elfsym, o, NULL) != 1) + if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, o, + NULL) != 1) goto error_return; } } @@ -11253,7 +11280,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) struct elf_link_hash_entry *); if (! ((*bed->elf_backend_output_arch_local_syms) - (abfd, info, &flinfo, (out_sym_func) elf_link_output_sym))) + (abfd, info, &flinfo, + (out_sym_func) elf_link_output_symstrtab))) return FALSE; } @@ -11364,12 +11392,16 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) struct elf_link_hash_entry *); if (! ((*bed->elf_backend_output_arch_syms) - (abfd, info, &flinfo, (out_sym_func) elf_link_output_sym))) + (abfd, info, &flinfo, + (out_sym_func) elf_link_output_symstrtab))) return FALSE; } - /* Flush all symbols to the file. */ - if (! elf_link_flush_output_syms (&flinfo, bed)) + /* Finalize the .strtab section. */ + _bfd_elf_strtab_finalize (flinfo.symstrtab); + + /* Swap out the .strtab section. */ + if (!elf_link_swap_symbols_out (&flinfo)) return FALSE; /* Now we know the size of the symtab section. */ @@ -11402,7 +11434,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) symstrtab_hdr->sh_type = SHT_STRTAB; symstrtab_hdr->sh_flags = 0; symstrtab_hdr->sh_addr = 0; - symstrtab_hdr->sh_size = _bfd_stringtab_size (flinfo.symstrtab); + symstrtab_hdr->sh_size = _bfd_elf_strtab_size (flinfo.symstrtab); symstrtab_hdr->sh_entsize = 0; symstrtab_hdr->sh_link = 0; symstrtab_hdr->sh_info = 0; @@ -11414,7 +11446,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elf_next_file_pos (abfd) = off; if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, flinfo.symstrtab)) + || ! _bfd_elf_strtab_emit (abfd, flinfo.symstrtab)) return FALSE; } diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index a5e6453bf97..9932453658b 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7614,7 +7614,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) htab->sstubs = s; if (!mips_elf_hash_table (info)->use_rld_obj_head - && !info->shared + && info->executable && bfd_get_linker_section (abfd, ".rld_map") == NULL) { s = bfd_make_section_anyway_with_flags (abfd, ".rld_map", @@ -7678,7 +7678,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); } - if (!info->shared) + if (info->executable) { const char *name; @@ -9719,7 +9719,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, info->combreloc = 0; } } - else if (! info->shared + else if (info->executable && ! mips_elf_hash_table (info)->use_rld_obj_head && CONST_STRNEQ (name, ".rld_map")) { @@ -9782,6 +9782,10 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0)) return FALSE; + if (info->executable + && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP_REL, 0)) + return FALSE; + /* The DT_DEBUG entry may be filled in by the dynamic linker and used by the debugger. */ if (info->executable @@ -11487,11 +11491,37 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, break; } s = h->root.u.def.section; + + /* The MIPS_RLD_MAP tag stores the absolute address of the + debug pointer. */ dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset + h->root.u.def.value); } break; + case DT_MIPS_RLD_MAP_REL: + { + struct elf_link_hash_entry *h; + bfd_vma dt_addr, rld_addr; + h = mips_elf_hash_table (info)->rld_symbol; + if (!h) + { + dyn_to_skip = MIPS_ELF_DYN_SIZE (dynobj); + swap_out_p = FALSE; + break; + } + s = h->root.u.def.section; + + /* The MIPS_RLD_MAP_REL tag stores the offset to the debug + pointer, relative to the address of the tag. */ + dt_addr = (sdyn->output_section->vma + sdyn->output_offset + + b - sdyn->contents); + rld_addr = (s->output_section->vma + s->output_offset + + h->root.u.def.value); + dyn.d_un.d_ptr = rld_addr - dt_addr; + } + break; + case DT_MIPS_OPTIONS: s = (bfd_get_section_by_name (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd))); @@ -15421,6 +15451,8 @@ _bfd_mips_elf_get_target_dtag (bfd_vma dtag) return "MIPS_HIPAGENO"; case DT_MIPS_RLD_MAP: return "MIPS_RLD_MAP"; + case DT_MIPS_RLD_MAP_REL: + return "MIPS_RLD_MAP_REL"; case DT_MIPS_DELTA_CLASS: return "MIPS_DELTA_CLASS"; case DT_MIPS_DELTA_CLASS_NO: diff --git a/bfd/version.h b/bfd/version.h index cae9de0a6af..17d2aebcc25 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20150624 +#define BFD_VERSION_DATE 20150628 #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/binutils/ChangeLog b/binutils/ChangeLog index c44146d6669..ab36fd93c8a 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2015-06-26 Matthew Fortune <matthew.fortune@imgtec.com> + + * readelf.c (get_mips_dynamic_type): Handle DT_MIPS_RLD_MAP_REL. + 2015-06-22 Nick Clifton <nickc@redhat.com> * objdump.c (disassemble_bytes): Set the stop_vma field in the diff --git a/binutils/readelf.c b/binutils/readelf.c index a0c20a38612..398a165d2bd 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1695,6 +1695,7 @@ get_mips_dynamic_type (unsigned long type) case DT_MIPS_GOTSYM: return "MIPS_GOTSYM"; case DT_MIPS_HIPAGENO: return "MIPS_HIPAGENO"; case DT_MIPS_RLD_MAP: return "MIPS_RLD_MAP"; + case DT_MIPS_RLD_MAP_REL: return "MIPS_RLD_MAP_REL"; case DT_MIPS_DELTA_CLASS: return "MIPS_DELTA_CLASS"; case DT_MIPS_DELTA_CLASS_NO: return "MIPS_DELTA_CLASS_NO"; case DT_MIPS_DELTA_INSTANCE: return "MIPS_DELTA_INSTANCE"; diff --git a/gas/ChangeLog b/gas/ChangeLog index 8d0f28fed96..7c49ea6b18f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2015-06-28 H.J. Lu <hongjiu.lu@intel.com> + + * as.c (parse_args): Replace COMPRESS_DEBUG_ZLIB with + COMPRESS_DEBUG_GNU_ZLIB. + * config/tc-i386.c (flag_compress_debug): Likewise. + +2015-06-24 H.J. Lu <hongjiu.lu@intel.com> + + * doc/as.texinfo (.cfi_lsda): Remove the extra @section. + 2015-06-19 Peter Bergner <bergner@vnet.ibm.com> * config/tc-ppc.c (md_assemble): Use ppc_optional_operand_value. @@ -665,7 +665,7 @@ This program has absolutely no warranty.\n")); if (strcasecmp (optarg, "none") == 0) flag_compress_debug = COMPRESS_DEBUG_NONE; else if (strcasecmp (optarg, "zlib") == 0) - flag_compress_debug = COMPRESS_DEBUG_ZLIB; + flag_compress_debug = COMPRESS_DEBUG_GNU_ZLIB; else if (strcasecmp (optarg, "zlib-gnu") == 0) flag_compress_debug = COMPRESS_DEBUG_GNU_ZLIB; else if (strcasecmp (optarg, "zlib-gabi") == 0) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 34b5c28e513..d8405b5d8ee 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -36,7 +36,7 @@ #ifdef TE_LINUX /* Default to compress debug sections for Linux. */ enum compressed_debug_section_type flag_compress_debug - = COMPRESS_DEBUG_ZLIB; + = COMPRESS_DEBUG_GNU_ZLIB; #endif #ifndef REGISTER_WARNINGS diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 6694b237001..f42979a3fc1 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -4680,7 +4680,6 @@ Only valid when generating compact EH frames (i.e. with @code{.cfi_sections eh_frame_entry}. @subsection @code{.cfi_lsda @var{encoding} [, @var{exp}]} -@section @code{.cfi_lsda @var{encoding} [, @var{exp}]} @code{.cfi_lsda} defines LSDA and its encoding. @var{encoding} must be a constant determining how the LSDA should be encoded. If it is 255 (@code{DW_EH_PE_omit}), the second diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index d469d4c0b53..e7ab1cf5eca 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2015-06-27 H.J. Lu <hongjiu.lu@intel.com> + + * gas/ia64/psn.d: Updated. + * gas/ia64/xdata-ilp32.d: Likewise. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + * gas/mmix/loc-3.d: Updated. + * gas/mmix/loc-5.d: Likewise. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + PR gas/18451 + * gas/elf/elf.exp: Run strtab. + * gas/elf/strtab.d: New file. + * gas/elf/strtab.s: Likewise. + 2015-06-22 Peter Bergner <bergner@vnet.ibm.com> * gas/ppc/e6500.s <sync>: Fix invalid test. diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 47b5a21b030..ff19badefb8 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -209,6 +209,8 @@ if { [is_elf_format] } then { run_dump_test "common1" run_dump_test "common2" + run_dump_test "strtab" + load_lib gas-dg.exp dg-init dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" "" diff --git a/gas/testsuite/gas/elf/strtab.d b/gas/testsuite/gas/elf/strtab.d new file mode 100644 index 00000000000..c6495d7262b --- /dev/null +++ b/gas/testsuite/gas/elf/strtab.d @@ -0,0 +1,7 @@ +#readelf: -W -x .strtab +#name: .strtab section + +#failif +#... + +0x[0-9 ]+.*\.xxxx\..* +#... diff --git a/gas/testsuite/gas/elf/strtab.s b/gas/testsuite/gas/elf/strtab.s new file mode 100644 index 00000000000..931d9ef31df --- /dev/null +++ b/gas/testsuite/gas/elf/strtab.s @@ -0,0 +1,8 @@ + .text +.globl x; x: +.globl xx; xx: +.globl xxx; xxx: +.globl xxxx; xxxx: +.globl xxxxx; xxxxx: +.globl xxxxxx; xxxxxx: + .byte 0 diff --git a/gas/testsuite/gas/ia64/psn.d b/gas/testsuite/gas/ia64/psn.d index 10e921eaac3..c496cb38379 100644 --- a/gas/testsuite/gas/ia64/psn.d +++ b/gas/testsuite/gas/ia64/psn.d @@ -2,7 +2,7 @@ # objdump: -d # name: ia64 psn -.*: +file format elf64-ia64.* +.*: +file format elf..-ia64.* Disassembly of section \.text: diff --git a/gas/testsuite/gas/ia64/xdata-ilp32.d b/gas/testsuite/gas/ia64/xdata-ilp32.d index 3958c71c1bf..8c0bb30cd36 100644 --- a/gas/testsuite/gas/ia64/xdata-ilp32.d +++ b/gas/testsuite/gas/ia64/xdata-ilp32.d @@ -16,7 +16,7 @@ Section Headers: \[ 6\] ,xdata3 PROGBITS 00000000 [[:xdigit:]]+ 000008 00 A 0 0 4 \[ 7\] \.xdata,4 PROGBITS 00000000 [[:xdigit:]]+ 000010 00 A 0 0 8 \[ 8\] "\.xdata5" PROGBITS 00000000 [[:xdigit:]]+ 000020 00 A 0 0 16 - \[ 9\] \.rela"\.xdata5" RELA 00000000 [[:xdigit:]]+ 000018 0c 17 8 4 + \[ 9\] \.rela"\.xdata5" RELA 00000000 [[:xdigit:]]+ 000018 0c I 17 8 4 \[10\] \.xreal\\1 PROGBITS 00000000 [[:xdigit:]]+ 000008 00 A 0 0 4 \[11\] \.xreal\+2 PROGBITS 00000000 [[:xdigit:]]+ 000010 00 A 0 0 8 \[12\] \.xreal\(3\) PROGBITS 00000000 [[:xdigit:]]+ 000014 00 A 0 0 16 diff --git a/gas/testsuite/gas/mmix/loc-3.d b/gas/testsuite/gas/mmix/loc-3.d index 1191084f0dd..2c477dbb732 100644 --- a/gas/testsuite/gas/mmix/loc-3.d +++ b/gas/testsuite/gas/mmix/loc-3.d @@ -17,7 +17,7 @@ Section Headers: +\[ 5\] \.symtab +SYMTAB +0000000000000000 .* +00000000000000c0 +0000000000000018 +6 +5 +8 +\[ 6\] \.strtab +STRTAB +0000000000000000 .* - +0000000000000030 +0000000000000000 +0 +0 +1 + +000000000000002e +0000000000000000 +0 +0 +1 Key to Flags: #... diff --git a/gas/testsuite/gas/mmix/loc-5.d b/gas/testsuite/gas/mmix/loc-5.d index eec81ad2591..fa80a86e27f 100644 --- a/gas/testsuite/gas/mmix/loc-5.d +++ b/gas/testsuite/gas/mmix/loc-5.d @@ -17,7 +17,7 @@ Section Headers: +\[ 5\] \.symtab +SYMTAB +0+ .* +0+c0 +0+18 +6 +6 +8 +\[ 6\] \.strtab +STRTAB +0+ .* - +0+29 +0+ +0 +0 +1 + +0+27 +0+ +0 +0 +1 Key to Flags: #... diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 19144edf348..8e11495b621 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,50 @@ +2015-06-26 Keith Seitz <keiths@redhat.com> + Doug Evans <dje@google.com> + + PR 16253 + * block.c (block_lookup_symbol): For non-function blocks, + continue to search for a symbol with an exact domain match + Otherwise, return any previously found "best domain" symbol. + (block_lookup_symbol_primary): Likewise. + +2015-06-26 Patrick Palka <patrick@parcs.ath.cx> + + * NEWS: Mention the new option "history remove-duplicates". + * top.c (history_remove_duplicates): New static variable. + (show_history_remove_duplicates): New static function. + (gdb_add_history): Conditionally remove duplicate history + entries. + (init_main): Add "history remove-duplicates" option. + +2015-06-26 Patrick Palka <patrick@parcs.ath.cx> + + * tui/tui-win.c (focus_completer): New static function. + (_initialize_tui_win): Set the completion function of the + "focus" command to focus_completer. + +2015-06-26 Jan Kratochvil <jan.kratochvil@redhat.com> + + * linespec.c (minsym_found): Reset sal.PC for COMPUNIT_LOCATIONS_VALID + and language_asm.. + * symtab.c (find_function_start_sal): Likewise. + +2015-06-25 Gary Benson <gbenson@redhat.com> + + * solib.c (solib_find_1): Set local variable sysroot to NULL if + it is the empty string after trailing slashes have been stripped. + +2015-06-25 Gary Benson <gbenson@redhat.com> + + * exec.c (exec_file_locate_attach): Remove gdb_sysroot NULL check. + * infrun.c (follow_exec): Likewise. + * remote.c (remote_filesystem_is_local): Likewise. + * solib.c (solib_find_1): Likewise. + +2015-06-24 Keith Seitz <keiths@redhat.com> + + * build-id.c (build_id_to_debug_bfd): Add cleanup to free + return value from lrealpath. + 2015-06-24 Mike Frysinger <vapier@gentoo.org> * remote-sim.c (gdbsim_open): Move sysroot update to the top. @@ -145,6 +145,10 @@ show max-completions to avoid generating large completion lists, the computation of which can cause the debugger to become temporarily unresponsive. +set history remove-duplicates +show history remove-duplicates + Control the removal of duplicate history entries. + maint set symbol-cache-size maint show symbol-cache-size Control the size of the symbol cache. diff --git a/gdb/block.c b/gdb/block.c index 79a8f195db8..f7621aa6102 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -739,13 +739,21 @@ block_lookup_symbol (const struct block *block, const char *name, if (!BLOCK_FUNCTION (block)) { + struct symbol *other = NULL; + ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym) { + if (SYMBOL_DOMAIN (sym) == domain) + return sym; + /* This is a bit of a hack, but symbol_matches_domain might ignore + STRUCT vs VAR domain symbols. So if a matching symbol is found, + make sure there is no "better" matching symbol, i.e., one with + exactly the same domain. PR 16253. */ if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), SYMBOL_DOMAIN (sym), domain)) - return sym; + other = sym; } - return NULL; + return other; } else { @@ -753,7 +761,10 @@ block_lookup_symbol (const struct block *block, const char *name, list; this loop makes sure to take anything else other than parameter symbols first; it only uses parameter symbols as a last resort. Note that this only takes up extra computation - time on a match. */ + time on a match. + It's hard to define types in the parameter list (at least in + C/C++) so we don't do the same PR 16253 hack here that is done + for the !BLOCK_FUNCTION case. */ struct symbol *sym_found = NULL; @@ -779,23 +790,31 @@ struct symbol * block_lookup_symbol_primary (const struct block *block, const char *name, const domain_enum domain) { - struct symbol *sym; + struct symbol *sym, *other; struct dict_iterator dict_iter; /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */ gdb_assert (BLOCK_SUPERBLOCK (block) == NULL || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL); + other = NULL; for (sym = dict_iter_name_first (block->dict, name, &dict_iter); sym != NULL; sym = dict_iter_name_next (name, &dict_iter)) { + if (SYMBOL_DOMAIN (sym) == domain) + return sym; + + /* This is a bit of a hack, but symbol_matches_domain might ignore + STRUCT vs VAR domain symbols. So if a matching symbol is found, + make sure there is no "better" matching symbol, i.e., one with + exactly the same domain. PR 16253. */ if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), SYMBOL_DOMAIN (sym), domain)) - return sym; + other = sym; } - return NULL; + return other; } /* See block.h. */ diff --git a/gdb/build-id.c b/gdb/build-id.c index ebf9f453480..c89cd55c262 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -93,6 +93,7 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) size_t size = build_id_len; char *s; char *filename = NULL; + struct cleanup *inner; memcpy (link, debugdir, debugdir_len); s = &link[debugdir_len]; @@ -116,7 +117,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) continue; /* We expect to be silent on the non-existing files. */ + inner = make_cleanup (xfree, filename); abfd = gdb_bfd_open (filename, gnutarget, -1); + do_cleanups (inner); + if (abfd == NULL) continue; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 6d867508520..e0beb7f0e38 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-26 Patrick Palka <patrick@parcs.ath.cx> + + * gdb.texinfo (Command History): Document the new option + "history remove-duplicates". + 2015-06-19 Doug Evans <dje@google.com> * stabs.texinfo (ELF Linker Relocation): Mention Sun stabs is no diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index c9a532a366f..20a95632a72 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -22644,6 +22644,21 @@ to 256 if this variable is not set. Non-numeric values of @env{GDBHISTSIZE} are ignored. If @var{size} is @code{unlimited} or if @env{GDBHISTSIZE} is either a negative number or the empty string, then the number of commands @value{GDBN} keeps in the history list is unlimited. + +@cindex remove duplicate history +@kindex set history remove-duplicates +@item set history remove-duplicates @var{count} +@itemx set history remove-duplicates unlimited +Control the removal of duplicate history entries in the command history list. +If @var{count} is non-zero, @value{GDBN} will look back at the last @var{count} +history entries and remove the first entry that is a duplicate of the current +entry being added to the command history list. If @var{count} is +@code{unlimited} then this lookbehind is unbounded. If @var{count} is 0, then +removal of duplicate history entries is disabled. + +Only history entries added during the current session are considered for +removal. This option is set to 0 by default. + @end table History expansion assigns special meaning to the character @kbd{!}. diff --git a/gdb/exec.c b/gdb/exec.c index 8a4ab6f0832..3dfc437a9b3 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -154,8 +154,7 @@ exec_file_locate_attach (int pid, int from_tty) /* If gdb_sysroot is not empty and the discovered filename is absolute then prefix the filename with gdb_sysroot. */ - if (gdb_sysroot != NULL && *gdb_sysroot != '\0' - && IS_ABSOLUTE_PATH (exec_file)) + if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file)) full_exec_path = exec_file_find (exec_file, NULL); if (full_exec_path == NULL) diff --git a/gdb/infrun.c b/gdb/infrun.c index 233d0f8ca5e..792f8474a5f 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1133,7 +1133,7 @@ follow_exec (ptid_t ptid, char *execd_pathname) breakpoint_init_inferior (inf_execd); - if (gdb_sysroot != NULL && *gdb_sysroot != '\0') + if (*gdb_sysroot != '\0') { char *name = exec_file_find (execd_pathname, NULL); diff --git a/gdb/linespec.c b/gdb/linespec.c index d2089b5dd9d..65155d98dda 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3432,7 +3432,9 @@ collect_symbols (struct symbol *sym, void *data) } /* We've found a minimal symbol MSYMBOL in OBJFILE to associate with our - linespec; return the SAL in RESULT. */ + linespec; return the SAL in RESULT. This function should return SALs + matching those from find_function_start_sal, otherwise false + multiple-locations breakpoints could be placed. */ static void minsym_found (struct linespec_state *self, struct objfile *objfile, @@ -3454,7 +3456,23 @@ minsym_found (struct linespec_state *self, struct objfile *objfile, sal = find_pc_sect_line (pc, NULL, 0); if (self->funfirstline) - skip_prologue_sal (&sal); + { + if (sal.symtab != NULL + && (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab)) + || SYMTAB_LANGUAGE (sal.symtab) == language_asm)) + { + /* If gdbarch_convert_from_func_ptr_addr does not apply then + sal.SECTION, sal.LINE&co. will stay correct from above. + If gdbarch_convert_from_func_ptr_addr applies then + sal.SECTION is cleared from above and sal.LINE&co. will + stay correct from the last find_pc_sect_line above. */ + sal.pc = MSYMBOL_VALUE_ADDRESS (objfile, msymbol); + sal.pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, + ¤t_target); + } + else + skip_prologue_sal (&sal); + } if (maybe_add_address (self->addr_set, objfile->pspace, sal.pc)) add_sal_to_sals (self, result, &sal, MSYMBOL_NATURAL_NAME (msymbol), 0); diff --git a/gdb/remote.c b/gdb/remote.c index f15d75efc1e..68dd99df8fc 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -10538,8 +10538,7 @@ remote_filesystem_is_local (struct target_ops *self) this case we treat the remote filesystem as local if the sysroot is exactly TARGET_SYSROOT_PREFIX and if the stub does not support vFile:open. */ - if (gdb_sysroot != NULL - && strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) == 0) + if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) == 0) { enum packet_support ps = packet_support (PACKET_vFile_open); diff --git a/gdb/solib.c b/gdb/solib.c index 0010c2fe45c..eb933c044d5 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -158,32 +158,27 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib) const char *fskind = effective_target_file_system_kind (); struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); char *sysroot = gdb_sysroot; - - if (sysroot != NULL) - { - /* If the absolute prefix starts with "target:" but the - filesystem accessed by the target_fileio_* methods - is the local filesystem then we strip the "target:" - prefix now and work with the local filesystem. This - ensures that the same search algorithm is used for - all local files regardless of whether a "target:" - prefix was used. */ - if (is_target_filename (sysroot) && target_filesystem_is_local ()) - sysroot += strlen (TARGET_SYSROOT_PREFIX); - - if (*sysroot == '\0') - sysroot = NULL; - } - - if (sysroot != NULL) + int prefix_len, orig_prefix_len; + + /* If the absolute prefix starts with "target:" but the filesystem + accessed by the target_fileio_* methods is the local filesystem + then we strip the "target:" prefix now and work with the local + filesystem. This ensures that the same search algorithm is used + for all local files regardless of whether a "target:" prefix was + used. */ + if (is_target_filename (sysroot) && target_filesystem_is_local ()) + sysroot += strlen (TARGET_SYSROOT_PREFIX); + + /* Strip any trailing slashes from the absolute prefix. */ + prefix_len = orig_prefix_len = strlen (sysroot); + + while (prefix_len > 0 && IS_DIR_SEPARATOR (sysroot[prefix_len - 1])) + prefix_len--; + + if (prefix_len == 0) + sysroot = NULL; + else if (prefix_len != orig_prefix_len) { - int prefix_len = strlen (sysroot); - - /* Remove trailing slashes from absolute prefix. */ - while (prefix_len > 0 - && IS_DIR_SEPARATOR (sysroot[prefix_len - 1])) - prefix_len--; - sysroot = savestring (sysroot, prefix_len); make_cleanup (xfree, sysroot); } diff --git a/gdb/symtab.c b/gdb/symtab.c index 669393060c9..2b6af6ccd19 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3605,7 +3605,9 @@ find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr) /* Given a function symbol SYM, find the symtab and line for the start of the function. If the argument FUNFIRSTLINE is nonzero, we want the first line - of real code inside the function. */ + of real code inside the function. + This function should return SALs matching those from minsym_found, + otherwise false multiple-locations breakpoints could be placed. */ struct symtab_and_line find_function_start_sal (struct symbol *sym, int funfirstline) @@ -3617,6 +3619,14 @@ find_function_start_sal (struct symbol *sym, int funfirstline) section = SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym); sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)), section, 0); + if (funfirstline && sal.symtab != NULL + && (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab)) + || SYMTAB_LANGUAGE (sal.symtab) == language_asm)) + { + sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); + return sal; + } + /* We always should have a line for the function start address. If we don't, something is odd. Create a plain SAL refering just the PC and hope that skip_prologue_sal (if requested) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c78dd295884..89d8e322a75 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,32 @@ +2015-06-26 Keith Seitz <keiths@redhat.com> + Doug Evans <dje@google.com> + + PR 16253 + * gdb.cp/var-tag-2.cc: New file. + * gdb.cp/var-tag-3.cc: New file. + * gdb.cp/var-tag-4.cc: New file. + * gdb.cp/var-tag.cc: New file. + * gdb.cp/var-tag.exp: New file. + +2015-06-26 Patrick Palka <patrick@parcs.ath.cx> + + * gdb.base/history-duplicates.exp: New test. + +2015-06-26 Patrick Palka <patrick@parcs.ath.cx> + + * gdb.base/completion.exp: Test the completion of the "focus" + command. + +2015-06-26 Jan Kratochvil <jan.kratochvil@redhat.com> + + * gdb.arch/amd64-prologue-skip.S: New file. + * gdb.arch/amd64-prologue-skip.exp: New file. + +2015-06-25 Simon Marchi <simon.marchi@ericsson.com> + + * gdb.python/py-prettyprint.exp (run_lang_tests): Add + is_address_zero_readable check. + 2015-06-24 Peter Bergner <bergner@vnet.ibm.com> * gdb.arch/powerpc-power.exp <rfebb>: Fixup test results. diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-skip.S b/gdb/testsuite/gdb.arch/amd64-prologue-skip.S new file mode 100644 index 00000000000..66b806a04fe --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-prologue-skip.S @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + + .text +/*0*/ hlt +pushrbp: .globl pushrbp +#define PUSHRBP push %rbp; mov %rsp, %rbp; nop +/*1*/ PUSHRBP +/*6*/ hlt + +/*7*/ hlt +#define MINSYM nop; .globl minsym; minsym: nop +/*8*/ MINSYM +/*a*/ hlt diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp b/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp new file mode 100644 index 00000000000..015cd69d2c4 --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp @@ -0,0 +1,35 @@ +# Copyright 2010-2015 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +standard_testfile .S +set binfile ${binfile}.o + +if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { + verbose "Skipping ${testfile}." + return +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}] != "" } { + untested ${testfile} + return +} + +clean_restart ${binfile} + +gdb_test "break *pushrbp" " at 0x1: file .*" +gdb_test "break pushrbp" " at 0x1: file .*" + +gdb_test "break *minsym" " at 0x9: file .*" +gdb_test "break minsym" " at 0x9: file .*" diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 4c31bfc5535..1eb0fd801a0 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -878,3 +878,21 @@ if {![skip_tui_tests]} { } } } +if {![skip_tui_tests]} { + with_test_prefix "focus command" { + set test "test completion" + send_gdb "focus \t\t" + gdb_test_multiple "" "$test" { + -re "cmd *next *prev *src *\r\n$gdb_prompt focus $" { + pass "$test" + } + } + send_gdb "\003" + set test "quit command input after testing completion" + gdb_test_multiple "" "$test" { + -re "$gdb_prompt $" { + pass "$test" + } + } + } +} diff --git a/gdb/testsuite/gdb.base/history-duplicates.exp b/gdb/testsuite/gdb.base/history-duplicates.exp new file mode 100644 index 00000000000..11bb1ed9caf --- /dev/null +++ b/gdb/testsuite/gdb.base/history-duplicates.exp @@ -0,0 +1,117 @@ +# Copyright 2015 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This file is part of the gdb testsuite. + +# Test the operation of the "history remove-duplicates" option. + + +# Check that the previous history entry is ENTRY. + +proc check_prev_history_entry { entry { test_suffix "" } } { + set test_name "history entry is $entry" + if { $test_suffix != "" } { + append test_name " $test_suffix" + } + + # Send ^P followed by ^L. + send_gdb "\x10\x0c" + + gdb_expect { + -re $entry { + pass $test_name + } + timeout { + fail $test_name + } + } +} + +# Foreach element ELT in THINGS, run the command "print $ELT", making sure that +# each invocation of "print" has a unique test name. + +proc run_print_on_each_thing { things } { + set index 0 + + foreach thing $things { + gdb_test "print $thing" "" "printing $thing (item #$index)" + incr index + } +} + +# By default the option is set to 0. +gdb_exit +gdb_start +gdb_test "show history remove-duplicates" "is 0\\." + +# Test the "unlimited" setting. +with_test_prefix "remove-duplicates=unlimited" { + gdb_exit + gdb_start + gdb_test "set history remove-duplicates unlimited" + + run_print_on_each_thing { 0 1 2 1 1 2 3 3 4 1 2 3 4 } + + check_prev_history_entry "print 4" + check_prev_history_entry "print 3" + check_prev_history_entry "print 2" + check_prev_history_entry "print 1" + check_prev_history_entry "print 0" +} + + +# Test the "1" setting. +with_test_prefix "remove-duplicates=1" { + gdb_exit + gdb_start + gdb_test "set history remove-duplicates 1" + + run_print_on_each_thing { 0 1 0 2 2 1 } + + check_prev_history_entry "print 1" + check_prev_history_entry "print 2" + check_prev_history_entry "print 0" + check_prev_history_entry "print 1" "(again)" + check_prev_history_entry "print 0" "(again)" +} + + +# Test the "0" setting. +with_test_prefix "remove-duplicates=0" { + gdb_exit + gdb_start + gdb_test "set history remove-duplicates 0" + + run_print_on_each_thing { 0 0 1 1 } + + check_prev_history_entry "print 1" + check_prev_history_entry "print 1" "(again)" + check_prev_history_entry "print 0" + check_prev_history_entry "print 0" "(again)" +} + + +# Test the "2" setting. +with_test_prefix "remove-duplicates=2" { + gdb_exit + gdb_start + gdb_test "set history remove-duplicates 2" + + run_print_on_each_thing { 1 2 0 2 0 } + + check_prev_history_entry "print 0" + check_prev_history_entry "print 2" + check_prev_history_entry "print 1" +} diff --git a/gdb/testsuite/gdb.cp/var-tag-2.cc b/gdb/testsuite/gdb.cp/var-tag-2.cc new file mode 100644 index 00000000000..7733473707a --- /dev/null +++ b/gdb/testsuite/gdb.cp/var-tag-2.cc @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* This object is in a separate file so that its debug info is not + expanded at startup. Once debug info is expanded we are no longer + exercising block_lookup_symbol, and instead are exercising + block_lookup_symbol_primary. */ +enum E2 {a2, b2, c2} E2; diff --git a/gdb/testsuite/gdb.cp/var-tag-3.cc b/gdb/testsuite/gdb.cp/var-tag-3.cc new file mode 100644 index 00000000000..7f2133f256d --- /dev/null +++ b/gdb/testsuite/gdb.cp/var-tag-3.cc @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* This object is in a separate file so that its debug info is not + expanded at startup. Once debug info is expanded we are no longer + exercising block_lookup_symbol, and instead are exercising + block_lookup_symbol_primary. */ +struct S2 {} S2; diff --git a/gdb/testsuite/gdb.cp/var-tag-4.cc b/gdb/testsuite/gdb.cp/var-tag-4.cc new file mode 100644 index 00000000000..162541cac3d --- /dev/null +++ b/gdb/testsuite/gdb.cp/var-tag-4.cc @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* This object is in a separate file so that its debug info is not + expanded at startup. Once debug info is expanded we are no longer + exercising block_lookup_symbol, and instead are exercising + block_lookup_symbol_primary. */ +union U2 {int a; char b;} U2; diff --git a/gdb/testsuite/gdb.cp/var-tag.cc b/gdb/testsuite/gdb.cp/var-tag.cc new file mode 100644 index 00000000000..93b9cafa434 --- /dev/null +++ b/gdb/testsuite/gdb.cp/var-tag.cc @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2014 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int global = 3; + +class C { +public: + struct C1 {} C1; + enum E1 {a1, b1, c1} E1; + union U1 {int a1; char b1;} U1; + + C () : E1 (b1) {} + void global (void) const {} + int f (void) const { global (); return 0; } +} C; + +struct S {} S; +enum E {a, b, c} E; +union U {int a; char b;} U; + +class CC {} cc; +struct SS {} ss; +enum EE {ea, eb, ec} ee; +union UU {int aa; char bb;} uu; + +int +main (void) +{ + return C.f (); +} diff --git a/gdb/testsuite/gdb.cp/var-tag.exp b/gdb/testsuite/gdb.cp/var-tag.exp new file mode 100644 index 00000000000..30aab99d82c --- /dev/null +++ b/gdb/testsuite/gdb.cp/var-tag.exp @@ -0,0 +1,105 @@ +# Copyright 2014, 2015 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This file is part of the gdb testsuite + +# Test expressions in which variable names shadow tag names. + +if {[skip_cplus_tests]} { continue } + +standard_testfile var-tag.cc var-tag-2.cc var-tag-3.cc var-tag-4.cc + +if {[prepare_for_testing $testfile.exp $testfile \ + [list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} { + return -1 +} + +proc do_global_tests {lang} { + set invalid_print "Attempt to use a type name as an expression" + set ptypefmt "type = (class|enum|union|struct) %s {.*}" + + with_test_prefix $lang { + gdb_test_no_output "set language $lang" + gdb_test "ptype C" "type = class C {.*}" + gdb_test "print E" "= a" + gdb_test "ptype E" "type = enum E {.*}" + gdb_test "print S" "= {<No data fields>}" + gdb_test "ptype S" "type = struct S {.*}" + gdb_test "print U" "= {.*}" + gdb_test "ptype U" "type = union U {.*}" + gdb_test "print cc" "= {.*}" + gdb_test "ptype cc" "type = class CC {.*}" + gdb_test "print CC" [format $invalid_print "CC"] + gdb_test "ptype CC" [format $ptypefmt "CC"] + gdb_test "print ss" "= {<No data fields>}" + gdb_test "ptype ss" "type = struct SS {.*}" + gdb_test "print SS" [format $invalid_print "SS"] + gdb_test "ptype SS" [format $ptypefmt "SS"] + gdb_test "print ee" "= .*" + gdb_test "ptype ee" "type = enum EE {.*}" + gdb_test "print EE" [format $invalid_print "EE"] + gdb_test "ptype EE" [format $ptypefmt "EE"] + gdb_test "print uu" "= {.*}" + gdb_test "ptype uu" "type = union UU {.*}" + gdb_test "print UU" [format $invalid_print "UU"] + gdb_test "ptype UU" [format $ptypefmt "UU"] + + # These tests exercise lookup of symbols using the "quick fns" API. + # Each of them is in a separate CU as once its CU is expanded, + # we're no longer using the quick fns API. + gdb_test "print E2" "= a2" + gdb_test "ptype E2" "type = enum E2 {.*}" + gdb_test "print S2" "= {<No data fields>}" + gdb_test "ptype S2" "type = struct S2 {.*}" + gdb_test "print U2" "= {.*}" + gdb_test "ptype U2" "type = union U2 {.*}" + } +} + +# First test expressions when there is no context. +with_test_prefix "before start" { + do_global_tests c++ + do_global_tests c +} + +# Run to main and test again. +if {![runto_main]} { + perror "couldn't run to main" + continue +} + +with_test_prefix "in main" { + do_global_tests c++ + do_global_tests c +} + +# Run to C::f and test again. +gdb_breakpoint "C::f" +gdb_continue_to_breakpoint "continue to C::f" +with_test_prefix "in C::f" { + do_global_tests c++ + do_global_tests c +} + +# Another hard-to-guess-the-users-intent bug... +# It would be really nice if we could query the user! +with_test_prefix "global collision" { + gdb_test_no_output "set language c++" + setup_kfail "c++/16463" "*-*-*" + gdb_test "print global" "= 3" + + # ... with a simple workaround: + gdb_test "print ::global" "= 3" +} diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index 399f0418b52..bbcee563127 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -92,8 +92,10 @@ proc run_lang_tests {exefile lang} { gdb_test "print cstring" " = \"const string\"" gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\"" - gdb_test "print estring3" \ - " = <error reading variable: Cannot create a lazy string with address 0x0, and a non-zero length.>" + if { ![is_address_zero_readable] } { + gdb_test "print estring3" \ + " = <error reading variable: Cannot create a lazy string with address 0x0, and a non-zero length.>" + } gdb_test_no_output "python pp_ls_encoding = 'UTF-8'" gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>" diff --git a/gdb/top.c b/gdb/top.c index 77fe0961192..01fddd2c95f 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -698,6 +698,20 @@ show_history_size (struct ui_file *file, int from_tty, value); } +/* Variable associated with the "history remove-duplicates" option. + The value -1 means unlimited. */ +static int history_remove_duplicates = 0; + +static void +show_history_remove_duplicates (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, + _("The number of history entries to look back at for " + "duplicates is %s.\n"), + value); +} + static char *history_filename; static void show_history_filename (struct ui_file *file, int from_tty, @@ -897,8 +911,43 @@ static int command_count = 0; void gdb_add_history (const char *command) { - add_history (command); command_count++; + + if (history_remove_duplicates != 0) + { + int lookbehind; + int lookbehind_threshold; + + /* The lookbehind threshold for finding a duplicate history entry is + bounded by command_count because we can't meaningfully delete + history entries that are already stored in the history file since + the history file is appended to. */ + if (history_remove_duplicates == -1 + || history_remove_duplicates > command_count) + lookbehind_threshold = command_count; + else + lookbehind_threshold = history_remove_duplicates; + + using_history (); + for (lookbehind = 0; lookbehind < lookbehind_threshold; lookbehind++) + { + HIST_ENTRY *temp = previous_history (); + + if (temp == NULL) + break; + + if (strcmp (temp->line, command) == 0) + { + HIST_ENTRY *prev = remove_history (where_history ()); + command_count--; + free_history_entry (prev); + break; + } + } + using_history (); + } + + add_history (command); } /* Safely append new history entries to the history file in a corruption-free @@ -1880,6 +1929,21 @@ variable \"GDBHISTSIZE\", or to 256 if this variable is not set."), show_history_size, &sethistlist, &showhistlist); + add_setshow_zuinteger_unlimited_cmd ("remove-duplicates", no_class, + &history_remove_duplicates, _("\ +Set how far back in history to look for and remove duplicate entries."), _("\ +Show how far back in history to look for and remove duplicate entries."), _("\ +If set to a nonzero value N, GDB will look back at the last N history entries\n\ +and remove the first history entry that is a duplicate of the most recent\n\ +entry, each time a new history entry is added.\n\ +If set to \"unlimited\", this lookbehind is unbounded.\n\ +Only history entries added during this session are considered for removal.\n\ +If set to 0, removal of duplicate history entries is disabled.\n\ +By default this option is set to 0."), + NULL, + show_history_remove_duplicates, + &sethistlist, &showhistlist); + add_setshow_filename_cmd ("filename", no_class, &history_filename, _("\ Set the filename in which to record the command history"), _("\ Show the filename in which to record the command history"), _("\ diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 8c0685bd41d..feb360b0218 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -354,6 +354,71 @@ tui_set_var_cmd (char *null_args, int from_tty, struct cmd_list_element *c) tui_rehighlight_all (); } +/* Complete possible window names to focus on. TEXT is the complete text + entered so far, WORD is the word currently being completed. */ + +static VEC (char_ptr) * +focus_completer (struct cmd_list_element *ignore, + const char *text, const char *word) +{ + VEC (const_char_ptr) *completion_name_vec = NULL; + VEC (char_ptr) *matches_vec; + int win_type; + + for (win_type = SRC_WIN; win_type < MAX_MAJOR_WINDOWS; win_type++) + { + const char *completion_name = NULL; + + /* We can't focus on an invisible window. */ + if (tui_win_list[win_type] == NULL + || !tui_win_list[win_type]->generic.is_visible) + continue; + + switch (win_type) + { + case SRC_WIN: + completion_name = "src"; + break; + case DISASSEM_WIN: + completion_name = "asm"; + break; + case DATA_WIN: + completion_name = "regs"; + break; + case CMD_WIN: + completion_name = "cmd"; + break; + default: + break; + } + + if (completion_name != NULL) + VEC_safe_push (const_char_ptr, completion_name_vec, completion_name); + } + + /* If no windows are considered visible then the TUI has not yet been + initialized. But still "focus src" and "focus cmd" will work because + invoking the focus command will entail initializing the TUI which sets the + default layout to SRC_COMMAND. */ + if (VEC_length (const_char_ptr, completion_name_vec) == 0) + { + VEC_safe_push (const_char_ptr, completion_name_vec, "src"); + VEC_safe_push (const_char_ptr, completion_name_vec, "cmd"); + } + + VEC_safe_push (const_char_ptr, completion_name_vec, "next"); + VEC_safe_push (const_char_ptr, completion_name_vec, "prev"); + VEC_safe_push (const_char_ptr, completion_name_vec, NULL); + + matches_vec + = complete_on_enum (VEC_address (const_char_ptr, completion_name_vec), + text, word); + + VEC_free (const_char_ptr, completion_name_vec); + + return matches_vec; +} + /* Function to initialize gdb commands, for tui window manipulation. */ @@ -365,6 +430,7 @@ _initialize_tui_win (void) { static struct cmd_list_element *tui_setlist; static struct cmd_list_element *tui_showlist; + struct cmd_list_element *focus_cmd; /* Define the classes of commands. They will appear in the help list in the reverse of this order. */ @@ -393,7 +459,7 @@ regs : the register display\n")); add_com_alias ("wh", "winheight", class_tui, 0); add_info ("win", tui_all_windows_info, _("List of all displayed windows.\n")); - add_com ("focus", class_tui, tui_set_focus_command, _("\ + focus_cmd = add_com ("focus", class_tui, tui_set_focus_command, _("\ Set focus to named window or next/prev window.\n\ Usage: focus {<win> | next | prev}\n\ Valid Window names are:\n\ @@ -402,6 +468,7 @@ asm : the disassembly window\n\ regs : the register display\n\ cmd : the command window\n")); add_com_alias ("fs", "focus", class_tui, 0); + set_cmd_completer (focus_cmd, focus_completer); add_com ("+", class_tui, tui_scroll_forward_command, _("\ Scroll window forward.\n\ Usage: + [win] [n]\n")); diff --git a/include/ChangeLog b/include/ChangeLog index 89b4bbebccd..d85a1b0e73c 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2015-06-26 Matthew Fortune <matthew.fortune@imgtec.com> + + * elf/mips.h (DT_MIPS_RLD_MAP_REL): New macro. + 2015-06-22 Nick Clifton <nickc@redhat.com> * dis-asm.h (struct disassemble_info): Add stop_vma field. diff --git a/include/elf/mips.h b/include/elf/mips.h index 23c21e208f6..3926380e45c 100644 --- a/include/elf/mips.h +++ b/include/elf/mips.h @@ -748,6 +748,9 @@ extern void bfd_mips_elf32_swap_reginfo_out /* Points to the base of a writable PLT. */ #define DT_MIPS_RWPLT 0x70000034 + +/* Relative offset of run time loader map, used for debugging. */ +#define DT_MIPS_RLD_MAP_REL 0x70000035 /* Flags which may appear in a DT_MIPS_FLAGS entry. */ diff --git a/ld/ChangeLog b/ld/ChangeLog index 38dbb8bb351..eeb08cdac38 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2015-06-28 H.J. Lu <hongjiu.lu@intel.com> + + * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): + Replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB. + +2015-06-26 H.J. Lu <hongjiu.lu@intel.com> + + * emulparams/elf_iamcu.sh (COMPILE_IN): New. + 2015-06-15 Nick Clifton <nickc@redhat.com> PR ld/18466 diff --git a/ld/emulparams/elf_iamcu.sh b/ld/emulparams/elf_iamcu.sh index adab897174b..39c7a57e6ce 100644 --- a/ld/emulparams/elf_iamcu.sh +++ b/ld/emulparams/elf_iamcu.sh @@ -8,6 +8,7 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" ARCH=iamcu MACHINE= +COMPILE_IN=yes TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index cdea5d8704e..14f7963fbd4 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2223,7 +2223,7 @@ gld${EMULATION_NAME}_handle_option (int optc) if (strcasecmp (optarg, "none") == 0) link_info.compress_debug = COMPRESS_DEBUG_NONE; else if (strcasecmp (optarg, "zlib") == 0) - link_info.compress_debug = COMPRESS_DEBUG_ZLIB; + link_info.compress_debug = COMPRESS_DEBUG_GNU_ZLIB; else if (strcasecmp (optarg, "zlib-gnu") == 0) link_info.compress_debug = COMPRESS_DEBUG_GNU_ZLIB; else if (strcasecmp (optarg, "zlib-gabi") == 0) diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 2031bc82936..e4f913f0cda 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,46 @@ +2015-06-27 H.J. Lu <hongjiu.lu@intel.com> + + * ld-xtensa/tlsbin.rd: Updated. + * ld-xtensa/tlspic.rd: Likewise. + +2015-06-26 Matthew Fortune <matthew.fortune@imgtec.com> + + * ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag. + * ld-mips-elf/pic-and-nonpic-4b.ad: Likewise. + * ld-mips-elf/pic-and-nonpic-5b.ad: Likewise. + * ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise. + * ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise. + * ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise. + * ld-mips-elf/tlsdyn-o32-1.d: Likewise. + * ld-mips-elf/tlsdyn-o32-1.got: Likewise. + * ld-mips-elf/tlsdyn-o32-2.d: Likewise. + * ld-mips-elf/tlsdyn-o32-2.got: Likewise. + * ld-mips-elf/tlsdyn-o32-3.d: Likewise. + * ld-mips-elf/tlsdyn-o32-3.got: Likewise. + * ld-mips-elf/tlsdyn-o32.d: Likewise. + * ld-mips-elf/tlsdyn-o32.got: Likewise. + * ld-mips-elf/pie-n32.d: New file. + * ld-mips-elf/pie-n64.d: Likewise. + * ld-mips-elf/pie-o32.d: Likewise. + * ld-mips-elf/pie.s: Likewise. + * ld-mips-elf/mips-elf.exp: Add new tests. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + * ld-elf/strtab.d: Only run on *-*-linux* and *-*-gnu* targets. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + * ld-mmix/bspec1.d: Updated. + * ld-mmix/bspec2.d: Likewise. + * ld-mmix/undef-3.d: Likewise. + +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + PR gas/18451 + * ld-elf/strtab.d: New file. + * ld-elf/strtab.s: Likewise. + 2015-06-24 H.J. Lu <hongjiu.lu@intel.com> * ld-i386/i386.exp: Run pltgot-2 for Linux targets. diff --git a/ld/testsuite/ld-elf/strtab.d b/ld/testsuite/ld-elf/strtab.d new file mode 100644 index 00000000000..c1e90969227 --- /dev/null +++ b/ld/testsuite/ld-elf/strtab.d @@ -0,0 +1,8 @@ +#ld: -shared +#readelf: -W -x .strtab +#target: *-*-linux* *-*-gnu* + +#failif +#... + +0x[0-9 ]+.*\.xxxx\..* +#... diff --git a/ld/testsuite/ld-elf/strtab.s b/ld/testsuite/ld-elf/strtab.s new file mode 100644 index 00000000000..931d9ef31df --- /dev/null +++ b/ld/testsuite/ld-elf/strtab.s @@ -0,0 +1,8 @@ + .text +.globl x; x: +.globl xx; xx: +.globl xxx; xxx: +.globl xxxx; xxxx: +.globl xxxxx; xxxxx: +.globl xxxxxx; xxxxxx: + .byte 0 diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 7057e2f74c1..923d8dffc60 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -186,6 +186,15 @@ if { $linux_gnu } { } } +# Test PIE debug dynamic tags +if { $linux_gnu } { + run_dump_test "pie-o32" + if { $has_newabi } { + run_dump_test "pie-n32" + run_dump_test "pie-n64" + } +} + if $has_newabi { if { $embedded_elf } { run_dump_test "elf-rel-got-n32-embed" \ diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad index 227d15d0cd9..9f5ca905bd3 100644 --- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad +++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad @@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*: 0x0000000a \(STRSZ\) .* 0x0000000b \(SYMENT\) .* 0x70000016 \(MIPS_RLD_MAP\) * 0x80000 + 0x70000035 \(MIPS_RLD_MAP_REL\) .* 0x00000015 \(DEBUG\) * 0x0 0x00000003 \(PLTGOT\) * 0xa0000 0x70000001 \(MIPS_RLD_VERSION\) * 1 diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad index e14a2d38796..1bea0447026 100644 --- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad +++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad @@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*: 0x0000000a \(STRSZ\) .* 0x0000000b \(SYMENT\) .* 0x70000016 \(MIPS_RLD_MAP\) * 0x80000 + 0x70000035 \(MIPS_RLD_MAP_REL\) .* 0x00000015 \(DEBUG\) * 0x0 0x00000003 \(PLTGOT\) * 0xa0000 0x00000011 \(REL\) * 0x43000 diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad index d7a672fcbe8..972ace16f13 100644 --- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad +++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad @@ -9,6 +9,7 @@ Dynamic section at offset .* contains .*: 0x0000000a \(STRSZ\) .* 0x0000000b \(SYMENT\) .* 0x70000016 \(MIPS_RLD_MAP\) * 0x80000 + 0x70000035 \(MIPS_RLD_MAP_REL\) .* 0x00000015 \(DEBUG\) * 0x0 0x00000016 \(TEXTREL\) * 0x0 0x00000003 \(PLTGOT\) * 0xa0000 diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad index 5df3c6ca16e..28ee34ada1e 100644 --- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad +++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad @@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*: 0x0000000a \(STRSZ\) .* 0x0000000b \(SYMENT\) .* 0x70000016 \(MIPS_RLD_MAP\) * 0x80000 + 0x70000035 \(MIPS_RLD_MAP_REL\) .* 0x00000015 \(DEBUG\) * 0x0 0x00000003 \(PLTGOT\) * 0xa0000 0x00000011 \(REL\) * 0x43000 diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad index d8fc300e5ca..7b2ce4cfc1d 100644 --- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad +++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad @@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*: 0x0+0000000a \(STRSZ\) .* 0x0+0000000b \(SYMENT\) .* 0x0+70000016 \(MIPS_RLD_MAP\) * 0x80000 + 0x0+70000035 \(MIPS_RLD_MAP_REL\) .* 0x0+00000015 \(DEBUG\) * 0x0 0x0+00000003 \(PLTGOT\) * 0xa0000 0x0+00000011 \(REL\) * 0x43000 diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad index 5df3c6ca16e..28ee34ada1e 100644 --- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad +++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad @@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*: 0x0000000a \(STRSZ\) .* 0x0000000b \(SYMENT\) .* 0x70000016 \(MIPS_RLD_MAP\) * 0x80000 + 0x70000035 \(MIPS_RLD_MAP_REL\) .* 0x00000015 \(DEBUG\) * 0x0 0x00000003 \(PLTGOT\) * 0xa0000 0x00000011 \(REL\) * 0x43000 diff --git a/ld/testsuite/ld-mips-elf/pie-n32.d b/ld/testsuite/ld-mips-elf/pie-n32.d new file mode 100644 index 00000000000..bcfbcd20968 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pie-n32.d @@ -0,0 +1,23 @@ +#source: pie.s +#as: -march=from-abi -mabi=n32 -EB +#ld: -melf32btsmipn32 -pie +#readelf: -d + +Dynamic section at offset 0x180 contains 16 entries: + Tag * Type * Name/Value + 0x00000004 \(HASH\) * 0x228 + 0x00000005 \(STRTAB\) * 0x304 + 0x00000006 \(SYMTAB\) * 0x264 + 0x0000000a \(STRSZ\) * 72 \(bytes\) + 0x0000000b \(SYMENT\) * 16 \(bytes\) + 0x70000035 \(MIPS_RLD_MAP_REL\) * 0x101b8 + 0x00000015 \(DEBUG\) * 0x0 + 0x00000003 \(PLTGOT\) * 0x10370 + 0x70000001 \(MIPS_RLD_VERSION\) * 1 + 0x70000005 \(MIPS_FLAGS\) * NOTPOT + 0x70000006 \(MIPS_BASE_ADDRESS\) * 0x0 + 0x7000000a \(MIPS_LOCAL_GOTNO\) * 2 + 0x70000011 \(MIPS_SYMTABNO\) * 10 + 0x70000012 \(MIPS_UNREFEXTNO\) * 13 + 0x70000013 \(MIPS_GOTSYM\) * 0xa + 0x00000000 \(NULL\) * 0x0 diff --git a/ld/testsuite/ld-mips-elf/pie-n64.d b/ld/testsuite/ld-mips-elf/pie-n64.d new file mode 100644 index 00000000000..bf2238c5410 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pie-n64.d @@ -0,0 +1,23 @@ +#source: pie.s +#as: -march=from-abi -mabi=64 -EB +#ld: -melf64btsmip -pie +#readelf: -d + +Dynamic section at offset 0x208 contains 16 entries: + Tag * Type * Name/Value + 0x0+00000004 \(HASH\) * 0x358 + 0x0+00000005 \(STRTAB\) * 0x488 + 0x0+00000006 \(SYMTAB\) * 0x398 + 0x0+0000000a \(STRSZ\) * 72 \(bytes\) + 0x0+0000000b \(SYMENT\) * 24 \(bytes\) + 0x0+70000035 \(MIPS_RLD_MAP_REL\) * 0x102a8 + 0x0+00000015 \(DEBUG\) * 0x0 + 0x0+00000003 \(PLTGOT\) * 0x10510 + 0x0+70000001 \(MIPS_RLD_VERSION\) * 1 + 0x0+70000005 \(MIPS_FLAGS\) * NOTPOT + 0x0+70000006 \(MIPS_BASE_ADDRESS\) * 0x0 + 0x0+7000000a \(MIPS_LOCAL_GOTNO\) * 2 + 0x0+70000011 \(MIPS_SYMTABNO\) * 10 + 0x0+70000012 \(MIPS_UNREFEXTNO\) * 13 + 0x0+70000013 \(MIPS_GOTSYM\) * 0xa + 0x0+00000000 \(NULL\) * 0x0 diff --git a/ld/testsuite/ld-mips-elf/pie-o32.d b/ld/testsuite/ld-mips-elf/pie-o32.d new file mode 100644 index 00000000000..5a9a30889e6 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pie-o32.d @@ -0,0 +1,23 @@ +#source: pie.s +#as: -mabi=32 -EB +#ld: -melf32btsmip -pie +#readelf: -d + +Dynamic section at offset 0x178 contains 16 entries: + Tag * Type * Name/Value + 0x00000004 \(HASH\) * 0x220 + 0x00000005 \(STRTAB\) * 0x2fc + 0x00000006 \(SYMTAB\) * 0x25c + 0x0000000a \(STRSZ\) * 72 \(bytes\) + 0x0000000b \(SYMENT\) * 16 \(bytes\) + 0x70000035 \(MIPS_RLD_MAP_REL\) * 0x101c0 + 0x00000015 \(DEBUG\) * 0x0 + 0x00000003 \(PLTGOT\) * 0x10370 + 0x70000001 \(MIPS_RLD_VERSION\) * 1 + 0x70000005 \(MIPS_FLAGS\) * NOTPOT + 0x70000006 \(MIPS_BASE_ADDRESS\) * 0x0 + 0x7000000a \(MIPS_LOCAL_GOTNO\) * 2 + 0x70000011 \(MIPS_SYMTABNO\) * 10 + 0x70000012 \(MIPS_UNREFEXTNO\) * 13 + 0x70000013 \(MIPS_GOTSYM\) * 0xa + 0x00000000 \(NULL\) * 0x0 diff --git a/ld/testsuite/ld-mips-elf/pie.s b/ld/testsuite/ld-mips-elf/pie.s new file mode 100644 index 00000000000..c7f2b206b9f --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pie.s @@ -0,0 +1,6 @@ + .abicalls + .global __start + .ent __start +__start: + jr $31 + .end __start diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d index ca52d8b18c0..6b8f96cbfc4 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d @@ -5,7 +5,7 @@ Disassembly of section .text: .* <__start>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7c40 addiu gp,gp,31808 + .*: 279c7c30 addiu gp,gp,31792 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) @@ -55,7 +55,7 @@ Disassembly of section .text: .* <other>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7b80 addiu gp,gp,31616 + .*: 279c7b70 addiu gp,gp,31600 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got index 163aeb5273b..1dbcab40a0a 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got @@ -13,6 +13,6 @@ OFFSET TYPE VALUE Contents of section .got: - 10000020 00000000 80000000 0040047c 00000000 ................ + 10000020 00000000 80000000 0040048c 00000000 .........@...... 10000030 00000000 00000000 00000000 00000000 ................ 10000040 00000000 00000001 00000000 ............ diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d index ca52d8b18c0..6b8f96cbfc4 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d @@ -5,7 +5,7 @@ Disassembly of section .text: .* <__start>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7c40 addiu gp,gp,31808 + .*: 279c7c30 addiu gp,gp,31792 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) @@ -55,7 +55,7 @@ Disassembly of section .text: .* <other>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7b80 addiu gp,gp,31616 + .*: 279c7b70 addiu gp,gp,31600 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got index 80e914818b5..fb50635f049 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got @@ -13,6 +13,6 @@ OFFSET TYPE VALUE Contents of section .got: - 10000020 00000000 80000000 0040047c 00000000 .* + 10000020 00000000 80000000 0040048c 00000000 .* 10000030 00000000 00000000 00000000 00000000 .* 10000040 00000000 00000001 00000000 .* diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d index 78eb8825521..758a4f22c9a 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d @@ -5,7 +5,7 @@ Disassembly of section .text: .* <other>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7c40 addiu gp,gp,31808 + .*: 279c7c30 addiu gp,gp,31792 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) @@ -51,7 +51,7 @@ Disassembly of section .text: .* <__start>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7b90 addiu gp,gp,31632 + .*: 279c7b80 addiu gp,gp,31616 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got index a1191e7960b..4a97099885d 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got @@ -13,6 +13,6 @@ OFFSET TYPE VALUE Contents of section .got: - 10000020 00000000 80000000 0040052c 00000000 .* + 10000020 00000000 80000000 0040053c 00000000 .* 10000030 00000000 00000000 00000000 00000000 .* 10000040 00000000 00000001 00000000 .* diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32.d index 699035bb3c6..ea50960ac6f 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32.d +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32.d @@ -5,7 +5,7 @@ Disassembly of section .text: .* <__start>: .*: 3c1c0fc0 lui gp,0xfc0 - .*: 279c7bf0 addiu gp,gp,31728 + .*: 279c7be0 addiu gp,gp,31712 .*: 0399e021 addu gp,gp,t9 .*: 27bdfff0 addiu sp,sp,-16 .*: afbe0008 sw s8,8\(sp\) diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32.got index a1587a69e9c..7942188441e 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32.got +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32.got @@ -13,6 +13,6 @@ OFFSET TYPE VALUE Contents of section .got: - 10000020 00000000 80000000 004004cc 00000000 ................ + 10000020 00000000 80000000 004004dc 00000000 .........@...... 10000030 00000000 00000000 00000001 00000000 ................ 10000040 00000000 00000000 00000000 ............ diff --git a/ld/testsuite/ld-mmix/bspec1.d b/ld/testsuite/ld-mmix/bspec1.d index 784ed55ae59..6440bbeefed 100644 --- a/ld/testsuite/ld-mmix/bspec1.d +++ b/ld/testsuite/ld-mmix/bspec1.d @@ -19,7 +19,7 @@ Section Headers: +\[ 4\] \.symtab +SYMTAB +0+ .* +0+d8 +0+18 +5 +3 +8 +\[ 5\] \.strtab +STRTAB +0+ .* - +0+2d +0+ +0 +0 +1 + +0+26 +0+ +0 +0 +1 Key to Flags: #... diff --git a/ld/testsuite/ld-mmix/bspec2.d b/ld/testsuite/ld-mmix/bspec2.d index 85d847d3cf0..e881b08b830 100644 --- a/ld/testsuite/ld-mmix/bspec2.d +++ b/ld/testsuite/ld-mmix/bspec2.d @@ -24,7 +24,7 @@ Section Headers: +\[ 5\] \.symtab +SYMTAB +0+ .* +0+108 +0+18 +6 +4 +8 +\[ 6\] \.strtab +STRTAB +0+ .* - +0+32 +0+ +0 +0 +1 + +0+2b +0+ +0 +0 +1 Key to Flags: #... diff --git a/ld/testsuite/ld-mmix/undef-3.d b/ld/testsuite/ld-mmix/undef-3.d index c0352a6964f..94eeeaa5a7b 100644 --- a/ld/testsuite/ld-mmix/undef-3.d +++ b/ld/testsuite/ld-mmix/undef-3.d @@ -16,7 +16,7 @@ Section Headers: +\[ 3\] \.symtab +SYMTAB +0+ .* +0+a8 +0+18 +4 +2 +8 +\[ 4\] \.strtab +STRTAB +0+ .* - +0+28 +0+ +0 +0 +1 + +0+21 +0+ +0 +0 +1 Key to Flags: #... diff --git a/ld/testsuite/ld-xtensa/tlsbin.rd b/ld/testsuite/ld-xtensa/tlsbin.rd index dcb9fab7bb4..6226ea704f5 100644 --- a/ld/testsuite/ld-xtensa/tlsbin.rd +++ b/ld/testsuite/ld-xtensa/tlsbin.rd @@ -19,9 +19,9 @@ Section Headers: +\[[ 0-9]+\] .tdata +PROGBITS +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 +WAT +0 +0 +4 +\[[ 0-9]+\] .dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4 +\[[ 0-9]+\] .got +PROGBITS +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 +WA +0 +0 +4 + +\[[ 0-9]+\] .xtensa.info +NOTE +0+ .* +\[[ 0-9]+\] .xt.lit +PROGBITS +0+ .* +\[[ 0-9]+\] .xt.prop +PROGBITS +0+ .* - +\[[ 0-9]+\] .xtensa.info +NOTE +0+ .* +\[[ 0-9]+\] .shstrtab +.* +\[[ 0-9]+\] .symtab +.* +\[[ 0-9]+\] .strtab +.* @@ -63,10 +63,10 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND * +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2 - +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start + +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 __bss_start +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1 - +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata - +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end + +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _edata + +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _end Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name @@ -84,6 +84,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 * +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +12 * +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +13 * + +[0-9]+: [0-9a-f]+ +0 +FILE +LOCAL +DEFAULT +ABS +tmpdir/tlsbin.o +[0-9]+: [0-9a-f]+ +0 +TLS +LOCAL +DEFAULT +8 sl1 +[0-9]+: [0-9a-f]+ +0 +TLS +LOCAL +DEFAULT +8 sl2 +[0-9]+: [0-9a-f]+ +0 +TLS +LOCAL +DEFAULT +8 sl3 @@ -92,6 +93,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: [0-9a-f]+ +0 +TLS +LOCAL +DEFAULT +8 sl6 +[0-9]+: [0-9a-f]+ +0 +TLS +LOCAL +DEFAULT +8 sl7 +[0-9]+: [0-9a-f]+ +0 +TLS +LOCAL +DEFAULT +8 sl8 + +[0-9]+: 0+ +0 +FILE +LOCAL +DEFAULT +ABS * +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +8 _TLS_MODULE_BASE_ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +DEFAULT +8 sg8 @@ -106,13 +108,13 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +6 _start +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +HIDDEN +8 sh4 +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +HIDDEN +8 sh5 - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 __bss_start +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +DEFAULT +8 sg2 +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1 +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +HIDDEN +8 sh1 +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +DEFAULT +8 sg6 +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +DEFAULT +8 sg7 - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _edata + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _end +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +HIDDEN +8 sh2 +[0-9]+: [0-9a-f]+ +0 +TLS +GLOBAL +HIDDEN +8 sh6 diff --git a/ld/testsuite/ld-xtensa/tlspic.rd b/ld/testsuite/ld-xtensa/tlspic.rd index 92d704e5004..2edd54f8068 100644 --- a/ld/testsuite/ld-xtensa/tlspic.rd +++ b/ld/testsuite/ld-xtensa/tlspic.rd @@ -20,9 +20,9 @@ Section Headers: +\[[ 0-9]+\] .tbss +NOBITS +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 +WAT +0 +0 +4 +\[[ 0-9]+\] .dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +3 +0 +4 +\[[ 0-9]+\] .got +PROGBITS +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 +WA +0 +0 +4 + +\[[ 0-9]+\] .xtensa.info +NOTE +0+ .* +\[[ 0-9]+\] .xt.lit +PROGBITS +0+ .* +\[[ 0-9]+\] .xt.prop +PROGBITS +0+ .* - +\[[ 0-9]+\] .xtensa.info +NOTE +0+ .* +\[[ 0-9]+\] .shstrtab +.* +\[[ 0-9]+\] .symtab +.* +\[[ 0-9]+\] .strtab +.* @@ -55,20 +55,20 @@ Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 18 entries: [0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +0+ +sg1 \+ 0 [0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+4 +sg2 \+ 0 [0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+4 +sg2 \+ 0 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +0+20 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +0+20 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+24 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +0+40 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +0+40 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+44 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +0+60 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +0+60 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+64 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +0+ -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +0+ -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+24 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+44 -[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +0+64 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +20 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +20 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +24 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +40 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +40 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +44 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +60 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +60 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +64 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_FN +0 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLSDESC_ARG +0 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +24 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +44 +[0-9a-f]+ +[0-9a-f]+ R_XTENSA_TLS_TPOFF +64 Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name @@ -79,12 +79,12 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5 +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1 +[0-9]+: 0+350 +0 +FUNC +GLOBAL +DEFAULT +5 _start - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 __bss_start +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2 +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6 +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7 - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _edata + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _end Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name @@ -102,6 +102,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 * +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +12 * +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +13 * + +[0-9]+: [0-9a-f]+ +0 +FILE +LOCAL +DEFAULT +ABS +tmpdir/tlspic1.o +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +7 sl1 +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +7 sl2 +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +7 sl3 @@ -110,6 +111,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +7 sl6 +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +7 sl7 +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +7 sl8 + +[0-9]+: 0+ +0 +FILE +LOCAL +DEFAULT +ABS * +[0-9]+: 0+60 +0 +TLS +LOCAL +DEFAULT +8 sH1 +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_ +[0-9]+: 0+144c +0 +OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC @@ -134,9 +136,9 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5 +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1 +[0-9]+: 0+350 +0 +FUNC +GLOBAL +DEFAULT +5 _start - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 __bss_start +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2 +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6 +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7 - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata - +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _edata + +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +10 _end |