aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog25
-rw-r--r--gdb/coff-pe-read.c24
-rw-r--r--gdb/coffread.c8
-rw-r--r--gdb/dbxread.c23
-rw-r--r--gdb/elfread.c11
-rw-r--r--gdb/machoread.c13
-rw-r--r--gdb/mdebugread.c38
-rw-r--r--gdb/minsyms.c10
-rw-r--r--gdb/minsyms.h6
-rw-r--r--gdb/mipsread.c3
-rw-r--r--gdb/objfiles.c13
-rw-r--r--gdb/somread.c24
-rw-r--r--gdb/symtab.h7
-rw-r--r--gdb/xcoffread.c1
14 files changed, 67 insertions, 139 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0ce3186..76389cc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,30 @@
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.
+
+2014-02-26 Tom Tromey <tromey@redhat.com>
+
* ada-lang.c (ada_main_name): Update.
(ada_add_standard_exceptions): Update.
* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index e1a61b7..dbb57f8 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -204,7 +204,7 @@ add_pe_forwarded_sym (const char *sym_name, const char *forward_dll_name,
const char *forward_func_name, int ordinal,
const char *dll_name, struct objfile *objfile)
{
- CORE_ADDR vma;
+ CORE_ADDR vma, baseaddr;
struct bound_minimal_symbol msymbol;
enum minimal_symbol_type msymtype;
char *qualified_name, *bare_name;
@@ -259,11 +259,18 @@ add_pe_forwarded_sym (const char *sym_name, const char *forward_dll_name,
qualified_name = xstrprintf ("%s!%s", dll_name, bare_name);
- prim_record_minimal_symbol_and_info (qualified_name, vma, msymtype,
- section, objfile);
+ /* Note that this code makes a minimal symbol whose value may point
+ outside of any section in this objfile. These symbols can't
+ really be relocated properly, but nevertheless we make a stab at
+ it, choosing an approach consistent with the history of this
+ code. */
+ baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+
+ prim_record_minimal_symbol_and_info (qualified_name, vma - baseaddr,
+ msymtype, section, objfile);
/* Enter the plain name as well, which might not be unique. */
- prim_record_minimal_symbol_and_info (bare_name, vma, msymtype,
+ prim_record_minimal_symbol_and_info (bare_name, vma - baseaddr, msymtype,
section, objfile);
xfree (qualified_name);
xfree (bare_name);
@@ -528,15 +535,6 @@ read_pe_exported_syms (struct objfile *objfile)
bfd_map_over_sections (dll, get_section_vmas, &pe_sections_info);
- /* Adjust the vma_offsets in case this PE got relocated. This
- assumes that *all* sections share the same relocation offset
- as the text section. */
- for (i = 0; i < otherix; i++)
- {
- section_data[i].vma_offset
- += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- }
-
/* Truncate name at first dot. Should maybe also convert to all
lower case for convenience on Windows. */
read_pe_truncate_name (dll_name);
diff --git a/gdb/coffread.c b/gdb/coffread.c
index c5ad60c..44d77f0 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -873,8 +873,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
minsyms. */
int section = cs_to_section (cs, objfile);
- tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
+ tmpaddr = cs->c_value;
record_minimal_symbol (cs, tmpaddr, mst_text,
section, objfile);
@@ -976,6 +975,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
enum minimal_symbol_type ms_type;
int sec;
+ CORE_ADDR offset = 0;
if (cs->c_secnum == N_UNDEF)
{
@@ -1007,7 +1007,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|| cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT
|| (pe_file && (cs->c_sclass == C_STAT)))
- tmpaddr += ANOFFSET (objfile->section_offsets, sec);
+ offset = ANOFFSET (objfile->section_offsets, sec);
if (bfd_section->flags & SEC_CODE)
{
@@ -1046,7 +1046,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
sym = process_coff_symbol
(cs, &main_aux, objfile);
- SYMBOL_VALUE (sym) = tmpaddr;
+ SYMBOL_VALUE (sym) = tmpaddr + offset;
SYMBOL_SECTION (sym) = sec;
}
}
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index e0e5c48..5171f50 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1045,20 +1045,14 @@ read_dbx_dynamic_symtab (struct objfile *objfile)
if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
{
- sym_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
type = N_TEXT;
}
else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
{
- sym_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
type = N_DATA;
}
else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
{
- sym_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
type = N_BSS;
}
else
@@ -1098,9 +1092,7 @@ read_dbx_dynamic_symtab (struct objfile *objfile)
counter++, relptr++)
{
arelent *rel = *relptr;
- CORE_ADDR address =
- rel->address + ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
+ CORE_ADDR address = rel->address;
switch (bfd_get_arch (abfd))
{
@@ -1326,22 +1318,16 @@ read_dbx_symtab (struct objfile *objfile)
case N_TEXT | N_EXT:
case N_NBTEXT | N_EXT:
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
goto record_it;
case N_DATA | N_EXT:
case N_NBDATA | N_EXT:
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
goto record_it;
case N_BSS:
case N_BSS | N_EXT:
case N_NBBSS | N_EXT:
case N_SETV | N_EXT: /* FIXME, is this in BSS? */
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
goto record_it;
case N_ABS | N_EXT:
@@ -1364,14 +1350,15 @@ read_dbx_symtab (struct objfile *objfile)
case N_FN:
case N_FN_SEQ:
case N_TEXT:
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
namestring = set_namestring (objfile, &nlist);
if ((namestring[0] == '-' && namestring[1] == 'l')
|| (namestring[(nsl = strlen (namestring)) - 1] == 'o'
&& namestring[nsl - 2] == '.'))
{
+ nlist.n_value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
+
if (past_first_source_file && pst
/* The gould NP1 uses low values for .o and -l symbols
which are not the address. */
@@ -1396,8 +1383,6 @@ read_dbx_symtab (struct objfile *objfile)
continue;
case N_DATA:
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
goto record_it;
case N_UNDF | N_EXT:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 7c4b175..fd88813 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -325,9 +325,6 @@ elf_symtab_read (struct objfile *objfile, int type,
&& bfd_get_section_by_name (abfd, ".plt") != NULL)
continue;
- symaddr += ANOFFSET (objfile->section_offsets,
- gdb_bfd_section_index (objfile->obfd, sect));
-
msym = record_minimal_symbol
(sym->name, strlen (sym->name), copy_names,
symaddr, mst_solib_trampoline, sect, objfile);
@@ -367,13 +364,6 @@ elf_symtab_read (struct objfile *objfile, int type,
interested in will have a section. */
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
- /* Relocate all non-absolute and non-TLS symbols by the
- section offset. */
- if (sym->section != bfd_abs_section_ptr
- && !(sym->section->flags & SEC_THREAD_LOCAL))
- {
- symaddr += offset;
- }
/* For non-absolute symbols, use the type of the section
they are relative to, to intuit text/data. Bfd provides
no way of figuring this out for absolute symbols. */
@@ -409,7 +399,6 @@ elf_symtab_read (struct objfile *objfile, int type,
{
if (sym->name[0] == '.')
continue;
- symaddr += offset;
}
}
else if (sym->section->flags & SEC_CODE)
diff --git a/gdb/machoread.c b/gdb/machoread.c
index f7194e2..f5e4a1e 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -111,24 +111,11 @@ macho_symtab_add_minsym (struct objfile *objfile, const asymbol *sym)
if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
{
CORE_ADDR symaddr;
- CORE_ADDR offset;
enum minimal_symbol_type ms_type;
- offset = ANOFFSET (objfile->section_offsets,
- gdb_bfd_section_index (objfile->obfd, sym->section));
-
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
- /* Select global/local/weak symbols. Note that bfd puts abs
- symbols in their own section, so all symbols we are
- interested in will have a section. */
- /* Relocate all non-absolute and non-TLS symbols by the
- section offset. */
- if (sym->section != bfd_abs_section_ptr
- && !(sym->section->flags & SEC_THREAD_LOCAL))
- symaddr += offset;
-
if (sym->section == bfd_abs_section_ptr)
ms_type = mst_abs;
else if (sym->section->flags & SEC_CODE)
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 5cb8d86..94af07b 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2519,14 +2519,10 @@ parse_partial_symbols (struct objfile *objfile)
{
case stProc:
/* Beginnning of Procedure */
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
break;
case stStaticProc:
/* Load time only static procs */
ms_type = mst_file_text;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
break;
case stGlobal:
/* External symbol */
@@ -2539,20 +2535,14 @@ parse_partial_symbols (struct objfile *objfile)
else if (SC_IS_DATA (ext_in->asym.sc))
{
ms_type = mst_data;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
ms_type = mst_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
}
else if (SC_IS_SBSS (ext_in->asym.sc))
{
ms_type = mst_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- get_section_index (objfile, ".sbss"));
}
else
ms_type = mst_abs;
@@ -2585,8 +2575,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_text;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
}
else if (SC_IS_DATA (ext_in->asym.sc))
{
@@ -2594,8 +2582,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_data;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
@@ -2603,8 +2589,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
}
else if (SC_IS_SBSS (ext_in->asym.sc))
{
@@ -2614,7 +2598,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_bss;
- svalue += ANOFFSET (objfile->section_offsets, sbss_sect_index);
}
else
ms_type = mst_abs;
@@ -2748,8 +2731,6 @@ parse_partial_symbols (struct objfile *objfile)
CORE_ADDR procaddr;
long isym;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
if (sh.st == stStaticProc)
{
namestring = debug_info->ss + fh->issBase + sh.iss;
@@ -2757,6 +2738,8 @@ parse_partial_symbols (struct objfile *objfile)
mst_file_text, sh.sc,
objfile);
}
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
procaddr = sh.value;
isym = AUX_GET_ISYM (fh->fBigendian,
@@ -2796,22 +2779,22 @@ parse_partial_symbols (struct objfile *objfile)
case scPData:
case scXData:
namestring = debug_info->ss + fh->issBase + sh.iss;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
record_minimal_symbol (namestring, sh.value,
mst_file_data, sh.sc,
objfile);
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_DATA (objfile));
break;
default:
/* FIXME! Shouldn't this use cases for bss,
then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
record_minimal_symbol (namestring, sh.value,
mst_file_bss, sh.sc,
objfile);
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_BSS (objfile));
break;
}
}
@@ -3435,6 +3418,7 @@ parse_partial_symbols (struct objfile *objfile)
{
char *name;
enum address_class class;
+ CORE_ADDR minsym_value;
(*swap_sym_in) (cur_bfd,
((char *) debug_info->external_sym
@@ -3460,6 +3444,8 @@ parse_partial_symbols (struct objfile *objfile)
name = debug_info->ss + fh->issBase + sh.iss;
+ minsym_value = sh.value;
+
switch (sh.sc)
{
case scText:
@@ -3492,7 +3478,7 @@ parse_partial_symbols (struct objfile *objfile)
int new_sdx;
case stStaticProc:
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_text,
SECT_OFF_TEXT (objfile),
objfile);
@@ -3578,12 +3564,12 @@ parse_partial_symbols (struct objfile *objfile)
case stStatic: /* Variable */
if (SC_IS_DATA (sh.sc))
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_data,
SECT_OFF_DATA (objfile),
objfile);
else
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_bss,
SECT_OFF_BSS (objfile),
objfile);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index aa6df11..df499a4 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1296,16 +1296,6 @@ terminate_minimal_symbol_table (struct objfile *objfile)
}
}
-/* Sort all the minimal symbols in OBJFILE. */
-
-void
-msymbols_sort (struct objfile *objfile)
-{
- qsort (objfile->msymbols, objfile->minimal_symbol_count,
- sizeof (struct minimal_symbol), compare_minimal_symbols);
- build_minimal_symbol_hash_tables (objfile);
-}
-
/* Check if PC is in a shared library trampoline code stub.
Return minimal symbol for the trampoline entry or NULL if PC is not
in a trampoline code stub. */
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index a11b5e8..289dcae 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -136,12 +136,6 @@ void install_minimal_symbols (struct objfile *);
void terminate_minimal_symbol_table (struct objfile *objfile);
-/* Sort all the minimal symbols in OBJFILE. This should be only be
- called after relocating symbols; it ensures that the minimal
- symbols are properly sorted by address. */
-
-void msymbols_sort (struct objfile *objfile);
-
/* Compute a hash code for the string argument. */
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index d199554..090a7e7 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -367,7 +367,6 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
ms_type = mst_text;
else
ms_type = mst_file_text;
- sym_value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
}
else if (sym_shndx == SHN_MIPS_DATA)
{
@@ -375,7 +374,6 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
ms_type = mst_data;
else
ms_type = mst_file_data;
- sym_value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
}
else if (sym_shndx == SHN_MIPS_ACOMMON)
{
@@ -383,7 +381,6 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
ms_type = mst_bss;
else
ms_type = mst_file_bss;
- sym_value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
}
else if (sym_shndx == SHN_ABS)
{
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index db0c720..f456569 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -801,19 +801,6 @@ objfile_relocate1 (struct objfile *objfile,
objfile->sf->qf->relocate (objfile, new_offsets, delta);
{
- struct minimal_symbol *msym;
-
- ALL_OBJFILE_MSYMBOLS (objfile, msym)
- if (MSYMBOL_SECTION (msym) >= 0)
- SET_MSYMBOL_VALUE_ADDRESS (msym, (MSYMBOL_VALUE_ADDRESS (objfile, msym)
- + ANOFFSET (delta,
- MSYMBOL_SECTION (msym))));
- }
- /* Relocating different sections by different amounts may cause the symbols
- to be out of order. */
- msymbols_sort (objfile);
-
- {
int i;
for (i = 0; i < objfile->num_sections; ++i)
diff --git a/gdb/somread.c b/gdb/somread.c
index 79068cd..4a7837e 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;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index d80222b5..ef145d9 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -393,12 +393,11 @@ struct minimal_symbol
#define MSYMBOL_VALUE(symbol) (symbol)->mginfo.value.ivalue
/* The unrelocated address of the minimal symbol. */
#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->mginfo.value.address + 0)
-/* This weird definition lets us syntax-check without affecting the
- results. It is a temporary measure until a later patch. */
+/* The relocated address of the minimal symbol, using the section
+ offsets from OBJFILE. */
#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \
((symbol)->mginfo.value.address \
- + (0 \
- * ANOFFSET ((objfile)->section_offsets, ((symbol)->mginfo.section))))
+ + ANOFFSET ((objfile)->section_offsets, ((symbol)->mginfo.section)))
/* For a bound minsym, we can easily compute the address directly. */
#define BMSYMBOL_VALUE_ADDRESS(symbol) \
MSYMBOL_VALUE_ADDRESS ((symbol).objfile, (symbol).minsym)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index db11820..b986dbd 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -948,7 +948,6 @@ record_minimal_symbol (const char *name, CORE_ADDR address,
if (name[0] == '.')
++name;
- address += ANOFFSET (objfile->section_offsets, section);
prim_record_minimal_symbol_and_info (name, address, ms_type,
secnum_to_section (n_scnum, objfile),
objfile);