Add comment (part of immediately previous commit).
[deliverable/binutils-gdb.git] / bfd / pc532-mach.c
CommitLineData
252b5132 1/* BFD back-end for Mach3/532 a.out-ish binaries.
8ba8a462 2 Copyright (C) 1990, 1991, 1992, 1994, 2000 Free Software Foundation, Inc.
252b5132
RH
3
4This file is part of BFD, the Binary File Descriptor library.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20/* Written by Ian Dall
21 * 19-Apr-94
22 *
23 * Formerly part of aout-pc532-mach.c. Split out to allow more
24 * flexibility with multiple formats.
25 *
26 */
27/* This architecture has N_TXTOFF and N_TXTADDR defined as if
28 * N_HEADER_IN_TEXT, but the a_text entry (text size) does not include the
29 * space for the header. So we have N_HEADER_IN_TEXT defined to
30 * 1 and specially define our own N_TXTSIZE
31 */
32
33#define N_HEADER_IN_TEXT(x) 1
34#define N_TXTSIZE(x) ((x).a_text)
35
252b5132
RH
36#define TEXT_START_ADDR 0x10000 /* from old ld */
37#define TARGET_PAGE_SIZE 0x1000 /* from old ld, 032 & 532 are really 512/4k */
38
39/* Use a_entry of 0 to distinguish object files from OMAGIC executables */
40#define N_TXTADDR(x) \
41 (N_MAGIC(x) == OMAGIC ? \
42 ((x).a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \
43 (N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \
44 TEXT_START_ADDR + EXEC_BYTES_SIZE))
45
46#define SEGMENT_SIZE TARGET_PAGE_SIZE
47
48#define N_SHARED_LIB(x) 0
49#define SEGMENT_SIZE TARGET_PAGE_SIZE
50#define DEFAULT_ARCH bfd_arch_ns32k
892339ee 51
252b5132
RH
52#define MY(OP) CAT(pc532machaout_,OP)
53
54/* Must be the same as aout-ns32k.c */
55#define NAME(x,y) CAT3(ns32kaout,_32_,y)
56
57#define TARGETNAME "a.out-pc532-mach"
58
59#include "bfd.h"
60#include "sysdep.h"
61#include "libaout.h"
62#include "libbfd.h"
63#include "aout/aout64.h"
64
65/* We can`t use the MYNS macro here for cpp reasons too subtle for me -- IWD */
66
67#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup
68
892339ee 69/* libaout doesn't use NAME for these ... */
252b5132
RH
70
71#define MY_get_section_contents aout_32_get_section_contents
72
73#define MY_text_includes_header 1
74
75#define MY_exec_header_not_counted 1
892339ee 76
252b5132
RH
77#define MYNSX(OP) CAT(ns32kaout_,OP)
78reloc_howto_type *
79MYNSX(bfd_reloc_type_lookup)
80 PARAMS((bfd *abfd AND
81 bfd_reloc_code_real_type code));
82
83boolean
84MYNSX(write_object_contents)
85 PARAMS((bfd *abfd));
86
87static boolean
88MY(write_object_contents) (abfd)
89bfd *abfd;
90{
91 struct external_exec exec_bytes;
92 struct internal_exec *execp = exec_hdr (abfd);
892339ee 93
252b5132 94 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
892339ee 95
252b5132
RH
96 BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_ns32k);
97 switch (bfd_get_mach (abfd))
98 {
99 case 32032:
100 N_SET_MACHTYPE (*execp, M_NS32032);
101 break;
102 case 32532:
103 default:
104 N_SET_MACHTYPE (*execp, M_NS32532);
105 break;
106 }
107 N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
892339ee 108
252b5132 109 WRITE_HEADERS(abfd, execp);
892339ee 110
252b5132
RH
111 return true;
112}
113
114#define MY_write_object_contents MY(write_object_contents)
115
116#include "aout-target.h"
This page took 0.07902 seconds and 4 git commands to generate.