1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32
33 /*!
34 * ======== gnu.targets.ITarget ========
35 * Interface to GCC compatible compilers
36 */
37 @TargetHeader("xdc/bld/stddefs.xdt")
38 metaonly interface ITarget inherits xdc.bld.ITarget3 {
39
40 override readonly config string stdInclude = "gnu/targets/std.h";
41 override config string dllExt = ".so";
42
43 /*!
44 * ======== GCCVERS ========
45 * Version number of the GCC compiler; e.g., "3.2".
46 *
47 * This string can be supplied by the user, otherwise it is obtained
48 * by running "gcc -dumpversion".
49 */
50 config string GCCVERS = null;
51
52 /*!
53 * ======== BINVERS ========
54 * Version number of binutils used with the compiler; e.g., "2.19".
55 *
56 * This string can be supplied by the user, otherwise it is obtained
57 * by running "ld -v".
58 */
59 config string BINVERS = null;
60
61 /*!
62 * ======== version ========
63 * The Compatibility Key associated with this target.
64 *
65 * The first two components of this target's Compatibility Key are '1,0'.
66 * The rest of the Key represents the compiler version. The third
67 * component combines the major and the minor version number in the format
68 * Major.Minor. The fourth component is the patch number.
69 *
70 * @a(Example)
71 * If this target's `rootDir` points to the compiler version 3.4.6, the
72 * Compatibility Key is [1,0,3.4,6].
73 *
74 */
75 override metaonly config String version;
76
77 /*!
78 * ======== GCCTARG ========
79 * The name of the platform executing programs produced by this target
80 *
81 * This string can be supplied by the user, otherwise is is obtained
82 * from the compiler and follows the GNU standard format
83 * (<cpu>-<manufacturer>-<os> or <cpu>-<manufacturer>-<kernel>-<os>);
84 * e.g., "arm-none-eabi" or "x86_64-unknown-linux-gnu".
85 *
86 * When building a GCC compiler, there are three different execution
87 * platforms to consider: the platform used to "build" the compiler, the
88 * "host" platform that runs the compiler, and the "target" platform
89 * that runs the executables produced by the compiler. All three
90 * platforms are identified using a
91 * {@link http://sources.redhat.com/autobook/autobook/autobook_17.html configuration name}
92 * defined by GNU Autotools. `GCCTARG` is the name of the "target"
93 * platform.
94 */
95 config string GCCTARG = null;
96
97 /*!
98 * ======== LONGNAME ========
99 * @_nodoc
100 * The "long name" of the gcc compiler
101 *
102 * This name is used (in conjunction with rootDir) to find the compiler
103 * and linker for this target. The format of `LONGNAME` is always
104 * "/bin/<machine>-gcc". For majority of the targets, the default value
105 * for `LONGNAME` does not ever need to be changed. But, there are
106 * targets where the different but compatible compilers may have
107 * different `LONGNAME` parameters. For such targets and compilers,
108 * `LONGNAME` can be set in `config.bld`.
109 *
110 * @a(Example)
111 * If a version 2010q1 of the CodeSourcery GNU toolchain for Arm is
112 * installed in C:/CodeSourcery/arm-2010q1, the following settings in
113 * `config.bld` configure `gnu.targets.arm.GCArmv6` target to use that
114 * toolchain:
115 * @p(code)
116 * var GCArmv6 = xdc.module("gnu.targets.arm.GCArmv6");
117 * GCArmv6.rootDir = "C:/CodeSourcery/arm-2010q1";
118 * GCArmv6.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
119 * @p
120 *
121 */
122 config string LONGNAME = null;
123
124 /*!
125 * ======== CYGWIN ========
126 * Is the target's compiler a cygwin executable
127 *
128 * Since file names produced by cygwin-based tools differ from the names
129 * understood by other Windows executables, it is important to avoid using
130 * the names output by cygwin tools as input to non-cygwin programs.
131 * This property tells the target whether or not it's possible to use the
132 * output from `gcc -MD -MF`, for example.
133 */
134 readonly config Bool CYGWIN = false;
135
136 /*!
137 * ======== noStdLinkScript ========
138 * Don't use the standard linker script
139 *
140 * If `true`, add a `-T` flag before the generated `package/cfg/*.xdl`
141 * file passed to the linker. This flag suppresses use of the standard
142 * linker script implicit in the GCC flow, which effectively says the
143 * generated `.xdl` file assumes total control for all `MEMORY` and
144 * `SECTION` directives.
145 *
146 */
147 config Bool noStdLinkScript = false;
148
149 150 151
152 override config xdc.bld.ITarget.OptionSet profiles[string] = [
153 ["debug", {
154 compileOpts: {
155 copts: "-g",
156 defs: "-D_DEBUG_=1",
157 },
158 linkOpts: "-g",
159 }],
160
161 ["release", {
162 compileOpts: {
163 copts: "-O2 -ffunction-sections -fdata-sections",
164 },
165 linkOpts: "-Wl,--gc-sections",
166 }],
167
168 ["profile", {
169 compileOpts: {
170 copts: "-g -pg",
171 },
172 linkOpts: "-pg"
173 }],
174
175 ["coverage", {
176 compileOpts: {
177 copts: "-fprofile-arcs -ftest-coverage",
178 },
179 linkOpts: "-fprofile-arcs -ftest-coverage",
180 }],
181 ];
182
183 /*!
184 * ======== versionMap ========
185 * Map of GCC compiler version numbers to compatibility keys.
186 *
187 * This map translates version string information from the compiler into a
188 * compatibility key. The compatibility key is used to validate consistency
189 * among a collection of packages used in a configuration.
190 *
191 * The compiler version string is "gcc<ver>", where <ver> is GCCVERS.
192 *
193 * If a compiler version is not found in this map the default is
194 * "1,0,<ver>", where <ver> is the compiler version number. Thus,
195 * the user only needs to extend this table when a significant
196 * incompatibility occurs or when two versions of the compiler should
197 * be treated as 100% compatible.
198 */
199 override config string versionMap[string] = [
200 ["gcc3.2", "1,0,3.2,0"],
201 ];
202
203 /*!
204 * ======== remoteHost ========
205 * Remote host used to run compiler, linker, and archiver tools
206 *
207 * If `remoteHost` is `null` (or `undefined`), the configured compiler
208 * is run locally; otherwise, `remoteHost` is taken to be the host name
209 * of the machine that that should be used to run the specified compiler.
210 *
211 * All target commands are prefixed with a command that uses `rsh` to run
212 * the commands on the specified host. Thus, in order to use this
213 * setting, the remote machine must be support `rsh` and the user must
214 * have permission to run commands from the local machine on the remote
215 * host named `remoteHost`. This usually involves adding a line to the
216 * user's `~/.rhosts` file on the remote machine of the form:
217 * @p(code)
218 * local-machine-name user-name
219 * @p
220 * where `local-machine-name` is the name of the local machine and
221 * `user-name` is the user's login name on the local machine.
222 */
223 config string remoteHost;
224
225 /*!
226 * ======== ar ========
227 * The command used to create an archive
228 */
229 override readonly config xdc.bld.ITarget2.Command ar = {
230 cmd: "$(rootDir)/bin/ar",
231 opts: "cr"
232 };
233
234 /*!
235 * ======== lnk ========
236 * The command used to link executables.
237 */
238 override readonly config xdc.bld.ITarget2.Command lnk = {
239 cmd: "$(rootDir)/bin/gcc",
240 opts: ""
241 };
242
243 override config xdc.bld.ITarget2.Options lnkOpts = {
244 prefix: "",
245 suffix: "-Wl,-Map=$(XDCCFGDIR)/$@.map -lstdc++ -L$(rootDir)/lib"
246 };
247
248 /*!
249 * ======== cc ========
250 * The command used to compile C/C++ source files into object files
251 */
252 override readonly config xdc.bld.ITarget2.Command cc = {
253 cmd: "$(rootDir)/bin/gcc -c -MD -MF $@.dep",
254 opts: ""
255 };
256
257 /*!
258 * ======== asm ========
259 * The command used to assembles assembly source files into object files
260 */
261 override readonly config xdc.bld.ITarget2.Command asm = {
262 cmd: "$(rootDir)/bin/gcc -c -x assembler",
263 opts: ""
264 };
265
266 /*!
267 * ======== includeOpts ========
268 * Additional user configurable target-specific include path options
269 */
270 override config string includeOpts = "";
271
272 override config String binaryParser = "xdc.targets.omf.Elf";
273
274 275 276 277
278 String initVers();
279
280 /*!
281 * ======== asmName ========
282 * The function that converts a C name into an assembly name
283 */
284 String asmName(String CName);
285 }
286 287 288
289