1 /* Generate parameters for an a.out system.
2 Copyright (C) 1990-2015 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
21 #include "/usr/include/a.out.h"
29 main (int argc
, char** argv
)
34 char * arch
= "unknown";
40 fprintf (stderr
, "Usage: gen-aout target_name\n");
44 file
= fopen ("gen-aout", "r");
47 fprintf (stderr
, "Cannot open gen-aout!\n");
51 if (fread (&my_exec
, sizeof (struct exec
), 1, file
) != 1)
53 fprintf(stderr
, "Cannot read gen-aout!\n");
60 page_size
= N_TXTOFF(my_exec
);
62 printf ("#define N_HEADER_IN_TEXT(x) 1\n");
64 printf ("#define N_HEADER_IN_TEXT(x) 0\n");
67 printf("#define BYTES_IN_WORD %d\n", sizeof (int));
68 if (my_exec
.a_entry
== 0)
70 printf ("#define ENTRY_CAN_BE_ZERO\n");
71 printf ("#define N_SHARED_LIB(x) 0 /* Avoids warning */\n");
75 printf ("/*#define ENTRY_CAN_BE_ZERO*/\n");
76 printf ("/*#define N_SHARED_LIB(x) 0*/\n");
79 printf ("#define TEXT_START_ADDR %d\n", my_exec
.a_entry
);
87 printf ("#define TARGET_PAGE_SIZE %d\n", page_size
);
89 printf ("/* #define TARGET_PAGE_SIZE ??? */\n");
91 printf ("#define SEGMENT_SIZE TARGET_PAGE_SIZE\n");
101 fprintf (stderr
, _("warning: preprocessor substituted architecture name inside string;"));
102 fprintf (stderr
, _(" fix DEFAULT_ARCH in the output file yourself\n"));
105 printf ("#define DEFAULT_ARCH bfd_arch_%s\n\n", arch
);
107 printf ("/* Do not \"beautify\" the CONCAT* macro args. Traditional C will not");
108 printf (" remove whitespace added here, and thus will fail to concatenate");
109 printf (" the tokens. */");
110 printf ("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target
);
111 printf ("#define TARGETNAME \"a.out-%s\"\n\n", target
);
113 printf ("#include \"sysdep.h\"\n");
114 printf ("#include \"bfd.h\"\n");
115 printf ("#include \"libbfd.h\"\n");
116 printf ("#include \"libaout.h\"\n");
117 printf ("\n#include \"aout-target.h\"\n");
This page took 0.031137 seconds and 4 git commands to generate.