home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / bfd / i386mach3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-05  |  2.6 KB  |  83 lines

  1. /* BFD back-end for i386 a.out (Mach 3) binaries.
  2.    Copyright (C) 1990, 1991, 1993, 1994 Free Software Foundation, Inc.
  3.  
  4. This file is part of BFD, the Binary File Descriptor library.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17.   along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* This is for Mach 3, which uses a.out, not Mach-O.  */
  21.  
  22. #ifndef MACH
  23. #define MACH
  24. #endif
  25.  
  26. /* There is no magic number or anything which lets us distinguish this target
  27.    from i386aout or i386bsd.  So this target is only useful if it is the
  28.    default target.  */
  29.  
  30. #define    PAGE_SIZE    4096
  31. #define    SEGMENT_SIZE    PAGE_SIZE
  32. #define BYTES_IN_WORD    4
  33. #define TEXT_START_ADDR    0x10000
  34.  
  35. /*
  36.  * Is the assumption that N_MAGIC == ZMAGIC still true?
  37.  * Also, why do we not adjust for the exec header?  Does our
  38.  * loader do things differently?
  39.  */
  40. #define N_HEADER_IN_TEXT(x)    1         /* (N_MAGIC(x) == ZMAGIC) */
  41. #define N_TXTSIZE(x)    ((x).a_text)
  42.  
  43. /*
  44.  * Mach 3.0 does not (yet) support shared libraries.
  45.  */
  46. #define    N_SHARED_LIB(x)    0
  47.  
  48. /*
  49.  * If the entry isn't the standard entry point for UX binaries, then
  50.  * assume that text starts at 0.  This is a terrible assumption, but
  51.  * it does the right thing for emulator and BSD386 binaries.
  52.  */
  53. #define N_TXTADDR(x) \
  54.     (N_MAGIC(x) != ZMAGIC ? 0 :    /* object file or NMAGIC */\
  55.      ((x).a_entry != (TEXT_START_ADDR + EXEC_BYTES_SIZE)) ? 0 :    \
  56.      N_HEADER_IN_TEXT(x)  ?    \
  57.         TEXT_START_ADDR + EXEC_BYTES_SIZE :    /* no padding */\
  58.         TEXT_START_ADDR            /* a page of padding */\
  59.     )
  60.  
  61. /*
  62.  * This is an attempt to be compatible with BSD386 binaries, which
  63.  * have a slightly different layout.
  64.  */
  65. #define N_TXTOFF(x)                            \
  66.     ((x).a_entry == 0 ? 0x1000:                        \
  67.     (N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : /* object file or NMAGIC */\
  68.      N_HEADER_IN_TEXT(x) ?                        \
  69.         EXEC_BYTES_SIZE :            /* no padding */    \
  70.         PAGE_SIZE                /* a page of padding */    \
  71.     ))
  72.  
  73. #define DEFAULT_ARCH bfd_arch_i386
  74. #define MY(OP) CAT(i386mach3_,OP)
  75. #define TARGETNAME "a.out-i386-mach3"
  76.  
  77. #include "bfd.h"
  78. #include "sysdep.h"
  79. #include "libbfd.h"
  80. #include "libaout.h"
  81.  
  82. #include "aout-target.h"
  83.