summaryrefslogtreecommitdiff
path: root/gdb/xcoffread.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1997-04-19 08:52:17 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1997-04-19 08:52:17 +0000
commit211b564e41c1258a7aefa6ad412b5c637c429e33 (patch)
treea0c7e0a2ba89062e93ed9335cbf242f1ffdcf4dc /gdb/xcoffread.c
parent27172171300d0f4c53e765cd3b1f72cc258a33ca (diff)
downloadbinutils-gdb-211b564e41c1258a7aefa6ad412b5c637c429e33.tar.gz
* config/powerpc/tm-ppc-aix4.h, config/rs6000/tm-rs6000-aix4.h
(DONT_RELOCATE_SYMFILE_OBJFILE): Removed. * xcoffsolib.h (struct vmap): Add new members tvma, toffs and dvma, remove tadj. * exec.c (bfdsec_to_vmap): Initialize new vmap members, initialize tstart and dstart with section VMA. * rs6000-nat.c (vmap_symtab): Relocate relative to the VMA in the object file. (vmap_ldinfo, xcoff_relocate_core): Adjust tstart by section offset of the text section, remove DONT_RELOCATE_SYMFILE_OBJFILE hack. (vmap_exec): Relocate relative to the VMA in the object file, relocate .bss section as well. (xcoff_relocate_core): No longer adjust section addresses by VMA. * rs6000-tdep.c (find_toc_address): Change type of tocbase to CORE_ADDR. * xcoffread.c (secnum_to_bfd_section): New routine to get BFD section from CS section number. (scan_xcoff_symtab): Make toc_offset section relative. * symtab.c (total_number_of_methods): Avoid core dump if baseclass type is still undefined.
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r--gdb/xcoffread.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 89df7dfa0c1..49814c3800d 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1,5 +1,5 @@
/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
+ Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 1997
Free Software Foundation, Inc.
Derived from coffread.c, dbxread.c, and a lot of hacking.
Contributed by IBM Corporation.
@@ -272,10 +272,12 @@ process_linenos PARAMS ((CORE_ADDR, CORE_ADDR));
/* Translate from a COFF section number (target_index) to a SECT_OFF_*
code. */
static int secnum_to_section PARAMS ((int, struct objfile *));
+static asection * secnum_to_bfd_section PARAMS ((int, struct objfile *));
struct find_targ_sec_arg {
int targ_index;
int *resultp;
+ asection **bfd_sect;
};
static void find_targ_sec PARAMS ((bfd *, asection *, void *));
@@ -295,6 +297,7 @@ static void find_targ_sec (abfd, sect, obj)
*args->resultp = SECT_OFF_DATA;
else
*args->resultp = SECT_OFF_BSS;
+ *args->bfd_sect = sect;
}
}
@@ -305,12 +308,30 @@ secnum_to_section (secnum, objfile)
struct objfile *objfile;
{
int off = SECT_OFF_TEXT;
+ asection *sect = NULL;
struct find_targ_sec_arg args;
args.targ_index = secnum;
args.resultp = &off;
+ args.bfd_sect = &sect;
bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
return off;
}
+
+/* Return the BFD section that CS points to. */
+static asection *
+secnum_to_bfd_section (secnum, objfile)
+ int secnum;
+ struct objfile *objfile;
+{
+ int off = SECT_OFF_TEXT;
+ asection *sect = NULL;
+ struct find_targ_sec_arg args;
+ args.targ_index = secnum;
+ args.resultp = &off;
+ args.bfd_sect = &sect;
+ bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
+ return sect;
+}
/* add a given stab string into given stab vector. */
@@ -2195,12 +2216,13 @@ scan_xcoff_symtab (section_offsets, objfile)
struct section_offsets *section_offsets;
struct objfile *objfile;
{
- int toc_offset = 0; /* toc offset value in data section. */
+ CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
char *filestring = NULL;
char *namestring;
int past_first_source_file = 0;
bfd *abfd;
+ asection *bfd_sect;
unsigned int nsyms;
/* Current partial symtab */
@@ -2363,6 +2385,11 @@ scan_xcoff_symtab (section_offsets, objfile)
if (toc_offset)
warning ("More than one XMC_TC0 symbol found.");
toc_offset = symbol.n_value;
+
+ /* Make TOC offset relative to start address of section. */
+ bfd_sect = secnum_to_bfd_section (symbol.n_scnum, objfile);
+ if (bfd_sect)
+ toc_offset -= bfd_section_vma (objfile->obfd, bfd_sect);
break;
case XMC_TC: