summaryrefslogtreecommitdiff
path: root/gdb/somread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-10-15 13:28:57 -0600
committerTom Tromey <tromey@redhat.com>2014-02-26 12:11:17 -0700
commit2273f0ac95a79ce29ef42025c63f90e82cf907d7 (patch)
tree11a8d5d14c815bc74dacecdc0374fb082512ab13 /gdb/somread.c
parent77e371c079408e265f1dfd2b0620dd8e76c23371 (diff)
downloadbinutils-gdb-2273f0ac95a79ce29ef42025c63f90e82cf907d7.tar.gz
change minsyms not to be relocated at read-time
This removes the runtime offsets from minsyms. Instead, these offsets will now be applied whenever the minsym's address is computed. This patch redefines MSYMBOL_VALUE_ADDRESS to actually use the offsets from the given objfile. Then, it updates all the symbol readers, changing them so that they do not add in the section offset when creating the symbol. This change also lets us remove relocation of minsyms from objfile_relocate1 and also msymbols_sort. 2014-02-26 Tom Tromey <tromey@redhat.com> * minsyms.c (msymbols_sort): Remove. * minsyms.h (msymbols_sort): Remove. * objfiles.c (objfile_relocate1): Don't relocate minsyms. * symtab.h (MSYMBOL_VALUE_ADDRESS): Use objfile offsets. * elfread.c (elf_symtab_read): Don't add section offsets. * xcoffread.c (record_minimal_symbol): Don't add section offset to minimal symbol address. * somread.c (text_offset, data_offset): Remove. (som_symtab_read): Don't add section offsets to minimal symbol addresses. * coff-pe-read.c (add_pe_forwarded_sym, read_pe_exported_syms): Don't add section offsets to minimal symbols. * coffread.c (coff_symtab_read): Don't add section offsets to minimal symbol addresses. * machoread.c (macho_symtab_add_minsym): Don't add section offset to minimal symbol addresses. * mipsread.c (read_alphacoff_dynamic_symtab): Don't add section offset to minimal symbol addresses. * mdebugread.c (parse_partial_symbols): Don't add section offset to minimal symbol addresses. * dbxread.c (read_dbx_dynamic_symtab): Don't add section offset to minimal symbol addresses.
Diffstat (limited to 'gdb/somread.c')
-rw-r--r--gdb/somread.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/gdb/somread.c b/gdb/somread.c
index 79068cd5e0b..4a7837e5923 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -57,9 +57,6 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
const int symsize = sizeof (struct som_external_symbol_dictionary_record);
-#define text_offset ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile))
-#define data_offset ANOFFSET (section_offsets, SECT_OFF_DATA (objfile))
-
number_of_symbols = bfd_get_symcount (abfd);
/* Allocate a buffer to read in the debug info.
@@ -94,7 +91,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
more accurate to check for a nonzero text offset, but they
have not provided any information about why that test is
more accurate. */
- dynamic = (text_offset != 0);
+ dynamic = (ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)) != 0);
endbufp = buf + number_of_symbols;
for (bufp = buf; bufp < endbufp; ++bufp)
@@ -152,7 +149,6 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
case ST_MILLICODE:
symname = bfd_getb32 (bufp->name) + stringtab;
ms_type = mst_text;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
break;
@@ -165,20 +161,17 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
ms_type = mst_solib_trampoline;
else
ms_type = mst_text;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
break;
case ST_STUB:
symname = bfd_getb32 (bufp->name) + stringtab;
ms_type = mst_solib_trampoline;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
break;
case ST_DATA:
symname = bfd_getb32 (bufp->name) + stringtab;
- symbol_value += data_offset;
ms_type = mst_data;
break;
default:
@@ -200,7 +193,6 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
case ST_CODE:
symname = bfd_getb32 (bufp->name) + stringtab;
ms_type = mst_file_text;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
check_strange_names:
@@ -231,7 +223,6 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
case ST_MILLICODE:
symname = bfd_getb32 (bufp->name) + stringtab;
ms_type = mst_file_text;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
break;
@@ -242,21 +233,18 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
using mst_file_text vs mst_solib_trampoline here like
we do for SS_UNIVERSAL and SS_EXTERNAL symbols above. */
ms_type = mst_file_text;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
break;
case ST_STUB:
symname = bfd_getb32 (bufp->name) + stringtab;
ms_type = mst_solib_trampoline;
- symbol_value += text_offset;
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
break;
case ST_DATA:
symname = bfd_getb32 (bufp->name) + stringtab;
- symbol_value += data_offset;
ms_type = mst_file_data;
goto check_strange_names;
@@ -277,7 +265,6 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
case ST_STORAGE:
case ST_DATA:
symname = bfd_getb32 (bufp->name) + stringtab;
- symbol_value += data_offset;
ms_type = mst_data;
break;
@@ -300,11 +287,16 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
ALL_OBJFILE_OSECTIONS (objfile, iter)
{
+ CORE_ADDR start;
+ CORE_ADDR len;
+
if (bfd_is_const_section (iter->the_bfd_section))
continue;
- if (obj_section_addr (iter) <= symbol_value
- && symbol_value < obj_section_endaddr (iter))
+ start = bfd_get_section_vma (iter->objfile->obfd,
+ iter->the_bfd_section);
+ len = bfd_get_section_size (iter->the_bfd_section);
+ if (start <= symbol_value && symbol_value < start + len)
{
section = iter->the_bfd_section;
break;