1 /* Generate parameters for an a.out system.
2 Copyright (C) 1990-1991 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
20 #include "/usr/include/a.out.h"
23 /* Stuffed value of "ABCD" in a long, followed by a 0. */
24 long int str
[2] = { 0x41424344, 0x0 };
30 FILE *file
= fopen("gen-aout", "r");
32 fprintf(stderr
, "Cannot open gen-aout!\n");
35 if (fread(&my_exec
, sizeof(struct exec
), 1, file
) != 1) {
36 fprintf(stderr
, "Cannot read gen-aout!\n");
40 if (strcmp ((char *)&str
[0], "ABCD") == 0)
41 printf("#define TARGET_IS_BIG_ENDIAN_P\n");
43 printf("#define TARGET_IS_LITTLE_ENDIAN_P\n");
46 page_size
= N_TXTOFF(my_exec
);
48 printf("#define N_HEADER_IN_TEXT(x) 1\n");
50 printf("#define N_HEADER_IN_TEXT(x) 0\n");
53 printf("#define BYTES_IN_WORD 4\n");
54 printf("#define ARCH 32\n");
55 if (my_exec
.a_entry
== 0)
56 printf("#define ENTRY_CAN_BE_ZERO\n");
57 printf("#define TEXT_START_ADDR %d\n", my_exec
.a_entry
);
64 printf("#define PAGE_SIZE %d\n", page_size
);