Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/libaout.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD back-end data structures for a.out (and similar) files.
    22   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    3    2000, 2001
     3   2000, 2001, 2002
    44   Free Software Foundation, Inc.
    55   Written by Cygnus Support.
    66
    7 This file is part of BFD, the Binary File Descriptor library.
    8 
    9 This program is free software; you can redistribute it and/or modify
    10 it under the terms of the GNU General Public License as published by
    11 the Free Software Foundation; either version 2 of the License, or
    12 (at your option) any later version.
    13 
    14 This program is distributed in the hope that it will be useful,
    15 but WITHOUT ANY WARRANTY; without even the implied warranty of
    16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17 GNU General Public License for more details.
    18 
    19 You should have received a copy of the GNU General Public License
    20 along with this program; if not, write to the Free Software
    21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     7   This file is part of BFD, the Binary File Descriptor library.
     8
     9   This program is free software; you can redistribute it and/or modify
     10   it under the terms of the GNU General Public License as published by
     11   the Free Software Foundation; either version 2 of the License, or
     12   (at your option) any later version.
     13
     14   This program is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   GNU General Public License for more details.
     18
     19   You should have received a copy of the GNU General Public License
     20   along with this program; if not, write to the Free Software
     21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2222
    2323#ifndef LIBAOUT_H
     
    3030#include "bfdlink.h"
    3131
     32/* Macros for accessing components in an aout header.  Saves cluttering
     33   the source with (bfd_vma) and (bfd_byte *) casts.  */
     34
     35#define H_PUT_64(abfd, val, where) \
     36  bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
     37
     38#define H_PUT_32(abfd, val, where) \
     39  bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
     40
     41#define H_PUT_16(abfd, val, where) \
     42  bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
     43
     44#define H_PUT_8 bfd_h_put_8
     45
     46#define H_PUT_S64(abfd, val, where) \
     47  bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
     48
     49#define H_PUT_S32(abfd, val, where) \
     50  bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
     51
     52#define H_PUT_S16(abfd, val, where) \
     53  bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
     54
     55#define H_PUT_S8 bfd_h_put_signed_8
     56
     57#define H_GET_64(abfd, where) \
     58  bfd_h_get_64 ((abfd), (bfd_byte *) (where))
     59
     60#define H_GET_32(abfd, where) \
     61  bfd_h_get_32 ((abfd), (bfd_byte *) (where))
     62
     63#define H_GET_16(abfd, where) \
     64  bfd_h_get_16 ((abfd), (bfd_byte *) (where))
     65
     66#define H_GET_8 bfd_h_get_8
     67
     68#define H_GET_S64(abfd, where) \
     69  bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
     70
     71#define H_GET_S32(abfd, where) \
     72  bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
     73
     74#define H_GET_S16(abfd, where) \
     75  bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
     76
     77#define H_GET_S8 bfd_h_get_signed_8
     78
    3279/* Parameterize the a.out code based on whether it is being built
    3380   for a 32-bit architecture or a 64-bit architecture.  */
     81/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
     82   remove whitespace added here, and thus will fail to concatenate
     83   the tokens.  */
    3484#if ARCH_SIZE==64
    35 #define GET_WORD bfd_h_get_64
    36 #define GET_SWORD bfd_h_get_signed_64
    37 #define PUT_WORD bfd_h_put_64
     85#define GET_WORD H_GET_64
     86#define GET_SWORD H_GET_S64
     87#define GET_MAGIC H_GET_32
     88#define PUT_WORD H_PUT_64
     89#define PUT_MAGIC H_PUT_32
    3890#ifndef NAME
    39 #define NAME(x,y) CAT3(x,_64_,y)
    40 #endif
    41 #define JNAME(x) CAT(x,_64)
     91#define NAME(x,y) CONCAT3 (x,_64_,y)
     92#endif
     93#define JNAME(x) CONCAT2 (x,_64)
    4294#define BYTES_IN_WORD 8
     95#else
     96#if ARCH_SIZE==16
     97#define GET_WORD H_GET_16
     98#define GET_SWORD H_GET_S16
     99#define GET_MAGIC H_GET_16
     100#define PUT_WORD H_PUT_16
     101#define PUT_MAGIC H_PUT_16
     102#ifndef NAME
     103#define NAME(x,y) CONCAT3 (x,_16_,y)
     104#endif
     105#define JNAME(x) CONCAT2 (x,_16)
     106#define BYTES_IN_WORD 2
    43107#else /* ARCH_SIZE == 32 */
    44 #define GET_WORD bfd_h_get_32
    45 #define GET_SWORD bfd_h_get_signed_32
    46 #define PUT_WORD bfd_h_put_32
     108#define GET_WORD H_GET_32
     109#define GET_SWORD H_GET_S32
     110#define GET_MAGIC H_GET_32
     111#define PUT_WORD H_PUT_32
     112#define PUT_MAGIC H_PUT_32
    47113#ifndef NAME
    48 #define NAME(x,y) CAT3(x,_32_,y)
    49 #endif
    50 #define JNAME(x) CAT(x,_32)
     114#define NAME(x,y) CONCAT3 (x,_32_,y)
     115#endif
     116#define JNAME(x) CONCAT2 (x,_32)
    51117#define BYTES_IN_WORD 4
    52118#endif /* ARCH_SIZE==32 */
     119#endif /* ARCH_SIZE==64 */
    53120
    54121/* Declare at file level, since used in parameter lists, which have
     
    66133  struct bfd_link_hash_entry root;
    67134  /* Whether this symbol has been written out.  */
    68   boolean written;
     135  bfd_boolean written;
    69136  /* Symbol index in output file.  */
    70137  int indx;
     
    89156  (bfd_link_hash_traverse                                               \
    90157   (&(table)->root,                                                     \
    91     (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),  \
     158    (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
    92159    (info)))
    93160
     
    129196  /* Callback for setting the page and segment sizes, if they can't be
    130197     trivially determined from the architecture.  */
    131   boolean (*set_sizes) PARAMS ((bfd *));
     198  bfd_boolean (*set_sizes)
     199    PARAMS ((bfd *));
    132200
    133201  /* zmagic files only. For go32, the length of the exec header contributes
     
    138206  /* Callback from the add symbols phase of the linker code to handle
    139207     a dynamic object.  */
    140   boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *,
    141                                           struct external_nlist **,
    142                                           bfd_size_type *, char **));
     208  bfd_boolean (*add_dynamic_symbols)
     209    PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **,
     210             bfd_size_type *, char **));
    143211
    144212  /* Callback from the add symbols phase of the linker code to handle
    145213     adding a single symbol to the global linker hash table.  */
    146   boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
    147                                      const char *, flagword, asection *,
    148                                      bfd_vma, const char *, boolean,
    149                                      boolean,
    150                                      struct bfd_link_hash_entry **));
     214  bfd_boolean (*add_one_symbol)
     215    PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
     216             asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
     217             struct bfd_link_hash_entry **));
    151218
    152219  /* Called to handle linking a dynamic object.  */
    153   boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *));
     220  bfd_boolean (*link_dynamic_object)
     221    PARAMS ((struct bfd_link_info *, bfd *));
    154222
    155223  /* Called for each global symbol being written out by the linker.
    156224     This should write out the dynamic symbol information.  */
    157   boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *,
    158                                           struct aout_link_hash_entry *));
     225  bfd_boolean (*write_dynamic_symbol)
     226    PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
    159227
    160228  /* If this callback is not NULL, the linker calls it for each reloc.
    161229     RELOC is a pointer to the unswapped reloc.  If *SKIP is set to
    162      true, the reloc will be skipped.  *RELOCATION may be changed to
     230     TRUE, the reloc will be skipped.  *RELOCATION may be changed to
    163231     change the effects of the relocation.  */
    164   boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info,
    165                                           bfd *input_bfd,
    166                                           asection *input_section,
    167                                           struct aout_link_hash_entry *h,
    168                                           PTR reloc, bfd_byte *contents,
    169                                           boolean *skip,
    170                                           bfd_vma *relocation));
     232  bfd_boolean (*check_dynamic_reloc)
     233    PARAMS ((struct bfd_link_info *info, bfd *input_bfd,
     234             asection *input_section, struct aout_link_hash_entry *h,
     235             PTR reloc, bfd_byte *contents, bfd_boolean *skip,
     236             bfd_vma *relocation));
    171237
    172238  /* Called at the end of a link to finish up any dynamic linking
    173239     information.  */
    174   boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *));
     240  bfd_boolean (*finish_dynamic_link)
     241    PARAMS ((bfd *, struct bfd_link_info *));
    175242};
    176243#define aout_backend_info(abfd) \
    177         ((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
     244        ((const struct aout_backend_data *)((abfd)->xvec->backend_data))
    178245
    179246/* This is the layout in memory of a "struct exec" while we process it.
     
    202269};
    203270
    204 /* Magic number is written 
     271/* Magic number is written
    205272< MSB          >
    2062733130292827262524232221201918171615141312111009080706050403020100
     
    218285  M_68020 = 2,
    219286  M_SPARC = 3,
    220   /* skip a bunch so we don't run into any of suns numbers */
    221   /* make these up for the ns32k*/
    222   M_NS32032 = (64),             /* ns32032 running ? */
    223   M_NS32532 = (64 + 5),         /* ns32532 running mach */
     287  /* Skip a bunch so we don't run into any of SUN's numbers. */
     288  /* Make these up for the ns32k.  */
     289  M_NS32032 = (64),     /* ns32032 running ? */
     290  M_NS32532 = (64 + 5), /* ns32532 running mach */
    224291
    225292  M_386 = 100,
     
    238305  M_ARM6_NETBSD = 143,  /* NetBSD/arm32 binary */
    239306  M_SPARCLET_1 = 147,   /* 0x93, reserved */
     307  M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */
    240308  M_MIPS1 = 151,        /* MIPS R2000/R3000 binary */
    241309  M_MIPS2 = 152,        /* MIPS R4000/R6000 binary */
     
    276344#ifndef N_SET_DYNAMIC
    277345# define N_SET_DYNAMIC(exec, dynamic) \
    278 ((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
     346((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \
    279347((exec).a_info & 0x7fffffff))
    280348#endif
     
    311379  struct internal_exec *hdr;            /* exec file header */
    312380  aout_symbol_type *symbols;            /* symtab for input bfd */
    313  
    314   /* For ease, we do this */
     381
     382  /* For ease, we do this. */
    315383  asection *textsec;
    316384  asection *datasec;
     
    322390  file_ptr str_filepos;
    323391
    324   /* Size of a relocation entry in external form */
     392  /* Size of a relocation entry in external form. */
    325393  unsigned reloc_entry_size;
    326394
    327   /* Size of a symbol table entry in external form */
     395  /* Size of a symbol table entry in external form. */
    328396  unsigned symbol_entry_size;
    329397
    330   /* Page size - needed for alignment of demand paged files. */
     398  /* Page size - needed for alignment of demand paged files.  */
    331399  unsigned long page_size;
    332400
    333   /* Segment size - needed for alignment of demand paged files. */
     401  /* Segment size - needed for alignment of demand paged files.  */
    334402  unsigned long segment_size;
    335403
     
    341409  unsigned vma_adjusted : 1;
    342410
    343   /* used when a bfd supports several highly similar formats */
     411  /* Used when a bfd supports several highly similar formats. */
    344412  enum
    345413    {
     
    406474
    407475/* We take the address of the first element of an asymbol to ensure that the
    408    macro is only ever applied to an asymbol */
     476   macro is only ever applied to an asymbol. */
    409477#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
    410478
     
    424492  ((s)->used_by_bfd = (PTR)&(v)->relocs)
    425493
    426 /* Prototype declarations for functions defined in aoutx.h  */
    427 
    428 boolean
    429 NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
    430 
    431 boolean
    432 NAME(aout,make_sections) PARAMS ((bfd *));
    433 
    434 const bfd_target *
    435 NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
    436                                        struct internal_exec *execp,
    437                                        const bfd_target *(*callback)(bfd *)));
    438 
    439 boolean
    440 NAME(aout,mkobject) PARAMS ((bfd *abfd));
    441 
    442 enum machine_type
    443 NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
    444                                  unsigned long machine,
    445                                  boolean *unknown));
    446 
    447 boolean
    448 NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
    449                                   unsigned long machine));
    450 
    451 boolean
    452 NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
    453 
    454 boolean
    455 NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
    456                          PTR location, file_ptr offset, bfd_size_type count));
    457 
    458 asymbol *
    459 NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
    460 
    461 boolean
    462 NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *,
    463                                            struct external_nlist *,
    464                                            bfd_size_type, char *,
    465                                            bfd_size_type,
    466                                            boolean dynamic));
    467 
    468 boolean
    469 NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
    470 
    471 boolean
    472 NAME(aout,write_syms) PARAMS ((bfd *abfd));
    473 
    474 void
    475 NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
    476 
    477 long
    478 NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
    479 
    480 long
    481 NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
    482 
    483 void
    484 NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *,
    485                                       arelent *, asymbol **, bfd_size_type));
    486 void
    487 NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
    488                                       arelent *, asymbol **, bfd_size_type));
    489 
    490 reloc_howto_type *
    491 NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd,
    492                                       bfd_reloc_code_real_type code));
    493 
    494 boolean
    495 NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
    496                                       asymbol **symbols));
    497 
    498 long
    499 NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
    500                                        arelent **relptr, asymbol **symbols));
    501 
    502 long
    503 NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
    504 
    505 void
    506 NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
    507 
    508 alent *
    509 NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
    510 
    511 void
    512 NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
    513                             asymbol *symbol, bfd_print_symbol_type how));
    514 
    515 void
    516 NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
    517                            asymbol *symbol, symbol_info *ret));
    518 
    519 boolean
    520 NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
    521       asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
    522       CONST char **functionname_ptr, unsigned int *line_ptr));
    523 
    524 long
    525 NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *));
    526 
    527 asymbol *
    528 NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
    529                                          asymbol *));
    530 
    531 int
    532 NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
    533 
    534 boolean
    535 NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
    536        bfd_size_type *text_size, file_ptr *text_end));
    537 
    538 void
    539 NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
    540        struct external_exec *raw_bytes, struct internal_exec *execp));
    541 
    542 void
    543 NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
    544        struct internal_exec *execp, struct external_exec *raw_bytes));
    545 
    546 struct bfd_hash_entry *
    547 NAME(aout,link_hash_newfunc)
     494/* Prototype declarations for functions defined in aoutx.h.  */
     495
     496extern bfd_boolean NAME(aout,squirt_out_relocs)
     497  PARAMS ((bfd *, asection *));
     498
     499extern bfd_boolean NAME(aout,make_sections)
     500  PARAMS ((bfd *));
     501
     502extern const bfd_target * NAME(aout,some_aout_object_p)
     503  PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
     504
     505extern bfd_boolean NAME(aout,mkobject)
     506  PARAMS ((bfd *));
     507
     508extern enum machine_type NAME(aout,machine_type)
     509  PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
     510
     511extern bfd_boolean NAME(aout,set_arch_mach)
     512  PARAMS ((bfd *, enum bfd_architecture, unsigned long));
     513
     514extern bfd_boolean NAME(aout,new_section_hook)
     515  PARAMS ((bfd *, asection *));
     516
     517extern bfd_boolean NAME(aout,set_section_contents)
     518  PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
     519
     520extern asymbol * NAME(aout,make_empty_symbol)
     521  PARAMS ((bfd *));
     522
     523extern bfd_boolean NAME(aout,translate_symbol_table)
     524  PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
     525           char *, bfd_size_type, bfd_boolean));
     526
     527extern bfd_boolean NAME(aout,slurp_symbol_table)
     528  PARAMS ((bfd *));
     529
     530extern bfd_boolean NAME(aout,write_syms)
     531  PARAMS ((bfd *));
     532
     533extern void NAME(aout,reclaim_symbol_table)
     534  PARAMS ((bfd *));
     535
     536extern long NAME(aout,get_symtab_upper_bound)
     537  PARAMS ((bfd *));
     538
     539extern long NAME(aout,get_symtab)
     540  PARAMS ((bfd *, asymbol **));
     541
     542extern void NAME(aout,swap_ext_reloc_in)
     543  PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **,
     544           bfd_size_type));
     545extern void NAME(aout,swap_std_reloc_in)
     546  PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
     547           bfd_size_type));
     548
     549extern reloc_howto_type * NAME(aout,reloc_type_lookup)
     550  PARAMS ((bfd *, bfd_reloc_code_real_type));
     551
     552extern bfd_boolean NAME(aout,slurp_reloc_table)
     553  PARAMS ((bfd *, sec_ptr, asymbol **));
     554
     555extern long NAME(aout,canonicalize_reloc)
     556  PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
     557
     558extern long NAME(aout,get_reloc_upper_bound)
     559  PARAMS ((bfd *, sec_ptr));
     560
     561extern void NAME(aout,reclaim_reloc)
     562  PARAMS ((bfd *, sec_ptr));
     563
     564extern alent * NAME(aout,get_lineno)
     565  PARAMS ((bfd *, asymbol *));
     566
     567extern void NAME(aout,print_symbol)
     568  PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
     569
     570extern void NAME(aout,get_symbol_info)
     571  PARAMS ((bfd *, asymbol *, symbol_info *));
     572
     573extern bfd_boolean NAME(aout,find_nearest_line)
     574  PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
     575           const char **, unsigned int *));
     576
     577extern long NAME(aout,read_minisymbols)
     578  PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
     579
     580extern asymbol * NAME(aout,minisymbol_to_symbol)
     581  PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
     582
     583extern int NAME(aout,sizeof_headers)
     584  PARAMS ((bfd *, bfd_boolean));
     585
     586extern bfd_boolean NAME(aout,adjust_sizes_and_vmas)
     587  PARAMS ((bfd *, bfd_size_type *, file_ptr *));
     588
     589extern void NAME(aout,swap_exec_header_in)
     590  PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
     591
     592extern void NAME(aout,swap_exec_header_out)
     593  PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
     594
     595extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
    548596  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
    549597
    550 boolean
    551 NAME(aout,link_hash_table_init)
    552      PARAMS ((struct aout_link_hash_table *, bfd *,
    553               struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
    554                                           struct bfd_hash_table *,
    555                                           const char *)));
    556 
    557 struct bfd_link_hash_table *
    558 NAME(aout,link_hash_table_create) PARAMS ((bfd *));
    559 
    560 boolean
    561 NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
    562 
    563 boolean
    564 NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *,
    565                                void (*) (bfd *, file_ptr *, file_ptr *,
    566                                          file_ptr *)));
    567 
    568 boolean
    569 NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
    570 
    571 /* A.out uses the generic versions of these routines... */
     598extern bfd_boolean NAME(aout,link_hash_table_init)
     599  PARAMS ((struct aout_link_hash_table *, bfd *,
     600           struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
     601                                       struct bfd_hash_table *,
     602                                       const char *)));
     603
     604extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
     605  PARAMS ((bfd *));
     606
     607extern bfd_boolean NAME(aout,link_add_symbols)
     608  PARAMS ((bfd *, struct bfd_link_info *));
     609
     610extern bfd_boolean NAME(aout,final_link)
     611  PARAMS ((bfd *, struct bfd_link_info *,
     612           void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
     613
     614extern bfd_boolean NAME(aout,bfd_free_cached_info)
     615  PARAMS ((bfd *));
     616
     617/* A.out uses the generic versions of these routines...  */
     618
     619#define aout_16_get_section_contents    _bfd_generic_get_section_contents
    572620
    573621#define aout_32_get_section_contents    _bfd_generic_get_section_contents
     
    599647        NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);           \
    600648                                                                              \
    601         if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false;       \
    602         if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)          \
    603             != EXEC_BYTES_SIZE)                                               \
    604           return false;                                                       \
    605         /* Now write out reloc info, followed by syms and strings */          \
     649        if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0                      \
     650            || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
     651                          abfd) != EXEC_BYTES_SIZE)                           \
     652          return FALSE;                                                       \
     653        /* Now write out reloc info, followed by syms and strings. */        \
    606654                                                                              \
    607655        if (bfd_get_outsymbols (abfd) != (asymbol **) NULL                    \
    608656            && bfd_get_symcount (abfd) != 0)                                  \
    609657          {                                                                   \
    610             if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
    611               return false;                                                   \
     658            if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
     659              return FALSE;                                                   \
    612660                                                                              \
    613             if (! NAME(aout,write_syms)(abfd)) return false;                  \
     661            if (! NAME(aout,write_syms) (abfd))                               \
     662              return FALSE;                                                   \
    614663          }                                                                   \
    615664                                                                              \
    616         if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0)    \
    617           return false;                                                       \
     665        if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0)   \
     666          return FALSE;                                                       \
    618667        if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))         \
    619           return false;                                                       \
     668          return FALSE;                                                       \
    620669                                                                              \
    621         if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0)    \
    622           return false;                                                       \
    623         if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd)))          \
    624           return false;                                                       \
    625       }                                                                       
    626 #endif
     670        if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0)   \
     671          return FALSE;                                                       \
     672        if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))         \
     673          return FALSE;                                                       \
     674      }
     675#endif
     676
     677/* Test if a read-only section can be merged with .text.  This is
     678   possible if:
     679
     680   1. Section has file contents and is read-only.
     681   2. The VMA of the section is after the end of .text and before
     682      the start of .data.
     683   3. The image is demand-pageable (otherwise, a_text in the header
     684      will not reflect the gap between .text and .data).  */
     685
     686#define aout_section_merge_with_text_p(abfd, sec)                       \
     687  (((sec)->flags & (SEC_HAS_CONTENTS | SEC_READONLY)) ==                \
     688      (SEC_HAS_CONTENTS | SEC_READONLY)                                 \
     689   && obj_textsec (abfd) != NULL                                        \
     690   && obj_datasec (abfd) != NULL                                        \
     691   && (sec)->vma >= (obj_textsec (abfd)->vma +                          \
     692                     obj_textsec (abfd)->_cooked_size)                  \
     693   && ((sec)->vma + (sec)->_cooked_size) <= obj_datasec (abfd)->vma     \
     694   && ((abfd)->flags & D_PAGED) != 0)
    627695
    628696#endif /* ! defined (LIBAOUT_H) */
Note: See TracChangeset for help on using the changeset viewer.