1 /* Generate parameters for an a.out system.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 #include "/usr/include/a.out.h"
26 int argc
; char** argv
;
30 char *target
= "unknown", *arch
= "unknown";
31 FILE *file
= fopen("gen-aout", "r");
34 fprintf(stderr
, "Cannot open gen-aout!\n");
37 if (fread(&my_exec
, sizeof(struct exec
), 1, file
) != 1) {
38 fprintf(stderr
, "Cannot read gen-aout!\n");
44 fprintf(stderr
, "Usage: gen-aout target_name\n");
49 page_size
= N_TXTOFF(my_exec
);
51 printf("#define N_HEADER_IN_TEXT(x) 1\n");
53 printf("#define N_HEADER_IN_TEXT(x) 0\n");
56 printf("#define BYTES_IN_WORD %d\n", sizeof (int));
57 if (my_exec
.a_entry
== 0) {
58 printf("#define ENTRY_CAN_BE_ZERO\n");
59 printf("#define N_SHARED_LIB(x) 0 /* Avoids warning */\n");
62 printf("/*#define ENTRY_CAN_BE_ZERO*/\n");
63 printf("/*#define N_SHARED_LIB(x) 0*/\n");
66 printf("#define TEXT_START_ADDR %d\n", my_exec
.a_entry
);
73 printf("#define TARGET_PAGE_SIZE %d\n", page_size
);
75 printf("/* #define TARGET_PAGE_SIZE ??? */\n");
76 printf("#define SEGMENT_SIZE TARGET_PAGE_SIZE\n");
86 fprintf (stderr
, _("warning: preprocessor substituted architecture name inside string;"));
87 fprintf (stderr
, _(" fix DEFAULT_ARCH in the output file yourself\n"));
90 printf("#define DEFAULT_ARCH bfd_arch_%s\n", arch
);
92 printf("\n#define MY(OP) CAT(%s_,OP)\n", target
);
93 printf("#define TARGETNAME \"a.out-%s\"\n\n", target
);
95 printf("#include \"bfd.h\"\n");
96 printf("#include \"sysdep.h\"\n");
97 printf("#include \"libbfd.h\"\n");
98 printf("#include \"libaout.h\"\n");
99 printf("\n#include \"aout-target.h\"\n");
This page took 0.030762 seconds and 4 git commands to generate.