* stab-syms.c (stdio.h): Include prior to libaout.h, which
[deliverable/binutils-gdb.git] / bfd / stab-syms.c
CommitLineData
c3a1a56b 1/* Table of stab names for the BFD library.
033d545b 2 Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
c3a1a56b
PB
3 Written by Cygnus Support.
4
5This file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21#include "bfd.h"
22
033d545b
FF
23#define ARCH_SIZE 32 /* Value doesn't matter. */
24#include <stdio.h> /* Required by bfdlink.h, from libaout.h */
c3a1a56b 25#include "libaout.h"
033d545b 26#include "aout/aout64.h"
c3a1a56b
PB
27
28/* Create a table of debugging stab-codes and corresponding names. */
29
c3a1a56b 30#define __define_stab(NAME, CODE, STRING) __define_name(CODE, STRING)
c3a1a56b
PB
31
32/* These are not really stab symbols, but it is
33 convenient to have them here for the sake of nm.
34 For completeness, we could also add N_TEXT etc, but those
35 are never needed, since nm treats those specially. */
033d545b
FF
36#define EXTRA_SYMBOLS \
37 __define_name (N_SETA, "SETA")/* Absolute set element symbol */ \
38 __define_name (N_SETT, "SETT")/* Text set element symbol */ \
39 __define_name (N_SETD, "SETD")/* Data set element symbol */ \
40 __define_name (N_SETB, "SETB")/* Bss set element symbol */ \
41 __define_name (N_SETV, "SETV")/* Pointer to set vector in data area. */ \
42 __define_name (N_INDR, "INDR") \
43 __define_name (N_WARNING, "WARNING")
44
45CONST char *
46aout_stab_name (code)
47 int code;
c3a1a56b 48{
033d545b
FF
49#if 0 /* This lookup table is slower than lots of explicit tests, at
50 least on the i386. One advantage is that the compiler can
51 eliminate duplicates from the code, whereas they can't easily
52 be eliminated from the lookup table. */
53
54#define __define_name(CODE, STRING) {(int)CODE, STRING},
55 static const struct {
56 int code;
57 char string[7];
58 } aout_stab_names[] = {
59#include "aout/stab.def"
60 EXTRA_SYMBOLS
61 };
62 register int i = sizeof (aout_stab_names) / sizeof (aout_stab_names[0]);
c3a1a56b
PB
63 while (--i >= 0)
64 if (aout_stab_names[i].code == code)
65 return aout_stab_names[i].string;
033d545b
FF
66
67#else
68
69#define __define_name(val, str) if (val == code) return str ;
70#include "aout/stab.def"
71 EXTRA_SYMBOLS
72
73#endif
74
c3a1a56b
PB
75 return 0;
76}
This page took 0.142946 seconds and 4 git commands to generate.