Ignore:
Timestamp:
Aug 16, 2003, 11:33:53 PM (22 years ago)
Author:
bird
Message:

Joined the port of 2.11.2 with 2.14.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/binutils/bfd/libaout.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r617 r618  
    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.
     
    205272};
    206273
    207 /* Magic number is written 
     274/* Magic number is written
    208275< MSB          >
    2092763130292827262524232221201918171615141312111009080706050403020100
     
    221288  M_68020 = 2,
    222289  M_SPARC = 3,
    223   /* skip a bunch so we don't run into any of suns numbers */
    224   /* make these up for the ns32k*/
    225   M_NS32032 = (64),             /* ns32032 running ? */
    226   M_NS32532 = (64 + 5),         /* ns32532 running mach */
     290  /* Skip a bunch so we don't run into any of SUN's numbers. */
     291  /* Make these up for the ns32k.  */
     292  M_NS32032 = (64),     /* ns32032 running ? */
     293  M_NS32532 = (64 + 5), /* ns32532 running mach */
    227294
    228295  M_386 = 100,
     
    241308  M_ARM6_NETBSD = 143,  /* NetBSD/arm32 binary */
    242309  M_SPARCLET_1 = 147,   /* 0x93, reserved */
     310  M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */
    243311  M_MIPS1 = 151,        /* MIPS R2000/R3000 binary */
    244312  M_MIPS2 = 152,        /* MIPS R4000/R6000 binary */
     
    279347#ifndef N_SET_DYNAMIC
    280348# define N_SET_DYNAMIC(exec, dynamic) \
    281 ((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
     349((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \
    282350((exec).a_info & 0x7fffffff))
    283351#endif
     
    314382  struct internal_exec *hdr;            /* exec file header */
    315383  aout_symbol_type *symbols;            /* symtab for input bfd */
    316  
    317   /* For ease, we do this */
     384
     385  /* For ease, we do this. */
    318386  asection *textsec;
    319387  asection *datasec;
     
    325393  file_ptr str_filepos;
    326394
    327   /* Size of a relocation entry in external form */
     395  /* Size of a relocation entry in external form. */
    328396  unsigned reloc_entry_size;
    329397
    330   /* Size of a symbol table entry in external form */
     398  /* Size of a symbol table entry in external form. */
    331399  unsigned symbol_entry_size;
    332400
    333   /* Page size - needed for alignment of demand paged files. */
     401  /* Page size - needed for alignment of demand paged files.  */
    334402  unsigned long page_size;
    335403
    336   /* Segment size - needed for alignment of demand paged files. */
     404  /* Segment size - needed for alignment of demand paged files.  */
    337405  unsigned long segment_size;
    338406
     
    344412  unsigned vma_adjusted : 1;
    345413
    346   /* used when a bfd supports several highly similar formats */
     414  /* Used when a bfd supports several highly similar formats. */
    347415  enum
    348416    {
     
    409477
    410478/* We take the address of the first element of an asymbol to ensure that the
    411    macro is only ever applied to an asymbol */
     479   macro is only ever applied to an asymbol. */
    412480#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
    413481
     
    427495  ((s)->used_by_bfd = (PTR)&(v)->relocs)
    428496
    429 /* Prototype declarations for functions defined in aoutx.h  */
    430 
    431 boolean
    432 NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
    433 
    434 boolean
    435 NAME(aout,make_sections) PARAMS ((bfd *));
    436 
    437 const bfd_target *
    438 NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
    439                                        struct internal_exec *execp,
    440                                        const bfd_target *(*callback)(bfd *)));
    441 
    442 boolean
    443 NAME(aout,mkobject) PARAMS ((bfd *abfd));
    444 
    445 enum machine_type
    446 NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
    447                                  unsigned long machine,
    448                                  boolean *unknown));
    449 
    450 boolean
    451 NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
    452                                   unsigned long machine));
    453 
    454 boolean
    455 NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
    456 
    457 boolean
    458 NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
    459                          PTR location, file_ptr offset, bfd_size_type count));
    460 
    461 asymbol *
    462 NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
    463 
    464 boolean
    465 NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *,
    466                                            struct external_nlist *,
    467                                            bfd_size_type, char *,
    468                                            bfd_size_type,
    469                                            boolean dynamic));
    470 
    471 boolean
    472 NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
    473 
    474 boolean
    475 NAME(aout,write_syms) PARAMS ((bfd *abfd));
    476 
    477 void
    478 NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
    479 
    480 long
    481 NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
    482 
    483 long
    484 NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
    485 
    486 void
    487 NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *,
    488                                       arelent *, asymbol **, bfd_size_type));
    489 void
    490 NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
    491                                       arelent *, asymbol **, bfd_size_type));
    492 
    493 reloc_howto_type *
    494 NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd,
    495                                       bfd_reloc_code_real_type code));
    496 
    497 boolean
    498 NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
    499                                       asymbol **symbols));
    500 
    501 long
    502 NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
    503                                        arelent **relptr, asymbol **symbols));
    504 
    505 long
    506 NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
    507 
    508 void
    509 NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
    510 
    511 alent *
    512 NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
    513 
    514 void
    515 NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
    516                             asymbol *symbol, bfd_print_symbol_type how));
    517 
    518 void
    519 NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
    520                            asymbol *symbol, symbol_info *ret));
    521 
    522 boolean
    523 NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
    524       asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
    525       CONST char **functionname_ptr, unsigned int *line_ptr));
    526 
    527 long
    528 NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *));
    529 
    530 asymbol *
    531 NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
    532                                          asymbol *));
    533 
    534 int
    535 NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
    536 
    537 boolean
    538 NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
    539        bfd_size_type *text_size, file_ptr *text_end));
    540 
    541 void
    542 NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
    543        struct external_exec *raw_bytes, struct internal_exec *execp));
    544 
    545 void
    546 NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
    547        struct internal_exec *execp, struct external_exec *raw_bytes));
    548 
    549 struct bfd_hash_entry *
    550 NAME(aout,link_hash_newfunc)
     497/* Prototype declarations for functions defined in aoutx.h.  */
     498
     499extern bfd_boolean NAME(aout,squirt_out_relocs)
     500  PARAMS ((bfd *, asection *));
     501
     502extern bfd_boolean NAME(aout,make_sections)
     503  PARAMS ((bfd *));
     504
     505extern const bfd_target * NAME(aout,some_aout_object_p)
     506  PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
     507
     508extern bfd_boolean NAME(aout,mkobject)
     509  PARAMS ((bfd *));
     510
     511extern enum machine_type NAME(aout,machine_type)
     512  PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
     513
     514extern bfd_boolean NAME(aout,set_arch_mach)
     515  PARAMS ((bfd *, enum bfd_architecture, unsigned long));
     516
     517extern bfd_boolean NAME(aout,new_section_hook)
     518  PARAMS ((bfd *, asection *));
     519
     520extern bfd_boolean NAME(aout,set_section_contents)
     521  PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
     522
     523extern asymbol * NAME(aout,make_empty_symbol)
     524  PARAMS ((bfd *));
     525
     526extern bfd_boolean NAME(aout,translate_symbol_table)
     527  PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
     528           char *, bfd_size_type, bfd_boolean));
     529
     530extern bfd_boolean NAME(aout,slurp_symbol_table)
     531  PARAMS ((bfd *));
     532
     533extern bfd_boolean NAME(aout,write_syms)
     534  PARAMS ((bfd *));
     535
     536extern void NAME(aout,reclaim_symbol_table)
     537  PARAMS ((bfd *));
     538
     539extern long NAME(aout,get_symtab_upper_bound)
     540  PARAMS ((bfd *));
     541
     542extern long NAME(aout,get_symtab)
     543  PARAMS ((bfd *, asymbol **));
     544
     545extern void NAME(aout,swap_ext_reloc_in)
     546  PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **,
     547           bfd_size_type));
     548extern void NAME(aout,swap_std_reloc_in)
     549  PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
     550           bfd_size_type));
     551
     552extern reloc_howto_type * NAME(aout,reloc_type_lookup)
     553  PARAMS ((bfd *, bfd_reloc_code_real_type));
     554
     555extern bfd_boolean NAME(aout,slurp_reloc_table)
     556  PARAMS ((bfd *, sec_ptr, asymbol **));
     557
     558extern long NAME(aout,canonicalize_reloc)
     559  PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
     560
     561extern long NAME(aout,get_reloc_upper_bound)
     562  PARAMS ((bfd *, sec_ptr));
     563
     564extern void NAME(aout,reclaim_reloc)
     565  PARAMS ((bfd *, sec_ptr));
     566
     567extern alent * NAME(aout,get_lineno)
     568  PARAMS ((bfd *, asymbol *));
     569
     570extern void NAME(aout,print_symbol)
     571  PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
     572
     573extern void NAME(aout,get_symbol_info)
     574  PARAMS ((bfd *, asymbol *, symbol_info *));
     575
     576extern bfd_boolean NAME(aout,find_nearest_line)
     577  PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
     578           const char **, unsigned int *));
     579
     580extern long NAME(aout,read_minisymbols)
     581  PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
     582
     583extern asymbol * NAME(aout,minisymbol_to_symbol)
     584  PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
     585
     586extern int NAME(aout,sizeof_headers)
     587  PARAMS ((bfd *, bfd_boolean));
     588
     589extern bfd_boolean NAME(aout,adjust_sizes_and_vmas)
     590  PARAMS ((bfd *, bfd_size_type *, file_ptr *));
     591
     592extern void NAME(aout,swap_exec_header_in)
     593  PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
     594
     595extern void NAME(aout,swap_exec_header_out)
     596  PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
     597
     598extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
    551599  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
    552600
    553 boolean
    554 NAME(aout,link_hash_table_init)
    555      PARAMS ((struct aout_link_hash_table *, bfd *,
    556               struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
    557                                           struct bfd_hash_table *,
    558                                           const char *)));
    559 
    560 struct bfd_link_hash_table *
    561 NAME(aout,link_hash_table_create) PARAMS ((bfd *));
    562 
    563 boolean
    564 NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
    565 
    566 boolean
    567 NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *,
    568                                void (*) (bfd *, file_ptr *, file_ptr *,
    569                                          file_ptr *)));
    570 
    571 boolean
    572 NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
    573 
    574 /* A.out uses the generic versions of these routines... */
     601extern bfd_boolean NAME(aout,link_hash_table_init)
     602  PARAMS ((struct aout_link_hash_table *, bfd *,
     603           struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
     604                                       struct bfd_hash_table *,
     605                                       const char *)));
     606
     607extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
     608  PARAMS ((bfd *));
     609
     610extern bfd_boolean NAME(aout,link_add_symbols)
     611  PARAMS ((bfd *, struct bfd_link_info *));
     612
     613extern bfd_boolean NAME(aout,final_link)
     614  PARAMS ((bfd *, struct bfd_link_info *,
     615           void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
     616
     617extern bfd_boolean NAME(aout,bfd_free_cached_info)
     618  PARAMS ((bfd *));
     619
     620/* A.out uses the generic versions of these routines...  */
     621
     622#define aout_16_get_section_contents    _bfd_generic_get_section_contents
    575623
    576624#define aout_32_get_section_contents    _bfd_generic_get_section_contents
     
    602650        NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);           \
    603651                                                                              \
    604         if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false;       \
    605         if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)          \
    606             != EXEC_BYTES_SIZE)                                               \
    607           return false;                                                       \
    608         /* Now write out reloc info, followed by syms and strings */          \
     652        if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0                      \
     653            || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
     654                          abfd) != EXEC_BYTES_SIZE)                           \
     655          return FALSE;                                                       \
     656        /* Now write out reloc info, followed by syms and strings. */        \
    609657                                                                              \
    610658        if (bfd_get_outsymbols (abfd) != (asymbol **) NULL                    \
    611659            && bfd_get_symcount (abfd) != 0)                                  \
    612660          {                                                                   \
    613             if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
    614               return false;                                                   \
     661            if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
     662              return FALSE;                                                   \
    615663                                                                              \
    616             if (! NAME(aout,write_syms)(abfd)) return false;                  \
     664            if (! NAME(aout,write_syms) (abfd))                               \
     665              return FALSE;                                                   \
    617666          }                                                                   \
    618667                                                                              \
    619         if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0)    \
    620           return false;                                                       \
     668        if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0)   \
     669          return FALSE;                                                       \
    621670        if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))         \
    622           return false;                                                       \
     671          return FALSE;                                                       \
    623672                                                                              \
    624         if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0)    \
    625           return false;                                                       \
    626         if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd)))          \
    627           return false;                                                       \
    628       }                                                                       
    629 #endif
     673        if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0)   \
     674          return FALSE;                                                       \
     675        if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))         \
     676          return FALSE;                                                       \
     677      }
     678#endif
     679
     680/* Test if a read-only section can be merged with .text.  This is
     681   possible if:
     682
     683   1. Section has file contents and is read-only.
     684   2. The VMA of the section is after the end of .text and before
     685      the start of .data.
     686   3. The image is demand-pageable (otherwise, a_text in the header
     687      will not reflect the gap between .text and .data).  */
     688
     689#define aout_section_merge_with_text_p(abfd, sec)                       \
     690  (((sec)->flags & (SEC_HAS_CONTENTS | SEC_READONLY)) ==                \
     691      (SEC_HAS_CONTENTS | SEC_READONLY)                                 \
     692   && obj_textsec (abfd) != NULL                                        \
     693   && obj_datasec (abfd) != NULL                                        \
     694   && (sec)->vma >= (obj_textsec (abfd)->vma +                          \
     695                     obj_textsec (abfd)->_cooked_size)                  \
     696   && ((sec)->vma + (sec)->_cooked_size) <= obj_datasec (abfd)->vma     \
     697   && ((abfd)->flags & D_PAGED) != 0)
    630698
    631699#endif /* ! defined (LIBAOUT_H) */
Note: See TracChangeset for help on using the changeset viewer.