diff options
author | dim <dim@FreeBSD.org> | 2011-02-18 20:54:12 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-18 20:54:12 +0000 |
commit | 58abb279f50d5ad9fbad30a39da04296664ec6cb (patch) | |
tree | 50e46c29de9d928e0d098104d28f1c1e0e628384 /contrib/gdb | |
parent | e1012e9afb73b834c089b15373d264e45a7b03f0 (diff) | |
parent | a3786f65f1e2fa3a4e925fdb4b2b5544b9021bf9 (diff) | |
download | FreeBSD-src-58abb279f50d5ad9fbad30a39da04296664ec6cb.zip FreeBSD-src-58abb279f50d5ad9fbad30a39da04296664ec6cb.tar.gz |
Merge binutils 2.17.50 to head. This brings a number of improvements to
x86 CPU support, better support for powerpc64, some new directives, and
many other things. Bump __FreeBSD_version, and add a note to UPDATING.
Thanks to the many people that have helped to test this.
Obtained from: projects/binutils-2.17
Diffstat (limited to 'contrib/gdb')
-rw-r--r-- | contrib/gdb/gdb/dsrec.c | 2 | ||||
-rw-r--r-- | contrib/gdb/gdb/dwarf2-frame.c | 4 | ||||
-rw-r--r-- | contrib/gdb/gdb/dwarf2read.c | 24 | ||||
-rw-r--r-- | contrib/gdb/gdb/elfread.c | 109 | ||||
-rw-r--r-- | contrib/gdb/gdb/gcore.c | 2 | ||||
-rw-r--r-- | contrib/gdb/gdb/mipsread.c | 8 | ||||
-rw-r--r-- | contrib/gdb/gdb/remote-e7000.c | 2 | ||||
-rw-r--r-- | contrib/gdb/gdb/remote.c | 2 | ||||
-rw-r--r-- | contrib/gdb/gdb/symfile.c | 18 | ||||
-rw-r--r-- | contrib/gdb/gdb/tracepoint.c | 2 |
10 files changed, 101 insertions, 72 deletions
diff --git a/contrib/gdb/gdb/dsrec.c b/contrib/gdb/gdb/dsrec.c index 1422600..42071e1 100644 --- a/contrib/gdb/gdb/dsrec.c +++ b/contrib/gdb/gdb/dsrec.c @@ -93,7 +93,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, { int numbytes; bfd_vma addr = bfd_get_section_vma (abfd, s) + load_offset; - bfd_size_type size = bfd_get_section_size_before_reloc (s); + bfd_size_type size = bfd_get_section_size (s); char *section_name = (char *) bfd_get_section_name (abfd, s); /* Both GDB and BFD have mechanisms for printing addresses. In the below, GDB's is used so that the address is diff --git a/contrib/gdb/gdb/dwarf2-frame.c b/contrib/gdb/gdb/dwarf2-frame.c index 51a631d..b54717a 100644 --- a/contrib/gdb/gdb/dwarf2-frame.c +++ b/contrib/gdb/gdb/dwarf2-frame.c @@ -1573,7 +1573,7 @@ dwarf2_build_frame_info (struct objfile *objfile) dwarf_eh_frame_section); unit.dwarf_frame_size - = bfd_get_section_size_before_reloc (dwarf_eh_frame_section); + = bfd_get_section_size (dwarf_eh_frame_section); unit.dwarf_frame_section = dwarf_eh_frame_section; /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base @@ -1601,7 +1601,7 @@ dwarf2_build_frame_info (struct objfile *objfile) unit.dwarf_frame_buffer = dwarf2_read_section (objfile, dwarf_frame_section); unit.dwarf_frame_size - = bfd_get_section_size_before_reloc (dwarf_frame_section); + = bfd_get_section_size (dwarf_frame_section); unit.dwarf_frame_section = dwarf_frame_section; frame_ptr = unit.dwarf_frame_buffer; diff --git a/contrib/gdb/gdb/dwarf2read.c b/contrib/gdb/gdb/dwarf2read.c index 5cd3d2c..400750d 100644 --- a/contrib/gdb/gdb/dwarf2read.c +++ b/contrib/gdb/gdb/dwarf2read.c @@ -954,47 +954,47 @@ dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr) { if (strcmp (sectp->name, INFO_SECTION) == 0) { - dwarf_info_size = bfd_get_section_size_before_reloc (sectp); + dwarf_info_size = bfd_get_section_size (sectp); dwarf_info_section = sectp; } else if (strcmp (sectp->name, ABBREV_SECTION) == 0) { - dwarf_abbrev_size = bfd_get_section_size_before_reloc (sectp); + dwarf_abbrev_size = bfd_get_section_size (sectp); dwarf_abbrev_section = sectp; } else if (strcmp (sectp->name, LINE_SECTION) == 0) { - dwarf_line_size = bfd_get_section_size_before_reloc (sectp); + dwarf_line_size = bfd_get_section_size (sectp); dwarf_line_section = sectp; } else if (strcmp (sectp->name, PUBNAMES_SECTION) == 0) { - dwarf_pubnames_size = bfd_get_section_size_before_reloc (sectp); + dwarf_pubnames_size = bfd_get_section_size (sectp); dwarf_pubnames_section = sectp; } else if (strcmp (sectp->name, ARANGES_SECTION) == 0) { - dwarf_aranges_size = bfd_get_section_size_before_reloc (sectp); + dwarf_aranges_size = bfd_get_section_size (sectp); dwarf_aranges_section = sectp; } else if (strcmp (sectp->name, LOC_SECTION) == 0) { - dwarf_loc_size = bfd_get_section_size_before_reloc (sectp); + dwarf_loc_size = bfd_get_section_size (sectp); dwarf_loc_section = sectp; } else if (strcmp (sectp->name, MACINFO_SECTION) == 0) { - dwarf_macinfo_size = bfd_get_section_size_before_reloc (sectp); + dwarf_macinfo_size = bfd_get_section_size (sectp); dwarf_macinfo_section = sectp; } else if (strcmp (sectp->name, STR_SECTION) == 0) { - dwarf_str_size = bfd_get_section_size_before_reloc (sectp); + dwarf_str_size = bfd_get_section_size (sectp); dwarf_str_section = sectp; } else if (strcmp (sectp->name, FRAME_SECTION) == 0) { - dwarf_frame_size = bfd_get_section_size_before_reloc (sectp); + dwarf_frame_size = bfd_get_section_size (sectp); dwarf_frame_section = sectp; } else if (strcmp (sectp->name, EH_FRAME_SECTION) == 0) @@ -1002,13 +1002,13 @@ dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr) flagword aflag = bfd_get_section_flags (ignore_abfd, sectp); if (aflag & SEC_HAS_CONTENTS) { - dwarf_eh_frame_size = bfd_get_section_size_before_reloc (sectp); + dwarf_eh_frame_size = bfd_get_section_size (sectp); dwarf_eh_frame_section = sectp; } } else if (strcmp (sectp->name, RANGES_SECTION) == 0) { - dwarf_ranges_size = bfd_get_section_size_before_reloc (sectp); + dwarf_ranges_size = bfd_get_section_size (sectp); dwarf_ranges_section = sectp; } } @@ -4185,7 +4185,7 @@ dwarf2_read_section (struct objfile *objfile, asection *sectp) { bfd *abfd = objfile->obfd; char *buf, *retbuf; - bfd_size_type size = bfd_get_section_size_before_reloc (sectp); + bfd_size_type size = bfd_get_section_size (sectp); if (size == 0) return NULL; diff --git a/contrib/gdb/gdb/elfread.c b/contrib/gdb/gdb/elfread.c index 83a1862..f6faecc 100644 --- a/contrib/gdb/gdb/elfread.c +++ b/contrib/gdb/gdb/elfread.c @@ -83,12 +83,12 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip) if (strcmp (sectp->name, ".debug") == 0) { ei->dboffset = sectp->filepos; - ei->dbsize = bfd_get_section_size_before_reloc (sectp); + ei->dbsize = bfd_get_section_size (sectp); } else if (strcmp (sectp->name, ".line") == 0) { ei->lnoffset = sectp->filepos; - ei->lnsize = bfd_get_section_size_before_reloc (sectp); + ei->lnsize = bfd_get_section_size (sectp); } else if (strcmp (sectp->name, ".stab") == 0) { @@ -124,13 +124,14 @@ record_minimal_symbol (char *name, CORE_ADDR address, SYNOPSIS - void elf_symtab_read (struct objfile *objfile, int dynamic) + void elf_symtab_read (struct objfile *objfile, int dynamic, + long number_of_symbols, asymbol **symbol_table) DESCRIPTION - Given an objfile and a flag that specifies whether or not the objfile - is for an executable or not (may be shared library for example), add - all the global function and data symbols to the minimal symbol table. + Given an objfile, a symbol table, and a flag indicating whether the + symbol table contains dynamic symbols, add all the global function + and data symbols to the minimal symbol table. In stabs-in-ELF, as implemented by Sun, there are some local symbols defined in the ELF symbol table, which can be used to locate @@ -141,14 +142,12 @@ record_minimal_symbol (char *name, CORE_ADDR address, */ static void -elf_symtab_read (struct objfile *objfile, int dynamic) +elf_symtab_read (struct objfile *objfile, int dynamic, + long number_of_symbols, asymbol **symbol_table) { long storage_needed; asymbol *sym; - asymbol **symbol_table; - long number_of_symbols; long i; - struct cleanup *back_to; CORE_ADDR symaddr; CORE_ADDR offset; enum minimal_symbol_type ms_type; @@ -165,34 +164,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic) struct dbx_symfile_info *dbx = objfile->sym_stab_info; int stripped = (bfd_get_symcount (objfile->obfd) == 0); - if (dynamic) + if (1) { - storage_needed = bfd_get_dynamic_symtab_upper_bound (objfile->obfd); - - /* Nothing to be done if there is no dynamic symtab. */ - if (storage_needed < 0) - return; - } - else - { - storage_needed = bfd_get_symtab_upper_bound (objfile->obfd); - if (storage_needed < 0) - error ("Can't read symbols from %s: %s", bfd_get_filename (objfile->obfd), - bfd_errmsg (bfd_get_error ())); - } - if (storage_needed > 0) - { - symbol_table = (asymbol **) xmalloc (storage_needed); - back_to = make_cleanup (xfree, symbol_table); - if (dynamic) - number_of_symbols = bfd_canonicalize_dynamic_symtab (objfile->obfd, - symbol_table); - else - number_of_symbols = bfd_canonicalize_symtab (objfile->obfd, symbol_table); - if (number_of_symbols < 0) - error ("Can't read symbols from %s: %s", bfd_get_filename (objfile->obfd), - bfd_errmsg (bfd_get_error ())); - for (i = 0; i < number_of_symbols; i++) { sym = symbol_table[i]; @@ -448,7 +421,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic) ELF_MAKE_MSYMBOL_SPECIAL (sym, msym); } } - do_cleanups (back_to); } } @@ -491,6 +463,9 @@ elf_symfile_read (struct objfile *objfile, int mainline) struct elfinfo ei; struct cleanup *back_to; CORE_ADDR offset; + long symcount = 0, dynsymcount = 0, synthcount, storage_needed; + asymbol **symbol_table = NULL, **dyn_symbol_table = NULL; + asymbol *synthsyms; init_minimal_symbol_collection (); back_to = make_cleanup_discard_minimal_symbols (); @@ -507,11 +482,65 @@ elf_symfile_read (struct objfile *objfile, int mainline) chain of info into the dbx_symfile_info in objfile->sym_stab_info, which can later be used by elfstab_offset_sections. */ - elf_symtab_read (objfile, 0); + storage_needed = bfd_get_symtab_upper_bound (objfile->obfd); + if (storage_needed < 0) + error (_("Can't read symbols from %s: %s"), bfd_get_filename (objfile->obfd), + bfd_errmsg (bfd_get_error ())); + + if (storage_needed > 0) + { + symbol_table = (asymbol **) xmalloc (storage_needed); + make_cleanup (xfree, symbol_table); + symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table); + + if (symcount < 0) + error (_("Can't read symbols from %s: %s"), bfd_get_filename (objfile->obfd), + bfd_errmsg (bfd_get_error ())); + + elf_symtab_read (objfile, 0, symcount, symbol_table); + } /* Add the dynamic symbols. */ - elf_symtab_read (objfile, 1); + storage_needed = bfd_get_dynamic_symtab_upper_bound (objfile->obfd); + + if (storage_needed > 0) + { + dyn_symbol_table = (asymbol **) xmalloc (storage_needed); + make_cleanup (xfree, dyn_symbol_table); + dynsymcount = bfd_canonicalize_dynamic_symtab (objfile->obfd, + dyn_symbol_table); + + if (dynsymcount < 0) + error (_("Can't read symbols from %s: %s"), bfd_get_filename (objfile->obfd), + bfd_errmsg (bfd_get_error ())); + + elf_symtab_read (objfile, 1, dynsymcount, dyn_symbol_table); + } + + /* Add synthetic symbols - for instance, names for any PLT entries. */ + + synthcount = bfd_get_synthetic_symtab (abfd, symcount, symbol_table, + dynsymcount, dyn_symbol_table, + &synthsyms); + if (synthcount > 0) + { + asymbol **synth_symbol_table; + long i; + + make_cleanup (xfree, synthsyms); + synth_symbol_table = xmalloc (sizeof (asymbol *) * synthcount); + for (i = 0; i < synthcount; i++) + { + synth_symbol_table[i] = synthsyms + i; + /* Synthetic symbols are not, strictly speaking, either local + or global. But we can treat them as global symbols, since + they are effectively dynamic symbols. */ + synth_symbol_table[i]->flags |= BSF_GLOBAL; + } + make_cleanup (xfree, synth_symbol_table); + elf_symtab_read (objfile, 0, synthcount, synth_symbol_table); + } /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. The debug readers below this point diff --git a/contrib/gdb/gdb/gcore.c b/contrib/gdb/gdb/gcore.c index b551372..3b3a259 100644 --- a/contrib/gdb/gdb/gcore.c +++ b/contrib/gdb/gdb/gcore.c @@ -244,7 +244,7 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top) || strcmp (".bss", bfd_section_name (abfd, sec)) == 0) { sec_vaddr = bfd_get_section_vma (abfd, sec); - sec_size = bfd_get_section_size_before_reloc (sec); + sec_size = bfd_get_section_size (sec); if (sec_vaddr + sec_size > top_of_data_memory) top_of_data_memory = sec_vaddr + sec_size; } diff --git a/contrib/gdb/gdb/mipsread.c b/contrib/gdb/gdb/mipsread.c index f67eeea..18549e8 100644 --- a/contrib/gdb/gdb/mipsread.c +++ b/contrib/gdb/gdb/mipsread.c @@ -256,10 +256,10 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets, || si.got_sect == NULL) return; - sym_secsize = bfd_get_section_size_before_reloc (si.sym_sect); - str_secsize = bfd_get_section_size_before_reloc (si.str_sect); - dyninfo_secsize = bfd_get_section_size_before_reloc (si.dyninfo_sect); - got_secsize = bfd_get_section_size_before_reloc (si.got_sect); + sym_secsize = bfd_get_section_size (si.sym_sect); + str_secsize = bfd_get_section_size (si.str_sect); + dyninfo_secsize = bfd_get_section_size (si.dyninfo_sect); + got_secsize = bfd_get_section_size (si.got_sect); sym_secptr = xmalloc (sym_secsize); cleanups = make_cleanup (free, sym_secptr); str_secptr = xmalloc (str_secsize); diff --git a/contrib/gdb/gdb/remote-e7000.c b/contrib/gdb/gdb/remote-e7000.c index c422c94..725aeef 100644 --- a/contrib/gdb/gdb/remote-e7000.c +++ b/contrib/gdb/gdb/remote-e7000.c @@ -1568,7 +1568,7 @@ e7000_load (char *args, int from_tty) file_ptr fptr; section_address = bfd_get_section_vma (pbfd, section); - section_size = bfd_get_section_size_before_reloc (section); + section_size = bfd_get_section_size (section); if (!quiet) printf_filtered ("[Loading section %s at 0x%s (%s bytes)]\n", diff --git a/contrib/gdb/gdb/remote.c b/contrib/gdb/gdb/remote.c index 36da449..7ff2cb8 100644 --- a/contrib/gdb/gdb/remote.c +++ b/contrib/gdb/gdb/remote.c @@ -4834,7 +4834,7 @@ compare_sections_command (char *args, int from_tty) if (!(s->flags & SEC_LOAD)) continue; /* skip non-loadable section */ - size = bfd_get_section_size_before_reloc (s); + size = bfd_get_section_size (s); if (size == 0) continue; /* skip zero-length section */ diff --git a/contrib/gdb/gdb/symfile.c b/contrib/gdb/gdb/symfile.c index 19ae294..c97b44c 100644 --- a/contrib/gdb/gdb/symfile.c +++ b/contrib/gdb/gdb/symfile.c @@ -1353,7 +1353,7 @@ add_section_size_callback (bfd *abfd, asection *asec, void *data) { bfd_size_type *sum = data; - *sum += bfd_get_section_size_before_reloc (asec); + *sum += bfd_get_section_size (asec); } /* Opaque data for load_section_callback. */ @@ -1373,7 +1373,7 @@ load_section_callback (bfd *abfd, asection *asec, void *data) if (bfd_get_section_flags (abfd, asec) & SEC_LOAD) { - bfd_size_type size = bfd_get_section_size_before_reloc (asec); + bfd_size_type size = bfd_get_section_size (asec); if (size > 0) { char *buffer; @@ -2879,7 +2879,7 @@ pc_in_unmapped_range (CORE_ADDR pc, asection *section) if (overlay_debugging) if (section && section_is_overlay (section)) { - size = bfd_get_section_size_before_reloc (section); + size = bfd_get_section_size (section); if (section->lma <= pc && pc < section->lma + size) return 1; } @@ -2899,7 +2899,7 @@ pc_in_mapped_range (CORE_ADDR pc, asection *section) if (overlay_debugging) if (section && section_is_overlay (section)) { - size = bfd_get_section_size_before_reloc (section); + size = bfd_get_section_size (section); if (section->vma <= pc && pc < section->vma + size) return 1; } @@ -2915,9 +2915,9 @@ sections_overlap (asection *a, asection *b) /* FIXME: need bfd *, so we can use bfd_section_vma methods. */ CORE_ADDR a_start = a->vma; - CORE_ADDR a_end = a->vma + bfd_get_section_size_before_reloc (a); + CORE_ADDR a_end = a->vma + bfd_get_section_size (a); CORE_ADDR b_start = b->vma; - CORE_ADDR b_end = b->vma + bfd_get_section_size_before_reloc (b); + CORE_ADDR b_end = b->vma + bfd_get_section_size (b); return (a_start < b_end && b_start < a_end); } @@ -3052,7 +3052,7 @@ list_overlays_command (char *args, int from_tty) vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section); lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section); - size = bfd_get_section_size_before_reloc (osect->the_bfd_section); + size = bfd_get_section_size (osect->the_bfd_section); name = bfd_section_name (objfile->obfd, osect->the_bfd_section); printf_filtered ("Section %s, loaded at ", name); @@ -3392,7 +3392,7 @@ simple_overlay_update_1 (struct obj_section *osect) bfd *obfd = osect->objfile->obfd; asection *bsect = osect->the_bfd_section; - size = bfd_get_section_size_before_reloc (osect->the_bfd_section); + size = bfd_get_section_size (osect->the_bfd_section); for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) @@ -3453,7 +3453,7 @@ simple_overlay_update (struct obj_section *osect) bfd *obfd = osect->objfile->obfd; asection *bsect = osect->the_bfd_section; - size = bfd_get_section_size_before_reloc (osect->the_bfd_section); + size = bfd_get_section_size (osect->the_bfd_section); for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) diff --git a/contrib/gdb/gdb/tracepoint.c b/contrib/gdb/gdb/tracepoint.c index 39c6877..52fe4ca 100644 --- a/contrib/gdb/gdb/tracepoint.c +++ b/contrib/gdb/gdb/tracepoint.c @@ -1693,7 +1693,7 @@ remote_set_transparent_ranges (void) anysecs = 1; lma = s->lma; - size = bfd_get_section_size_before_reloc (s); + size = bfd_get_section_size (s); sprintf_vma (tmp1, lma); sprintf_vma (tmp2, lma + size); sprintf (target_buf + strlen (target_buf), |