1999-05-03 15:29:11 +08:00
|
|
|
|
/* stabs.c -- Parse COFF debugging information
|
2020-01-01 15:57:01 +08:00
|
|
|
|
Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
Written by Ian Lance Taylor <ian@cygnus.com>.
|
|
|
|
|
|
|
|
|
|
This file is part of GNU Binutils.
|
|
|
|
|
|
|
|
|
|
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
|
2007-07-06 00:54:46 +08:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-05-03 15:29:11 +08:00
|
|
|
|
(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, write to the Free Software
|
2005-05-08 22:17:41 +08:00
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
|
02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
/* This file contains code which parses COFF debugging information. */
|
|
|
|
|
|
2007-04-26 22:47:00 +08:00
|
|
|
|
#include "sysdep.h"
|
1999-05-03 15:29:11 +08:00
|
|
|
|
#include "bfd.h"
|
|
|
|
|
#include "coff/internal.h"
|
|
|
|
|
#include "libiberty.h"
|
2007-04-26 22:47:00 +08:00
|
|
|
|
#include "bucomm.h"
|
1999-05-03 15:29:11 +08:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "budbg.h"
|
|
|
|
|
|
|
|
|
|
/* FIXME: We should not need this BFD internal file. We need it for
|
|
|
|
|
the N_BTMASK, etc., values. */
|
|
|
|
|
#include "libcoff.h"
|
|
|
|
|
|
|
|
|
|
/* These macros extract the right mask and shifts for this BFD. They
|
|
|
|
|
assume that there is a local variable named ABFD. This is so that
|
|
|
|
|
macros like ISFCN and DECREF, from coff/internal.h, will work
|
|
|
|
|
without modification. */
|
|
|
|
|
#define N_BTMASK (coff_data (abfd)->local_n_btmask)
|
|
|
|
|
#define N_BTSHFT (coff_data (abfd)->local_n_btshft)
|
|
|
|
|
#define N_TMASK (coff_data (abfd)->local_n_tmask)
|
|
|
|
|
#define N_TSHIFT (coff_data (abfd)->local_n_tshift)
|
|
|
|
|
|
|
|
|
|
/* This structure is used to hold the symbols, as well as the current
|
|
|
|
|
location within the symbols. */
|
|
|
|
|
|
|
|
|
|
struct coff_symbols
|
|
|
|
|
{
|
|
|
|
|
/* The symbols. */
|
|
|
|
|
asymbol **syms;
|
|
|
|
|
/* The number of symbols. */
|
|
|
|
|
long symcount;
|
|
|
|
|
/* The index of the current symbol. */
|
|
|
|
|
long symno;
|
|
|
|
|
/* The index of the current symbol in the COFF symbol table (where
|
|
|
|
|
each auxent counts as a symbol). */
|
|
|
|
|
long coff_symno;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* The largest basic type we are prepared to handle. */
|
|
|
|
|
|
|
|
|
|
#define T_MAX (T_LNGDBL)
|
|
|
|
|
|
|
|
|
|
/* This structure is used to hold slots. */
|
|
|
|
|
|
|
|
|
|
struct coff_slots
|
|
|
|
|
{
|
|
|
|
|
/* Next set of slots. */
|
|
|
|
|
struct coff_slots *next;
|
|
|
|
|
/* Slots. */
|
|
|
|
|
#define COFF_SLOTS (16)
|
|
|
|
|
debug_type slots[COFF_SLOTS];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* This structure is used to map symbol indices to types. */
|
|
|
|
|
|
|
|
|
|
struct coff_types
|
|
|
|
|
{
|
|
|
|
|
/* Slots. */
|
|
|
|
|
struct coff_slots *slots;
|
|
|
|
|
/* Basic types. */
|
|
|
|
|
debug_type basic[T_MAX + 1];
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-13 06:39:58 +08:00
|
|
|
|
static debug_type *coff_get_slot (struct coff_types *, long);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
static debug_type parse_coff_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
(bfd *, struct coff_symbols *, struct coff_types *, long, int,
|
|
|
|
|
union internal_auxent *, bfd_boolean, void *);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
static debug_type parse_coff_base_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
(bfd *, struct coff_symbols *, struct coff_types *, long, int,
|
|
|
|
|
union internal_auxent *, void *);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
static debug_type parse_coff_struct_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
(bfd *, struct coff_symbols *, struct coff_types *, int,
|
|
|
|
|
union internal_auxent *, void *);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
static debug_type parse_coff_enum_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
(bfd *, struct coff_symbols *, struct coff_types *,
|
|
|
|
|
union internal_auxent *, void *);
|
2002-11-30 16:39:46 +08:00
|
|
|
|
static bfd_boolean parse_coff_symbol
|
2003-09-14 20:20:17 +08:00
|
|
|
|
(bfd *, struct coff_types *, asymbol *, long, struct internal_syment *,
|
|
|
|
|
void *, debug_type, bfd_boolean);
|
|
|
|
|
static bfd_boolean external_coff_symbol_p (int sym_class);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
/* Return the slot for a type. */
|
|
|
|
|
|
|
|
|
|
static debug_type *
|
2014-11-13 06:39:58 +08:00
|
|
|
|
coff_get_slot (struct coff_types *types, long indx)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
struct coff_slots **pps;
|
|
|
|
|
|
|
|
|
|
pps = &types->slots;
|
|
|
|
|
|
2014-11-13 06:39:58 +08:00
|
|
|
|
/* PR 17512: file: 078-18333-0.001:0.1.
|
|
|
|
|
FIXME: The value of 1000 is a guess. Maybe a better heuristic is needed. */
|
|
|
|
|
if (indx / COFF_SLOTS > 1000)
|
|
|
|
|
fatal (_("Excessively large slot index: %lx"), indx);
|
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
|
while (indx >= COFF_SLOTS)
|
|
|
|
|
{
|
|
|
|
|
if (*pps == NULL)
|
|
|
|
|
{
|
|
|
|
|
*pps = (struct coff_slots *) xmalloc (sizeof **pps);
|
|
|
|
|
memset (*pps, 0, sizeof **pps);
|
|
|
|
|
}
|
|
|
|
|
pps = &(*pps)->next;
|
|
|
|
|
indx -= COFF_SLOTS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*pps == NULL)
|
|
|
|
|
{
|
|
|
|
|
*pps = (struct coff_slots *) xmalloc (sizeof **pps);
|
|
|
|
|
memset (*pps, 0, sizeof **pps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (*pps)->slots + indx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse a COFF type code in NTYPE. */
|
|
|
|
|
|
|
|
|
|
static debug_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
parse_coff_type (bfd *abfd, struct coff_symbols *symbols,
|
|
|
|
|
struct coff_types *types, long coff_symno, int ntype,
|
|
|
|
|
union internal_auxent *pauxent, bfd_boolean useaux,
|
|
|
|
|
void *dhandle)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
debug_type type;
|
|
|
|
|
|
|
|
|
|
if ((ntype & ~N_BTMASK) != 0)
|
|
|
|
|
{
|
|
|
|
|
int newtype;
|
|
|
|
|
|
|
|
|
|
newtype = DECREF (ntype);
|
|
|
|
|
|
|
|
|
|
if (ISPTR (ntype))
|
|
|
|
|
{
|
|
|
|
|
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
|
|
|
|
|
pauxent, useaux, dhandle);
|
|
|
|
|
type = debug_make_pointer_type (dhandle, type);
|
|
|
|
|
}
|
|
|
|
|
else if (ISFCN (ntype))
|
|
|
|
|
{
|
|
|
|
|
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
|
|
|
|
|
pauxent, useaux, dhandle);
|
|
|
|
|
type = debug_make_function_type (dhandle, type, (debug_type *) NULL,
|
2002-11-30 16:39:46 +08:00
|
|
|
|
FALSE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if (ISARY (ntype))
|
|
|
|
|
{
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
if (pauxent == NULL)
|
|
|
|
|
n = 0;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unsigned short *dim;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* FIXME: If pauxent->x_sym.x_tagndx.l == 0, gdb sets
|
|
|
|
|
the c_naux field of the syment to 0. */
|
|
|
|
|
|
|
|
|
|
/* Move the dimensions down, so that the next array
|
|
|
|
|
picks up the next one. */
|
|
|
|
|
dim = pauxent->x_sym.x_fcnary.x_ary.x_dimen;
|
|
|
|
|
n = dim[0];
|
|
|
|
|
for (i = 0; *dim != 0 && i < DIMNUM - 1; i++, dim++)
|
|
|
|
|
*dim = *(dim + 1);
|
|
|
|
|
*dim = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
|
2002-11-30 16:39:46 +08:00
|
|
|
|
pauxent, FALSE, dhandle);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
type = debug_make_array_type (dhandle, type,
|
|
|
|
|
parse_coff_base_type (abfd, symbols,
|
|
|
|
|
types,
|
|
|
|
|
coff_symno,
|
|
|
|
|
T_INT,
|
|
|
|
|
NULL, dhandle),
|
2002-11-30 16:39:46 +08:00
|
|
|
|
0, n - 1, FALSE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("parse_coff_type: Bad type code 0x%x"), ntype);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
return DEBUG_TYPE_NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pauxent != NULL && pauxent->x_sym.x_tagndx.l > 0)
|
|
|
|
|
{
|
|
|
|
|
debug_type *slot;
|
|
|
|
|
|
|
|
|
|
/* This is a reference to an existing type. FIXME: gdb checks
|
|
|
|
|
that the class is not C_STRTAG, nor C_UNTAG, nor C_ENTAG. */
|
|
|
|
|
slot = coff_get_slot (types, pauxent->x_sym.x_tagndx.l);
|
|
|
|
|
if (*slot != DEBUG_TYPE_NULL)
|
|
|
|
|
return *slot;
|
|
|
|
|
else
|
|
|
|
|
return debug_make_indirect_type (dhandle, slot, (const char *) NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the aux entry has already been used for something, useaux will
|
|
|
|
|
have been set to false, indicating that parse_coff_base_type
|
|
|
|
|
should not use it. We need to do it this way, rather than simply
|
|
|
|
|
passing pauxent as NULL, because we need to be able handle
|
|
|
|
|
multiple array dimensions while still discarding pauxent after
|
|
|
|
|
having handled all of them. */
|
|
|
|
|
if (! useaux)
|
|
|
|
|
pauxent = NULL;
|
|
|
|
|
|
|
|
|
|
return parse_coff_base_type (abfd, symbols, types, coff_symno, ntype,
|
|
|
|
|
pauxent, dhandle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse a basic COFF type in NTYPE. */
|
|
|
|
|
|
|
|
|
|
static debug_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
parse_coff_base_type (bfd *abfd, struct coff_symbols *symbols,
|
|
|
|
|
struct coff_types *types, long coff_symno, int ntype,
|
|
|
|
|
union internal_auxent *pauxent, void *dhandle)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
debug_type ret;
|
2002-11-30 16:39:46 +08:00
|
|
|
|
bfd_boolean set_basic;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
const char *name;
|
|
|
|
|
debug_type *slot;
|
|
|
|
|
|
|
|
|
|
if (ntype >= 0
|
|
|
|
|
&& ntype <= T_MAX
|
|
|
|
|
&& types->basic[ntype] != DEBUG_TYPE_NULL)
|
|
|
|
|
return types->basic[ntype];
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
set_basic = TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = NULL;
|
|
|
|
|
|
|
|
|
|
switch (ntype)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
ret = debug_make_void_type (dhandle);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_NULL:
|
|
|
|
|
case T_VOID:
|
|
|
|
|
ret = debug_make_void_type (dhandle);
|
|
|
|
|
name = "void";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_CHAR:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 1, FALSE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "char";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_SHORT:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 2, FALSE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "short";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_INT:
|
|
|
|
|
/* FIXME: Perhaps the size should depend upon the architecture. */
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 4, FALSE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "int";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_LONG:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 4, FALSE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "long";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_FLOAT:
|
|
|
|
|
ret = debug_make_float_type (dhandle, 4);
|
|
|
|
|
name = "float";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_DOUBLE:
|
|
|
|
|
ret = debug_make_float_type (dhandle, 8);
|
|
|
|
|
name = "double";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_LNGDBL:
|
|
|
|
|
ret = debug_make_float_type (dhandle, 12);
|
|
|
|
|
name = "long double";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_UCHAR:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 1, TRUE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "unsigned char";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_USHORT:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 2, TRUE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "unsigned short";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_UINT:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 4, TRUE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "unsigned int";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_ULONG:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_int_type (dhandle, 4, TRUE);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
name = "unsigned long";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_STRUCT:
|
|
|
|
|
if (pauxent == NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_struct_type (dhandle, TRUE, 0,
|
1999-05-03 15:29:11 +08:00
|
|
|
|
(debug_field *) NULL);
|
|
|
|
|
else
|
|
|
|
|
ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
|
|
|
|
|
dhandle);
|
|
|
|
|
|
|
|
|
|
slot = coff_get_slot (types, coff_symno);
|
|
|
|
|
*slot = ret;
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
set_basic = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_UNION:
|
|
|
|
|
if (pauxent == NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
ret = debug_make_struct_type (dhandle, FALSE, 0, (debug_field *) NULL);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
else
|
|
|
|
|
ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
|
|
|
|
|
dhandle);
|
|
|
|
|
|
|
|
|
|
slot = coff_get_slot (types, coff_symno);
|
|
|
|
|
*slot = ret;
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
set_basic = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_ENUM:
|
|
|
|
|
if (pauxent == NULL)
|
|
|
|
|
ret = debug_make_enum_type (dhandle, (const char **) NULL,
|
|
|
|
|
(bfd_signed_vma *) NULL);
|
|
|
|
|
else
|
|
|
|
|
ret = parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle);
|
|
|
|
|
|
|
|
|
|
slot = coff_get_slot (types, coff_symno);
|
|
|
|
|
*slot = ret;
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
set_basic = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (name != NULL)
|
|
|
|
|
ret = debug_name_type (dhandle, name, ret);
|
|
|
|
|
|
|
|
|
|
if (set_basic
|
|
|
|
|
&& ntype >= 0
|
|
|
|
|
&& ntype <= T_MAX)
|
|
|
|
|
types->basic[ntype] = ret;
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse a struct type. */
|
|
|
|
|
|
|
|
|
|
static debug_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
parse_coff_struct_type (bfd *abfd, struct coff_symbols *symbols,
|
|
|
|
|
struct coff_types *types, int ntype,
|
|
|
|
|
union internal_auxent *pauxent, void *dhandle)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
long symend;
|
|
|
|
|
int alloc;
|
|
|
|
|
debug_field *fields;
|
|
|
|
|
int count;
|
2002-11-30 16:39:46 +08:00
|
|
|
|
bfd_boolean done;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
|
|
|
|
|
|
|
|
|
|
alloc = 10;
|
|
|
|
|
fields = (debug_field *) xmalloc (alloc * sizeof *fields);
|
|
|
|
|
count = 0;
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
done = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
while (! done
|
|
|
|
|
&& symbols->coff_symno < symend
|
|
|
|
|
&& symbols->symno < symbols->symcount)
|
|
|
|
|
{
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
long this_coff_symno;
|
|
|
|
|
struct internal_syment syment;
|
|
|
|
|
union internal_auxent auxent;
|
|
|
|
|
union internal_auxent *psubaux;
|
|
|
|
|
bfd_vma bitpos = 0, bitsize = 0;
|
|
|
|
|
|
|
|
|
|
sym = symbols->syms[symbols->symno];
|
|
|
|
|
|
|
|
|
|
if (! bfd_coff_get_syment (abfd, sym, &syment))
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
2018-07-25 17:56:45 +08:00
|
|
|
|
free (fields);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
return DEBUG_TYPE_NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this_coff_symno = symbols->coff_symno;
|
|
|
|
|
|
|
|
|
|
++symbols->symno;
|
|
|
|
|
symbols->coff_symno += 1 + syment.n_numaux;
|
|
|
|
|
|
|
|
|
|
if (syment.n_numaux == 0)
|
|
|
|
|
psubaux = NULL;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("bfd_coff_get_auxent failed: %s"),
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
2018-07-25 17:56:45 +08:00
|
|
|
|
free (fields);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
return DEBUG_TYPE_NULL;
|
|
|
|
|
}
|
|
|
|
|
psubaux = &auxent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (syment.n_sclass)
|
|
|
|
|
{
|
|
|
|
|
case C_MOS:
|
|
|
|
|
case C_MOU:
|
|
|
|
|
bitpos = 8 * bfd_asymbol_value (sym);
|
|
|
|
|
bitsize = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_FIELD:
|
|
|
|
|
bitpos = bfd_asymbol_value (sym);
|
|
|
|
|
bitsize = auxent.x_sym.x_misc.x_lnsz.x_size;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_EOS:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
done = TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! done)
|
|
|
|
|
{
|
|
|
|
|
debug_type ftype;
|
|
|
|
|
debug_field f;
|
|
|
|
|
|
|
|
|
|
ftype = parse_coff_type (abfd, symbols, types, this_coff_symno,
|
2002-11-30 16:39:46 +08:00
|
|
|
|
syment.n_type, psubaux, TRUE, dhandle);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
f = debug_make_field (dhandle, bfd_asymbol_name (sym), ftype,
|
|
|
|
|
bitpos, bitsize, DEBUG_VISIBILITY_PUBLIC);
|
|
|
|
|
if (f == DEBUG_FIELD_NULL)
|
|
|
|
|
return DEBUG_TYPE_NULL;
|
|
|
|
|
|
|
|
|
|
if (count + 1 >= alloc)
|
|
|
|
|
{
|
|
|
|
|
alloc += 10;
|
|
|
|
|
fields = ((debug_field *)
|
|
|
|
|
xrealloc (fields, alloc * sizeof *fields));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fields[count] = f;
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fields[count] = DEBUG_FIELD_NULL;
|
|
|
|
|
|
|
|
|
|
return debug_make_struct_type (dhandle, ntype == T_STRUCT,
|
|
|
|
|
pauxent->x_sym.x_misc.x_lnsz.x_size,
|
|
|
|
|
fields);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse an enum type. */
|
|
|
|
|
|
|
|
|
|
static debug_type
|
2003-09-14 20:20:17 +08:00
|
|
|
|
parse_coff_enum_type (bfd *abfd, struct coff_symbols *symbols,
|
|
|
|
|
struct coff_types *types ATTRIBUTE_UNUSED,
|
|
|
|
|
union internal_auxent *pauxent, void *dhandle)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
long symend;
|
|
|
|
|
int alloc;
|
|
|
|
|
const char **names;
|
|
|
|
|
bfd_signed_vma *vals;
|
|
|
|
|
int count;
|
2002-11-30 16:39:46 +08:00
|
|
|
|
bfd_boolean done;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
|
|
|
|
|
|
|
|
|
|
alloc = 10;
|
|
|
|
|
names = (const char **) xmalloc (alloc * sizeof *names);
|
|
|
|
|
vals = (bfd_signed_vma *) xmalloc (alloc * sizeof *vals);
|
|
|
|
|
count = 0;
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
done = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
while (! done
|
|
|
|
|
&& symbols->coff_symno < symend
|
|
|
|
|
&& symbols->symno < symbols->symcount)
|
|
|
|
|
{
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
struct internal_syment syment;
|
|
|
|
|
|
|
|
|
|
sym = symbols->syms[symbols->symno];
|
|
|
|
|
|
|
|
|
|
if (! bfd_coff_get_syment (abfd, sym, &syment))
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
2018-07-25 17:56:45 +08:00
|
|
|
|
free (names);
|
|
|
|
|
free (vals);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
return DEBUG_TYPE_NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++symbols->symno;
|
|
|
|
|
symbols->coff_symno += 1 + syment.n_numaux;
|
|
|
|
|
|
|
|
|
|
switch (syment.n_sclass)
|
|
|
|
|
{
|
|
|
|
|
case C_MOE:
|
|
|
|
|
if (count + 1 >= alloc)
|
|
|
|
|
{
|
|
|
|
|
alloc += 10;
|
|
|
|
|
names = ((const char **)
|
|
|
|
|
xrealloc (names, alloc * sizeof *names));
|
|
|
|
|
vals = ((bfd_signed_vma *)
|
|
|
|
|
xrealloc (vals, alloc * sizeof *vals));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
names[count] = bfd_asymbol_name (sym);
|
|
|
|
|
vals[count] = bfd_asymbol_value (sym);
|
|
|
|
|
++count;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_EOS:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
done = TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
names[count] = NULL;
|
|
|
|
|
|
|
|
|
|
return debug_make_enum_type (dhandle, names, vals);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle a single COFF symbol. */
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
static bfd_boolean
|
2003-09-14 20:20:17 +08:00
|
|
|
|
parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct coff_types *types,
|
|
|
|
|
asymbol *sym, long coff_symno,
|
|
|
|
|
struct internal_syment *psyment, void *dhandle,
|
|
|
|
|
debug_type type, bfd_boolean within_function)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
switch (psyment->n_sclass)
|
|
|
|
|
{
|
|
|
|
|
case C_NULL:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_AUTO:
|
|
|
|
|
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
|
|
|
|
DEBUG_LOCAL, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
2000-06-26 00:39:45 +08:00
|
|
|
|
case C_WEAKEXT:
|
1999-05-03 15:29:11 +08:00
|
|
|
|
case C_EXT:
|
|
|
|
|
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
|
|
|
|
DEBUG_GLOBAL, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_STAT:
|
|
|
|
|
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
|
|
|
|
(within_function
|
|
|
|
|
? DEBUG_LOCAL_STATIC
|
|
|
|
|
: DEBUG_STATIC),
|
|
|
|
|
bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_REG:
|
|
|
|
|
/* FIXME: We may need to convert the register number. */
|
|
|
|
|
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
|
|
|
|
|
DEBUG_REGISTER, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_LABEL:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_ARG:
|
|
|
|
|
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
|
|
|
|
|
DEBUG_PARM_STACK, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_REGPARM:
|
|
|
|
|
/* FIXME: We may need to convert the register number. */
|
|
|
|
|
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
|
|
|
|
|
DEBUG_PARM_REG, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_TPDEF:
|
|
|
|
|
type = debug_name_type (dhandle, bfd_asymbol_name (sym), type);
|
|
|
|
|
if (type == DEBUG_TYPE_NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_STRTAG:
|
|
|
|
|
case C_UNTAG:
|
|
|
|
|
case C_ENTAG:
|
|
|
|
|
{
|
|
|
|
|
debug_type *slot;
|
|
|
|
|
|
|
|
|
|
type = debug_tag_type (dhandle, bfd_asymbol_name (sym), type);
|
|
|
|
|
if (type == DEBUG_TYPE_NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
/* Store the named type into the slot, so that references get
|
|
|
|
|
the name. */
|
|
|
|
|
slot = coff_get_slot (types, coff_symno);
|
|
|
|
|
*slot = type;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2000-06-26 00:39:45 +08:00
|
|
|
|
/* Determine if a symbol has external visibility. */
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
static bfd_boolean
|
2003-09-14 20:20:17 +08:00
|
|
|
|
external_coff_symbol_p (int sym_class)
|
2000-06-26 00:39:45 +08:00
|
|
|
|
{
|
|
|
|
|
switch (sym_class)
|
|
|
|
|
{
|
2002-05-23 12:11:57 +08:00
|
|
|
|
case C_EXT:
|
|
|
|
|
case C_WEAKEXT:
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return TRUE;
|
2000-06-26 00:39:45 +08:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
2000-06-26 00:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
|
/* This is the main routine. It looks through all the symbols and
|
|
|
|
|
handles them. */
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
bfd_boolean
|
2003-09-14 20:20:17 +08:00
|
|
|
|
parse_coff (bfd *abfd, asymbol **syms, long symcount, void *dhandle)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
{
|
|
|
|
|
struct coff_symbols symbols;
|
|
|
|
|
struct coff_types types;
|
|
|
|
|
int i;
|
|
|
|
|
long next_c_file;
|
|
|
|
|
const char *fnname;
|
|
|
|
|
int fnclass;
|
|
|
|
|
int fntype;
|
|
|
|
|
bfd_vma fnend;
|
|
|
|
|
alent *linenos;
|
2002-11-30 16:39:46 +08:00
|
|
|
|
bfd_boolean within_function;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
long this_coff_symno;
|
|
|
|
|
|
|
|
|
|
symbols.syms = syms;
|
|
|
|
|
symbols.symcount = symcount;
|
|
|
|
|
symbols.symno = 0;
|
|
|
|
|
symbols.coff_symno = 0;
|
|
|
|
|
|
|
|
|
|
types.slots = NULL;
|
|
|
|
|
for (i = 0; i <= T_MAX; i++)
|
|
|
|
|
types.basic[i] = DEBUG_TYPE_NULL;
|
|
|
|
|
|
|
|
|
|
next_c_file = -1;
|
|
|
|
|
fnname = NULL;
|
|
|
|
|
fnclass = 0;
|
|
|
|
|
fntype = 0;
|
|
|
|
|
fnend = 0;
|
|
|
|
|
linenos = NULL;
|
2002-11-30 16:39:46 +08:00
|
|
|
|
within_function = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
while (symbols.symno < symcount)
|
|
|
|
|
{
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
const char *name;
|
|
|
|
|
struct internal_syment syment;
|
|
|
|
|
union internal_auxent auxent;
|
|
|
|
|
union internal_auxent *paux;
|
|
|
|
|
debug_type type;
|
|
|
|
|
|
|
|
|
|
sym = syms[symbols.symno];
|
|
|
|
|
|
|
|
|
|
if (! bfd_coff_get_syment (abfd, sym, &syment))
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = bfd_asymbol_name (sym);
|
|
|
|
|
|
|
|
|
|
this_coff_symno = symbols.coff_symno;
|
|
|
|
|
|
|
|
|
|
++symbols.symno;
|
|
|
|
|
symbols.coff_symno += 1 + syment.n_numaux;
|
|
|
|
|
|
|
|
|
|
/* We only worry about the first auxent, because that is the
|
|
|
|
|
only one which is relevant for debugging information. */
|
|
|
|
|
if (syment.n_numaux == 0)
|
|
|
|
|
paux = NULL;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("bfd_coff_get_auxent failed: %s"),
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
paux = &auxent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this_coff_symno == next_c_file && syment.n_sclass != C_FILE)
|
|
|
|
|
{
|
|
|
|
|
/* The last C_FILE symbol points to the first external
|
|
|
|
|
symbol. */
|
|
|
|
|
if (! debug_set_filename (dhandle, "*globals*"))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (syment.n_sclass)
|
|
|
|
|
{
|
|
|
|
|
case C_EFCN:
|
|
|
|
|
case C_EXTDEF:
|
|
|
|
|
case C_ULABEL:
|
|
|
|
|
case C_USTATIC:
|
|
|
|
|
case C_LINE:
|
|
|
|
|
case C_ALIAS:
|
|
|
|
|
case C_HIDDEN:
|
|
|
|
|
/* Just ignore these classes. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_FILE:
|
|
|
|
|
next_c_file = syment.n_value;
|
|
|
|
|
if (! debug_set_filename (dhandle, name))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_STAT:
|
|
|
|
|
/* Ignore static symbols with a type of T_NULL. These
|
|
|
|
|
represent section entries. */
|
|
|
|
|
if (syment.n_type == T_NULL)
|
|
|
|
|
break;
|
|
|
|
|
/* Fall through. */
|
2002-05-23 12:11:57 +08:00
|
|
|
|
case C_WEAKEXT:
|
1999-05-03 15:29:11 +08:00
|
|
|
|
case C_EXT:
|
|
|
|
|
if (ISFCN (syment.n_type))
|
|
|
|
|
{
|
|
|
|
|
fnname = name;
|
|
|
|
|
fnclass = syment.n_sclass;
|
|
|
|
|
fntype = syment.n_type;
|
|
|
|
|
if (syment.n_numaux > 0)
|
|
|
|
|
fnend = bfd_asymbol_value (sym) + auxent.x_sym.x_misc.x_fsize;
|
|
|
|
|
else
|
|
|
|
|
fnend = 0;
|
|
|
|
|
linenos = BFD_SEND (abfd, _get_lineno, (abfd, sym));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
|
2002-11-30 16:39:46 +08:00
|
|
|
|
syment.n_type, paux, TRUE, dhandle);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
if (type == DEBUG_TYPE_NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
|
|
|
|
|
dhandle, type, within_function))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_FCN:
|
|
|
|
|
if (strcmp (name, ".bf") == 0)
|
|
|
|
|
{
|
|
|
|
|
if (fnname == NULL)
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("%ld: .bf without preceding function"),
|
|
|
|
|
this_coff_symno);
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
|
2002-11-30 16:39:46 +08:00
|
|
|
|
DECREF (fntype), paux, FALSE, dhandle);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
if (type == DEBUG_TYPE_NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
if (! debug_record_function (dhandle, fnname, type,
|
2000-06-26 00:39:45 +08:00
|
|
|
|
external_coff_symbol_p (fnclass),
|
1999-05-03 15:29:11 +08:00
|
|
|
|
bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
if (linenos != NULL)
|
|
|
|
|
{
|
|
|
|
|
int base;
|
|
|
|
|
bfd_vma addr;
|
|
|
|
|
|
|
|
|
|
if (syment.n_numaux == 0)
|
|
|
|
|
base = 0;
|
|
|
|
|
else
|
|
|
|
|
base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
|
|
|
|
|
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
|
addr = bfd_section_vma (bfd_asymbol_section (sym));
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
++linenos;
|
|
|
|
|
|
|
|
|
|
while (linenos->line_number != 0)
|
|
|
|
|
{
|
|
|
|
|
if (! debug_record_line (dhandle,
|
|
|
|
|
linenos->line_number + base,
|
|
|
|
|
linenos->u.offset + addr))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
++linenos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fnname = NULL;
|
|
|
|
|
linenos = NULL;
|
|
|
|
|
fnclass = 0;
|
|
|
|
|
fntype = 0;
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
within_function = TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if (strcmp (name, ".ef") == 0)
|
|
|
|
|
{
|
|
|
|
|
if (! within_function)
|
|
|
|
|
{
|
2000-04-07 12:34:50 +08:00
|
|
|
|
non_fatal (_("%ld: unexpected .ef\n"), this_coff_symno);
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bfd_asymbol_value (sym) > fnend)
|
|
|
|
|
fnend = bfd_asymbol_value (sym);
|
|
|
|
|
if (! debug_end_function (dhandle, fnend))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
fnend = 0;
|
2002-11-30 16:39:46 +08:00
|
|
|
|
within_function = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_BLOCK:
|
|
|
|
|
if (strcmp (name, ".bb") == 0)
|
|
|
|
|
{
|
|
|
|
|
if (! debug_start_block (dhandle, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if (strcmp (name, ".eb") == 0)
|
|
|
|
|
{
|
|
|
|
|
if (! debug_end_block (dhandle, bfd_asymbol_value (sym)))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
|
2002-11-30 16:39:46 +08:00
|
|
|
|
syment.n_type, paux, TRUE, dhandle);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
if (type == DEBUG_TYPE_NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
|
|
|
|
|
dhandle, type, within_function))
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
|
return TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|