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