~ubuntu-branches/ubuntu/hoary/binutils/hoary

« back to all changes in this revision

Viewing changes to gas/ecoff.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-03-18 13:07:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050318130752-j4i37zgqclj53b94
Tags: 2.15-5ubuntu2
debian/rules: Call pkgstriptranslations if present (the package does not
use debhelper, thus it does not happen automatically).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1408
1408
 
1409
1409
/* Prototypes for functions defined in this file.  */
1410
1410
 
1411
 
static void add_varray_page PARAMS ((varray_t *vp));
1412
 
static symint_t add_string PARAMS ((varray_t *vp,
1413
 
                                    struct hash_control *hash_tbl,
1414
 
                                    const char *str,
1415
 
                                    shash_t **ret_hash));
1416
 
static localsym_t *add_ecoff_symbol PARAMS ((const char *str, st_t type,
1417
 
                                             sc_t storage, symbolS *sym,
1418
 
                                             bfd_vma addend, symint_t value,
1419
 
                                             symint_t indx));
1420
 
static symint_t add_aux_sym_symint PARAMS ((symint_t aux_word));
1421
 
static symint_t add_aux_sym_rndx PARAMS ((int file_index,
1422
 
                                          symint_t sym_index));
1423
 
static symint_t add_aux_sym_tir PARAMS ((type_info_t *t,
1424
 
                                         hash_state_t state,
1425
 
                                         thash_t **hash_tbl));
1426
 
static tag_t *get_tag PARAMS ((const char *tag, localsym_t *sym,
1427
 
                               bt_t basic_type));
1428
 
static void add_unknown_tag PARAMS ((tag_t *ptag));
1429
 
static void add_procedure PARAMS ((char *func));
1430
 
static void add_file PARAMS ((const char *file_name, int indx, int fake));
 
1411
static void add_varray_page (varray_t *vp);
 
1412
static symint_t add_string (varray_t *vp,
 
1413
                            struct hash_control *hash_tbl,
 
1414
                            const char *str,
 
1415
                            shash_t **ret_hash);
 
1416
static localsym_t *add_ecoff_symbol (const char *str, st_t type,
 
1417
                                     sc_t storage, symbolS *sym,
 
1418
                                     bfd_vma addend, symint_t value,
 
1419
                                     symint_t indx);
 
1420
static symint_t add_aux_sym_symint (symint_t aux_word);
 
1421
static symint_t add_aux_sym_rndx (int file_index, symint_t sym_index);
 
1422
static symint_t add_aux_sym_tir (type_info_t *t,
 
1423
                                 hash_state_t state,
 
1424
                                 thash_t **hash_tbl);
 
1425
static tag_t *get_tag (const char *tag, localsym_t *sym, bt_t basic_type);
 
1426
static void add_unknown_tag (tag_t *ptag);
 
1427
static void add_procedure (char *func);
 
1428
static void add_file (const char *file_name, int indx, int fake);
1431
1429
#ifdef ECOFF_DEBUG
1432
 
static char *sc_to_string PARAMS ((sc_t storage_class));
1433
 
static char *st_to_string PARAMS ((st_t symbol_type));
 
1430
static char *sc_to_string (sc_t storage_class);
 
1431
static char *st_to_string (st_t symbol_type);
1434
1432
#endif
1435
 
static void mark_stabs PARAMS ((int));
1436
 
static char *ecoff_add_bytes PARAMS ((char **buf, char **bufend,
1437
 
                                      char *bufptr, unsigned long need));
 
1433
static void mark_stabs (int);
 
1434
static char *ecoff_add_bytes (char **buf, char **bufend,
 
1435
                              char *bufptr, unsigned long need);
1438
1436
static unsigned long ecoff_padding_adjust
1439
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1440
 
           unsigned long offset, char **bufptrptr));
 
1437
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1438
   unsigned long offset, char **bufptrptr);
1441
1439
static unsigned long ecoff_build_lineno
1442
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1443
 
           unsigned long offset, long *linecntptr));
 
1440
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1441
   unsigned long offset, long *linecntptr);
1444
1442
static unsigned long ecoff_build_symbols
1445
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1446
 
           unsigned long offset));
 
1443
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1444
   unsigned long offset);
1447
1445
static unsigned long ecoff_build_procs
1448
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1449
 
           unsigned long offset));
 
1446
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1447
   unsigned long offset);
1450
1448
static unsigned long ecoff_build_aux
1451
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1452
 
           unsigned long offset));
1453
 
static unsigned long ecoff_build_strings PARAMS ((char **buf, char **bufend,
1454
 
                                                  unsigned long offset,
1455
 
                                                  varray_t *vp));
 
1449
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1450
   unsigned long offset);
 
1451
static unsigned long ecoff_build_strings (char **buf, char **bufend,
 
1452
                                          unsigned long offset,
 
1453
                                          varray_t *vp);
1456
1454
static unsigned long ecoff_build_ss
1457
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1458
 
           unsigned long offset));
 
1455
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1456
   unsigned long offset);
1459
1457
static unsigned long ecoff_build_fdr
1460
 
  PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
1461
 
           unsigned long offset));
1462
 
static void ecoff_setup_ext PARAMS ((void));
1463
 
static page_type *allocate_cluster PARAMS ((unsigned long npages));
1464
 
static page_type *allocate_page PARAMS ((void));
1465
 
static scope_t *allocate_scope PARAMS ((void));
1466
 
static void free_scope PARAMS ((scope_t *ptr));
1467
 
static vlinks_t *allocate_vlinks PARAMS ((void));
1468
 
static shash_t *allocate_shash PARAMS ((void));
1469
 
static thash_t *allocate_thash PARAMS ((void));
1470
 
static tag_t *allocate_tag PARAMS ((void));
1471
 
static void free_tag PARAMS ((tag_t *ptr));
1472
 
static forward_t *allocate_forward PARAMS ((void));
1473
 
static thead_t *allocate_thead PARAMS ((void));
1474
 
static void free_thead PARAMS ((thead_t *ptr));
1475
 
static lineno_list_t *allocate_lineno_list PARAMS ((void));
 
1458
  (const struct ecoff_debug_swap *backend, char **buf, char **bufend,
 
1459
   unsigned long offset);
 
1460
static void ecoff_setup_ext (void);
 
1461
static page_type *allocate_cluster (unsigned long npages);
 
1462
static page_type *allocate_page (void);
 
1463
static scope_t *allocate_scope (void);
 
1464
static void free_scope (scope_t *ptr);
 
1465
static vlinks_t *allocate_vlinks (void);
 
1466
static shash_t *allocate_shash (void);
 
1467
static thash_t *allocate_thash (void);
 
1468
static tag_t *allocate_tag (void);
 
1469
static void free_tag (tag_t *ptr);
 
1470
static forward_t *allocate_forward (void);
 
1471
static thead_t *allocate_thead (void);
 
1472
static void free_thead (thead_t *ptr);
 
1473
static lineno_list_t *allocate_lineno_list (void);
1476
1474
 
1477
1475
/* This function should be called when the assembler starts up.  */
1478
1476
 
1479
1477
void
1480
 
ecoff_read_begin_hook ()
 
1478
ecoff_read_begin_hook (void)
1481
1479
{
1482
1480
  tag_hash = hash_new ();
1483
1481
  top_tag_head = allocate_thead ();
1490
1488
/* This function should be called when a symbol is created.  */
1491
1489
 
1492
1490
void
1493
 
ecoff_symbol_new_hook (symbolP)
1494
 
     symbolS *symbolP;
 
1491
ecoff_symbol_new_hook (symbolS *symbolP)
1495
1492
{
1496
1493
  OBJ_SYMFIELD_TYPE *obj;
1497
1494
 
1512
1509
/* Add a page to a varray object.  */
1513
1510
 
1514
1511
static void
1515
 
add_varray_page (vp)
1516
 
     varray_t *vp;                              /* varray to add page to */
 
1512
add_varray_page (varray_t *vp /* varray to add page to */)
1517
1513
{
1518
1514
  vlinks_t *new_links = allocate_vlinks ();
1519
1515
 
1543
1539
/* Add a string (and null pad) to one of the string tables.  */
1544
1540
 
1545
1541
static symint_t
1546
 
add_string (vp, hash_tbl, str, ret_hash)
1547
 
     varray_t *vp;                      /* string obstack */
1548
 
     struct hash_control *hash_tbl;     /* ptr to hash table */
1549
 
     const char *str;                   /* string */
1550
 
     shash_t **ret_hash;                /* return hash pointer */
 
1542
add_string (varray_t *vp,                       /* string obstack */
 
1543
            struct hash_control *hash_tbl,      /* ptr to hash table */
 
1544
            const char *str,                    /* string */
 
1545
            shash_t **ret_hash                  /* return hash pointer */)
1551
1546
{
1552
1547
  register unsigned long len = strlen (str);
1553
1548
  register shash_t *hash_ptr;
1592
1587
/* Add debugging information for a symbol.  */
1593
1588
 
1594
1589
static localsym_t *
1595
 
add_ecoff_symbol (str, type, storage, sym_value, addend, value, indx)
1596
 
     const char *str;                   /* symbol name */
1597
 
     st_t type;                         /* symbol type */
1598
 
     sc_t storage;                      /* storage class */
1599
 
     symbolS *sym_value;                /* associated symbol.  */
1600
 
     bfd_vma addend;                    /* addend to sym_value.  */
1601
 
     symint_t value;                    /* value of symbol */
1602
 
     symint_t indx;                     /* index to local/aux. syms */
 
1590
add_ecoff_symbol (const char *str,      /* symbol name */
 
1591
                  st_t type,            /* symbol type */
 
1592
                  sc_t storage,         /* storage class */
 
1593
                  symbolS *sym_value,   /* associated symbol.  */
 
1594
                  bfd_vma addend,       /* addend to sym_value.  */
 
1595
                  symint_t value,       /* value of symbol */
 
1596
                  symint_t indx         /* index to local/aux. syms */)
1603
1597
{
1604
1598
  localsym_t *psym;
1605
1599
  register scope_t *pscope;
1798
1792
   for integral aux types, not just symints.  */
1799
1793
 
1800
1794
static symint_t
1801
 
add_aux_sym_symint (aux_word)
1802
 
     symint_t aux_word;         /* auxiliary information word */
 
1795
add_aux_sym_symint (symint_t aux_word /* auxiliary information word */)
1803
1796
{
1804
1797
  register varray_t *vp;
1805
1798
  register aux_t *aux_ptr;
1822
1815
/* Add an auxiliary symbol (passing a file/symbol index combo).  */
1823
1816
 
1824
1817
static symint_t
1825
 
add_aux_sym_rndx (file_index, sym_index)
1826
 
     int file_index;
1827
 
     symint_t sym_index;
 
1818
add_aux_sym_rndx (int file_index, symint_t sym_index)
1828
1819
{
1829
1820
  register varray_t *vp;
1830
1821
  register aux_t *aux_ptr;
1849
1840
   type qualifiers).  */
1850
1841
 
1851
1842
static symint_t
1852
 
add_aux_sym_tir (t, state, hash_tbl)
1853
 
     type_info_t *t;            /* current type information */
1854
 
     hash_state_t state;        /* whether to hash type or not */
1855
 
     thash_t **hash_tbl;        /* pointer to hash table to use */
 
1843
add_aux_sym_tir (type_info_t *t,        /* current type information */
 
1844
                 hash_state_t state,    /* whether to hash type or not */
 
1845
                 thash_t **hash_tbl     /* pointer to hash table to use */)
1856
1846
{
1857
1847
  register varray_t *vp;
1858
1848
  register aux_t *aux_ptr;
2006
1996
/* Add a tag to the tag table (unless it already exists).  */
2007
1997
 
2008
1998
static tag_t *
2009
 
get_tag (tag, sym, basic_type)
2010
 
     const char *tag;                   /* tag name */
2011
 
     localsym_t *sym;                   /* tag start block */
2012
 
     bt_t basic_type;                   /* bt_Struct, bt_Union, or bt_Enum */
 
1999
get_tag (const char *tag,       /* tag name */
 
2000
         localsym_t *sym,       /* tag start block */
 
2001
         bt_t basic_type        /* bt_Struct, bt_Union, or bt_Enum */)
2013
2002
{
2014
2003
  shash_t *hash_ptr;
2015
2004
  const char *err;
2066
2055
/* Add an unknown {struct, union, enum} tag.  */
2067
2056
 
2068
2057
static void
2069
 
add_unknown_tag (ptag)
2070
 
     tag_t *ptag;               /* pointer to tag information */
 
2058
add_unknown_tag (tag_t *ptag /* pointer to tag information */)
2071
2059
{
2072
2060
  shash_t *hash_ptr     = ptag->hash_ptr;
2073
2061
  char *name            = hash_ptr->string;
2116
2104
   this is the current procedure.  */
2117
2105
 
2118
2106
static void
2119
 
add_procedure (func)
2120
 
     char *func;                        /* func name */
 
2107
add_procedure (char *func /* func name */)
2121
2108
{
2122
2109
  register varray_t *vp;
2123
2110
  register proc_t *new_proc_ptr;
2177
2164
}
2178
2165
 
2179
2166
symbolS *
2180
 
ecoff_get_cur_proc_sym ()
 
2167
ecoff_get_cur_proc_sym (void)
2181
2168
{
2182
2169
  return (cur_proc_ptr ? cur_proc_ptr->sym->as_sym : NULL);
2183
2170
}
2187
2174
   where the current file structure lives.  */
2188
2175
 
2189
2176
static void
2190
 
add_file (file_name, indx, fake)
2191
 
     const char *file_name;             /* file name */
2192
 
     int indx ATTRIBUTE_UNUSED;
2193
 
     int fake;
 
2177
add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake)
2194
2178
{
2195
2179
  register int first_ch;
2196
2180
  register efdr_t *fil_ptr;
2328
2312
   compiler output, only in hand coded assembler.  */
2329
2313
 
2330
2314
void
2331
 
ecoff_new_file (name)
2332
 
     const char *name;
 
2315
ecoff_new_file (const char *name)
2333
2316
{
2334
2317
  if (cur_file_ptr != NULL && strcmp (cur_file_ptr->name, name) == 0)
2335
2318
    return;
2424
2407
   which gives the location of the start of the block.  */
2425
2408
 
2426
2409
void
2427
 
ecoff_directive_begin (ignore)
2428
 
     int ignore ATTRIBUTE_UNUSED;
 
2410
ecoff_directive_begin (int ignore ATTRIBUTE_UNUSED)
2429
2411
{
2430
2412
  char *name;
2431
2413
  char name_end;
2462
2444
   which gives the location of the end of the block.  */
2463
2445
 
2464
2446
void
2465
 
ecoff_directive_bend (ignore)
2466
 
     int ignore ATTRIBUTE_UNUSED;
 
2447
ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED)
2467
2448
{
2468
2449
  char *name;
2469
2450
  char name_end;
2521
2502
/* Handle a .def directive: start defining a symbol.  */
2522
2503
 
2523
2504
void
2524
 
ecoff_directive_def (ignore)
2525
 
     int ignore ATTRIBUTE_UNUSED;
 
2505
ecoff_directive_def (int ignore ATTRIBUTE_UNUSED)
2526
2506
{
2527
2507
  char *name;
2528
2508
  char name_end;
2567
2547
   more than that anyhow, so I will also make that assumption.  */
2568
2548
 
2569
2549
void
2570
 
ecoff_directive_dim (ignore)
2571
 
     int ignore ATTRIBUTE_UNUSED;
 
2550
ecoff_directive_dim (int ignore ATTRIBUTE_UNUSED)
2572
2551
{
2573
2552
  int dimens[N_TQ];
2574
2553
  int i;
2617
2596
   symbol.  */
2618
2597
 
2619
2598
void
2620
 
ecoff_directive_scl (ignore)
2621
 
     int ignore ATTRIBUTE_UNUSED;
 
2599
ecoff_directive_scl (int ignore ATTRIBUTE_UNUSED)
2622
2600
{
2623
2601
  long val;
2624
2602
 
2642
2620
   never generate more than one argument.  */
2643
2621
 
2644
2622
void
2645
 
ecoff_directive_size (ignore)
2646
 
     int ignore ATTRIBUTE_UNUSED;
 
2623
ecoff_directive_size (int ignore ATTRIBUTE_UNUSED)
2647
2624
{
2648
2625
  int sizes[N_TQ];
2649
2626
  int i;
2692
2669
   symbol.  */
2693
2670
 
2694
2671
void
2695
 
ecoff_directive_type (ignore)
2696
 
     int ignore ATTRIBUTE_UNUSED;
 
2672
ecoff_directive_type (int ignore ATTRIBUTE_UNUSED)
2697
2673
{
2698
2674
  long val;
2699
2675
  tq_t *tq_ptr;
2761
2737
   union or enum.  */
2762
2738
 
2763
2739
void
2764
 
ecoff_directive_tag (ignore)
2765
 
     int ignore ATTRIBUTE_UNUSED;
 
2740
ecoff_directive_tag (int ignore ATTRIBUTE_UNUSED)
2766
2741
{
2767
2742
  char *name;
2768
2743
  char name_end;
2788
2763
   may be the name of a static or global symbol.  */
2789
2764
 
2790
2765
void
2791
 
ecoff_directive_val (ignore)
2792
 
     int ignore ATTRIBUTE_UNUSED;
 
2766
ecoff_directive_val (int ignore ATTRIBUTE_UNUSED)
2793
2767
{
2794
2768
  expressionS exp;
2795
2769
 
2823
2797
   debugging information for a symbol.  */
2824
2798
 
2825
2799
void
2826
 
ecoff_directive_endef (ignore)
2827
 
     int ignore ATTRIBUTE_UNUSED;
 
2800
ecoff_directive_endef (int ignore ATTRIBUTE_UNUSED)
2828
2801
{
2829
2802
  char *name;
2830
2803
  symint_t indx;
2890
2863
  else if (coff_symbol_typ == st_Member
2891
2864
           && coff_type.num_sizes - coff_type.extra_sizes == 1)
2892
2865
    {
2893
 
      /* Is this a bitfield?  This is indicated by a structure memeber
 
2866
      /* Is this a bitfield?  This is indicated by a structure member
2894
2867
         having a size field that isn't an array.  */
2895
2868
      coff_type.bitfield = 1;
2896
2869
    }
3003
2976
/* Parse .end directives.  */
3004
2977
 
3005
2978
void
3006
 
ecoff_directive_end (ignore)
3007
 
     int ignore ATTRIBUTE_UNUSED;
 
2979
ecoff_directive_end (int ignore ATTRIBUTE_UNUSED)
3008
2980
{
3009
2981
  char *name;
3010
2982
  char name_end;
3058
3030
/* Parse .ent directives.  */
3059
3031
 
3060
3032
void
3061
 
ecoff_directive_ent (ignore)
3062
 
     int ignore ATTRIBUTE_UNUSED;
 
3033
ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED)
3063
3034
{
3064
3035
  char *name;
3065
3036
  char name_end;
3109
3080
/* Parse .extern directives.  */
3110
3081
 
3111
3082
void
3112
 
ecoff_directive_extern (ignore)
3113
 
     int ignore ATTRIBUTE_UNUSED;
 
3083
ecoff_directive_extern (int ignore ATTRIBUTE_UNUSED)
3114
3084
{
3115
3085
  char *name;
3116
3086
  int c;
3134
3104
/* Parse .file directives.  */
3135
3105
 
3136
3106
void
3137
 
ecoff_directive_file (ignore)
3138
 
     int ignore ATTRIBUTE_UNUSED;
 
3107
ecoff_directive_file (int ignore ATTRIBUTE_UNUSED)
3139
3108
{
3140
3109
  int indx;
3141
3110
  char *name;
3161
3130
/* Parse .fmask directives.  */
3162
3131
 
3163
3132
void
3164
 
ecoff_directive_fmask (ignore)
3165
 
     int ignore ATTRIBUTE_UNUSED;
 
3133
ecoff_directive_fmask (int ignore ATTRIBUTE_UNUSED)
3166
3134
{
3167
3135
  long val;
3168
3136
 
3190
3158
/* Parse .frame directives.  */
3191
3159
 
3192
3160
void
3193
 
ecoff_directive_frame (ignore)
3194
 
     int ignore ATTRIBUTE_UNUSED;
 
3161
ecoff_directive_frame (int ignore ATTRIBUTE_UNUSED)
3195
3162
{
3196
3163
  long val;
3197
3164
 
3231
3198
/* Parse .mask directives.  */
3232
3199
 
3233
3200
void
3234
 
ecoff_directive_mask (ignore)
3235
 
     int ignore ATTRIBUTE_UNUSED;
 
3201
ecoff_directive_mask (int ignore ATTRIBUTE_UNUSED)
3236
3202
{
3237
3203
  long val;
3238
3204
 
3260
3226
/* Parse .loc directives.  */
3261
3227
 
3262
3228
void
3263
 
ecoff_directive_loc (ignore)
3264
 
     int ignore ATTRIBUTE_UNUSED;
 
3229
ecoff_directive_loc (int ignore ATTRIBUTE_UNUSED)
3265
3230
{
3266
3231
  lineno_list_t *list;
3267
3232
  symint_t lineno;
3341
3306
   information so that it points to the instruction after the nop.  */
3342
3307
 
3343
3308
void
3344
 
ecoff_fix_loc (old_frag, old_frag_offset)
3345
 
     fragS *old_frag;
3346
 
     unsigned long old_frag_offset;
 
3309
ecoff_fix_loc (fragS *old_frag, unsigned long old_frag_offset)
3347
3310
{
3348
3311
  if (last_lineno != NULL
3349
3312
      && last_lineno->frag == old_frag
3357
3320
/* Make sure the @stabs symbol is emitted.  */
3358
3321
 
3359
3322
static void
3360
 
mark_stabs (ignore)
3361
 
     int ignore ATTRIBUTE_UNUSED;
 
3323
mark_stabs (int ignore ATTRIBUTE_UNUSED)
3362
3324
{
3363
3325
  if (! stabs_seen)
3364
3326
    {
3375
3337
#ifndef TC_MIPS
3376
3338
/* For TC_MIPS use the version in tc-mips.c.  */
3377
3339
void
3378
 
ecoff_directive_weakext (ignore)
3379
 
     int ignore ATTRIBUTE_UNUSED;
 
3340
ecoff_directive_weakext (int ignore ATTRIBUTE_UNUSED)
3380
3341
{
3381
3342
  char *name;
3382
3343
  int c;
3454
3415
        value           a numeric value or an address.  */
3455
3416
 
3456
3417
void
3457
 
ecoff_stab (sec, what, string, type, other, desc)
3458
 
     segT sec ATTRIBUTE_UNUSED;
3459
 
     int what;
3460
 
     const char *string;
3461
 
     int type;
3462
 
     int other;
3463
 
     int desc;
 
3418
ecoff_stab (segT sec ATTRIBUTE_UNUSED,
 
3419
            int what,
 
3420
            const char *string,
 
3421
            int type,
 
3422
            int other,
 
3423
            int desc)
3464
3424
{
3465
3425
  efdr_t *save_file_ptr = cur_file_ptr;
3466
3426
  symbolS *sym;
3609
3569
   .scommon section rather than bfd_com_section.  */
3610
3570
 
3611
3571
void
3612
 
ecoff_frob_symbol (sym)
3613
 
     symbolS *sym;
 
3572
ecoff_frob_symbol (symbolS *sym)
3614
3573
{
3615
3574
  if (S_IS_COMMON (sym)
3616
3575
      && S_GET_VALUE (sym) > 0
3647
3606
/* Add bytes to the symbolic information buffer.  */
3648
3607
 
3649
3608
static char *
3650
 
ecoff_add_bytes (buf, bufend, bufptr, need)
3651
 
     char **buf;
3652
 
     char **bufend;
3653
 
     char *bufptr;
3654
 
     unsigned long need;
 
3609
ecoff_add_bytes (char **buf,
 
3610
                 char **bufend,
 
3611
                 char *bufptr,
 
3612
                 unsigned long need)
3655
3613
{
3656
3614
  unsigned long at;
3657
3615
  unsigned long want;
3670
3628
   for the ECOFF target debugging information.  */
3671
3629
 
3672
3630
static unsigned long
3673
 
ecoff_padding_adjust (backend, buf, bufend, offset, bufptrptr)
3674
 
     const struct ecoff_debug_swap *backend;
3675
 
     char **buf;
3676
 
     char **bufend;
3677
 
     unsigned long offset;
3678
 
     char **bufptrptr;
 
3631
ecoff_padding_adjust (const struct ecoff_debug_swap *backend,
 
3632
                      char **buf,
 
3633
                      char **bufend,
 
3634
                      unsigned long offset,
 
3635
                      char **bufptrptr)
3679
3636
{
3680
3637
  bfd_size_type align;
3681
3638
 
3699
3656
/* Build the line number information.  */
3700
3657
 
3701
3658
static unsigned long
3702
 
ecoff_build_lineno (backend, buf, bufend, offset, linecntptr)
3703
 
     const struct ecoff_debug_swap *backend;
3704
 
     char **buf;
3705
 
     char **bufend;
3706
 
     unsigned long offset;
3707
 
     long *linecntptr;
 
3659
ecoff_build_lineno (const struct ecoff_debug_swap *backend,
 
3660
                    char **buf,
 
3661
                    char **bufend,
 
3662
                    unsigned long offset,
 
3663
                    long *linecntptr)
3708
3664
{
3709
3665
  char *bufptr;
3710
3666
  register lineno_list_t *l;
3929
3885
/* Build and swap out the symbols.  */
3930
3886
 
3931
3887
static unsigned long
3932
 
ecoff_build_symbols (backend, buf, bufend, offset)
3933
 
     const struct ecoff_debug_swap *backend;
3934
 
     char **buf;
3935
 
     char **bufend;
3936
 
     unsigned long offset;
 
3888
ecoff_build_symbols (const struct ecoff_debug_swap *backend,
 
3889
                     char **buf,
 
3890
                     char **bufend,
 
3891
                     unsigned long offset)
3937
3892
{
3938
3893
  const bfd_size_type external_sym_size = backend->external_sym_size;
3939
 
  void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR))
 
3894
  void (* const swap_sym_out) (bfd *, const SYMR *, PTR)
3940
3895
    = backend->swap_sym_out;
3941
3896
  char *sym_out;
3942
3897
  long isym;
4295
4250
/* Swap out the procedure information.  */
4296
4251
 
4297
4252
static unsigned long
4298
 
ecoff_build_procs (backend, buf, bufend, offset)
4299
 
     const struct ecoff_debug_swap *backend;
4300
 
     char **buf;
4301
 
     char **bufend;
4302
 
     unsigned long offset;
 
4253
ecoff_build_procs (const struct ecoff_debug_swap *backend,
 
4254
                   char **buf,
 
4255
                   char **bufend,
 
4256
                   unsigned long offset)
4303
4257
{
4304
4258
  const bfd_size_type external_pdr_size = backend->external_pdr_size;
4305
 
  void (* const swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR))
 
4259
  void (* const swap_pdr_out) (bfd *, const PDR *, PTR)
4306
4260
    = backend->swap_pdr_out;
4307
4261
  char *pdr_out;
4308
4262
  long iproc;
4386
4340
/* Swap out the aux information.  */
4387
4341
 
4388
4342
static unsigned long
4389
 
ecoff_build_aux (backend, buf, bufend, offset)
4390
 
     const struct ecoff_debug_swap *backend;
4391
 
     char **buf;
4392
 
     char **bufend;
4393
 
     unsigned long offset;
 
4343
ecoff_build_aux (const struct ecoff_debug_swap *backend,
 
4344
                 char **buf,
 
4345
                 char **bufend,
 
4346
                 unsigned long offset)
4394
4347
{
4395
4348
  int bigendian;
4396
4349
  union aux_ext *aux_out;
4501
4454
   bytes copied, rather than the new offset.  */
4502
4455
 
4503
4456
static unsigned long
4504
 
ecoff_build_strings (buf, bufend, offset, vp)
4505
 
     char **buf;
4506
 
     char **bufend;
4507
 
     unsigned long offset;
4508
 
     varray_t *vp;
 
4457
ecoff_build_strings (char **buf,
 
4458
                     char **bufend,
 
4459
                     unsigned long offset,
 
4460
                     varray_t *vp)
4509
4461
{
4510
4462
  unsigned long istr;
4511
4463
  char *str_out;
4540
4492
/* Dump out the local strings.  */
4541
4493
 
4542
4494
static unsigned long
4543
 
ecoff_build_ss (backend, buf, bufend, offset)
4544
 
     const struct ecoff_debug_swap *backend;
4545
 
     char **buf;
4546
 
     char **bufend;
4547
 
     unsigned long offset;
 
4495
ecoff_build_ss (const struct ecoff_debug_swap *backend,
 
4496
                char **buf,
 
4497
                char **bufend,
 
4498
                unsigned long offset)
4548
4499
{
4549
4500
  long iss;
4550
4501
  vlinks_t *file_link;
4584
4535
/* Swap out the file descriptors.  */
4585
4536
 
4586
4537
static unsigned long
4587
 
ecoff_build_fdr (backend, buf, bufend, offset)
4588
 
     const struct ecoff_debug_swap *backend;
4589
 
     char **buf;
4590
 
     char **bufend;
4591
 
     unsigned long offset;
 
4538
ecoff_build_fdr (const struct ecoff_debug_swap *backend,
 
4539
                 char **buf,
 
4540
                 char **bufend,
 
4541
                 unsigned long offset)
4592
4542
{
4593
4543
  const bfd_size_type external_fdr_size = backend->external_fdr_size;
4594
 
  void (* const swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR))
 
4544
  void (* const swap_fdr_out) (bfd *, const FDR *, PTR)
4595
4545
    = backend->swap_fdr_out;
4596
4546
  long ifile;
4597
4547
  char *fdr_out;
4634
4584
   calls a backend function to deal with it.  */
4635
4585
 
4636
4586
static void
4637
 
ecoff_setup_ext ()
 
4587
ecoff_setup_ext (void)
4638
4588
{
4639
4589
  register symbolS *sym;
4640
4590
 
4664
4614
/* Build the ECOFF debugging information.  */
4665
4615
 
4666
4616
unsigned long
4667
 
ecoff_build_debug (hdr, bufp, backend)
4668
 
     HDRR *hdr;
4669
 
     char **bufp;
4670
 
     const struct ecoff_debug_swap *backend;
 
4617
ecoff_build_debug (HDRR *hdr,
 
4618
                   char **bufp,
 
4619
                   const struct ecoff_debug_swap *backend)
4671
4620
{
4672
4621
  const bfd_size_type external_pdr_size = backend->external_pdr_size;
4673
4622
  tag_t *ptag;
4831
4780
#ifndef MALLOC_CHECK
4832
4781
 
4833
4782
static page_type *
4834
 
allocate_cluster (npages)
4835
 
     unsigned long npages;
 
4783
allocate_cluster (unsigned long npages)
4836
4784
{
4837
4785
  register page_type *value = (page_type *) xmalloc (npages * PAGE_USIZE);
4838
4786
 
4854
4802
/* Allocate one page (which is initialized to 0).  */
4855
4803
 
4856
4804
static page_type *
4857
 
allocate_page ()
 
4805
allocate_page (void)
4858
4806
{
4859
4807
#ifndef MALLOC_CHECK
4860
4808
 
4881
4829
/* Allocate scoping information.  */
4882
4830
 
4883
4831
static scope_t *
4884
 
allocate_scope ()
 
4832
allocate_scope (void)
4885
4833
{
4886
4834
  register scope_t *ptr;
4887
4835
  static scope_t initial_scope;
4921
4869
/* Free scoping information.  */
4922
4870
 
4923
4871
static void
4924
 
free_scope (ptr)
4925
 
     scope_t *ptr;
 
4872
free_scope (scope_t *ptr)
4926
4873
{
4927
4874
  alloc_counts[(int) alloc_type_scope].total_free++;
4928
4875
 
4937
4884
/* Allocate links for pages in a virtual array.  */
4938
4885
 
4939
4886
static vlinks_t *
4940
 
allocate_vlinks ()
 
4887
allocate_vlinks (void)
4941
4888
{
4942
4889
  register vlinks_t *ptr;
4943
4890
  static vlinks_t initial_vlinks;
4971
4918
/* Allocate string hash buckets.  */
4972
4919
 
4973
4920
static shash_t *
4974
 
allocate_shash ()
 
4921
allocate_shash (void)
4975
4922
{
4976
4923
  register shash_t *ptr;
4977
4924
  static shash_t initial_shash;
5005
4952
/* Allocate type hash buckets.  */
5006
4953
 
5007
4954
static thash_t *
5008
 
allocate_thash ()
 
4955
allocate_thash (void)
5009
4956
{
5010
4957
  register thash_t *ptr;
5011
4958
  static thash_t initial_thash;
5039
4986
/* Allocate structure, union, or enum tag information.  */
5040
4987
 
5041
4988
static tag_t *
5042
 
allocate_tag ()
 
4989
allocate_tag (void)
5043
4990
{
5044
4991
  register tag_t *ptr;
5045
4992
  static tag_t initial_tag;
5079
5026
/* Free scoping information.  */
5080
5027
 
5081
5028
static void
5082
 
free_tag (ptr)
5083
 
     tag_t *ptr;
 
5029
free_tag (tag_t *ptr)
5084
5030
{
5085
5031
  alloc_counts[(int) alloc_type_tag].total_free++;
5086
5032
 
5095
5041
/* Allocate forward reference to a yet unknown tag.  */
5096
5042
 
5097
5043
static forward_t *
5098
 
allocate_forward ()
 
5044
allocate_forward (void)
5099
5045
{
5100
5046
  register forward_t *ptr;
5101
5047
  static forward_t initial_forward;
5129
5075
/* Allocate head of type hash list.  */
5130
5076
 
5131
5077
static thead_t *
5132
 
allocate_thead ()
 
5078
allocate_thead (void)
5133
5079
{
5134
5080
  register thead_t *ptr;
5135
5081
  static thead_t initial_thead;
5169
5115
/* Free scoping information.  */
5170
5116
 
5171
5117
static void
5172
 
free_thead (ptr)
5173
 
     thead_t *ptr;
 
5118
free_thead (thead_t *ptr)
5174
5119
{
5175
5120
  alloc_counts[(int) alloc_type_thead].total_free++;
5176
5121
 
5183
5128
}
5184
5129
 
5185
5130
static lineno_list_t *
5186
 
allocate_lineno_list ()
 
5131
allocate_lineno_list (void)
5187
5132
{
5188
5133
  register lineno_list_t *ptr;
5189
5134
  static lineno_list_t initial_lineno_list;
5215
5160
}
5216
5161
 
5217
5162
void
5218
 
ecoff_set_gp_prolog_size (sz)
5219
 
     int sz;
 
5163
ecoff_set_gp_prolog_size (int sz)
5220
5164
{
5221
5165
  if (cur_proc_ptr == 0)
5222
5166
    return;
5232
5176
}
5233
5177
 
5234
5178
int
5235
 
ecoff_no_current_file ()
 
5179
ecoff_no_current_file (void)
5236
5180
{
5237
5181
  return cur_file_ptr == (efdr_t *) NULL;
5238
5182
}
5239
5183
 
5240
5184
void
5241
 
ecoff_generate_asm_lineno ()
 
5185
ecoff_generate_asm_lineno (void)
5242
5186
{
5243
5187
  unsigned int lineno;
5244
5188
  char *filename;
5285
5229
#else
5286
5230
 
5287
5231
void
5288
 
ecoff_generate_asm_lineno ()
 
5232
ecoff_generate_asm_lineno (void)
5289
5233
{
5290
5234
}
5291
5235