retarget patch for gcc 4.8.3
[AROS.git] / tools / crosstools / gcc-4.8.3-aros.diff
blob21243d9a221e0b5300497144567924e05fb17e96
1 diff -urN gcc-4.8.1/configure gcc-4.8.1.new/configure
2 --- gcc-4.8.1/configure 2011-12-18 05:03:44.000000000 -0500
3 +++ gcc-4.8.1.new/configure 2013-12-02 20:22:15.904776124 -0500
4 @@ -2997,6 +2997,9 @@
5 ppc*-*-pe)
6 noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl gnuserv"
7 ;;
8 + *-*-aros*)
9 + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv gdb"
10 + ;;
11 powerpc-*-beos*)
12 noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline"
14 @@ -3810,6 +3813,8 @@
15 # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
16 host_makefile_frag="config/mh-x86omitfp"
18 + *-*-aros*)
19 + ;;
20 esac
23 diff -urN gcc-4.8.1/configure.ac gcc-4.8.1.new/configure.ac
24 --- gcc-4.8.1/configure.ac 2011-11-18 06:45:44.000000000 -0500
25 +++ gcc-4.8.1.new/configure.ac 2013-12-02 20:22:15.904776124 -0500
26 @@ -453,6 +453,9 @@
27 ppc*-*-pe)
28 noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl gnuserv"
30 + *-*-aros*)
31 + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv gdb"
32 + ;;
33 powerpc-*-beos*)
34 noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline"
36 @@ -1237,6 +1240,8 @@
37 # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
38 host_makefile_frag="config/mh-x86omitfp"
40 + *-*-aros*)
41 + ;;
42 esac
45 diff -urN gcc-4.8.1/fixincludes/configure gcc-4.8.1.new/fixincludes/configure
46 --- gcc-4.8.1/fixincludes/configure 2010-06-03 02:45:02.000000000 -0400
47 +++ gcc-4.8.1.new/fixincludes/configure 2013-12-02 20:22:15.904776124 -0500
48 @@ -4245,6 +4245,7 @@
50 else
51 case $host in
52 + *-*-aros* | \
53 i?86-*-msdosdjgpp* | \
54 i?86-*-mingw32* | \
55 x86_64-*-mingw32* | \
56 diff -urN gcc-4.8.1/fixincludes/configure.ac gcc-4.8.1.new/fixincludes/configure.ac
57 --- gcc-4.8.1/fixincludes/configure.ac 2010-06-03 02:45:02.000000000 -0400
58 +++ gcc-4.8.1.new/fixincludes/configure.ac 2013-12-02 20:22:15.904776124 -0500
59 @@ -49,6 +49,7 @@
60 TARGET=oneprocess
61 fi],
62 [case $host in
63 + *-*-aros* | \
64 i?86-*-msdosdjgpp* | \
65 i?86-*-mingw32* | \
66 x86_64-*-mingw32* | \
67 diff -urN gcc-4.8.1/gcc/config/arm/aros.h gcc-4.8.1.new/gcc/config/arm/aros.h
68 --- gcc-4.8.1/gcc/config/arm/aros.h 1969-12-31 19:00:00.000000000 -0500
69 +++ gcc-4.8.1.new/gcc/config/arm/aros.h 2013-12-02 20:22:15.904776124 -0500
70 @@ -0,0 +1,82 @@
71 +/* Configuration file for ARM AROS EABI targets.
72 + Copyright (C) 2004, 2005, 2006, 2007, 2010
73 + Free Software Foundation, Inc.
74 + Contributed by Pavel Fedin
75 + Based on linux-eabi.h and other AROS targets
77 + This file is part of GCC.
79 + GCC is free software; you can redistribute it and/or modify it
80 + under the terms of the GNU General Public License as published
81 + by the Free Software Foundation; either version 3, or (at your
82 + option) any later version.
84 + GCC is distributed in the hope that it will be useful, but WITHOUT
85 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
86 + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
87 + License for more details.
89 + You should have received a copy of the GNU General Public License
90 + along with GCC; see the file COPYING3. If not see
91 + <http://www.gnu.org/licenses/>. */
93 +/* On EABI GNU/Linux, we want both the BPABI builtins and the
94 + GNU/Linux builtins. */
95 +#undef TARGET_OS_CPP_BUILTINS
96 +#define TARGET_OS_CPP_BUILTINS() \
97 + do \
98 + { \
99 + TARGET_BPABI_CPP_BUILTINS(); \
100 + builtin_define_std ("AROS"); \
101 + builtin_define ("AMIGA"); \
102 + builtin_define ("_AMIGA"); \
103 + builtin_assert ("system=posix"); \
104 + if (flag_pic) \
105 + { \
106 + builtin_define ("__PIC__"); \
107 + builtin_define ("__pic__"); \
108 + } \
109 + } \
110 + while (false)
112 +/* We default to a softfp ABI so that we are compatible
113 + with the Linux EABI (as used by the linker). */
114 +#undef TARGET_DEFAULT_FLOAT_ABI
115 +#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFTFP
117 +/* We default to the "aapcs-linux" ABI so that enums are int-sized by
118 + default. */
119 +#undef ARM_DEFAULT_ABI
120 +#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
122 +/* Default to armv5t so that thumb shared libraries work.
123 + The ARM10TDMI core is the default for armv5t, so set
124 + SUBTARGET_CPU_DEFAULT to achieve this. */
125 +#undef SUBTARGET_CPU_DEFAULT
126 +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
128 +/* TARGET_BIG_ENDIAN_DEFAULT is set in
129 + config.gcc for big endian configurations. */
130 +#undef TARGET_LINKER_EMULATION
131 +#if TARGET_BIG_ENDIAN_DEFAULT
132 +#define TARGET_LINKER_EMULATION "armelfb_aros"
133 +#else
134 +#define TARGET_LINKER_EMULATION "armelf_aros"
135 +#endif
137 +#undef SUBTARGET_CPP_SPEC
138 +#define SUBTARGET_CPP_SPEC "-D__ELF__ %{!nostdinc:%{!nostdc:%{!noposixc:-isystem %R/include/aros/posixc} -isystem %R/include/aros/stdc}}"
140 +#undef SUBTARGET_EXTRA_LINK_SPEC
141 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
143 +/* Provide a LINK_SPEC appropriate for AROS. */
144 +#undef LINK_SPEC
145 +#define LINK_SPEC "-m armelf_aros -L %R/lib"
147 +/* Use own supplement to libgcc. */
148 +#undef LIBGCC_SPEC
149 +#define LIBGCC_SPEC "-laeabi -lgcc"
151 +/* FIXME: AROS doesn't support dw2 unwinding yet. */
152 +#undef MD_FALLBACK_FRAME_STATE_FOR
153 diff -urN gcc-4.8.1/gcc/config/arm/t-aros gcc-4.8.1.new/gcc/config/arm/t-aros
154 --- gcc-4.8.1/gcc/config/arm/t-aros 1969-12-31 19:00:00.000000000 -0500
155 +++ gcc-4.8.1.new/gcc/config/arm/t-aros 2013-12-02 20:22:15.904776124 -0500
156 @@ -0,0 +1,21 @@
157 +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
158 +# 2008, 2010 Free Software Foundation, Inc.
160 +# This file is part of GCC.
162 +# GCC is free software; you can redistribute it and/or modify
163 +# it under the terms of the GNU General Public License as published by
164 +# the Free Software Foundation; either version 3, or (at your option)
165 +# any later version.
167 +# GCC is distributed in the hope that it will be useful,
168 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
169 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
170 +# GNU General Public License for more details.
172 +# You should have received a copy of the GNU General Public License
173 +# along with GCC; see the file COPYING3. If not see
174 +# <http://www.gnu.org/licenses/>.
176 +MULTILIB_OPTIONS = marm mfloat-abi=hard
177 +MULTILIB_DIRNAMES = arm fpu
178 diff -urN gcc-4.8.1/gcc/config/aros.h gcc-4.8.1.new/gcc/config/aros.h
179 --- gcc-4.8.1/gcc/config/aros.h 1969-12-31 19:00:00.000000000 -0500
180 +++ gcc-4.8.1.new/gcc/config/aros.h 2013-12-02 20:22:15.908776146 -0500
181 @@ -0,0 +1,108 @@
182 +/* Definitions for AROS
183 + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
184 + Contributed by Fabio Alemagna
185 + Based upon linux.h, contributed by Eric Youngdale.
187 +This file is part of GNU CC.
189 +GNU CC is free software; you can redistribute it and/or modify
190 +it under the terms of the GNU General Public License as published by
191 +the Free Software Foundation; either version 2, or (at your option)
192 +any later version.
194 +GNU CC is distributed in the hope that it will be useful,
195 +but WITHOUT ANY WARRANTY; without even the implied warranty of
196 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
197 +GNU General Public License for more details.
199 +You should have received a copy of the GNU General Public License
200 +along with GNU CC; see the file COPYING. If not, write to
201 +the Free Software Foundation, 59 Temple Place - Suite 330,
202 +Boston, MA 02111-1307, USA. */
204 +/* Don't assume anything about the header files. */
205 +#define NO_IMPLICIT_EXTERN_C
207 +#undef SIZE_TYPE
208 +#define SIZE_TYPE "long unsigned int"
210 +#undef WCHAR_TYPE
211 +#define WCHAR_TYPE "char"
213 +#undef WCHAR_TYPE_SIZE
214 +#define WCHAR_TYPE_SIZE 8
216 +#undef PTRDIFF_TYPE
217 +#define PTRDIFF_TYPE "long int"
219 +#undef TARGET_OS_CPP_BUILTINS
220 +#define TARGET_OS_CPP_BUILTINS() \
221 + do \
222 + { \
223 + builtin_define_std ("AROS"); \
224 + builtin_define ("AMIGA"); \
225 + builtin_define ("_AMIGA"); \
226 + builtin_define ("__ELF__"); \
227 + builtin_assert ("system=posix"); \
228 + } \
229 + while (0)
231 +#undef ASM_APP_ON
232 +#define ASM_APP_ON "#APP\n"
234 +#undef ASM_APP_OFF
235 +#define ASM_APP_OFF "#NO_APP\n"
237 +#undef MD_EXEC_PREFIX
238 +#undef MD_STARTFILE_PREFIX
240 +/* Provide a STARTFILE_SPEC appropriate for AROS. AROS has its own
241 + set of startup files which also take care of handling C++
242 + constructors/destructors. */
244 +#undef STARTFILE_SPEC
245 +#define STARTFILE_SPEC \
246 + "%{detach:detach.o%s} startup.o%s %{nix:nixmain.o%s}"
248 +/* Provide a ENDFILE_SPEC appropriate for AROS. */
250 +#undef ENDFILE_SPEC
251 +#define ENDFILE_SPEC \
252 + "-lautoinit"
254 +#undef INCLUDE_DEFAULTS
255 +#define INCLUDE_DEFAULTS \
256 +{ \
257 + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
258 + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 1 }, \
259 + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
260 + { "/local/include", 0, 0, 1, 1, 0 }, \
261 + { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, \
262 + { 0, 0, 0, 0, 0, 0 } \
263 +}; \
265 +#undef CPP_SPEC
266 +#define CPP_SPEC "%{!nostdinc:%{!nostdc:%{!noposixc:-isystem %R/include/aros/posixc} -isystem %R/include/aros/stdc}}"
268 +/* This is for -profile to use -lc_p instead of -lc. */
269 +#ifndef CC1_SPEC
270 +#define CC1_SPEC "%{profile:-p}"
271 +#endif
273 +/* The GNU C++ standard library requires that these macros be defined. */
274 +#undef CPLUSPLUS_CPP_SPEC
275 +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
277 +#undef LIB_SPEC
278 +#define LIB_SPEC \
279 + "-lmui -larossupport -lamiga %{!nostdc:%{!noposixc:-lposixc} -lstdcio -lstdc} -lcodesets -lkeymap -lexpansion -lcommodities -ldiskfont -lasl -lmuimaster -ldatatypes -lcybergraphics -lworkbench -licon -lintuition -lgadtools -llayers -laros -lpartition -liffparse -lgraphics -llocale -ldos -lutility -loop %{!nosysbase:-lexec} -lautoinit -llibinit -lautoinit %{nostdc:-lstdc.static}"
281 +#if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
282 +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
283 +#endif
285 +/* AROS uses its own collect-like program for the moment. */
286 +#undef LINKER_NAME
287 +#define LINKER_NAME "collect-aros"
289 +#define TARGET_HAS_F_SETLKW
290 diff -urN gcc-4.8.1/gcc/config/i386/aros64.h gcc-4.8.1.new/gcc/config/i386/aros64.h
291 --- gcc-4.8.1/gcc/config/i386/aros64.h 1969-12-31 19:00:00.000000000 -0500
292 +++ gcc-4.8.1.new/gcc/config/i386/aros64.h 2013-12-02 20:22:15.908776146 -0500
293 @@ -0,0 +1,40 @@
294 +/* Definitions for AMD x86_64 running AROS systems with ELF64 format.
295 + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002
296 + Free Software Foundation, Inc.
297 + Contributed by Stanislaw Szymczyk <sszymczy@gmail.com>. Based on aros.h.
299 +This file is part of GNU CC.
301 +GNU CC is free software; you can redistribute it and/or modify
302 +it under the terms of the GNU General Public License as published by
303 +the Free Software Foundation; either version 2, or (at your option)
304 +any later version.
306 +GNU CC is distributed in the hope that it will be useful,
307 +but WITHOUT ANY WARRANTY; without even the implied warranty of
308 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
309 +GNU General Public License for more details.
311 +You should have received a copy of the GNU General Public License
312 +along with GNU CC; see the file COPYING. If not, write to
313 +the Free Software Foundation, 59 Temple Place - Suite 330,
314 +Boston, MA 02111-1307, USA. */
316 +/* Output at beginning of assembler file. */
317 +/* The .file command should always begin the output. */
319 +#undef TARGET_VERSION
320 +#define TARGET_VERSION fprintf (stderr, " (x86_64 AROS/ELF)");
322 +/* The svr4 ABI for the i386 says that records and unions are returned
323 + in memory. In the 64bit compilation we will turn this flag off in
324 + override_options, as we never do pcc_struct_return scheme on this target. */
325 +#undef DEFAULT_PCC_STRUCT_RETURN
326 +#define DEFAULT_PCC_STRUCT_RETURN 1
328 +/* Provide a LINK_SPEC appropriate for AROS. */
330 +#undef LINK_SPEC
331 +#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} -L %R/lib"
333 +/* FIXME: AROS doesn't support dw2 unwinding yet. */
334 diff -urN gcc-4.8.1/gcc/config/i386/aros.h gcc-4.8.1.new/gcc/config/i386/aros.h
335 --- gcc-4.8.1/gcc/config/i386/aros.h 1969-12-31 19:00:00.000000000 -0500
336 +++ gcc-4.8.1.new/gcc/config/i386/aros.h 2013-12-02 20:22:15.908776146 -0500
337 @@ -0,0 +1,25 @@
338 +/* Definitions for Intel 386 running AROS systems with ELF format.
339 + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002
340 + Free Software Foundation, Inc.
341 + Contributed by Fabio Alemagna.
342 + Based upon i386/linux.h by Eric Youngdale.
344 +This file is part of GNU CC.
346 +GNU CC is free software; you can redistribute it and/or modify
347 +it under the terms of the GNU General Public License as published by
348 +the Free Software Foundation; either version 2, or (at your option)
349 +any later version.
351 +GNU CC is distributed in the hope that it will be useful,
352 +but WITHOUT ANY WARRANTY; without even the implied warranty of
353 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
354 +GNU General Public License for more details.
356 +You should have received a copy of the GNU General Public License
357 +along with GNU CC; see the file COPYING. If not, write to
358 +the Free Software Foundation, 59 Temple Place - Suite 330,
359 +Boston, MA 02111-1307, USA. */
361 +#undef LINK_SPEC
362 +#define LINK_SPEC "-m elf_i386 -L%R/lib"
363 diff -urN gcc-4.8.1/gcc/config/m68k/m68k.c gcc-4.8.1.new/gcc/config/m68k/m68k.c
364 --- gcc-4.8.1/gcc/config/m68k/m68k.c 2011-07-31 11:09:25.000000000 -0400
365 +++ gcc-4.8.1.new/gcc/config/m68k/m68k.c 2013-12-02 20:22:15.908776146 -0500
366 @@ -4522,7 +4522,7 @@
367 else if (letter == '/')
368 asm_fprintf (file, "%R");
369 else if (letter == '?')
370 - asm_fprintf (file, m68k_library_id_string);
371 + asm_fprintf (file, "%s", m68k_library_id_string);
372 else if (letter == 'p')
374 output_addr_const (file, op);
375 diff -urN gcc-4.8.1/gcc/config/m68k/m68k.h gcc-4.8.1.new/gcc/config/m68k/m68k.h
376 --- gcc-4.8.1/gcc/config/m68k/m68k.h 2010-11-21 20:57:50.000000000 -0500
377 +++ gcc-4.8.1.new/gcc/config/m68k/m68k.h 2013-12-02 20:22:15.908776146 -0500
378 @@ -342,7 +342,9 @@
379 register elimination. */
380 #define FIRST_PSEUDO_REGISTER 25
382 -/* All m68k targets (except AmigaOS) use %a5 as the PIC register */
383 +/* All m68k targets (except AmigaOS) use %a5 as the PIC register.
384 + * On AmigaOS, we use %a4
385 + */
386 #define PIC_OFFSET_TABLE_REGNUM \
387 (!flag_pic ? INVALID_REGNUM \
388 : reload_completed ? REGNO (pic_offset_table_rtx) \
389 @@ -432,7 +434,8 @@
390 /* Most m68k targets use %a6 as a frame pointer. The AmigaOS
391 ABI uses %a6 for shared library calls, therefore the frame
392 pointer is shifted to %a5 on this target. */
393 -#define FRAME_POINTER_REGNUM A6_REG
394 +#define FRAME_POINTER_REGNUM A5_REG
395 +#define PIC_REG A4_REG
397 /* Base register for access to arguments of the function.
398 * This isn't a hardware register. It will be eliminated to the
399 diff -urN gcc-4.8.1/gcc/config/m68k/m68k.md gcc-4.8.1.new/gcc/config/m68k/m68k.md
400 --- gcc-4.8.1/gcc/config/m68k/m68k.md 2009-12-30 18:03:46.000000000 -0500
401 +++ gcc-4.8.1.new/gcc/config/m68k/m68k.md 2013-12-02 20:22:15.912776170 -0500
402 @@ -131,7 +131,8 @@
403 [(D0_REG 0)
404 (A0_REG 8)
405 (A1_REG 9)
406 - (PIC_REG 13)
407 + (A4_REG 12)
408 + (A5_REG 13)
409 (A6_REG 14)
410 (SP_REG 15)
411 (FP0_REG 16)
412 @@ -7295,7 +7296,7 @@
414 if (TARGET_ID_SHARED_LIBRARY)
416 - operands[1] = gen_rtx_REG (Pmode, PIC_REG);
417 + operands[1] = gen_rtx_REG (Pmode, A4_REG);
418 return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
420 else if (MOTOROLA)
421 diff -urN gcc-4.8.1/gcc/config/m68k/t-aros gcc-4.8.1.new/gcc/config/m68k/t-aros
422 --- gcc-4.8.1/gcc/config/m68k/t-aros 1969-12-31 19:00:00.000000000 -0500
423 +++ gcc-4.8.1.new/gcc/config/m68k/t-aros 2013-12-02 20:22:15.912776170 -0500
424 @@ -0,0 +1,2 @@
425 +# Custom multilibs for AROS
426 +M68K_MLIB_CPU += && match(MLIB, "^68")
427 diff -urN gcc-4.8.1/gcc/config/rs6000/aros.h gcc-4.8.1.new/gcc/config/rs6000/aros.h
428 --- gcc-4.8.1/gcc/config/rs6000/aros.h 1969-12-31 19:00:00.000000000 -0500
429 +++ gcc-4.8.1.new/gcc/config/rs6000/aros.h 2013-12-02 20:22:15.912776170 -0500
430 @@ -0,0 +1,161 @@
431 +/* Definitions for Powerpc running AROS systems with ELF format.
432 + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002
433 + Free Software Foundation, Inc.
434 + Contributed by Markus Weiss.
435 + Based upon i386/aros.h by Fabio Alemagna.
437 +This file is part of GNU CC.
439 +GNU CC is free software; you can redistribute it and/or modify
440 +it under the terms of the GNU General Public License as published by
441 +the Free Software Foundation; either version 2, or (at your option)
442 +any later version.
444 +GNU CC is distributed in the hope that it will be useful,
445 +but WITHOUT ANY WARRANTY; without even the implied warranty of
446 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
447 +GNU General Public License for more details.
449 +You should have received a copy of the GNU General Public License
450 +along with GNU CC; see the file COPYING. If not, write to
451 +the Free Software Foundation, 59 Temple Place - Suite 330,
452 +Boston, MA 02111-1307, USA. */
454 +/* Symbols missing in comparison to i386/aros.h are either
455 + defined in elfos.h, rs6000/rs6000.h rs6000/sysv4.h
456 + or not needed for PowerPC.
459 +/* We need to define __powerpc__. */
461 +#undef TARGET_OS_CPP_BUILTINS
462 +#define TARGET_OS_CPP_BUILTINS() \
463 + do \
464 + { \
465 + builtin_define_std ("AROS"); \
466 + builtin_define ("AMIGA"); \
467 + builtin_define ("_AMIGA"); \
468 + builtin_define ("__powerpc__"); \
469 + builtin_define ("__ELF__"); \
470 + builtin_assert ("system=posix"); \
471 + if (flag_pic) \
472 + { \
473 + builtin_define ("__PIC__"); \
474 + builtin_define ("__pic__"); \
475 + } \
476 + } \
477 + while (0)
479 +/* This one taken from linux.h. */
480 +/* We are 32-bit all the time, so optimize a little. */
481 +#undef TARGET_64BIT
482 +#define TARGET_64BIT 0
484 +/* Output at beginning of assembler file. */
485 +/* The .file command should always begin the output. */
486 +/*#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
487 +#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
488 +defined in elfos.h
491 +#undef TARGET_VERSION
492 +#define TARGET_VERSION fprintf (stderr, " (PowerPC AROS/ELF)");
494 +/* The svr4 ABI for the i386 says that records and unions are returned
495 + in memory. */
496 +/*#undef DEFAULT_PCC_STRUCT_RETURN
497 +#define DEFAULT_PCC_STRUCT_RETURN 1
498 +see rs6000/rs6000.h
502 +#undef ASM_COMMENT_START
503 +#define ASM_COMMENT_START "#"
504 +see rs6000/rs6000.h
508 +#undef DBX_REGISTER_NUMBER
509 +#define DBX_REGISTER_NUMBER(n) \
510 + (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
511 +see rs6000/sysv4.h
514 +/* Output assembler code to FILE to call the profiler.
515 + To the best of my knowledge, no Linux libc has required the label
516 + argument to mcount. */
519 +#define NO_PROFILE_COUNTERS 1
520 +not used by other similar ppc compilers
521 +only in darwin.h rs6000/linux64.h rs6000/rs6000.c
525 +#undef MCOUNT_NAME
526 +#define MCOUNT_NAME "mcount"
527 +see rs6000/sysv4.h RS6000_MCOUNT
530 +/* The GLIBC version of mcount for the x86 assumes that there is a
531 + frame, so we cannot allow profiling without a frame pointer. */
533 +#undef SUBTARGET_FRAME_POINTER_REQUIRED
534 +#define SUBTARGET_FRAME_POINTER_REQUIRED crtl->profile
535 +seems to be handled by rs6000/rs6000.h
538 +#undef CC1_SPEC
539 +#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
541 +/* Provide a LINK_SPEC appropriate for AROS. */
543 +#undef LINK_SPEC
544 +#define LINK_SPEC "-m elf32ppc -L %R/lib"
546 +/* A C statement (sans semicolon) to output to the stdio stream
547 + FILE the assembler definition of uninitialized global DECL named
548 + NAME whose size is SIZE bytes and alignment is ALIGN bytes.
549 + Try to use asm_output_aligned_bss to implement this macro. */
551 +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
552 + asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
553 +see rs6000/sysv4.h
556 +/* A C statement to output to the stdio stream FILE an assembler
557 + command to advance the location counter to a multiple of 1<<LOG
558 + bytes if it is within MAX_SKIP bytes.
560 + This is used to align code labels according to Intel recommendations. */
562 +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
563 +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
564 + do { \
565 + if ((LOG) != 0) { \
566 + if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
567 + else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
568 + } \
569 + } while (0)
570 +#endif
571 +see rs6000/sysv4.h
574 +/* Handle special EH pointer encodings. Absolute, pc-relative, and
575 + indirect are handled automatically. */
577 +#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
578 + do { \
579 + if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
580 + { \
581 + fputs (ASM_LONG, FILE); \
582 + assemble_name (FILE, XSTR (ADDR, 0)); \
583 + fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
584 + goto DONE; \
585 + } \
586 + } while (0)
587 +not used for PowerPC
590 +/* FIXME: AROS doesn't support dw2 unwinding yet. */
591 +#undef MD_FALLBACK_FRAME_STATE_FOR
592 diff -urN gcc-4.8.1/gcc/config/rs6000/rs6000.c gcc-4.8.1.new/gcc/config/rs6000/rs6000.c
593 --- gcc-4.8.1/gcc/config/rs6000/rs6000.c 2013-02-08 10:07:55.000000000 -0500
594 +++ gcc-4.8.1.new/gcc/config/rs6000/rs6000.c 2013-12-02 20:22:15.916776186 -0500
595 @@ -1110,10 +1111,12 @@
596 { "altivec", 1, 1, false, true, false, rs6000_handle_altivec_attribute,
597 false },
598 { "longcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute,
599 false },
600 { "shortcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute,
601 false },
602 + { "stackparm", 0, 0, false, true, true, rs6000_handle_longcall_attribute,
603 + false },
604 { "ms_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute,
605 false },
606 { "gcc_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute,
607 false },
608 #ifdef SUBTARGET_ATTRIBUTE_TABLE
609 @@ -7588,6 +7589,9 @@
610 && !lookup_attribute ("shortcall", TYPE_ATTRIBUTES (fntype))))
611 cum->call_cookie |= CALL_LONG;
613 + cum->stackparm = fntype && lookup_attribute("stackparm",
614 + TYPE_ATTRIBUTES(fntype));
616 if (TARGET_DEBUG_ARG)
618 fprintf (stderr, "\ninit_cumulative_args:");
619 @@ -8568,6 +8569,9 @@
620 return GEN_INT (cum->call_cookie & ~CALL_LIBCALL);
623 + if (cum->stackparm)
624 + return NULL_RTX;
626 if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
628 rtx rslt = rs6000_darwin64_record_arg (cum, type, named, /*retval= */false);
629 @@ -9460,6 +9467,9 @@
630 int first_reg_offset;
631 alias_set_type set;
633 + if (cum->stackparm)
634 + return;
636 /* Skip the last named argument. */
637 next_cum = *cum;
638 rs6000_function_arg_advance_1 (&next_cum, mode, type, true, 0);
639 diff -urN gcc-4.8.1/gcc/config/rs6000/rs6000.h gcc-4.8.1.new/gcc/config/rs6000/rs6000.h
640 --- gcc-4.8.1/gcc/config/rs6000/rs6000.h 2012-04-13 17:55:15.000000000 -0400
641 +++ gcc-4.8.1.new/gcc/config/rs6000/rs6000.h 2013-12-02 20:22:15.916776186 -0500
642 @@ -1564,6 +1564,7 @@
643 int nargs_prototype; /* # args left in the current prototype */
644 int prototype; /* Whether a prototype was defined */
645 int stdarg; /* Whether function is a stdarg function. */
646 + int stackparm; /* Whether function has all args on the stack */
647 int call_cookie; /* Do special things for this call */
648 int sysv_gregno; /* next available GP register */
649 int intoffset; /* running offset in struct (darwin64) */
650 diff -urN gcc-4.8.1/gcc/config/t-aros gcc-4.8.1.new/gcc/config/t-aros
651 --- gcc-4.8.1/gcc/config/t-aros 1969-12-31 19:00:00.000000000 -0500
652 +++ gcc-4.8.1.new/gcc/config/t-aros 2013-12-02 20:22:15.920776210 -0500
653 @@ -0,0 +1,29 @@
654 +# In AROS, "/usr" is a four-letter word.
655 +# Must match STANDARD_INCLUDE_DIR in aros.h !
656 +NATIVE_SYSTEM_HEADER_DIR = /include
658 +# Don't add AROS target include path when compiling host compiler
659 +CPPFLAGS =
661 +# Copy AROS specific include replacement files
662 +LIBGCC_DEPS += stmp-aros-hrds
664 +EXTRA_AROS_HEADERS = aros/types/size_t.h aros/types/ptrdiff_t.h \
665 + aros/types/wchar_t.h aros/types/wint_t.h aros/types/null.h
667 +stmp-int-hdrs : | include/aros/types
669 +include/aros/types : $(addprefix $(srcdir)/ginclude/,$(EXTRA_AROS_HEADERS))
670 + -if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi
671 + -if [ -d include/aros/types ] ; \
672 + then true; \
673 + else \
674 + mkdir include/aros; chmod a+rx include/aros; \
675 + mkdir include/aros/types; chmod a+rx include/aros/types; \
676 + fi
677 + for file in $(EXTRA_AROS_HEADERS); do \
678 + $(STAMP) include/$$file; \
679 + rm -fr include/$$file; \
680 + cp $(srcdir)/ginclude/$$file include/$$file; \
681 + chmod a+r include/$$file; \
682 + done
683 diff -urN gcc-4.8.1/gcc/config.build gcc-4.8.1.new/gcc/config.build
684 --- gcc-4.8.1/gcc/config.build 2010-04-12 14:36:30.000000000 -0400
685 +++ gcc-4.8.1.new/gcc/config.build 2013-12-02 20:22:15.920776210 -0500
686 @@ -124,6 +124,9 @@
687 # HP 9000 series 300
688 build_install_headers_dir=install-headers-cpio
690 + *-*-aros*)
691 + build_xm_file=xm-aros.h
692 + ;;
693 *-*-sysv*)
694 # All other System V variants.
695 build_install_headers_dir=install-headers-cpio
696 diff -urN gcc-4.8.1/gcc/config.gcc gcc-4.8.1.new/gcc/config.gcc
697 --- gcc-4.8.1/gcc/config.gcc 2013-03-06 12:40:07.000000000 -0500
698 +++ gcc-4.8.1.new/gcc/config.gcc 2013-12-02 20:22:15.920776210 -0500
699 @@ -656,6 +656,14 @@
701 esac
703 +*-*-aros*)
704 + gas=yes
705 + gnu_ld=yes
706 + thread_file=single
707 + use_collect2=no
708 + xm_defines='STDC_HEADERS=1'
709 + ;;
711 *-*-openbsd*)
712 tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
713 case ${enable_threads} in
714 @@ -793,6 +801,16 @@
715 tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
716 extra_parts="crtinit.o crtfini.o"
718 +arm*-*-aros*)
719 + tm_file="dbxelf.h elfos.h arm/elf.h arm/bpabi.h aros.h arm/aros.h arm/aout.h arm/arm.h"
720 + tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h"
721 + tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-arm-softfp arm/t-bpabi arm/t-aros t-aros"
722 + xm_file="xm-aros.h"
723 + # The BPABI long long divmod functions return a 128-bit value in
724 + # registers r0-r3. Correctly modeling that requires the use of
725 + # TImode.
726 + need_64bit_hwint=yes
727 + ;;
728 arm-wrs-vxworks)
729 tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h"
730 extra_options="${extra_options} arm/vxworks.opt"
731 @@ -1316,6 +1334,16 @@
732 esac
733 tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules"
735 +i[34567]86-*-aros*)
736 + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h aros.h i386/aros.h"
737 + xm_file=xm-aros.h
738 + tmake_file="${tmake_file} i386/t-i386elf t-aros"
739 + ;;
740 +x86_64-*-aros*)
741 + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h aros.h i386/aros64.h"
742 + tmake_file="${tmake_file} i386/t-i386elf t-aros"
743 + xm_file=xm-aros.h
744 + ;;
745 i[34567]86-pc-msdosdjgpp*)
746 xm_file=i386/xm-djgpp.h
747 tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h i386/djgpp-stdint.h"
748 @@ -1678,6 +1706,16 @@
749 thread_file='posix'
752 +m68k-*-aros*)
753 + default_m68k_cpu=68000
754 + default_cf_cpu=5206
755 + tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h newlib-stdint.h m68k/m68kemb.h m68k/m68020-elf.h"
756 + tm_file="${tm_file} aros.h"
757 + tm_defines="${tm_defines} MOTOROLA=1"
758 + tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf"
759 + tmake_file="$tmake_file m68k/t-aros m68k/t-mlibs t-aros"
760 + extra_parts="crtbegin.o crtend.o"
761 + ;;
762 m68k-*-elf* | fido-*-elf*)
763 case ${target} in
764 fido-*-elf*)
765 @@ -2147,6 +2185,13 @@
766 extra_options="${extra_options} rs6000/sysv4.opt"
767 tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-rtems t-rtems rs6000/t-ppccomm"
769 +powerpc-*-aros*)
770 + tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h aros.h"
771 + extra_options="${extra_options} rs6000/sysv4.opt"
772 + tm_file="${tm_file} rs6000/aros.h"
773 + xm_file=xm-aros.h
774 + tmake_file="$tmake_file t-aros"
775 + ;;
776 powerpc-*-linux* | powerpc64-*-linux*)
777 tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
778 extra_options="${extra_options} rs6000/sysv4.opt"
779 diff -urN gcc-4.8.1/gcc/config.host gcc-4.8.1.new/gcc/config.host
780 --- gcc-4.8.1/gcc/config.host 2011-02-15 04:49:14.000000000 -0500
781 +++ gcc-4.8.1.new/gcc/config.host 2013-12-02 20:22:15.920776210 -0500
782 @@ -277,4 +277,8 @@
783 out_host_hook_obj=host-hpux.o
784 host_xmake_file="${host_xmake_file} x-hpux"
786 + *-*-aros*)
787 + host_can_use_collect2=no
788 + host_xm_file=xm-aros.h
789 + ;;
790 esac
791 diff -urN gcc-4.8.1/gcc/doc/cppopts.texi.old gcc-4.8.1.new/gcc/doc/cppopts.texi.old
792 --- gcc-4.8.1/gcc/doc/cppopts.texi.old 1969-12-31 19:00:00.000000000 -0500
793 +++ gcc-4.8.1.new/gcc/doc/cppopts.texi.old 2013-03-20 07:08:52.000000000 -0400
794 @@ -0,0 +1,797 @@
795 +@c Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
796 +@c 2010, Free Software Foundation, Inc.
797 +@c This is part of the CPP and GCC manuals.
798 +@c For copying conditions, see the file gcc.texi.
800 +@c ---------------------------------------------------------------------
801 +@c Options affecting the preprocessor
802 +@c ---------------------------------------------------------------------
804 +@c If this file is included with the flag ``cppmanual'' set, it is
805 +@c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
807 +@table @gcctabopt
808 +@item -D @var{name}
809 +@opindex D
810 +Predefine @var{name} as a macro, with definition @code{1}.
812 +@item -D @var{name}=@var{definition}
813 +The contents of @var{definition} are tokenized and processed as if
814 +they appeared during translation phase three in a @samp{#define}
815 +directive. In particular, the definition will be truncated by
816 +embedded newline characters.
818 +If you are invoking the preprocessor from a shell or shell-like
819 +program you may need to use the shell's quoting syntax to protect
820 +characters such as spaces that have a meaning in the shell syntax.
822 +If you wish to define a function-like macro on the command line, write
823 +its argument list with surrounding parentheses before the equals sign
824 +(if any). Parentheses are meaningful to most shells, so you will need
825 +to quote the option. With @command{sh} and @command{csh},
826 +@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
828 +@option{-D} and @option{-U} options are processed in the order they
829 +are given on the command line. All @option{-imacros @var{file}} and
830 +@option{-include @var{file}} options are processed after all
831 +@option{-D} and @option{-U} options.
833 +@item -U @var{name}
834 +@opindex U
835 +Cancel any previous definition of @var{name}, either built in or
836 +provided with a @option{-D} option.
838 +@item -undef
839 +@opindex undef
840 +Do not predefine any system-specific or GCC-specific macros. The
841 +standard predefined macros remain defined.
842 +@ifset cppmanual
843 +@xref{Standard Predefined Macros}.
844 +@end ifset
846 +@item -I @var{dir}
847 +@opindex I
848 +Add the directory @var{dir} to the list of directories to be searched
849 +for header files.
850 +@ifset cppmanual
851 +@xref{Search Path}.
852 +@end ifset
853 +Directories named by @option{-I} are searched before the standard
854 +system include directories. If the directory @var{dir} is a standard
855 +system include directory, the option is ignored to ensure that the
856 +default search order for system directories and the special treatment
857 +of system headers are not defeated
858 +@ifset cppmanual
859 +(@pxref{System Headers})
860 +@end ifset
862 +If @var{dir} begins with @code{=}, then the @code{=} will be replaced
863 +by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
865 +@item -o @var{file}
866 +@opindex o
867 +Write output to @var{file}. This is the same as specifying @var{file}
868 +as the second non-option argument to @command{cpp}. @command{gcc} has a
869 +different interpretation of a second non-option argument, so you must
870 +use @option{-o} to specify the output file.
872 +@item -Wall
873 +@opindex Wall
874 +Turns on all optional warnings which are desirable for normal code.
875 +At present this is @option{-Wcomment}, @option{-Wtrigraphs},
876 +@option{-Wmultichar} and a warning about integer promotion causing a
877 +change of sign in @code{#if} expressions. Note that many of the
878 +preprocessor's warnings are on by default and have no options to
879 +control them.
881 +@item -Wcomment
882 +@itemx -Wcomments
883 +@opindex Wcomment
884 +@opindex Wcomments
885 +Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
886 +comment, or whenever a backslash-newline appears in a @samp{//} comment.
887 +(Both forms have the same effect.)
889 +@item -Wtrigraphs
890 +@opindex Wtrigraphs
891 +@anchor{Wtrigraphs}
892 +Most trigraphs in comments cannot affect the meaning of the program.
893 +However, a trigraph that would form an escaped newline (@samp{??/} at
894 +the end of a line) can, by changing where the comment begins or ends.
895 +Therefore, only trigraphs that would form escaped newlines produce
896 +warnings inside a comment.
898 +This option is implied by @option{-Wall}. If @option{-Wall} is not
899 +given, this option is still enabled unless trigraphs are enabled. To
900 +get trigraph conversion without warnings, but get the other
901 +@option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
903 +@item -Wtraditional
904 +@opindex Wtraditional
905 +Warn about certain constructs that behave differently in traditional and
906 +ISO C@. Also warn about ISO C constructs that have no traditional C
907 +equivalent, and problematic constructs which should be avoided.
908 +@ifset cppmanual
909 +@xref{Traditional Mode}.
910 +@end ifset
912 +@item -Wundef
913 +@opindex Wundef
914 +Warn whenever an identifier which is not a macro is encountered in an
915 +@samp{#if} directive, outside of @samp{defined}. Such identifiers are
916 +replaced with zero.
918 +@item -Wunused-macros
919 +@opindex Wunused-macros
920 +Warn about macros defined in the main file that are unused. A macro
921 +is @dfn{used} if it is expanded or tested for existence at least once.
922 +The preprocessor will also warn if the macro has not been used at the
923 +time it is redefined or undefined.
925 +Built-in macros, macros defined on the command line, and macros
926 +defined in include files are not warned about.
928 +@emph{Note:} If a macro is actually used, but only used in skipped
929 +conditional blocks, then CPP will report it as unused. To avoid the
930 +warning in such a case, you might improve the scope of the macro's
931 +definition by, for example, moving it into the first skipped block.
932 +Alternatively, you could provide a dummy use with something like:
934 +@smallexample
935 +#if defined the_macro_causing_the_warning
936 +#endif
937 +@end smallexample
939 +@item -Wendif-labels
940 +@opindex Wendif-labels
941 +Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
942 +This usually happens in code of the form
944 +@smallexample
945 +#if FOO
946 +@dots{}
947 +#else FOO
948 +@dots{}
949 +#endif FOO
950 +@end smallexample
952 +@noindent
953 +The second and third @code{FOO} should be in comments, but often are not
954 +in older programs. This warning is on by default.
956 +@item -Werror
957 +@opindex Werror
958 +Make all warnings into hard errors. Source code which triggers warnings
959 +will be rejected.
961 +@item -Wsystem-headers
962 +@opindex Wsystem-headers
963 +Issue warnings for code in system headers. These are normally unhelpful
964 +in finding bugs in your own code, therefore suppressed. If you are
965 +responsible for the system library, you may want to see them.
967 +@item -w
968 +@opindex w
969 +Suppress all warnings, including those which GNU CPP issues by default.
971 +@item -pedantic
972 +@opindex pedantic
973 +Issue all the mandatory diagnostics listed in the C standard. Some of
974 +them are left out by default, since they trigger frequently on harmless
975 +code.
977 +@item -pedantic-errors
978 +@opindex pedantic-errors
979 +Issue all the mandatory diagnostics, and make all mandatory diagnostics
980 +into errors. This includes mandatory diagnostics that GCC issues
981 +without @samp{-pedantic} but treats as warnings.
983 +@item -M
984 +@opindex M
985 +@cindex @command{make}
986 +@cindex dependencies, @command{make}
987 +Instead of outputting the result of preprocessing, output a rule
988 +suitable for @command{make} describing the dependencies of the main
989 +source file. The preprocessor outputs one @command{make} rule containing
990 +the object file name for that source file, a colon, and the names of all
991 +the included files, including those coming from @option{-include} or
992 +@option{-imacros} command line options.
994 +Unless specified explicitly (with @option{-MT} or @option{-MQ}), the
995 +object file name consists of the name of the source file with any
996 +suffix replaced with object file suffix and with any leading directory
997 +parts removed. If there are many included files then the rule is
998 +split into several lines using @samp{\}-newline. The rule has no
999 +commands.
1001 +This option does not suppress the preprocessor's debug output, such as
1002 +@option{-dM}. To avoid mixing such debug output with the dependency
1003 +rules you should explicitly specify the dependency output file with
1004 +@option{-MF}, or use an environment variable like
1005 +@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output
1006 +will still be sent to the regular output stream as normal.
1008 +Passing @option{-M} to the driver implies @option{-E}, and suppresses
1009 +warnings with an implicit @option{-w}.
1011 +@item -MM
1012 +@opindex MM
1013 +Like @option{-M} but do not mention header files that are found in
1014 +system header directories, nor header files that are included,
1015 +directly or indirectly, from such a header.
1017 +This implies that the choice of angle brackets or double quotes in an
1018 +@samp{#include} directive does not in itself determine whether that
1019 +header will appear in @option{-MM} dependency output. This is a
1020 +slight change in semantics from GCC versions 3.0 and earlier.
1022 +@anchor{dashMF}
1023 +@item -MF @var{file}
1024 +@opindex MF
1025 +When used with @option{-M} or @option{-MM}, specifies a
1026 +file to write the dependencies to. If no @option{-MF} switch is given
1027 +the preprocessor sends the rules to the same place it would have sent
1028 +preprocessed output.
1030 +When used with the driver options @option{-MD} or @option{-MMD},
1031 +@option{-MF} overrides the default dependency output file.
1033 +@item -MG
1034 +@opindex MG
1035 +In conjunction with an option such as @option{-M} requesting
1036 +dependency generation, @option{-MG} assumes missing header files are
1037 +generated files and adds them to the dependency list without raising
1038 +an error. The dependency filename is taken directly from the
1039 +@code{#include} directive without prepending any path. @option{-MG}
1040 +also suppresses preprocessed output, as a missing header file renders
1041 +this useless.
1043 +This feature is used in automatic updating of makefiles.
1045 +@item -MP
1046 +@opindex MP
1047 +This option instructs CPP to add a phony target for each dependency
1048 +other than the main file, causing each to depend on nothing. These
1049 +dummy rules work around errors @command{make} gives if you remove header
1050 +files without updating the @file{Makefile} to match.
1052 +This is typical output:
1054 +@smallexample
1055 +test.o: test.c test.h
1057 +test.h:
1058 +@end smallexample
1060 +@item -MT @var{target}
1061 +@opindex MT
1063 +Change the target of the rule emitted by dependency generation. By
1064 +default CPP takes the name of the main input file, deletes any
1065 +directory components and any file suffix such as @samp{.c}, and
1066 +appends the platform's usual object suffix. The result is the target.
1068 +An @option{-MT} option will set the target to be exactly the string you
1069 +specify. If you want multiple targets, you can specify them as a single
1070 +argument to @option{-MT}, or use multiple @option{-MT} options.
1072 +For example, @option{@w{-MT '$(objpfx)foo.o'}} might give
1074 +@smallexample
1075 +$(objpfx)foo.o: foo.c
1076 +@end smallexample
1078 +@item -MQ @var{target}
1079 +@opindex MQ
1081 +Same as @option{-MT}, but it quotes any characters which are special to
1082 +Make. @option{@w{-MQ '$(objpfx)foo.o'}} gives
1084 +@smallexample
1085 +$$(objpfx)foo.o: foo.c
1086 +@end smallexample
1088 +The default target is automatically quoted, as if it were given with
1089 +@option{-MQ}.
1091 +@item -MD
1092 +@opindex MD
1093 +@option{-MD} is equivalent to @option{-M -MF @var{file}}, except that
1094 +@option{-E} is not implied. The driver determines @var{file} based on
1095 +whether an @option{-o} option is given. If it is, the driver uses its
1096 +argument but with a suffix of @file{.d}, otherwise it takes the name
1097 +of the input file, removes any directory components and suffix, and
1098 +applies a @file{.d} suffix.
1100 +If @option{-MD} is used in conjunction with @option{-E}, any
1101 +@option{-o} switch is understood to specify the dependency output file
1102 +(@pxref{dashMF,,-MF}), but if used without @option{-E}, each @option{-o}
1103 +is understood to specify a target object file.
1105 +Since @option{-E} is not implied, @option{-MD} can be used to generate
1106 +a dependency output file as a side-effect of the compilation process.
1108 +@item -MMD
1109 +@opindex MMD
1110 +Like @option{-MD} except mention only user header files, not system
1111 +header files.
1113 +@ifclear cppmanual
1114 +@item -fpch-deps
1115 +@opindex fpch-deps
1116 +When using precompiled headers (@pxref{Precompiled Headers}), this flag
1117 +will cause the dependency-output flags to also list the files from the
1118 +precompiled header's dependencies. If not specified only the
1119 +precompiled header would be listed and not the files that were used to
1120 +create it because those files are not consulted when a precompiled
1121 +header is used.
1123 +@item -fpch-preprocess
1124 +@opindex fpch-preprocess
1125 +This option allows use of a precompiled header (@pxref{Precompiled
1126 +Headers}) together with @option{-E}. It inserts a special @code{#pragma},
1127 +@code{#pragma GCC pch_preprocess "@var{filename}"} in the output to mark
1128 +the place where the precompiled header was found, and its @var{filename}.
1129 +When @option{-fpreprocessed} is in use, GCC recognizes this @code{#pragma}
1130 +and loads the PCH@.
1132 +This option is off by default, because the resulting preprocessed output
1133 +is only really suitable as input to GCC@. It is switched on by
1134 +@option{-save-temps}.
1136 +You should not write this @code{#pragma} in your own code, but it is
1137 +safe to edit the filename if the PCH file is available in a different
1138 +location. The filename may be absolute or it may be relative to GCC's
1139 +current directory.
1141 +@end ifclear
1142 +@item -x c
1143 +@itemx -x c++
1144 +@itemx -x objective-c
1145 +@itemx -x assembler-with-cpp
1146 +@opindex x
1147 +Specify the source language: C, C++, Objective-C, or assembly. This has
1148 +nothing to do with standards conformance or extensions; it merely
1149 +selects which base syntax to expect. If you give none of these options,
1150 +cpp will deduce the language from the extension of the source file:
1151 +@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common
1152 +extensions for C++ and assembly are also recognized. If cpp does not
1153 +recognize the extension, it will treat the file as C; this is the most
1154 +generic mode.
1156 +@emph{Note:} Previous versions of cpp accepted a @option{-lang} option
1157 +which selected both the language and the standards conformance level.
1158 +This option has been removed, because it conflicts with the @option{-l}
1159 +option.
1161 +@item -std=@var{standard}
1162 +@itemx -ansi
1163 +@opindex ansi
1164 +@opindex std=
1165 +Specify the standard to which the code should conform. Currently CPP
1166 +knows about C and C++ standards; others may be added in the future.
1168 +@var{standard}
1169 +may be one of:
1170 +@table @code
1171 +@item c90
1172 +@itemx c89
1173 +@itemx iso9899:1990
1174 +The ISO C standard from 1990. @samp{c90} is the customary shorthand for
1175 +this version of the standard.
1177 +The @option{-ansi} option is equivalent to @option{-std=c90}.
1179 +@item iso9899:199409
1180 +The 1990 C standard, as amended in 1994.
1182 +@item iso9899:1999
1183 +@itemx c99
1184 +@itemx iso9899:199x
1185 +@itemx c9x
1186 +The revised ISO C standard, published in December 1999. Before
1187 +publication, this was known as C9X@.
1189 +@item c1x
1190 +The next version of the ISO C standard, still under development.
1192 +@item gnu90
1193 +@itemx gnu89
1194 +The 1990 C standard plus GNU extensions. This is the default.
1196 +@item gnu99
1197 +@itemx gnu9x
1198 +The 1999 C standard plus GNU extensions.
1200 +@item gnu1x
1201 +The next version of the ISO C standard, still under development, plus
1202 +GNU extensions.
1204 +@item c++98
1205 +The 1998 ISO C++ standard plus amendments.
1207 +@item gnu++98
1208 +The same as @option{-std=c++98} plus GNU extensions. This is the
1209 +default for C++ code.
1210 +@end table
1212 +@item -I-
1213 +@opindex I-
1214 +Split the include path. Any directories specified with @option{-I}
1215 +options before @option{-I-} are searched only for headers requested with
1216 +@code{@w{#include "@var{file}"}}; they are not searched for
1217 +@code{@w{#include <@var{file}>}}. If additional directories are
1218 +specified with @option{-I} options after the @option{-I-}, those
1219 +directories are searched for all @samp{#include} directives.
1221 +In addition, @option{-I-} inhibits the use of the directory of the current
1222 +file directory as the first search directory for @code{@w{#include
1223 +"@var{file}"}}.
1224 +@ifset cppmanual
1225 +@xref{Search Path}.
1226 +@end ifset
1227 +This option has been deprecated.
1229 +@item -nostdinc
1230 +@opindex nostdinc
1231 +Do not search the standard system directories for header files.
1232 +Only the directories you have specified with @option{-I} options
1233 +(and the directory of the current file, if appropriate) are searched.
1235 +@item -nostdinc++
1236 +@opindex nostdinc++
1237 +Do not search for header files in the C++-specific standard directories,
1238 +but do still search the other standard directories. (This option is
1239 +used when building the C++ library.)
1241 +@item -include @var{file}
1242 +@opindex include
1243 +Process @var{file} as if @code{#include "file"} appeared as the first
1244 +line of the primary source file. However, the first directory searched
1245 +for @var{file} is the preprocessor's working directory @emph{instead of}
1246 +the directory containing the main source file. If not found there, it
1247 +is searched for in the remainder of the @code{#include "@dots{}"} search
1248 +chain as normal.
1250 +If multiple @option{-include} options are given, the files are included
1251 +in the order they appear on the command line.
1253 +@item -imacros @var{file}
1254 +@opindex imacros
1255 +Exactly like @option{-include}, except that any output produced by
1256 +scanning @var{file} is thrown away. Macros it defines remain defined.
1257 +This allows you to acquire all the macros from a header without also
1258 +processing its declarations.
1260 +All files specified by @option{-imacros} are processed before all files
1261 +specified by @option{-include}.
1263 +@item -idirafter @var{dir}
1264 +@opindex idirafter
1265 +Search @var{dir} for header files, but do it @emph{after} all
1266 +directories specified with @option{-I} and the standard system directories
1267 +have been exhausted. @var{dir} is treated as a system include directory.
1268 +If @var{dir} begins with @code{=}, then the @code{=} will be replaced
1269 +by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
1271 +@item -iprefix @var{prefix}
1272 +@opindex iprefix
1273 +Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
1274 +options. If the prefix represents a directory, you should include the
1275 +final @samp{/}.
1277 +@item -iwithprefix @var{dir}
1278 +@itemx -iwithprefixbefore @var{dir}
1279 +@opindex iwithprefix
1280 +@opindex iwithprefixbefore
1281 +Append @var{dir} to the prefix specified previously with
1282 +@option{-iprefix}, and add the resulting directory to the include search
1283 +path. @option{-iwithprefixbefore} puts it in the same place @option{-I}
1284 +would; @option{-iwithprefix} puts it where @option{-idirafter} would.
1286 +@item -isysroot @var{dir}
1287 +@opindex isysroot
1288 +This option is like the @option{--sysroot} option, but applies only to
1289 +header files (except for Darwin targets, where it applies to both header
1290 +files and libraries). See the @option{--sysroot} option for more
1291 +information.
1293 +@item -imultilib @var{dir}
1294 +@opindex imultilib
1295 +Use @var{dir} as a subdirectory of the directory containing
1296 +target-specific C++ headers.
1298 +@item -isystem @var{dir}
1299 +@opindex isystem
1300 +Search @var{dir} for header files, after all directories specified by
1301 +@option{-I} but before the standard system directories. Mark it
1302 +as a system directory, so that it gets the same special treatment as
1303 +is applied to the standard system directories.
1304 +@ifset cppmanual
1305 +@xref{System Headers}.
1306 +@end ifset
1307 +If @var{dir} begins with @code{=}, then the @code{=} will be replaced
1308 +by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
1310 +@item -iquote @var{dir}
1311 +@opindex iquote
1312 +Search @var{dir} only for header files requested with
1313 +@code{@w{#include "@var{file}"}}; they are not searched for
1314 +@code{@w{#include <@var{file}>}}, before all directories specified by
1315 +@option{-I} and before the standard system directories.
1316 +@ifset cppmanual
1317 +@xref{Search Path}.
1318 +@end ifset
1319 +If @var{dir} begins with @code{=}, then the @code{=} will be replaced
1320 +by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
1322 +@item -fdirectives-only
1323 +@opindex fdirectives-only
1324 +When preprocessing, handle directives, but do not expand macros.
1326 +The option's behavior depends on the @option{-E} and @option{-fpreprocessed}
1327 +options.
1329 +With @option{-E}, preprocessing is limited to the handling of directives
1330 +such as @code{#define}, @code{#ifdef}, and @code{#error}. Other
1331 +preprocessor operations, such as macro expansion and trigraph
1332 +conversion are not performed. In addition, the @option{-dD} option is
1333 +implicitly enabled.
1335 +With @option{-fpreprocessed}, predefinition of command line and most
1336 +builtin macros is disabled. Macros such as @code{__LINE__}, which are
1337 +contextually dependent, are handled normally. This enables compilation of
1338 +files previously preprocessed with @code{-E -fdirectives-only}.
1340 +With both @option{-E} and @option{-fpreprocessed}, the rules for
1341 +@option{-fpreprocessed} take precedence. This enables full preprocessing of
1342 +files previously preprocessed with @code{-E -fdirectives-only}.
1344 +@item -fdollars-in-identifiers
1345 +@opindex fdollars-in-identifiers
1346 +@anchor{fdollars-in-identifiers}
1347 +Accept @samp{$} in identifiers.
1348 +@ifset cppmanual
1349 +@xref{Identifier characters}.
1350 +@end ifset
1352 +@item -fextended-identifiers
1353 +@opindex fextended-identifiers
1354 +Accept universal character names in identifiers. This option is
1355 +experimental; in a future version of GCC, it will be enabled by
1356 +default for C99 and C++.
1358 +@item -fpreprocessed
1359 +@opindex fpreprocessed
1360 +Indicate to the preprocessor that the input file has already been
1361 +preprocessed. This suppresses things like macro expansion, trigraph
1362 +conversion, escaped newline splicing, and processing of most directives.
1363 +The preprocessor still recognizes and removes comments, so that you can
1364 +pass a file preprocessed with @option{-C} to the compiler without
1365 +problems. In this mode the integrated preprocessor is little more than
1366 +a tokenizer for the front ends.
1368 +@option{-fpreprocessed} is implicit if the input file has one of the
1369 +extensions @samp{.i}, @samp{.ii} or @samp{.mi}. These are the
1370 +extensions that GCC uses for preprocessed files created by
1371 +@option{-save-temps}.
1373 +@item -ftabstop=@var{width}
1374 +@opindex ftabstop
1375 +Set the distance between tab stops. This helps the preprocessor report
1376 +correct column numbers in warnings or errors, even if tabs appear on the
1377 +line. If the value is less than 1 or greater than 100, the option is
1378 +ignored. The default is 8.
1380 +@item -fexec-charset=@var{charset}
1381 +@opindex fexec-charset
1382 +@cindex character set, execution
1383 +Set the execution character set, used for string and character
1384 +constants. The default is UTF-8. @var{charset} can be any encoding
1385 +supported by the system's @code{iconv} library routine.
1387 +@item -fwide-exec-charset=@var{charset}
1388 +@opindex fwide-exec-charset
1389 +@cindex character set, wide execution
1390 +Set the wide execution character set, used for wide string and
1391 +character constants. The default is UTF-32 or UTF-16, whichever
1392 +corresponds to the width of @code{wchar_t}. As with
1393 +@option{-fexec-charset}, @var{charset} can be any encoding supported
1394 +by the system's @code{iconv} library routine; however, you will have
1395 +problems with encodings that do not fit exactly in @code{wchar_t}.
1397 +@item -finput-charset=@var{charset}
1398 +@opindex finput-charset
1399 +@cindex character set, input
1400 +Set the input character set, used for translation from the character
1401 +set of the input file to the source character set used by GCC@. If the
1402 +locale does not specify, or GCC cannot get this information from the
1403 +locale, the default is UTF-8. This can be overridden by either the locale
1404 +or this command line option. Currently the command line option takes
1405 +precedence if there's a conflict. @var{charset} can be any encoding
1406 +supported by the system's @code{iconv} library routine.
1408 +@item -fworking-directory
1409 +@opindex fworking-directory
1410 +@opindex fno-working-directory
1411 +Enable generation of linemarkers in the preprocessor output that will
1412 +let the compiler know the current working directory at the time of
1413 +preprocessing. When this option is enabled, the preprocessor will
1414 +emit, after the initial linemarker, a second linemarker with the
1415 +current working directory followed by two slashes. GCC will use this
1416 +directory, when it's present in the preprocessed input, as the
1417 +directory emitted as the current working directory in some debugging
1418 +information formats. This option is implicitly enabled if debugging
1419 +information is enabled, but this can be inhibited with the negated
1420 +form @option{-fno-working-directory}. If the @option{-P} flag is
1421 +present in the command line, this option has no effect, since no
1422 +@code{#line} directives are emitted whatsoever.
1424 +@item -fno-show-column
1425 +@opindex fno-show-column
1426 +Do not print column numbers in diagnostics. This may be necessary if
1427 +diagnostics are being scanned by a program that does not understand the
1428 +column numbers, such as @command{dejagnu}.
1430 +@item -A @var{predicate}=@var{answer}
1431 +@opindex A
1432 +Make an assertion with the predicate @var{predicate} and answer
1433 +@var{answer}. This form is preferred to the older form @option{-A
1434 +@var{predicate}(@var{answer})}, which is still supported, because
1435 +it does not use shell special characters.
1436 +@ifset cppmanual
1437 +@xref{Obsolete Features}.
1438 +@end ifset
1440 +@item -A -@var{predicate}=@var{answer}
1441 +Cancel an assertion with the predicate @var{predicate} and answer
1442 +@var{answer}.
1444 +@item -dCHARS
1445 +@var{CHARS} is a sequence of one or more of the following characters,
1446 +and must not be preceded by a space. Other characters are interpreted
1447 +by the compiler proper, or reserved for future versions of GCC, and so
1448 +are silently ignored. If you specify characters whose behavior
1449 +conflicts, the result is undefined.
1451 +@table @samp
1452 +@item M
1453 +@opindex dM
1454 +Instead of the normal output, generate a list of @samp{#define}
1455 +directives for all the macros defined during the execution of the
1456 +preprocessor, including predefined macros. This gives you a way of
1457 +finding out what is predefined in your version of the preprocessor.
1458 +Assuming you have no file @file{foo.h}, the command
1460 +@smallexample
1461 +touch foo.h; cpp -dM foo.h
1462 +@end smallexample
1464 +@noindent
1465 +will show all the predefined macros.
1467 +If you use @option{-dM} without the @option{-E} option, @option{-dM} is
1468 +interpreted as a synonym for @option{-fdump-rtl-mach}.
1469 +@xref{Debugging Options, , ,gcc}.
1471 +@item D
1472 +@opindex dD
1473 +Like @samp{M} except in two respects: it does @emph{not} include the
1474 +predefined macros, and it outputs @emph{both} the @samp{#define}
1475 +directives and the result of preprocessing. Both kinds of output go to
1476 +the standard output file.
1478 +@item N
1479 +@opindex dN
1480 +Like @samp{D}, but emit only the macro names, not their expansions.
1482 +@item I
1483 +@opindex dI
1484 +Output @samp{#include} directives in addition to the result of
1485 +preprocessing.
1487 +@item U
1488 +@opindex dU
1489 +Like @samp{D} except that only macros that are expanded, or whose
1490 +definedness is tested in preprocessor directives, are output; the
1491 +output is delayed until the use or test of the macro; and
1492 +@samp{#undef} directives are also output for macros tested but
1493 +undefined at the time.
1494 +@end table
1496 +@item -P
1497 +@opindex P
1498 +Inhibit generation of linemarkers in the output from the preprocessor.
1499 +This might be useful when running the preprocessor on something that is
1500 +not C code, and will be sent to a program which might be confused by the
1501 +linemarkers.
1502 +@ifset cppmanual
1503 +@xref{Preprocessor Output}.
1504 +@end ifset
1506 +@item -C
1507 +@opindex C
1508 +Do not discard comments. All comments are passed through to the output
1509 +file, except for comments in processed directives, which are deleted
1510 +along with the directive.
1512 +You should be prepared for side effects when using @option{-C}; it
1513 +causes the preprocessor to treat comments as tokens in their own right.
1514 +For example, comments appearing at the start of what would be a
1515 +directive line have the effect of turning that line into an ordinary
1516 +source line, since the first token on the line is no longer a @samp{#}.
1518 +@item -CC
1519 +Do not discard comments, including during macro expansion. This is
1520 +like @option{-C}, except that comments contained within macros are
1521 +also passed through to the output file where the macro is expanded.
1523 +In addition to the side-effects of the @option{-C} option, the
1524 +@option{-CC} option causes all C++-style comments inside a macro
1525 +to be converted to C-style comments. This is to prevent later use
1526 +of that macro from inadvertently commenting out the remainder of
1527 +the source line.
1529 +The @option{-CC} option is generally used to support lint comments.
1531 +@item -traditional-cpp
1532 +@opindex traditional-cpp
1533 +Try to imitate the behavior of old-fashioned C preprocessors, as
1534 +opposed to ISO C preprocessors.
1535 +@ifset cppmanual
1536 +@xref{Traditional Mode}.
1537 +@end ifset
1539 +@item -trigraphs
1540 +@opindex trigraphs
1541 +Process trigraph sequences.
1542 +@ifset cppmanual
1543 +@xref{Initial processing}.
1544 +@end ifset
1545 +@ifclear cppmanual
1546 +These are three-character sequences, all starting with @samp{??}, that
1547 +are defined by ISO C to stand for single characters. For example,
1548 +@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character
1549 +constant for a newline. By default, GCC ignores trigraphs, but in
1550 +standard-conforming modes it converts them. See the @option{-std} and
1551 +@option{-ansi} options.
1553 +The nine trigraphs and their replacements are
1555 +@smallexample
1556 +Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
1557 +Replacement: [ ] @{ @} # \ ^ | ~
1558 +@end smallexample
1559 +@end ifclear
1561 +@item -remap
1562 +@opindex remap
1563 +Enable special code to work around file systems which only permit very
1564 +short file names, such as MS-DOS@.
1566 +@item --help
1567 +@itemx --target-help
1568 +@opindex help
1569 +@opindex target-help
1570 +Print text describing all the command line options instead of
1571 +preprocessing anything.
1573 +@item -v
1574 +@opindex v
1575 +Verbose mode. Print out GNU CPP's version number at the beginning of
1576 +execution, and report the final form of the include path.
1578 +@item -H
1579 +@opindex H
1580 +Print the name of each header file used, in addition to other normal
1581 +activities. Each name is indented to show how deep in the
1582 +@samp{#include} stack it is. Precompiled header files are also
1583 +printed, even if they are found to be invalid; an invalid precompiled
1584 +header file is printed with @samp{...x} and a valid one with @samp{...!} .
1586 +@item -version
1587 +@itemx --version
1588 +@opindex version
1589 +Print out GNU CPP's version number. With one dash, proceed to
1590 +preprocess as normal. With two dashes, exit immediately.
1591 +@end table
1592 diff -urN gcc-4.8.1/gcc/doc/cppopts.texi.rej.old gcc-4.8.1.new/gcc/doc/cppopts.texi.rej.old
1593 --- gcc-4.8.1/gcc/doc/cppopts.texi.rej.old 1969-12-31 19:00:00.000000000 -0500
1594 +++ gcc-4.8.1.new/gcc/doc/cppopts.texi.rej.old 2013-12-02 20:22:15.920776210 -0500
1595 @@ -0,0 +1,11 @@
1596 +--- gcc/doc/cppopts.texi 2010-12-20 08:26:12.000000000 +0100
1597 ++++ gcc/doc/cppopts.texi 2013-08-26 07:55:42.000000000 +0200
1598 +@@ -769,7 +769,7 @@
1599 + Enable special code to work around file systems which only permit very
1600 + short file names, such as MS-DOS@.
1602 +-@itemx --help
1603 ++@item --help
1604 + @itemx --target-help
1605 + @opindex help
1606 + @opindex target-help
1607 diff -urN gcc-4.8.1/gcc/doc/generic.texi.old gcc-4.8.1.new/gcc/doc/generic.texi.old
1608 --- gcc-4.8.1/gcc/doc/generic.texi.old 1969-12-31 19:00:00.000000000 -0500
1609 +++ gcc-4.8.1.new/gcc/doc/generic.texi.old 2013-03-20 07:08:52.000000000 -0400
1610 @@ -0,0 +1,3345 @@
1611 +@c Copyright (c) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
1612 +@c Free Software Foundation, Inc.
1613 +@c This is part of the GCC manual.
1614 +@c For copying conditions, see the file gcc.texi.
1616 +@c ---------------------------------------------------------------------
1617 +@c GENERIC
1618 +@c ---------------------------------------------------------------------
1620 +@node GENERIC
1621 +@chapter GENERIC
1622 +@cindex GENERIC
1624 +The purpose of GENERIC is simply to provide a
1625 +language-independent way of representing an entire function in
1626 +trees. To this end, it was necessary to add a few new tree codes
1627 +to the back end, but most everything was already there. If you
1628 +can express it with the codes in @code{gcc/tree.def}, it's
1629 +GENERIC@.
1631 +Early on, there was a great deal of debate about how to think
1632 +about statements in a tree IL@. In GENERIC, a statement is
1633 +defined as any expression whose value, if any, is ignored. A
1634 +statement will always have @code{TREE_SIDE_EFFECTS} set (or it
1635 +will be discarded), but a non-statement expression may also have
1636 +side effects. A @code{CALL_EXPR}, for instance.
1638 +It would be possible for some local optimizations to work on the
1639 +GENERIC form of a function; indeed, the adapted tree inliner
1640 +works fine on GENERIC, but the current compiler performs inlining
1641 +after lowering to GIMPLE (a restricted form described in the next
1642 +section). Indeed, currently the frontends perform this lowering
1643 +before handing off to @code{tree_rest_of_compilation}, but this
1644 +seems inelegant.
1646 +@menu
1647 +* Deficiencies:: Topics net yet covered in this document.
1648 +* Tree overview:: All about @code{tree}s.
1649 +* Types:: Fundamental and aggregate types.
1650 +* Declarations:: Type declarations and variables.
1651 +* Attributes:: Declaration and type attributes.
1652 +* Expressions: Expression trees. Operating on data.
1653 +* Statements:: Control flow and related trees.
1654 +* Functions:: Function bodies, linkage, and other aspects.
1655 +* Language-dependent trees:: Topics and trees specific to language front ends.
1656 +* C and C++ Trees:: Trees specific to C and C++.
1657 +* Java Trees:: Trees specific to Java.
1658 +@end menu
1660 +@c ---------------------------------------------------------------------
1661 +@c Deficiencies
1662 +@c ---------------------------------------------------------------------
1664 +@node Deficiencies
1665 +@section Deficiencies
1667 +There are many places in which this document is incomplet and incorrekt.
1668 +It is, as of yet, only @emph{preliminary} documentation.
1670 +@c ---------------------------------------------------------------------
1671 +@c Overview
1672 +@c ---------------------------------------------------------------------
1674 +@node Tree overview
1675 +@section Overview
1676 +@cindex tree
1677 +@findex TREE_CODE
1679 +The central data structure used by the internal representation is the
1680 +@code{tree}. These nodes, while all of the C type @code{tree}, are of
1681 +many varieties. A @code{tree} is a pointer type, but the object to
1682 +which it points may be of a variety of types. From this point forward,
1683 +we will refer to trees in ordinary type, rather than in @code{this
1684 +font}, except when talking about the actual C type @code{tree}.
1686 +You can tell what kind of node a particular tree is by using the
1687 +@code{TREE_CODE} macro. Many, many macros take trees as input and
1688 +return trees as output. However, most macros require a certain kind of
1689 +tree node as input. In other words, there is a type-system for trees,
1690 +but it is not reflected in the C type-system.
1692 +For safety, it is useful to configure GCC with @option{--enable-checking}.
1693 +Although this results in a significant performance penalty (since all
1694 +tree types are checked at run-time), and is therefore inappropriate in a
1695 +release version, it is extremely helpful during the development process.
1697 +Many macros behave as predicates. Many, although not all, of these
1698 +predicates end in @samp{_P}. Do not rely on the result type of these
1699 +macros being of any particular type. You may, however, rely on the fact
1700 +that the type can be compared to @code{0}, so that statements like
1701 +@smallexample
1702 +if (TEST_P (t) && !TEST_P (y))
1703 + x = 1;
1704 +@end smallexample
1705 +@noindent
1706 +and
1707 +@smallexample
1708 +int i = (TEST_P (t) != 0);
1709 +@end smallexample
1710 +@noindent
1711 +are legal. Macros that return @code{int} values now may be changed to
1712 +return @code{tree} values, or other pointers in the future. Even those
1713 +that continue to return @code{int} may return multiple nonzero codes
1714 +where previously they returned only zero and one. Therefore, you should
1715 +not write code like
1716 +@smallexample
1717 +if (TEST_P (t) == 1)
1718 +@end smallexample
1719 +@noindent
1720 +as this code is not guaranteed to work correctly in the future.
1722 +You should not take the address of values returned by the macros or
1723 +functions described here. In particular, no guarantee is given that the
1724 +values are lvalues.
1726 +In general, the names of macros are all in uppercase, while the names of
1727 +functions are entirely in lowercase. There are rare exceptions to this
1728 +rule. You should assume that any macro or function whose name is made
1729 +up entirely of uppercase letters may evaluate its arguments more than
1730 +once. You may assume that a macro or function whose name is made up
1731 +entirely of lowercase letters will evaluate its arguments only once.
1733 +The @code{error_mark_node} is a special tree. Its tree code is
1734 +@code{ERROR_MARK}, but since there is only ever one node with that code,
1735 +the usual practice is to compare the tree against
1736 +@code{error_mark_node}. (This test is just a test for pointer
1737 +equality.) If an error has occurred during front-end processing the
1738 +flag @code{errorcount} will be set. If the front end has encountered
1739 +code it cannot handle, it will issue a message to the user and set
1740 +@code{sorrycount}. When these flags are set, any macro or function
1741 +which normally returns a tree of a particular kind may instead return
1742 +the @code{error_mark_node}. Thus, if you intend to do any processing of
1743 +erroneous code, you must be prepared to deal with the
1744 +@code{error_mark_node}.
1746 +Occasionally, a particular tree slot (like an operand to an expression,
1747 +or a particular field in a declaration) will be referred to as
1748 +``reserved for the back end''. These slots are used to store RTL when
1749 +the tree is converted to RTL for use by the GCC back end. However, if
1750 +that process is not taking place (e.g., if the front end is being hooked
1751 +up to an intelligent editor), then those slots may be used by the
1752 +back end presently in use.
1754 +If you encounter situations that do not match this documentation, such
1755 +as tree nodes of types not mentioned here, or macros documented to
1756 +return entities of a particular kind that instead return entities of
1757 +some different kind, you have found a bug, either in the front end or in
1758 +the documentation. Please report these bugs as you would any other
1759 +bug.
1761 +@menu
1762 +* Macros and Functions::Macros and functions that can be used with all trees.
1763 +* Identifiers:: The names of things.
1764 +* Containers:: Lists and vectors.
1765 +@end menu
1767 +@c ---------------------------------------------------------------------
1768 +@c Trees
1769 +@c ---------------------------------------------------------------------
1771 +@node Macros and Functions
1772 +@subsection Trees
1773 +@cindex tree
1774 +@findex TREE_CHAIN
1775 +@findex TREE_TYPE
1777 +All GENERIC trees have two fields in common. First, @code{TREE_CHAIN}
1778 +is a pointer that can be used as a singly-linked list to other trees.
1779 +The other is @code{TREE_TYPE}. Many trees store the type of an
1780 +expression or declaration in this field.
1782 +These are some other functions for handling trees:
1784 +@ftable @code
1786 +@item tree_size
1787 +Return the number of bytes a tree takes.
1789 +@item build0
1790 +@itemx build1
1791 +@itemx build2
1792 +@itemx build3
1793 +@itemx build4
1794 +@itemx build5
1795 +@itemx build6
1797 +These functions build a tree and supply values to put in each
1798 +parameter. The basic signature is @samp{@w{code, type, [operands]}}.
1799 +@code{code} is the @code{TREE_CODE}, and @code{type} is a tree
1800 +representing the @code{TREE_TYPE}. These are followed by the
1801 +operands, each of which is also a tree.
1803 +@end ftable
1806 +@c ---------------------------------------------------------------------
1807 +@c Identifiers
1808 +@c ---------------------------------------------------------------------
1810 +@node Identifiers
1811 +@subsection Identifiers
1812 +@cindex identifier
1813 +@cindex name
1814 +@tindex IDENTIFIER_NODE
1816 +An @code{IDENTIFIER_NODE} represents a slightly more general concept
1817 +that the standard C or C++ concept of identifier. In particular, an
1818 +@code{IDENTIFIER_NODE} may contain a @samp{$}, or other extraordinary
1819 +characters.
1821 +There are never two distinct @code{IDENTIFIER_NODE}s representing the
1822 +same identifier. Therefore, you may use pointer equality to compare
1823 +@code{IDENTIFIER_NODE}s, rather than using a routine like
1824 +@code{strcmp}. Use @code{get_identifier} to obtain the unique
1825 +@code{IDENTIFIER_NODE} for a supplied string.
1827 +You can use the following macros to access identifiers:
1828 +@ftable @code
1829 +@item IDENTIFIER_POINTER
1830 +The string represented by the identifier, represented as a
1831 +@code{char*}. This string is always @code{NUL}-terminated, and contains
1832 +no embedded @code{NUL} characters.
1834 +@item IDENTIFIER_LENGTH
1835 +The length of the string returned by @code{IDENTIFIER_POINTER}, not
1836 +including the trailing @code{NUL}. This value of
1837 +@code{IDENTIFIER_LENGTH (x)} is always the same as @code{strlen
1838 +(IDENTIFIER_POINTER (x))}.
1840 +@item IDENTIFIER_OPNAME_P
1841 +This predicate holds if the identifier represents the name of an
1842 +overloaded operator. In this case, you should not depend on the
1843 +contents of either the @code{IDENTIFIER_POINTER} or the
1844 +@code{IDENTIFIER_LENGTH}.
1846 +@item IDENTIFIER_TYPENAME_P
1847 +This predicate holds if the identifier represents the name of a
1848 +user-defined conversion operator. In this case, the @code{TREE_TYPE} of
1849 +the @code{IDENTIFIER_NODE} holds the type to which the conversion
1850 +operator converts.
1852 +@end ftable
1854 +@c ---------------------------------------------------------------------
1855 +@c Containers
1856 +@c ---------------------------------------------------------------------
1858 +@node Containers
1859 +@subsection Containers
1860 +@cindex container
1861 +@cindex list
1862 +@cindex vector
1863 +@tindex TREE_LIST
1864 +@tindex TREE_VEC
1865 +@findex TREE_PURPOSE
1866 +@findex TREE_VALUE
1867 +@findex TREE_VEC_LENGTH
1868 +@findex TREE_VEC_ELT
1870 +Two common container data structures can be represented directly with
1871 +tree nodes. A @code{TREE_LIST} is a singly linked list containing two
1872 +trees per node. These are the @code{TREE_PURPOSE} and @code{TREE_VALUE}
1873 +of each node. (Often, the @code{TREE_PURPOSE} contains some kind of
1874 +tag, or additional information, while the @code{TREE_VALUE} contains the
1875 +majority of the payload. In other cases, the @code{TREE_PURPOSE} is
1876 +simply @code{NULL_TREE}, while in still others both the
1877 +@code{TREE_PURPOSE} and @code{TREE_VALUE} are of equal stature.) Given
1878 +one @code{TREE_LIST} node, the next node is found by following the
1879 +@code{TREE_CHAIN}. If the @code{TREE_CHAIN} is @code{NULL_TREE}, then
1880 +you have reached the end of the list.
1882 +A @code{TREE_VEC} is a simple vector. The @code{TREE_VEC_LENGTH} is an
1883 +integer (not a tree) giving the number of nodes in the vector. The
1884 +nodes themselves are accessed using the @code{TREE_VEC_ELT} macro, which
1885 +takes two arguments. The first is the @code{TREE_VEC} in question; the
1886 +second is an integer indicating which element in the vector is desired.
1887 +The elements are indexed from zero.
1889 +@c ---------------------------------------------------------------------
1890 +@c Types
1891 +@c ---------------------------------------------------------------------
1893 +@node Types
1894 +@section Types
1895 +@cindex type
1896 +@cindex pointer
1897 +@cindex reference
1898 +@cindex fundamental type
1899 +@cindex array
1900 +@tindex VOID_TYPE
1901 +@tindex INTEGER_TYPE
1902 +@tindex TYPE_MIN_VALUE
1903 +@tindex TYPE_MAX_VALUE
1904 +@tindex REAL_TYPE
1905 +@tindex FIXED_POINT_TYPE
1906 +@tindex COMPLEX_TYPE
1907 +@tindex ENUMERAL_TYPE
1908 +@tindex BOOLEAN_TYPE
1909 +@tindex POINTER_TYPE
1910 +@tindex REFERENCE_TYPE
1911 +@tindex FUNCTION_TYPE
1912 +@tindex METHOD_TYPE
1913 +@tindex ARRAY_TYPE
1914 +@tindex RECORD_TYPE
1915 +@tindex UNION_TYPE
1916 +@tindex UNKNOWN_TYPE
1917 +@tindex OFFSET_TYPE
1918 +@findex TYPE_UNQUALIFIED
1919 +@findex TYPE_QUAL_CONST
1920 +@findex TYPE_QUAL_VOLATILE
1921 +@findex TYPE_QUAL_RESTRICT
1922 +@findex TYPE_MAIN_VARIANT
1923 +@cindex qualified type
1924 +@findex TYPE_SIZE
1925 +@findex TYPE_ALIGN
1926 +@findex TYPE_PRECISION
1927 +@findex TYPE_ARG_TYPES
1928 +@findex TYPE_METHOD_BASETYPE
1929 +@findex TYPE_OFFSET_BASETYPE
1930 +@findex TREE_TYPE
1931 +@findex TYPE_CONTEXT
1932 +@findex TYPE_NAME
1933 +@findex TYPENAME_TYPE_FULLNAME
1934 +@findex TYPE_FIELDS
1935 +@findex TYPE_CANONICAL
1936 +@findex TYPE_STRUCTURAL_EQUALITY_P
1937 +@findex SET_TYPE_STRUCTURAL_EQUALITY
1939 +All types have corresponding tree nodes. However, you should not assume
1940 +that there is exactly one tree node corresponding to each type. There
1941 +are often multiple nodes corresponding to the same type.
1943 +For the most part, different kinds of types have different tree codes.
1944 +(For example, pointer types use a @code{POINTER_TYPE} code while arrays
1945 +use an @code{ARRAY_TYPE} code.) However, pointers to member functions
1946 +use the @code{RECORD_TYPE} code. Therefore, when writing a
1947 +@code{switch} statement that depends on the code associated with a
1948 +particular type, you should take care to handle pointers to member
1949 +functions under the @code{RECORD_TYPE} case label.
1951 +The following functions and macros deal with cv-qualification of types:
1952 +@ftable @code
1953 +@item TYPE_MAIN_VARIANT
1954 +This macro returns the unqualified version of a type. It may be applied
1955 +to an unqualified type, but it is not always the identity function in
1956 +that case.
1957 +@end ftable
1959 +A few other macros and functions are usable with all types:
1960 +@ftable @code
1961 +@item TYPE_SIZE
1962 +The number of bits required to represent the type, represented as an
1963 +@code{INTEGER_CST}. For an incomplete type, @code{TYPE_SIZE} will be
1964 +@code{NULL_TREE}.
1966 +@item TYPE_ALIGN
1967 +The alignment of the type, in bits, represented as an @code{int}.
1969 +@item TYPE_NAME
1970 +This macro returns a declaration (in the form of a @code{TYPE_DECL}) for
1971 +the type. (Note this macro does @emph{not} return an
1972 +@code{IDENTIFIER_NODE}, as you might expect, given its name!) You can
1973 +look at the @code{DECL_NAME} of the @code{TYPE_DECL} to obtain the
1974 +actual name of the type. The @code{TYPE_NAME} will be @code{NULL_TREE}
1975 +for a type that is not a built-in type, the result of a typedef, or a
1976 +named class type.
1978 +@item TYPE_CANONICAL
1979 +This macro returns the ``canonical'' type for the given type
1980 +node. Canonical types are used to improve performance in the C++ and
1981 +Objective-C++ front ends by allowing efficient comparison between two
1982 +type nodes in @code{same_type_p}: if the @code{TYPE_CANONICAL} values
1983 +of the types are equal, the types are equivalent; otherwise, the types
1984 +are not equivalent. The notion of equivalence for canonical types is
1985 +the same as the notion of type equivalence in the language itself. For
1986 +instance,
1988 +When @code{TYPE_CANONICAL} is @code{NULL_TREE}, there is no canonical
1989 +type for the given type node. In this case, comparison between this
1990 +type and any other type requires the compiler to perform a deep,
1991 +``structural'' comparison to see if the two type nodes have the same
1992 +form and properties.
1994 +The canonical type for a node is always the most fundamental type in
1995 +the equivalence class of types. For instance, @code{int} is its own
1996 +canonical type. A typedef @code{I} of @code{int} will have @code{int}
1997 +as its canonical type. Similarly, @code{I*}@ and a typedef @code{IP}@
1998 +(defined to @code{I*}) will has @code{int*} as their canonical
1999 +type. When building a new type node, be sure to set
2000 +@code{TYPE_CANONICAL} to the appropriate canonical type. If the new
2001 +type is a compound type (built from other types), and any of those
2002 +other types require structural equality, use
2003 +@code{SET_TYPE_STRUCTURAL_EQUALITY} to ensure that the new type also
2004 +requires structural equality. Finally, if for some reason you cannot
2005 +guarantee that @code{TYPE_CANONICAL} will point to the canonical type,
2006 +use @code{SET_TYPE_STRUCTURAL_EQUALITY} to make sure that the new
2007 +type--and any type constructed based on it--requires structural
2008 +equality. If you suspect that the canonical type system is
2009 +miscomparing types, pass @code{--param verify-canonical-types=1} to
2010 +the compiler or configure with @code{--enable-checking} to force the
2011 +compiler to verify its canonical-type comparisons against the
2012 +structural comparisons; the compiler will then print any warnings if
2013 +the canonical types miscompare.
2015 +@item TYPE_STRUCTURAL_EQUALITY_P
2016 +This predicate holds when the node requires structural equality
2017 +checks, e.g., when @code{TYPE_CANONICAL} is @code{NULL_TREE}.
2019 +@item SET_TYPE_STRUCTURAL_EQUALITY
2020 +This macro states that the type node it is given requires structural
2021 +equality checks, e.g., it sets @code{TYPE_CANONICAL} to
2022 +@code{NULL_TREE}.
2024 +@item same_type_p
2025 +This predicate takes two types as input, and holds if they are the same
2026 +type. For example, if one type is a @code{typedef} for the other, or
2027 +both are @code{typedef}s for the same type. This predicate also holds if
2028 +the two trees given as input are simply copies of one another; i.e.,
2029 +there is no difference between them at the source level, but, for
2030 +whatever reason, a duplicate has been made in the representation. You
2031 +should never use @code{==} (pointer equality) to compare types; always
2032 +use @code{same_type_p} instead.
2033 +@end ftable
2035 +Detailed below are the various kinds of types, and the macros that can
2036 +be used to access them. Although other kinds of types are used
2037 +elsewhere in G++, the types described here are the only ones that you
2038 +will encounter while examining the intermediate representation.
2040 +@table @code
2041 +@item VOID_TYPE
2042 +Used to represent the @code{void} type.
2044 +@item INTEGER_TYPE
2045 +Used to represent the various integral types, including @code{char},
2046 +@code{short}, @code{int}, @code{long}, and @code{long long}. This code
2047 +is not used for enumeration types, nor for the @code{bool} type.
2048 +The @code{TYPE_PRECISION} is the number of bits used in
2049 +the representation, represented as an @code{unsigned int}. (Note that
2050 +in the general case this is not the same value as @code{TYPE_SIZE};
2051 +suppose that there were a 24-bit integer type, but that alignment
2052 +requirements for the ABI required 32-bit alignment. Then,
2053 +@code{TYPE_SIZE} would be an @code{INTEGER_CST} for 32, while
2054 +@code{TYPE_PRECISION} would be 24.) The integer type is unsigned if
2055 +@code{TYPE_UNSIGNED} holds; otherwise, it is signed.
2057 +The @code{TYPE_MIN_VALUE} is an @code{INTEGER_CST} for the smallest
2058 +integer that may be represented by this type. Similarly, the
2059 +@code{TYPE_MAX_VALUE} is an @code{INTEGER_CST} for the largest integer
2060 +that may be represented by this type.
2062 +@item REAL_TYPE
2063 +Used to represent the @code{float}, @code{double}, and @code{long
2064 +double} types. The number of bits in the floating-point representation
2065 +is given by @code{TYPE_PRECISION}, as in the @code{INTEGER_TYPE} case.
2067 +@item FIXED_POINT_TYPE
2068 +Used to represent the @code{short _Fract}, @code{_Fract}, @code{long
2069 +_Fract}, @code{long long _Fract}, @code{short _Accum}, @code{_Accum},
2070 +@code{long _Accum}, and @code{long long _Accum} types. The number of bits
2071 +in the fixed-point representation is given by @code{TYPE_PRECISION},
2072 +as in the @code{INTEGER_TYPE} case. There may be padding bits, fractional
2073 +bits and integral bits. The number of fractional bits is given by
2074 +@code{TYPE_FBIT}, and the number of integral bits is given by @code{TYPE_IBIT}.
2075 +The fixed-point type is unsigned if @code{TYPE_UNSIGNED} holds; otherwise,
2076 +it is signed.
2077 +The fixed-point type is saturating if @code{TYPE_SATURATING} holds; otherwise,
2078 +it is not saturating.
2080 +@item COMPLEX_TYPE
2081 +Used to represent GCC built-in @code{__complex__} data types. The
2082 +@code{TREE_TYPE} is the type of the real and imaginary parts.
2084 +@item ENUMERAL_TYPE
2085 +Used to represent an enumeration type. The @code{TYPE_PRECISION} gives
2086 +(as an @code{int}), the number of bits used to represent the type. If
2087 +there are no negative enumeration constants, @code{TYPE_UNSIGNED} will
2088 +hold. The minimum and maximum enumeration constants may be obtained
2089 +with @code{TYPE_MIN_VALUE} and @code{TYPE_MAX_VALUE}, respectively; each
2090 +of these macros returns an @code{INTEGER_CST}.
2092 +The actual enumeration constants themselves may be obtained by looking
2093 +at the @code{TYPE_VALUES}. This macro will return a @code{TREE_LIST},
2094 +containing the constants. The @code{TREE_PURPOSE} of each node will be
2095 +an @code{IDENTIFIER_NODE} giving the name of the constant; the
2096 +@code{TREE_VALUE} will be an @code{INTEGER_CST} giving the value
2097 +assigned to that constant. These constants will appear in the order in
2098 +which they were declared. The @code{TREE_TYPE} of each of these
2099 +constants will be the type of enumeration type itself.
2101 +@item BOOLEAN_TYPE
2102 +Used to represent the @code{bool} type.
2104 +@item POINTER_TYPE
2105 +Used to represent pointer types, and pointer to data member types. The
2106 +@code{TREE_TYPE} gives the type to which this type points.
2108 +@item REFERENCE_TYPE
2109 +Used to represent reference types. The @code{TREE_TYPE} gives the type
2110 +to which this type refers.
2112 +@item FUNCTION_TYPE
2113 +Used to represent the type of non-member functions and of static member
2114 +functions. The @code{TREE_TYPE} gives the return type of the function.
2115 +The @code{TYPE_ARG_TYPES} are a @code{TREE_LIST} of the argument types.
2116 +The @code{TREE_VALUE} of each node in this list is the type of the
2117 +corresponding argument; the @code{TREE_PURPOSE} is an expression for the
2118 +default argument value, if any. If the last node in the list is
2119 +@code{void_list_node} (a @code{TREE_LIST} node whose @code{TREE_VALUE}
2120 +is the @code{void_type_node}), then functions of this type do not take
2121 +variable arguments. Otherwise, they do take a variable number of
2122 +arguments.
2124 +Note that in C (but not in C++) a function declared like @code{void f()}
2125 +is an unprototyped function taking a variable number of arguments; the
2126 +@code{TYPE_ARG_TYPES} of such a function will be @code{NULL}.
2128 +@item METHOD_TYPE
2129 +Used to represent the type of a non-static member function. Like a
2130 +@code{FUNCTION_TYPE}, the return type is given by the @code{TREE_TYPE}.
2131 +The type of @code{*this}, i.e., the class of which functions of this
2132 +type are a member, is given by the @code{TYPE_METHOD_BASETYPE}. The
2133 +@code{TYPE_ARG_TYPES} is the parameter list, as for a
2134 +@code{FUNCTION_TYPE}, and includes the @code{this} argument.
2136 +@item ARRAY_TYPE
2137 +Used to represent array types. The @code{TREE_TYPE} gives the type of
2138 +the elements in the array. If the array-bound is present in the type,
2139 +the @code{TYPE_DOMAIN} is an @code{INTEGER_TYPE} whose
2140 +@code{TYPE_MIN_VALUE} and @code{TYPE_MAX_VALUE} will be the lower and
2141 +upper bounds of the array, respectively. The @code{TYPE_MIN_VALUE} will
2142 +always be an @code{INTEGER_CST} for zero, while the
2143 +@code{TYPE_MAX_VALUE} will be one less than the number of elements in
2144 +the array, i.e., the highest value which may be used to index an element
2145 +in the array.
2147 +@item RECORD_TYPE
2148 +Used to represent @code{struct} and @code{class} types, as well as
2149 +pointers to member functions and similar constructs in other languages.
2150 +@code{TYPE_FIELDS} contains the items contained in this type, each of
2151 +which can be a @code{FIELD_DECL}, @code{VAR_DECL}, @code{CONST_DECL}, or
2152 +@code{TYPE_DECL}. You may not make any assumptions about the ordering
2153 +of the fields in the type or whether one or more of them overlap.
2155 +@item UNION_TYPE
2156 +Used to represent @code{union} types. Similar to @code{RECORD_TYPE}
2157 +except that all @code{FIELD_DECL} nodes in @code{TYPE_FIELD} start at
2158 +bit position zero.
2160 +@item QUAL_UNION_TYPE
2161 +Used to represent part of a variant record in Ada. Similar to
2162 +@code{UNION_TYPE} except that each @code{FIELD_DECL} has a
2163 +@code{DECL_QUALIFIER} field, which contains a boolean expression that
2164 +indicates whether the field is present in the object. The type will only
2165 +have one field, so each field's @code{DECL_QUALIFIER} is only evaluated
2166 +if none of the expressions in the previous fields in @code{TYPE_FIELDS}
2167 +are nonzero. Normally these expressions will reference a field in the
2168 +outer object using a @code{PLACEHOLDER_EXPR}.
2170 +@item LANG_TYPE
2171 +This node is used to represent a language-specific type. The front
2172 +end must handle it.
2174 +@item OFFSET_TYPE
2175 +This node is used to represent a pointer-to-data member. For a data
2176 +member @code{X::m} the @code{TYPE_OFFSET_BASETYPE} is @code{X} and the
2177 +@code{TREE_TYPE} is the type of @code{m}.
2179 +@end table
2181 +There are variables whose values represent some of the basic types.
2182 +These include:
2183 +@table @code
2184 +@item void_type_node
2185 +A node for @code{void}.
2187 +@item integer_type_node
2188 +A node for @code{int}.
2190 +@item unsigned_type_node.
2191 +A node for @code{unsigned int}.
2193 +@item char_type_node.
2194 +A node for @code{char}.
2195 +@end table
2196 +@noindent
2197 +It may sometimes be useful to compare one of these variables with a type
2198 +in hand, using @code{same_type_p}.
2200 +@c ---------------------------------------------------------------------
2201 +@c Declarations
2202 +@c ---------------------------------------------------------------------
2204 +@node Declarations
2205 +@section Declarations
2206 +@cindex declaration
2207 +@cindex variable
2208 +@cindex type declaration
2209 +@tindex LABEL_DECL
2210 +@tindex CONST_DECL
2211 +@tindex TYPE_DECL
2212 +@tindex VAR_DECL
2213 +@tindex PARM_DECL
2214 +@tindex DEBUG_EXPR_DECL
2215 +@tindex FIELD_DECL
2216 +@tindex NAMESPACE_DECL
2217 +@tindex RESULT_DECL
2218 +@tindex TEMPLATE_DECL
2219 +@tindex THUNK_DECL
2220 +@findex THUNK_DELTA
2221 +@findex DECL_INITIAL
2222 +@findex DECL_SIZE
2223 +@findex DECL_ALIGN
2224 +@findex DECL_EXTERNAL
2226 +This section covers the various kinds of declarations that appear in the
2227 +internal representation, except for declarations of functions
2228 +(represented by @code{FUNCTION_DECL} nodes), which are described in
2229 +@ref{Functions}.
2231 +@menu
2232 +* Working with declarations:: Macros and functions that work on
2233 +declarations.
2234 +* Internal structure:: How declaration nodes are represented.
2235 +@end menu
2237 +@node Working with declarations
2238 +@subsection Working with declarations
2240 +Some macros can be used with any kind of declaration. These include:
2241 +@ftable @code
2242 +@item DECL_NAME
2243 +This macro returns an @code{IDENTIFIER_NODE} giving the name of the
2244 +entity.
2246 +@item TREE_TYPE
2247 +This macro returns the type of the entity declared.
2249 +@item EXPR_FILENAME
2250 +This macro returns the name of the file in which the entity was
2251 +declared, as a @code{char*}. For an entity declared implicitly by the
2252 +compiler (like @code{__builtin_memcpy}), this will be the string
2253 +@code{"<internal>"}.
2255 +@item EXPR_LINENO
2256 +This macro returns the line number at which the entity was declared, as
2257 +an @code{int}.
2259 +@item DECL_ARTIFICIAL
2260 +This predicate holds if the declaration was implicitly generated by the
2261 +compiler. For example, this predicate will hold of an implicitly
2262 +declared member function, or of the @code{TYPE_DECL} implicitly
2263 +generated for a class type. Recall that in C++ code like:
2264 +@smallexample
2265 +struct S @{@};
2266 +@end smallexample
2267 +@noindent
2268 +is roughly equivalent to C code like:
2269 +@smallexample
2270 +struct S @{@};
2271 +typedef struct S S;
2272 +@end smallexample
2273 +The implicitly generated @code{typedef} declaration is represented by a
2274 +@code{TYPE_DECL} for which @code{DECL_ARTIFICIAL} holds.
2276 +@end ftable
2278 +The various kinds of declarations include:
2279 +@table @code
2280 +@item LABEL_DECL
2281 +These nodes are used to represent labels in function bodies. For more
2282 +information, see @ref{Functions}. These nodes only appear in block
2283 +scopes.
2285 +@item CONST_DECL
2286 +These nodes are used to represent enumeration constants. The value of
2287 +the constant is given by @code{DECL_INITIAL} which will be an
2288 +@code{INTEGER_CST} with the same type as the @code{TREE_TYPE} of the
2289 +@code{CONST_DECL}, i.e., an @code{ENUMERAL_TYPE}.
2291 +@item RESULT_DECL
2292 +These nodes represent the value returned by a function. When a value is
2293 +assigned to a @code{RESULT_DECL}, that indicates that the value should
2294 +be returned, via bitwise copy, by the function. You can use
2295 +@code{DECL_SIZE} and @code{DECL_ALIGN} on a @code{RESULT_DECL}, just as
2296 +with a @code{VAR_DECL}.
2298 +@item TYPE_DECL
2299 +These nodes represent @code{typedef} declarations. The @code{TREE_TYPE}
2300 +is the type declared to have the name given by @code{DECL_NAME}. In
2301 +some cases, there is no associated name.
2303 +@item VAR_DECL
2304 +These nodes represent variables with namespace or block scope, as well
2305 +as static data members. The @code{DECL_SIZE} and @code{DECL_ALIGN} are
2306 +analogous to @code{TYPE_SIZE} and @code{TYPE_ALIGN}. For a declaration,
2307 +you should always use the @code{DECL_SIZE} and @code{DECL_ALIGN} rather
2308 +than the @code{TYPE_SIZE} and @code{TYPE_ALIGN} given by the
2309 +@code{TREE_TYPE}, since special attributes may have been applied to the
2310 +variable to give it a particular size and alignment. You may use the
2311 +predicates @code{DECL_THIS_STATIC} or @code{DECL_THIS_EXTERN} to test
2312 +whether the storage class specifiers @code{static} or @code{extern} were
2313 +used to declare a variable.
2315 +If this variable is initialized (but does not require a constructor),
2316 +the @code{DECL_INITIAL} will be an expression for the initializer. The
2317 +initializer should be evaluated, and a bitwise copy into the variable
2318 +performed. If the @code{DECL_INITIAL} is the @code{error_mark_node},
2319 +there is an initializer, but it is given by an explicit statement later
2320 +in the code; no bitwise copy is required.
2322 +GCC provides an extension that allows either automatic variables, or
2323 +global variables, to be placed in particular registers. This extension
2324 +is being used for a particular @code{VAR_DECL} if @code{DECL_REGISTER}
2325 +holds for the @code{VAR_DECL}, and if @code{DECL_ASSEMBLER_NAME} is not
2326 +equal to @code{DECL_NAME}. In that case, @code{DECL_ASSEMBLER_NAME} is
2327 +the name of the register into which the variable will be placed.
2329 +@item PARM_DECL
2330 +Used to represent a parameter to a function. Treat these nodes
2331 +similarly to @code{VAR_DECL} nodes. These nodes only appear in the
2332 +@code{DECL_ARGUMENTS} for a @code{FUNCTION_DECL}.
2334 +The @code{DECL_ARG_TYPE} for a @code{PARM_DECL} is the type that will
2335 +actually be used when a value is passed to this function. It may be a
2336 +wider type than the @code{TREE_TYPE} of the parameter; for example, the
2337 +ordinary type might be @code{short} while the @code{DECL_ARG_TYPE} is
2338 +@code{int}.
2340 +@item DEBUG_EXPR_DECL
2341 +Used to represent an anonymous debug-information temporary created to
2342 +hold an expression as it is optimized away, so that its value can be
2343 +referenced in debug bind statements.
2345 +@item FIELD_DECL
2346 +These nodes represent non-static data members. The @code{DECL_SIZE} and
2347 +@code{DECL_ALIGN} behave as for @code{VAR_DECL} nodes.
2348 +The position of the field within the parent record is specified by a
2349 +combination of three attributes. @code{DECL_FIELD_OFFSET} is the position,
2350 +counting in bytes, of the @code{DECL_OFFSET_ALIGN}-bit sized word containing
2351 +the bit of the field closest to the beginning of the structure.
2352 +@code{DECL_FIELD_BIT_OFFSET} is the bit offset of the first bit of the field
2353 +within this word; this may be nonzero even for fields that are not bit-fields,
2354 +since @code{DECL_OFFSET_ALIGN} may be greater than the natural alignment
2355 +of the field's type.
2357 +If @code{DECL_C_BIT_FIELD} holds, this field is a bit-field. In a bit-field,
2358 +@code{DECL_BIT_FIELD_TYPE} also contains the type that was originally
2359 +specified for it, while DECL_TYPE may be a modified type with lesser precision,
2360 +according to the size of the bit field.
2362 +@item NAMESPACE_DECL
2363 +Namespaces provide a name hierarchy for other declarations. They
2364 +appear in the @code{DECL_CONTEXT} of other @code{_DECL} nodes.
2366 +@end table
2368 +@node Internal structure
2369 +@subsection Internal structure
2371 +@code{DECL} nodes are represented internally as a hierarchy of
2372 +structures.
2374 +@menu
2375 +* Current structure hierarchy:: The current DECL node structure
2376 +hierarchy.
2377 +* Adding new DECL node types:: How to add a new DECL node to a
2378 +frontend.
2379 +@end menu
2381 +@node Current structure hierarchy
2382 +@subsubsection Current structure hierarchy
2384 +@table @code
2386 +@item struct tree_decl_minimal
2387 +This is the minimal structure to inherit from in order for common
2388 +@code{DECL} macros to work. The fields it contains are a unique ID,
2389 +source location, context, and name.
2391 +@item struct tree_decl_common
2392 +This structure inherits from @code{struct tree_decl_minimal}. It
2393 +contains fields that most @code{DECL} nodes need, such as a field to
2394 +store alignment, machine mode, size, and attributes.
2396 +@item struct tree_field_decl
2397 +This structure inherits from @code{struct tree_decl_common}. It is
2398 +used to represent @code{FIELD_DECL}.
2400 +@item struct tree_label_decl
2401 +This structure inherits from @code{struct tree_decl_common}. It is
2402 +used to represent @code{LABEL_DECL}.
2404 +@item struct tree_translation_unit_decl
2405 +This structure inherits from @code{struct tree_decl_common}. It is
2406 +used to represent @code{TRANSLATION_UNIT_DECL}.
2408 +@item struct tree_decl_with_rtl
2409 +This structure inherits from @code{struct tree_decl_common}. It
2410 +contains a field to store the low-level RTL associated with a
2411 +@code{DECL} node.
2413 +@item struct tree_result_decl
2414 +This structure inherits from @code{struct tree_decl_with_rtl}. It is
2415 +used to represent @code{RESULT_DECL}.
2417 +@item struct tree_const_decl
2418 +This structure inherits from @code{struct tree_decl_with_rtl}. It is
2419 +used to represent @code{CONST_DECL}.
2421 +@item struct tree_parm_decl
2422 +This structure inherits from @code{struct tree_decl_with_rtl}. It is
2423 +used to represent @code{PARM_DECL}.
2425 +@item struct tree_decl_with_vis
2426 +This structure inherits from @code{struct tree_decl_with_rtl}. It
2427 +contains fields necessary to store visibility information, as well as
2428 +a section name and assembler name.
2430 +@item struct tree_var_decl
2431 +This structure inherits from @code{struct tree_decl_with_vis}. It is
2432 +used to represent @code{VAR_DECL}.
2434 +@item struct tree_function_decl
2435 +This structure inherits from @code{struct tree_decl_with_vis}. It is
2436 +used to represent @code{FUNCTION_DECL}.
2438 +@end table
2439 +@node Adding new DECL node types
2440 +@subsubsection Adding new DECL node types
2442 +Adding a new @code{DECL} tree consists of the following steps
2444 +@table @asis
2446 +@item Add a new tree code for the @code{DECL} node
2447 +For language specific @code{DECL} nodes, there is a @file{.def} file
2448 +in each frontend directory where the tree code should be added.
2449 +For @code{DECL} nodes that are part of the middle-end, the code should
2450 +be added to @file{tree.def}.
2452 +@item Create a new structure type for the @code{DECL} node
2453 +These structures should inherit from one of the existing structures in
2454 +the language hierarchy by using that structure as the first member.
2456 +@smallexample
2457 +struct tree_foo_decl
2459 + struct tree_decl_with_vis common;
2461 +@end smallexample
2463 +Would create a structure name @code{tree_foo_decl} that inherits from
2464 +@code{struct tree_decl_with_vis}.
2466 +For language specific @code{DECL} nodes, this new structure type
2467 +should go in the appropriate @file{.h} file.
2468 +For @code{DECL} nodes that are part of the middle-end, the structure
2469 +type should go in @file{tree.h}.
2471 +@item Add a member to the tree structure enumerator for the node
2472 +For garbage collection and dynamic checking purposes, each @code{DECL}
2473 +node structure type is required to have a unique enumerator value
2474 +specified with it.
2475 +For language specific @code{DECL} nodes, this new enumerator value
2476 +should go in the appropriate @file{.def} file.
2477 +For @code{DECL} nodes that are part of the middle-end, the enumerator
2478 +values are specified in @file{treestruct.def}.
2480 +@item Update @code{union tree_node}
2481 +In order to make your new structure type usable, it must be added to
2482 +@code{union tree_node}.
2483 +For language specific @code{DECL} nodes, a new entry should be added
2484 +to the appropriate @file{.h} file of the form
2485 +@smallexample
2486 + struct tree_foo_decl GTY ((tag ("TS_VAR_DECL"))) foo_decl;
2487 +@end smallexample
2488 +For @code{DECL} nodes that are part of the middle-end, the additional
2489 +member goes directly into @code{union tree_node} in @file{tree.h}.
2491 +@item Update dynamic checking info
2492 +In order to be able to check whether accessing a named portion of
2493 +@code{union tree_node} is legal, and whether a certain @code{DECL} node
2494 +contains one of the enumerated @code{DECL} node structures in the
2495 +hierarchy, a simple lookup table is used.
2496 +This lookup table needs to be kept up to date with the tree structure
2497 +hierarchy, or else checking and containment macros will fail
2498 +inappropriately.
2500 +For language specific @code{DECL} nodes, their is an @code{init_ts}
2501 +function in an appropriate @file{.c} file, which initializes the lookup
2502 +table.
2503 +Code setting up the table for new @code{DECL} nodes should be added
2504 +there.
2505 +For each @code{DECL} tree code and enumerator value representing a
2506 +member of the inheritance hierarchy, the table should contain 1 if
2507 +that tree code inherits (directly or indirectly) from that member.
2508 +Thus, a @code{FOO_DECL} node derived from @code{struct decl_with_rtl},
2509 +and enumerator value @code{TS_FOO_DECL}, would be set up as follows
2510 +@smallexample
2511 +tree_contains_struct[FOO_DECL][TS_FOO_DECL] = 1;
2512 +tree_contains_struct[FOO_DECL][TS_DECL_WRTL] = 1;
2513 +tree_contains_struct[FOO_DECL][TS_DECL_COMMON] = 1;
2514 +tree_contains_struct[FOO_DECL][TS_DECL_MINIMAL] = 1;
2515 +@end smallexample
2517 +For @code{DECL} nodes that are part of the middle-end, the setup code
2518 +goes into @file{tree.c}.
2520 +@item Add macros to access any new fields and flags
2522 +Each added field or flag should have a macro that is used to access
2523 +it, that performs appropriate checking to ensure only the right type of
2524 +@code{DECL} nodes access the field.
2526 +These macros generally take the following form
2527 +@smallexample
2528 +#define FOO_DECL_FIELDNAME(NODE) FOO_DECL_CHECK(NODE)->foo_decl.fieldname
2529 +@end smallexample
2530 +However, if the structure is simply a base class for further
2531 +structures, something like the following should be used
2532 +@smallexample
2533 +#define BASE_STRUCT_CHECK(T) CONTAINS_STRUCT_CHECK(T, TS_BASE_STRUCT)
2534 +#define BASE_STRUCT_FIELDNAME(NODE) \
2535 + (BASE_STRUCT_CHECK(NODE)->base_struct.fieldname
2536 +@end smallexample
2538 +@end table
2541 +@c ---------------------------------------------------------------------
2542 +@c Attributes
2543 +@c ---------------------------------------------------------------------
2544 +@node Attributes
2545 +@section Attributes in trees
2546 +@cindex attributes
2548 +Attributes, as specified using the @code{__attribute__} keyword, are
2549 +represented internally as a @code{TREE_LIST}. The @code{TREE_PURPOSE}
2550 +is the name of the attribute, as an @code{IDENTIFIER_NODE}. The
2551 +@code{TREE_VALUE} is a @code{TREE_LIST} of the arguments of the
2552 +attribute, if any, or @code{NULL_TREE} if there are no arguments; the
2553 +arguments are stored as the @code{TREE_VALUE} of successive entries in
2554 +the list, and may be identifiers or expressions. The @code{TREE_CHAIN}
2555 +of the attribute is the next attribute in a list of attributes applying
2556 +to the same declaration or type, or @code{NULL_TREE} if there are no
2557 +further attributes in the list.
2559 +Attributes may be attached to declarations and to types; these
2560 +attributes may be accessed with the following macros. All attributes
2561 +are stored in this way, and many also cause other changes to the
2562 +declaration or type or to other internal compiler data structures.
2564 +@deftypefn {Tree Macro} tree DECL_ATTRIBUTES (tree @var{decl})
2565 +This macro returns the attributes on the declaration @var{decl}.
2566 +@end deftypefn
2568 +@deftypefn {Tree Macro} tree TYPE_ATTRIBUTES (tree @var{type})
2569 +This macro returns the attributes on the type @var{type}.
2570 +@end deftypefn
2573 +@c ---------------------------------------------------------------------
2574 +@c Expressions
2575 +@c ---------------------------------------------------------------------
2577 +@node Expression trees
2578 +@section Expressions
2579 +@cindex expression
2580 +@findex TREE_TYPE
2581 +@findex TREE_OPERAND
2583 +The internal representation for expressions is for the most part quite
2584 +straightforward. However, there are a few facts that one must bear in
2585 +mind. In particular, the expression ``tree'' is actually a directed
2586 +acyclic graph. (For example there may be many references to the integer
2587 +constant zero throughout the source program; many of these will be
2588 +represented by the same expression node.) You should not rely on
2589 +certain kinds of node being shared, nor should you rely on certain kinds of
2590 +nodes being unshared.
2592 +The following macros can be used with all expression nodes:
2594 +@ftable @code
2595 +@item TREE_TYPE
2596 +Returns the type of the expression. This value may not be precisely the
2597 +same type that would be given the expression in the original program.
2598 +@end ftable
2600 +In what follows, some nodes that one might expect to always have type
2601 +@code{bool} are documented to have either integral or boolean type. At
2602 +some point in the future, the C front end may also make use of this same
2603 +intermediate representation, and at this point these nodes will
2604 +certainly have integral type. The previous sentence is not meant to
2605 +imply that the C++ front end does not or will not give these nodes
2606 +integral type.
2608 +Below, we list the various kinds of expression nodes. Except where
2609 +noted otherwise, the operands to an expression are accessed using the
2610 +@code{TREE_OPERAND} macro. For example, to access the first operand to
2611 +a binary plus expression @code{expr}, use:
2613 +@smallexample
2614 +TREE_OPERAND (expr, 0)
2615 +@end smallexample
2616 +@noindent
2618 +As this example indicates, the operands are zero-indexed.
2621 +@menu
2622 +* Constants: Constant expressions.
2623 +* Storage References::
2624 +* Unary and Binary Expressions::
2625 +* Vectors::
2626 +@end menu
2628 +@node Constant expressions
2629 +@subsection Constant expressions
2630 +@tindex INTEGER_CST
2631 +@findex TREE_INT_CST_HIGH
2632 +@findex TREE_INT_CST_LOW
2633 +@findex tree_int_cst_lt
2634 +@findex tree_int_cst_equal
2635 +@tindex REAL_CST
2636 +@tindex FIXED_CST
2637 +@tindex COMPLEX_CST
2638 +@tindex VECTOR_CST
2639 +@tindex STRING_CST
2640 +@findex TREE_STRING_LENGTH
2641 +@findex TREE_STRING_POINTER
2643 +The table below begins with constants, moves on to unary expressions,
2644 +then proceeds to binary expressions, and concludes with various other
2645 +kinds of expressions:
2647 +@table @code
2648 +@item INTEGER_CST
2649 +These nodes represent integer constants. Note that the type of these
2650 +constants is obtained with @code{TREE_TYPE}; they are not always of type
2651 +@code{int}. In particular, @code{char} constants are represented with
2652 +@code{INTEGER_CST} nodes. The value of the integer constant @code{e} is
2653 +given by
2654 +@smallexample
2655 +((TREE_INT_CST_HIGH (e) << HOST_BITS_PER_WIDE_INT)
2656 ++ TREE_INST_CST_LOW (e))
2657 +@end smallexample
2658 +@noindent
2659 +HOST_BITS_PER_WIDE_INT is at least thirty-two on all platforms. Both
2660 +@code{TREE_INT_CST_HIGH} and @code{TREE_INT_CST_LOW} return a
2661 +@code{HOST_WIDE_INT}. The value of an @code{INTEGER_CST} is interpreted
2662 +as a signed or unsigned quantity depending on the type of the constant.
2663 +In general, the expression given above will overflow, so it should not
2664 +be used to calculate the value of the constant.
2666 +The variable @code{integer_zero_node} is an integer constant with value
2667 +zero. Similarly, @code{integer_one_node} is an integer constant with
2668 +value one. The @code{size_zero_node} and @code{size_one_node} variables
2669 +are analogous, but have type @code{size_t} rather than @code{int}.
2671 +The function @code{tree_int_cst_lt} is a predicate which holds if its
2672 +first argument is less than its second. Both constants are assumed to
2673 +have the same signedness (i.e., either both should be signed or both
2674 +should be unsigned.) The full width of the constant is used when doing
2675 +the comparison; the usual rules about promotions and conversions are
2676 +ignored. Similarly, @code{tree_int_cst_equal} holds if the two
2677 +constants are equal. The @code{tree_int_cst_sgn} function returns the
2678 +sign of a constant. The value is @code{1}, @code{0}, or @code{-1}
2679 +according on whether the constant is greater than, equal to, or less
2680 +than zero. Again, the signedness of the constant's type is taken into
2681 +account; an unsigned constant is never less than zero, no matter what
2682 +its bit-pattern.
2684 +@item REAL_CST
2686 +FIXME: Talk about how to obtain representations of this constant, do
2687 +comparisons, and so forth.
2689 +@item FIXED_CST
2691 +These nodes represent fixed-point constants. The type of these constants
2692 +is obtained with @code{TREE_TYPE}. @code{TREE_FIXED_CST_PTR} points to
2693 +a @code{struct fixed_value}; @code{TREE_FIXED_CST} returns the structure
2694 +itself. @code{struct fixed_value} contains @code{data} with the size of two
2695 +@code{HOST_BITS_PER_WIDE_INT} and @code{mode} as the associated fixed-point
2696 +machine mode for @code{data}.
2698 +@item COMPLEX_CST
2699 +These nodes are used to represent complex number constants, that is a
2700 +@code{__complex__} whose parts are constant nodes. The
2701 +@code{TREE_REALPART} and @code{TREE_IMAGPART} return the real and the
2702 +imaginary parts respectively.
2704 +@item VECTOR_CST
2705 +These nodes are used to represent vector constants, whose parts are
2706 +constant nodes. Each individual constant node is either an integer or a
2707 +double constant node. The first operand is a @code{TREE_LIST} of the
2708 +constant nodes and is accessed through @code{TREE_VECTOR_CST_ELTS}.
2710 +@item STRING_CST
2711 +These nodes represent string-constants. The @code{TREE_STRING_LENGTH}
2712 +returns the length of the string, as an @code{int}. The
2713 +@code{TREE_STRING_POINTER} is a @code{char*} containing the string
2714 +itself. The string may not be @code{NUL}-terminated, and it may contain
2715 +embedded @code{NUL} characters. Therefore, the
2716 +@code{TREE_STRING_LENGTH} includes the trailing @code{NUL} if it is
2717 +present.
2719 +For wide string constants, the @code{TREE_STRING_LENGTH} is the number
2720 +of bytes in the string, and the @code{TREE_STRING_POINTER}
2721 +points to an array of the bytes of the string, as represented on the
2722 +target system (that is, as integers in the target endianness). Wide and
2723 +non-wide string constants are distinguished only by the @code{TREE_TYPE}
2724 +of the @code{STRING_CST}.
2726 +FIXME: The formats of string constants are not well-defined when the
2727 +target system bytes are not the same width as host system bytes.
2729 +@end table
2731 +@node Storage References
2732 +@subsection References to storage
2733 +@tindex ADDR_EXPR
2734 +@tindex INDIRECT_REF
2735 +@tindex MEM_REF
2736 +@tindex ARRAY_REF
2737 +@tindex ARRAY_RANGE_REF
2738 +@tindex TARGET_MEM_REF
2739 +@tindex COMPONENT_REF
2741 +@table @code
2742 +@item ARRAY_REF
2743 +These nodes represent array accesses. The first operand is the array;
2744 +the second is the index. To calculate the address of the memory
2745 +accessed, you must scale the index by the size of the type of the array
2746 +elements. The type of these expressions must be the type of a component of
2747 +the array. The third and fourth operands are used after gimplification
2748 +to represent the lower bound and component size but should not be used
2749 +directly; call @code{array_ref_low_bound} and @code{array_ref_element_size}
2750 +instead.
2752 +@item ARRAY_RANGE_REF
2753 +These nodes represent access to a range (or ``slice'') of an array. The
2754 +operands are the same as that for @code{ARRAY_REF} and have the same
2755 +meanings. The type of these expressions must be an array whose component
2756 +type is the same as that of the first operand. The range of that array
2757 +type determines the amount of data these expressions access.
2759 +@item TARGET_MEM_REF
2760 +These nodes represent memory accesses whose address directly map to
2761 +an addressing mode of the target architecture. The first argument
2762 +is @code{TMR_SYMBOL} and must be a @code{VAR_DECL} of an object with
2763 +a fixed address. The second argument is @code{TMR_BASE} and the
2764 +third one is @code{TMR_INDEX}. The fourth argument is
2765 +@code{TMR_STEP} and must be an @code{INTEGER_CST}. The fifth
2766 +argument is @code{TMR_OFFSET} and must be an @code{INTEGER_CST}.
2767 +Any of the arguments may be NULL if the appropriate component
2768 +does not appear in the address. Address of the @code{TARGET_MEM_REF}
2769 +is determined in the following way.
2771 +@smallexample
2772 +&TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET
2773 +@end smallexample
2775 +The sixth argument is the reference to the original memory access, which
2776 +is preserved for the purposes of the RTL alias analysis. The seventh
2777 +argument is a tag representing the results of tree level alias analysis.
2779 +@item ADDR_EXPR
2780 +These nodes are used to represent the address of an object. (These
2781 +expressions will always have pointer or reference type.) The operand may
2782 +be another expression, or it may be a declaration.
2784 +As an extension, GCC allows users to take the address of a label. In
2785 +this case, the operand of the @code{ADDR_EXPR} will be a
2786 +@code{LABEL_DECL}. The type of such an expression is @code{void*}.
2788 +If the object addressed is not an lvalue, a temporary is created, and
2789 +the address of the temporary is used.
2791 +@item INDIRECT_REF
2792 +These nodes are used to represent the object pointed to by a pointer.
2793 +The operand is the pointer being dereferenced; it will always have
2794 +pointer or reference type.
2796 +@item MEM_REF
2797 +These nodes are used to represent the object pointed to by a pointer
2798 +offset by a constant.
2799 +The first operand is the pointer being dereferenced; it will always have
2800 +pointer or reference type. The second operand is a pointer constant.
2801 +Its type is specifying the type to be used for type-based alias analysis.
2803 +@item COMPONENT_REF
2804 +These nodes represent non-static data member accesses. The first
2805 +operand is the object (rather than a pointer to it); the second operand
2806 +is the @code{FIELD_DECL} for the data member. The third operand represents
2807 +the byte offset of the field, but should not be used directly; call
2808 +@code{component_ref_field_offset} instead.
2811 +@end table
2813 +@node Unary and Binary Expressions
2814 +@subsection Unary and Binary Expressions
2815 +@tindex NEGATE_EXPR
2816 +@tindex ABS_EXPR
2817 +@tindex BIT_NOT_EXPR
2818 +@tindex TRUTH_NOT_EXPR
2819 +@tindex PREDECREMENT_EXPR
2820 +@tindex PREINCREMENT_EXPR
2821 +@tindex POSTDECREMENT_EXPR
2822 +@tindex POSTINCREMENT_EXPR
2823 +@tindex FIX_TRUNC_EXPR
2824 +@tindex FLOAT_EXPR
2825 +@tindex COMPLEX_EXPR
2826 +@tindex CONJ_EXPR
2827 +@tindex REALPART_EXPR
2828 +@tindex IMAGPART_EXPR
2829 +@tindex NON_LVALUE_EXPR
2830 +@tindex NOP_EXPR
2831 +@tindex CONVERT_EXPR
2832 +@tindex FIXED_CONVERT_EXPR
2833 +@tindex THROW_EXPR
2834 +@tindex LSHIFT_EXPR
2835 +@tindex RSHIFT_EXPR
2836 +@tindex BIT_IOR_EXPR
2837 +@tindex BIT_XOR_EXPR
2838 +@tindex BIT_AND_EXPR
2839 +@tindex TRUTH_ANDIF_EXPR
2840 +@tindex TRUTH_ORIF_EXPR
2841 +@tindex TRUTH_AND_EXPR
2842 +@tindex TRUTH_OR_EXPR
2843 +@tindex TRUTH_XOR_EXPR
2844 +@tindex POINTER_PLUS_EXPR
2845 +@tindex PLUS_EXPR
2846 +@tindex MINUS_EXPR
2847 +@tindex MULT_EXPR
2848 +@tindex RDIV_EXPR
2849 +@tindex TRUNC_DIV_EXPR
2850 +@tindex FLOOR_DIV_EXPR
2851 +@tindex CEIL_DIV_EXPR
2852 +@tindex ROUND_DIV_EXPR
2853 +@tindex TRUNC_MOD_EXPR
2854 +@tindex FLOOR_MOD_EXPR
2855 +@tindex CEIL_MOD_EXPR
2856 +@tindex ROUND_MOD_EXPR
2857 +@tindex EXACT_DIV_EXPR
2858 +@tindex LT_EXPR
2859 +@tindex LE_EXPR
2860 +@tindex GT_EXPR
2861 +@tindex GE_EXPR
2862 +@tindex EQ_EXPR
2863 +@tindex NE_EXPR
2864 +@tindex ORDERED_EXPR
2865 +@tindex UNORDERED_EXPR
2866 +@tindex UNLT_EXPR
2867 +@tindex UNLE_EXPR
2868 +@tindex UNGT_EXPR
2869 +@tindex UNGE_EXPR
2870 +@tindex UNEQ_EXPR
2871 +@tindex LTGT_EXPR
2872 +@tindex MODIFY_EXPR
2873 +@tindex INIT_EXPR
2874 +@tindex COMPOUND_EXPR
2875 +@tindex COND_EXPR
2876 +@tindex CALL_EXPR
2877 +@tindex STMT_EXPR
2878 +@tindex BIND_EXPR
2879 +@tindex LOOP_EXPR
2880 +@tindex EXIT_EXPR
2881 +@tindex CLEANUP_POINT_EXPR
2882 +@tindex CONSTRUCTOR
2883 +@tindex COMPOUND_LITERAL_EXPR
2884 +@tindex SAVE_EXPR
2885 +@tindex TARGET_EXPR
2886 +@tindex VA_ARG_EXPR
2888 +@table @code
2889 +@item NEGATE_EXPR
2890 +These nodes represent unary negation of the single operand, for both
2891 +integer and floating-point types. The type of negation can be
2892 +determined by looking at the type of the expression.
2894 +The behavior of this operation on signed arithmetic overflow is
2895 +controlled by the @code{flag_wrapv} and @code{flag_trapv} variables.
2897 +@item ABS_EXPR
2898 +These nodes represent the absolute value of the single operand, for
2899 +both integer and floating-point types. This is typically used to
2900 +implement the @code{abs}, @code{labs} and @code{llabs} builtins for
2901 +integer types, and the @code{fabs}, @code{fabsf} and @code{fabsl}
2902 +builtins for floating point types. The type of abs operation can
2903 +be determined by looking at the type of the expression.
2905 +This node is not used for complex types. To represent the modulus
2906 +or complex abs of a complex value, use the @code{BUILT_IN_CABS},
2907 +@code{BUILT_IN_CABSF} or @code{BUILT_IN_CABSL} builtins, as used
2908 +to implement the C99 @code{cabs}, @code{cabsf} and @code{cabsl}
2909 +built-in functions.
2911 +@item BIT_NOT_EXPR
2912 +These nodes represent bitwise complement, and will always have integral
2913 +type. The only operand is the value to be complemented.
2915 +@item TRUTH_NOT_EXPR
2916 +These nodes represent logical negation, and will always have integral
2917 +(or boolean) type. The operand is the value being negated. The type
2918 +of the operand and that of the result are always of @code{BOOLEAN_TYPE}
2919 +or @code{INTEGER_TYPE}.
2921 +@item PREDECREMENT_EXPR
2922 +@itemx PREINCREMENT_EXPR
2923 +@itemx POSTDECREMENT_EXPR
2924 +@itemx POSTINCREMENT_EXPR
2925 +These nodes represent increment and decrement expressions. The value of
2926 +the single operand is computed, and the operand incremented or
2927 +decremented. In the case of @code{PREDECREMENT_EXPR} and
2928 +@code{PREINCREMENT_EXPR}, the value of the expression is the value
2929 +resulting after the increment or decrement; in the case of
2930 +@code{POSTDECREMENT_EXPR} and @code{POSTINCREMENT_EXPR} is the value
2931 +before the increment or decrement occurs. The type of the operand, like
2932 +that of the result, will be either integral, boolean, or floating-point.
2934 +@item FIX_TRUNC_EXPR
2935 +These nodes represent conversion of a floating-point value to an
2936 +integer. The single operand will have a floating-point type, while
2937 +the complete expression will have an integral (or boolean) type. The
2938 +operand is rounded towards zero.
2940 +@item FLOAT_EXPR
2941 +These nodes represent conversion of an integral (or boolean) value to a
2942 +floating-point value. The single operand will have integral type, while
2943 +the complete expression will have a floating-point type.
2945 +FIXME: How is the operand supposed to be rounded? Is this dependent on
2946 +@option{-mieee}?
2948 +@item COMPLEX_EXPR
2949 +These nodes are used to represent complex numbers constructed from two
2950 +expressions of the same (integer or real) type. The first operand is the
2951 +real part and the second operand is the imaginary part.
2953 +@item CONJ_EXPR
2954 +These nodes represent the conjugate of their operand.
2956 +@item REALPART_EXPR
2957 +@itemx IMAGPART_EXPR
2958 +These nodes represent respectively the real and the imaginary parts
2959 +of complex numbers (their sole argument).
2961 +@item NON_LVALUE_EXPR
2962 +These nodes indicate that their one and only operand is not an lvalue.
2963 +A back end can treat these identically to the single operand.
2965 +@item NOP_EXPR
2966 +These nodes are used to represent conversions that do not require any
2967 +code-generation. For example, conversion of a @code{char*} to an
2968 +@code{int*} does not require any code be generated; such a conversion is
2969 +represented by a @code{NOP_EXPR}. The single operand is the expression
2970 +to be converted. The conversion from a pointer to a reference is also
2971 +represented with a @code{NOP_EXPR}.
2973 +@item CONVERT_EXPR
2974 +These nodes are similar to @code{NOP_EXPR}s, but are used in those
2975 +situations where code may need to be generated. For example, if an
2976 +@code{int*} is converted to an @code{int} code may need to be generated
2977 +on some platforms. These nodes are never used for C++-specific
2978 +conversions, like conversions between pointers to different classes in
2979 +an inheritance hierarchy. Any adjustments that need to be made in such
2980 +cases are always indicated explicitly. Similarly, a user-defined
2981 +conversion is never represented by a @code{CONVERT_EXPR}; instead, the
2982 +function calls are made explicit.
2984 +@item FIXED_CONVERT_EXPR
2985 +These nodes are used to represent conversions that involve fixed-point
2986 +values. For example, from a fixed-point value to another fixed-point value,
2987 +from an integer to a fixed-point value, from a fixed-point value to an
2988 +integer, from a floating-point value to a fixed-point value, or from
2989 +a fixed-point value to a floating-point value.
2991 +@item LSHIFT_EXPR
2992 +@itemx RSHIFT_EXPR
2993 +These nodes represent left and right shifts, respectively. The first
2994 +operand is the value to shift; it will always be of integral type. The
2995 +second operand is an expression for the number of bits by which to
2996 +shift. Right shift should be treated as arithmetic, i.e., the
2997 +high-order bits should be zero-filled when the expression has unsigned
2998 +type and filled with the sign bit when the expression has signed type.
2999 +Note that the result is undefined if the second operand is larger
3000 +than or equal to the first operand's type size.
3003 +@item BIT_IOR_EXPR
3004 +@itemx BIT_XOR_EXPR
3005 +@itemx BIT_AND_EXPR
3006 +These nodes represent bitwise inclusive or, bitwise exclusive or, and
3007 +bitwise and, respectively. Both operands will always have integral
3008 +type.
3010 +@item TRUTH_ANDIF_EXPR
3011 +@itemx TRUTH_ORIF_EXPR
3012 +These nodes represent logical ``and'' and logical ``or'', respectively.
3013 +These operators are not strict; i.e., the second operand is evaluated
3014 +only if the value of the expression is not determined by evaluation of
3015 +the first operand. The type of the operands and that of the result are
3016 +always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}.
3018 +@item TRUTH_AND_EXPR
3019 +@itemx TRUTH_OR_EXPR
3020 +@itemx TRUTH_XOR_EXPR
3021 +These nodes represent logical and, logical or, and logical exclusive or.
3022 +They are strict; both arguments are always evaluated. There are no
3023 +corresponding operators in C or C++, but the front end will sometimes
3024 +generate these expressions anyhow, if it can tell that strictness does
3025 +not matter. The type of the operands and that of the result are
3026 +always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}.
3028 +@item POINTER_PLUS_EXPR
3029 +This node represents pointer arithmetic. The first operand is always
3030 +a pointer/reference type. The second operand is always an unsigned
3031 +integer type compatible with sizetype. This is the only binary
3032 +arithmetic operand that can operate on pointer types.
3034 +@item PLUS_EXPR
3035 +@itemx MINUS_EXPR
3036 +@itemx MULT_EXPR
3037 +These nodes represent various binary arithmetic operations.
3038 +Respectively, these operations are addition, subtraction (of the second
3039 +operand from the first) and multiplication. Their operands may have
3040 +either integral or floating type, but there will never be case in which
3041 +one operand is of floating type and the other is of integral type.
3043 +The behavior of these operations on signed arithmetic overflow is
3044 +controlled by the @code{flag_wrapv} and @code{flag_trapv} variables.
3046 +@item RDIV_EXPR
3047 +This node represents a floating point division operation.
3049 +@item TRUNC_DIV_EXPR
3050 +@itemx FLOOR_DIV_EXPR
3051 +@itemx CEIL_DIV_EXPR
3052 +@itemx ROUND_DIV_EXPR
3053 +These nodes represent integer division operations that return an integer
3054 +result. @code{TRUNC_DIV_EXPR} rounds towards zero, @code{FLOOR_DIV_EXPR}
3055 +rounds towards negative infinity, @code{CEIL_DIV_EXPR} rounds towards
3056 +positive infinity and @code{ROUND_DIV_EXPR} rounds to the closest integer.
3057 +Integer division in C and C++ is truncating, i.e.@: @code{TRUNC_DIV_EXPR}.
3059 +The behavior of these operations on signed arithmetic overflow, when
3060 +dividing the minimum signed integer by minus one, is controlled by the
3061 +@code{flag_wrapv} and @code{flag_trapv} variables.
3063 +@item TRUNC_MOD_EXPR
3064 +@itemx FLOOR_MOD_EXPR
3065 +@itemx CEIL_MOD_EXPR
3066 +@itemx ROUND_MOD_EXPR
3067 +These nodes represent the integer remainder or modulus operation.
3068 +The integer modulus of two operands @code{a} and @code{b} is
3069 +defined as @code{a - (a/b)*b} where the division calculated using
3070 +the corresponding division operator. Hence for @code{TRUNC_MOD_EXPR}
3071 +this definition assumes division using truncation towards zero, i.e.@:
3072 +@code{TRUNC_DIV_EXPR}. Integer remainder in C and C++ uses truncating
3073 +division, i.e.@: @code{TRUNC_MOD_EXPR}.
3075 +@item EXACT_DIV_EXPR
3076 +The @code{EXACT_DIV_EXPR} code is used to represent integer divisions where
3077 +the numerator is known to be an exact multiple of the denominator. This
3078 +allows the backend to choose between the faster of @code{TRUNC_DIV_EXPR},
3079 +@code{CEIL_DIV_EXPR} and @code{FLOOR_DIV_EXPR} for the current target.
3081 +@item LT_EXPR
3082 +@itemx LE_EXPR
3083 +@itemx GT_EXPR
3084 +@itemx GE_EXPR
3085 +@itemx EQ_EXPR
3086 +@itemx NE_EXPR
3087 +These nodes represent the less than, less than or equal to, greater
3088 +than, greater than or equal to, equal, and not equal comparison
3089 +operators. The first and second operand with either be both of integral
3090 +type or both of floating type. The result type of these expressions
3091 +will always be of integral or boolean type. These operations return
3092 +the result type's zero value for false, and the result type's one value
3093 +for true.
3095 +For floating point comparisons, if we honor IEEE NaNs and either operand
3096 +is NaN, then @code{NE_EXPR} always returns true and the remaining operators
3097 +always return false. On some targets, comparisons against an IEEE NaN,
3098 +other than equality and inequality, may generate a floating point exception.
3100 +@item ORDERED_EXPR
3101 +@itemx UNORDERED_EXPR
3102 +These nodes represent non-trapping ordered and unordered comparison
3103 +operators. These operations take two floating point operands and
3104 +determine whether they are ordered or unordered relative to each other.
3105 +If either operand is an IEEE NaN, their comparison is defined to be
3106 +unordered, otherwise the comparison is defined to be ordered. The
3107 +result type of these expressions will always be of integral or boolean
3108 +type. These operations return the result type's zero value for false,
3109 +and the result type's one value for true.
3111 +@item UNLT_EXPR
3112 +@itemx UNLE_EXPR
3113 +@itemx UNGT_EXPR
3114 +@itemx UNGE_EXPR
3115 +@itemx UNEQ_EXPR
3116 +@itemx LTGT_EXPR
3117 +These nodes represent the unordered comparison operators.
3118 +These operations take two floating point operands and determine whether
3119 +the operands are unordered or are less than, less than or equal to,
3120 +greater than, greater than or equal to, or equal respectively. For
3121 +example, @code{UNLT_EXPR} returns true if either operand is an IEEE
3122 +NaN or the first operand is less than the second. With the possible
3123 +exception of @code{LTGT_EXPR}, all of these operations are guaranteed
3124 +not to generate a floating point exception. The result
3125 +type of these expressions will always be of integral or boolean type.
3126 +These operations return the result type's zero value for false,
3127 +and the result type's one value for true.
3129 +@item MODIFY_EXPR
3130 +These nodes represent assignment. The left-hand side is the first
3131 +operand; the right-hand side is the second operand. The left-hand side
3132 +will be a @code{VAR_DECL}, @code{INDIRECT_REF}, @code{COMPONENT_REF}, or
3133 +other lvalue.
3135 +These nodes are used to represent not only assignment with @samp{=} but
3136 +also compound assignments (like @samp{+=}), by reduction to @samp{=}
3137 +assignment. In other words, the representation for @samp{i += 3} looks
3138 +just like that for @samp{i = i + 3}.
3140 +@item INIT_EXPR
3141 +These nodes are just like @code{MODIFY_EXPR}, but are used only when a
3142 +variable is initialized, rather than assigned to subsequently. This
3143 +means that we can assume that the target of the initialization is not
3144 +used in computing its own value; any reference to the lhs in computing
3145 +the rhs is undefined.
3147 +@item COMPOUND_EXPR
3148 +These nodes represent comma-expressions. The first operand is an
3149 +expression whose value is computed and thrown away prior to the
3150 +evaluation of the second operand. The value of the entire expression is
3151 +the value of the second operand.
3153 +@item COND_EXPR
3154 +These nodes represent @code{?:} expressions. The first operand
3155 +is of boolean or integral type. If it evaluates to a nonzero value,
3156 +the second operand should be evaluated, and returned as the value of the
3157 +expression. Otherwise, the third operand is evaluated, and returned as
3158 +the value of the expression.
3160 +The second operand must have the same type as the entire expression,
3161 +unless it unconditionally throws an exception or calls a noreturn
3162 +function, in which case it should have void type. The same constraints
3163 +apply to the third operand. This allows array bounds checks to be
3164 +represented conveniently as @code{(i >= 0 && i < 10) ? i : abort()}.
3166 +As a GNU extension, the C language front-ends allow the second
3167 +operand of the @code{?:} operator may be omitted in the source.
3168 +For example, @code{x ? : 3} is equivalent to @code{x ? x : 3},
3169 +assuming that @code{x} is an expression without side-effects.
3170 +In the tree representation, however, the second operand is always
3171 +present, possibly protected by @code{SAVE_EXPR} if the first
3172 +argument does cause side-effects.
3174 +@item CALL_EXPR
3175 +These nodes are used to represent calls to functions, including
3176 +non-static member functions. @code{CALL_EXPR}s are implemented as
3177 +expression nodes with a variable number of operands. Rather than using
3178 +@code{TREE_OPERAND} to extract them, it is preferable to use the
3179 +specialized accessor macros and functions that operate specifically on
3180 +@code{CALL_EXPR} nodes.
3182 +@code{CALL_EXPR_FN} returns a pointer to the
3183 +function to call; it is always an expression whose type is a
3184 +@code{POINTER_TYPE}.
3186 +The number of arguments to the call is returned by @code{call_expr_nargs},
3187 +while the arguments themselves can be accessed with the @code{CALL_EXPR_ARG}
3188 +macro. The arguments are zero-indexed and numbered left-to-right.
3189 +You can iterate over the arguments using @code{FOR_EACH_CALL_EXPR_ARG}, as in:
3191 +@smallexample
3192 +tree call, arg;
3193 +call_expr_arg_iterator iter;
3194 +FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
3195 + /* arg is bound to successive arguments of call. */
3196 + @dots{};
3197 +@end smallexample
3199 +For non-static
3200 +member functions, there will be an operand corresponding to the
3201 +@code{this} pointer. There will always be expressions corresponding to
3202 +all of the arguments, even if the function is declared with default
3203 +arguments and some arguments are not explicitly provided at the call
3204 +sites.
3206 +@code{CALL_EXPR}s also have a @code{CALL_EXPR_STATIC_CHAIN} operand that
3207 +is used to implement nested functions. This operand is otherwise null.
3209 +@item CLEANUP_POINT_EXPR
3210 +These nodes represent full-expressions. The single operand is an
3211 +expression to evaluate. Any destructor calls engendered by the creation
3212 +of temporaries during the evaluation of that expression should be
3213 +performed immediately after the expression is evaluated.
3215 +@item CONSTRUCTOR
3216 +These nodes represent the brace-enclosed initializers for a structure or
3217 +array. The first operand is reserved for use by the back end. The
3218 +second operand is a @code{TREE_LIST}. If the @code{TREE_TYPE} of the
3219 +@code{CONSTRUCTOR} is a @code{RECORD_TYPE} or @code{UNION_TYPE}, then
3220 +the @code{TREE_PURPOSE} of each node in the @code{TREE_LIST} will be a
3221 +@code{FIELD_DECL} and the @code{TREE_VALUE} of each node will be the
3222 +expression used to initialize that field.
3224 +If the @code{TREE_TYPE} of the @code{CONSTRUCTOR} is an
3225 +@code{ARRAY_TYPE}, then the @code{TREE_PURPOSE} of each element in the
3226 +@code{TREE_LIST} will be an @code{INTEGER_CST} or a @code{RANGE_EXPR} of
3227 +two @code{INTEGER_CST}s. A single @code{INTEGER_CST} indicates which
3228 +element of the array (indexed from zero) is being assigned to. A
3229 +@code{RANGE_EXPR} indicates an inclusive range of elements to
3230 +initialize. In both cases the @code{TREE_VALUE} is the corresponding
3231 +initializer. It is re-evaluated for each element of a
3232 +@code{RANGE_EXPR}. If the @code{TREE_PURPOSE} is @code{NULL_TREE}, then
3233 +the initializer is for the next available array element.
3235 +In the front end, you should not depend on the fields appearing in any
3236 +particular order. However, in the middle end, fields must appear in
3237 +declaration order. You should not assume that all fields will be
3238 +represented. Unrepresented fields will be set to zero.
3240 +@item COMPOUND_LITERAL_EXPR
3241 +@findex COMPOUND_LITERAL_EXPR_DECL_EXPR
3242 +@findex COMPOUND_LITERAL_EXPR_DECL
3243 +These nodes represent ISO C99 compound literals. The
3244 +@code{COMPOUND_LITERAL_EXPR_DECL_EXPR} is a @code{DECL_EXPR}
3245 +containing an anonymous @code{VAR_DECL} for
3246 +the unnamed object represented by the compound literal; the
3247 +@code{DECL_INITIAL} of that @code{VAR_DECL} is a @code{CONSTRUCTOR}
3248 +representing the brace-enclosed list of initializers in the compound
3249 +literal. That anonymous @code{VAR_DECL} can also be accessed directly
3250 +by the @code{COMPOUND_LITERAL_EXPR_DECL} macro.
3252 +@item SAVE_EXPR
3254 +A @code{SAVE_EXPR} represents an expression (possibly involving
3255 +side-effects) that is used more than once. The side-effects should
3256 +occur only the first time the expression is evaluated. Subsequent uses
3257 +should just reuse the computed value. The first operand to the
3258 +@code{SAVE_EXPR} is the expression to evaluate. The side-effects should
3259 +be executed where the @code{SAVE_EXPR} is first encountered in a
3260 +depth-first preorder traversal of the expression tree.
3262 +@item TARGET_EXPR
3263 +A @code{TARGET_EXPR} represents a temporary object. The first operand
3264 +is a @code{VAR_DECL} for the temporary variable. The second operand is
3265 +the initializer for the temporary. The initializer is evaluated and,
3266 +if non-void, copied (bitwise) into the temporary. If the initializer
3267 +is void, that means that it will perform the initialization itself.
3269 +Often, a @code{TARGET_EXPR} occurs on the right-hand side of an
3270 +assignment, or as the second operand to a comma-expression which is
3271 +itself the right-hand side of an assignment, etc. In this case, we say
3272 +that the @code{TARGET_EXPR} is ``normal''; otherwise, we say it is
3273 +``orphaned''. For a normal @code{TARGET_EXPR} the temporary variable
3274 +should be treated as an alias for the left-hand side of the assignment,
3275 +rather than as a new temporary variable.
3277 +The third operand to the @code{TARGET_EXPR}, if present, is a
3278 +cleanup-expression (i.e., destructor call) for the temporary. If this
3279 +expression is orphaned, then this expression must be executed when the
3280 +statement containing this expression is complete. These cleanups must
3281 +always be executed in the order opposite to that in which they were
3282 +encountered. Note that if a temporary is created on one branch of a
3283 +conditional operator (i.e., in the second or third operand to a
3284 +@code{COND_EXPR}), the cleanup must be run only if that branch is
3285 +actually executed.
3287 +@item VA_ARG_EXPR
3288 +This node is used to implement support for the C/C++ variable argument-list
3289 +mechanism. It represents expressions like @code{va_arg (ap, type)}.
3290 +Its @code{TREE_TYPE} yields the tree representation for @code{type} and
3291 +its sole argument yields the representation for @code{ap}.
3293 +@end table
3295 +@node Vectors
3296 +@subsection Vectors
3297 +@tindex VEC_LSHIFT_EXPR
3298 +@tindex VEC_RSHIFT_EXPR
3299 +@tindex VEC_WIDEN_MULT_HI_EXPR
3300 +@tindex VEC_WIDEN_MULT_LO_EXPR
3301 +@tindex VEC_UNPACK_HI_EXPR
3302 +@tindex VEC_UNPACK_LO_EXPR
3303 +@tindex VEC_UNPACK_FLOAT_HI_EXPR
3304 +@tindex VEC_UNPACK_FLOAT_LO_EXPR
3305 +@tindex VEC_PACK_TRUNC_EXPR
3306 +@tindex VEC_PACK_SAT_EXPR
3307 +@tindex VEC_PACK_FIX_TRUNC_EXPR
3308 +@tindex VEC_EXTRACT_EVEN_EXPR
3309 +@tindex VEC_EXTRACT_ODD_EXPR
3310 +@tindex VEC_INTERLEAVE_HIGH_EXPR
3311 +@tindex VEC_INTERLEAVE_LOW_EXPR
3313 +@table @code
3314 +@item VEC_LSHIFT_EXPR
3315 +@itemx VEC_RSHIFT_EXPR
3316 +These nodes represent whole vector left and right shifts, respectively.
3317 +The first operand is the vector to shift; it will always be of vector type.
3318 +The second operand is an expression for the number of bits by which to
3319 +shift. Note that the result is undefined if the second operand is larger
3320 +than or equal to the first operand's type size.
3322 +@item VEC_WIDEN_MULT_HI_EXPR
3323 +@itemx VEC_WIDEN_MULT_LO_EXPR
3324 +These nodes represent widening vector multiplication of the high and low
3325 +parts of the two input vectors, respectively. Their operands are vectors
3326 +that contain the same number of elements (@code{N}) of the same integral type.
3327 +The result is a vector that contains half as many elements, of an integral type
3328 +whose size is twice as wide. In the case of @code{VEC_WIDEN_MULT_HI_EXPR} the
3329 +high @code{N/2} elements of the two vector are multiplied to produce the
3330 +vector of @code{N/2} products. In the case of @code{VEC_WIDEN_MULT_LO_EXPR} the
3331 +low @code{N/2} elements of the two vector are multiplied to produce the
3332 +vector of @code{N/2} products.
3334 +@item VEC_UNPACK_HI_EXPR
3335 +@itemx VEC_UNPACK_LO_EXPR
3336 +These nodes represent unpacking of the high and low parts of the input vector,
3337 +respectively. The single operand is a vector that contains @code{N} elements
3338 +of the same integral or floating point type. The result is a vector
3339 +that contains half as many elements, of an integral or floating point type
3340 +whose size is twice as wide. In the case of @code{VEC_UNPACK_HI_EXPR} the
3341 +high @code{N/2} elements of the vector are extracted and widened (promoted).
3342 +In the case of @code{VEC_UNPACK_LO_EXPR} the low @code{N/2} elements of the
3343 +vector are extracted and widened (promoted).
3345 +@item VEC_UNPACK_FLOAT_HI_EXPR
3346 +@itemx VEC_UNPACK_FLOAT_LO_EXPR
3347 +These nodes represent unpacking of the high and low parts of the input vector,
3348 +where the values are converted from fixed point to floating point. The
3349 +single operand is a vector that contains @code{N} elements of the same
3350 +integral type. The result is a vector that contains half as many elements
3351 +of a floating point type whose size is twice as wide. In the case of
3352 +@code{VEC_UNPACK_HI_EXPR} the high @code{N/2} elements of the vector are
3353 +extracted, converted and widened. In the case of @code{VEC_UNPACK_LO_EXPR}
3354 +the low @code{N/2} elements of the vector are extracted, converted and widened.
3356 +@item VEC_PACK_TRUNC_EXPR
3357 +This node represents packing of truncated elements of the two input vectors
3358 +into the output vector. Input operands are vectors that contain the same
3359 +number of elements of the same integral or floating point type. The result
3360 +is a vector that contains twice as many elements of an integral or floating
3361 +point type whose size is half as wide. The elements of the two vectors are
3362 +demoted and merged (concatenated) to form the output vector.
3364 +@item VEC_PACK_SAT_EXPR
3365 +This node represents packing of elements of the two input vectors into the
3366 +output vector using saturation. Input operands are vectors that contain
3367 +the same number of elements of the same integral type. The result is a
3368 +vector that contains twice as many elements of an integral type whose size
3369 +is half as wide. The elements of the two vectors are demoted and merged
3370 +(concatenated) to form the output vector.
3372 +@item VEC_PACK_FIX_TRUNC_EXPR
3373 +This node represents packing of elements of the two input vectors into the
3374 +output vector, where the values are converted from floating point
3375 +to fixed point. Input operands are vectors that contain the same number
3376 +of elements of a floating point type. The result is a vector that contains
3377 +twice as many elements of an integral type whose size is half as wide. The
3378 +elements of the two vectors are merged (concatenated) to form the output
3379 +vector.
3381 +@item VEC_EXTRACT_EVEN_EXPR
3382 +@itemx VEC_EXTRACT_ODD_EXPR
3383 +These nodes represent extracting of the even/odd elements of the two input
3384 +vectors, respectively. Their operands and result are vectors that contain the
3385 +same number of elements of the same type.
3387 +@item VEC_INTERLEAVE_HIGH_EXPR
3388 +@itemx VEC_INTERLEAVE_LOW_EXPR
3389 +These nodes represent merging and interleaving of the high/low elements of the
3390 +two input vectors, respectively. The operands and the result are vectors that
3391 +contain the same number of elements (@code{N}) of the same type.
3392 +In the case of @code{VEC_INTERLEAVE_HIGH_EXPR}, the high @code{N/2} elements of
3393 +the first input vector are interleaved with the high @code{N/2} elements of the
3394 +second input vector. In the case of @code{VEC_INTERLEAVE_LOW_EXPR}, the low
3395 +@code{N/2} elements of the first input vector are interleaved with the low
3396 +@code{N/2} elements of the second input vector.
3398 +@end table
3401 +@c ---------------------------------------------------------------------
3402 +@c Statements
3403 +@c ---------------------------------------------------------------------
3405 +@node Statements
3406 +@section Statements
3407 +@cindex Statements
3409 +Most statements in GIMPLE are assignment statements, represented by
3410 +@code{GIMPLE_ASSIGN}. No other C expressions can appear at statement level;
3411 +a reference to a volatile object is converted into a
3412 +@code{GIMPLE_ASSIGN}.
3414 +There are also several varieties of complex statements.
3416 +@menu
3417 +* Basic Statements::
3418 +* Blocks::
3419 +* Statement Sequences::
3420 +* Empty Statements::
3421 +* Jumps::
3422 +* Cleanups::
3423 +* OpenMP::
3424 +@end menu
3426 +@node Basic Statements
3427 +@subsection Basic Statements
3428 +@cindex Basic Statements
3430 +@table @code
3431 +@item ASM_EXPR
3433 +Used to represent an inline assembly statement. For an inline assembly
3434 +statement like:
3435 +@smallexample
3436 +asm ("mov x, y");
3437 +@end smallexample
3438 +The @code{ASM_STRING} macro will return a @code{STRING_CST} node for
3439 +@code{"mov x, y"}. If the original statement made use of the
3440 +extended-assembly syntax, then @code{ASM_OUTPUTS},
3441 +@code{ASM_INPUTS}, and @code{ASM_CLOBBERS} will be the outputs, inputs,
3442 +and clobbers for the statement, represented as @code{STRING_CST} nodes.
3443 +The extended-assembly syntax looks like:
3444 +@smallexample
3445 +asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
3446 +@end smallexample
3447 +The first string is the @code{ASM_STRING}, containing the instruction
3448 +template. The next two strings are the output and inputs, respectively;
3449 +this statement has no clobbers. As this example indicates, ``plain''
3450 +assembly statements are merely a special case of extended assembly
3451 +statements; they have no cv-qualifiers, outputs, inputs, or clobbers.
3452 +All of the strings will be @code{NUL}-terminated, and will contain no
3453 +embedded @code{NUL}-characters.
3455 +If the assembly statement is declared @code{volatile}, or if the
3456 +statement was not an extended assembly statement, and is therefore
3457 +implicitly volatile, then the predicate @code{ASM_VOLATILE_P} will hold
3458 +of the @code{ASM_EXPR}.
3460 +@item DECL_EXPR
3462 +Used to represent a local declaration. The @code{DECL_EXPR_DECL} macro
3463 +can be used to obtain the entity declared. This declaration may be a
3464 +@code{LABEL_DECL}, indicating that the label declared is a local label.
3465 +(As an extension, GCC allows the declaration of labels with scope.) In
3466 +C, this declaration may be a @code{FUNCTION_DECL}, indicating the
3467 +use of the GCC nested function extension. For more information,
3468 +@pxref{Functions}.
3470 +@item LABEL_EXPR
3472 +Used to represent a label. The @code{LABEL_DECL} declared by this
3473 +statement can be obtained with the @code{LABEL_EXPR_LABEL} macro. The
3474 +@code{IDENTIFIER_NODE} giving the name of the label can be obtained from
3475 +the @code{LABEL_DECL} with @code{DECL_NAME}.
3477 +@item GOTO_EXPR
3479 +Used to represent a @code{goto} statement. The @code{GOTO_DESTINATION} will
3480 +usually be a @code{LABEL_DECL}. However, if the ``computed goto'' extension
3481 +has been used, the @code{GOTO_DESTINATION} will be an arbitrary expression
3482 +indicating the destination. This expression will always have pointer type.
3484 +@item RETURN_EXPR
3486 +Used to represent a @code{return} statement. Operand 0 represents the
3487 +value to return. It should either be the @code{RESULT_DECL} for the
3488 +containing function, or a @code{MODIFY_EXPR} or @code{INIT_EXPR}
3489 +setting the function's @code{RESULT_DECL}. It will be
3490 +@code{NULL_TREE} if the statement was just
3491 +@smallexample
3492 +return;
3493 +@end smallexample
3495 +@item LOOP_EXPR
3496 +These nodes represent ``infinite'' loops. The @code{LOOP_EXPR_BODY}
3497 +represents the body of the loop. It should be executed forever, unless
3498 +an @code{EXIT_EXPR} is encountered.
3500 +@item EXIT_EXPR
3501 +These nodes represent conditional exits from the nearest enclosing
3502 +@code{LOOP_EXPR}. The single operand is the condition; if it is
3503 +nonzero, then the loop should be exited. An @code{EXIT_EXPR} will only
3504 +appear within a @code{LOOP_EXPR}.
3506 +@item SWITCH_STMT
3508 +Used to represent a @code{switch} statement. The @code{SWITCH_STMT_COND}
3509 +is the expression on which the switch is occurring. See the documentation
3510 +for an @code{IF_STMT} for more information on the representation used
3511 +for the condition. The @code{SWITCH_STMT_BODY} is the body of the switch
3512 +statement. The @code{SWITCH_STMT_TYPE} is the original type of switch
3513 +expression as given in the source, before any compiler conversions.
3515 +@item CASE_LABEL_EXPR
3517 +Use to represent a @code{case} label, range of @code{case} labels, or a
3518 +@code{default} label. If @code{CASE_LOW} is @code{NULL_TREE}, then this is a
3519 +@code{default} label. Otherwise, if @code{CASE_HIGH} is @code{NULL_TREE}, then
3520 +this is an ordinary @code{case} label. In this case, @code{CASE_LOW} is
3521 +an expression giving the value of the label. Both @code{CASE_LOW} and
3522 +@code{CASE_HIGH} are @code{INTEGER_CST} nodes. These values will have
3523 +the same type as the condition expression in the switch statement.
3525 +Otherwise, if both @code{CASE_LOW} and @code{CASE_HIGH} are defined, the
3526 +statement is a range of case labels. Such statements originate with the
3527 +extension that allows users to write things of the form:
3528 +@smallexample
3529 +case 2 ... 5:
3530 +@end smallexample
3531 +The first value will be @code{CASE_LOW}, while the second will be
3532 +@code{CASE_HIGH}.
3534 +@end table
3537 +@node Blocks
3538 +@subsection Blocks
3539 +@cindex Blocks
3541 +Block scopes and the variables they declare in GENERIC are
3542 +expressed using the @code{BIND_EXPR} code, which in previous
3543 +versions of GCC was primarily used for the C statement-expression
3544 +extension.
3546 +Variables in a block are collected into @code{BIND_EXPR_VARS} in
3547 +declaration order through their @code{TREE_CHAIN} field. Any runtime
3548 +initialization is moved out of @code{DECL_INITIAL} and into a
3549 +statement in the controlled block. When gimplifying from C or C++,
3550 +this initialization replaces the @code{DECL_STMT}. These variables
3551 +will never require cleanups. The scope of these variables is just the
3552 +body
3554 +Variable-length arrays (VLAs) complicate this process, as their
3555 +size often refers to variables initialized earlier in the block.
3556 +To handle this, we currently split the block at that point, and
3557 +move the VLA into a new, inner @code{BIND_EXPR}. This strategy
3558 +may change in the future.
3560 +A C++ program will usually contain more @code{BIND_EXPR}s than
3561 +there are syntactic blocks in the source code, since several C++
3562 +constructs have implicit scopes associated with them. On the
3563 +other hand, although the C++ front end uses pseudo-scopes to
3564 +handle cleanups for objects with destructors, these don't
3565 +translate into the GIMPLE form; multiple declarations at the same
3566 +level use the same @code{BIND_EXPR}.
3568 +@node Statement Sequences
3569 +@subsection Statement Sequences
3570 +@cindex Statement Sequences
3572 +Multiple statements at the same nesting level are collected into
3573 +a @code{STATEMENT_LIST}. Statement lists are modified and
3574 +traversed using the interface in @samp{tree-iterator.h}.
3576 +@node Empty Statements
3577 +@subsection Empty Statements
3578 +@cindex Empty Statements
3580 +Whenever possible, statements with no effect are discarded. But
3581 +if they are nested within another construct which cannot be
3582 +discarded for some reason, they are instead replaced with an
3583 +empty statement, generated by @code{build_empty_stmt}.
3584 +Initially, all empty statements were shared, after the pattern of
3585 +the Java front end, but this caused a lot of trouble in practice.
3587 +An empty statement is represented as @code{(void)0}.
3589 +@node Jumps
3590 +@subsection Jumps
3591 +@cindex Jumps
3593 +Other jumps are expressed by either @code{GOTO_EXPR} or
3594 +@code{RETURN_EXPR}.
3596 +The operand of a @code{GOTO_EXPR} must be either a label or a
3597 +variable containing the address to jump to.
3599 +The operand of a @code{RETURN_EXPR} is either @code{NULL_TREE},
3600 +@code{RESULT_DECL}, or a @code{MODIFY_EXPR} which sets the return
3601 +value. It would be nice to move the @code{MODIFY_EXPR} into a
3602 +separate statement, but the special return semantics in
3603 +@code{expand_return} make that difficult. It may still happen in
3604 +the future, perhaps by moving most of that logic into
3605 +@code{expand_assignment}.
3607 +@node Cleanups
3608 +@subsection Cleanups
3609 +@cindex Cleanups
3611 +Destructors for local C++ objects and similar dynamic cleanups are
3612 +represented in GIMPLE by a @code{TRY_FINALLY_EXPR}.
3613 +@code{TRY_FINALLY_EXPR} has two operands, both of which are a sequence
3614 +of statements to execute. The first sequence is executed. When it
3615 +completes the second sequence is executed.
3617 +The first sequence may complete in the following ways:
3619 +@enumerate
3621 +@item Execute the last statement in the sequence and fall off the
3622 +end.
3624 +@item Execute a goto statement (@code{GOTO_EXPR}) to an ordinary
3625 +label outside the sequence.
3627 +@item Execute a return statement (@code{RETURN_EXPR}).
3629 +@item Throw an exception. This is currently not explicitly represented in
3630 +GIMPLE.
3632 +@end enumerate
3634 +The second sequence is not executed if the first sequence completes by
3635 +calling @code{setjmp} or @code{exit} or any other function that does
3636 +not return. The second sequence is also not executed if the first
3637 +sequence completes via a non-local goto or a computed goto (in general
3638 +the compiler does not know whether such a goto statement exits the
3639 +first sequence or not, so we assume that it doesn't).
3641 +After the second sequence is executed, if it completes normally by
3642 +falling off the end, execution continues wherever the first sequence
3643 +would have continued, by falling off the end, or doing a goto, etc.
3645 +@code{TRY_FINALLY_EXPR} complicates the flow graph, since the cleanup
3646 +needs to appear on every edge out of the controlled block; this
3647 +reduces the freedom to move code across these edges. Therefore, the
3648 +EH lowering pass which runs before most of the optimization passes
3649 +eliminates these expressions by explicitly adding the cleanup to each
3650 +edge. Rethrowing the exception is represented using @code{RESX_EXPR}.
3652 +@node OpenMP
3653 +@subsection OpenMP
3654 +@tindex OMP_PARALLEL
3655 +@tindex OMP_FOR
3656 +@tindex OMP_SECTIONS
3657 +@tindex OMP_SINGLE
3658 +@tindex OMP_SECTION
3659 +@tindex OMP_MASTER
3660 +@tindex OMP_ORDERED
3661 +@tindex OMP_CRITICAL
3662 +@tindex OMP_RETURN
3663 +@tindex OMP_CONTINUE
3664 +@tindex OMP_ATOMIC
3665 +@tindex OMP_CLAUSE
3667 +All the statements starting with @code{OMP_} represent directives and
3668 +clauses used by the OpenMP API @w{@uref{http://www.openmp.org/}}.
3670 +@table @code
3671 +@item OMP_PARALLEL
3673 +Represents @code{#pragma omp parallel [clause1 @dots{} clauseN]}. It
3674 +has four operands:
3676 +Operand @code{OMP_PARALLEL_BODY} is valid while in GENERIC and
3677 +High GIMPLE forms. It contains the body of code to be executed
3678 +by all the threads. During GIMPLE lowering, this operand becomes
3679 +@code{NULL} and the body is emitted linearly after
3680 +@code{OMP_PARALLEL}.
3682 +Operand @code{OMP_PARALLEL_CLAUSES} is the list of clauses
3683 +associated with the directive.
3685 +Operand @code{OMP_PARALLEL_FN} is created by
3686 +@code{pass_lower_omp}, it contains the @code{FUNCTION_DECL}
3687 +for the function that will contain the body of the parallel
3688 +region.
3690 +Operand @code{OMP_PARALLEL_DATA_ARG} is also created by
3691 +@code{pass_lower_omp}. If there are shared variables to be
3692 +communicated to the children threads, this operand will contain
3693 +the @code{VAR_DECL} that contains all the shared values and
3694 +variables.
3696 +@item OMP_FOR
3698 +Represents @code{#pragma omp for [clause1 @dots{} clauseN]}. It
3699 +has 5 operands:
3701 +Operand @code{OMP_FOR_BODY} contains the loop body.
3703 +Operand @code{OMP_FOR_CLAUSES} is the list of clauses
3704 +associated with the directive.
3706 +Operand @code{OMP_FOR_INIT} is the loop initialization code of
3707 +the form @code{VAR = N1}.
3709 +Operand @code{OMP_FOR_COND} is the loop conditional expression
3710 +of the form @code{VAR @{<,>,<=,>=@} N2}.
3712 +Operand @code{OMP_FOR_INCR} is the loop index increment of the
3713 +form @code{VAR @{+=,-=@} INCR}.
3715 +Operand @code{OMP_FOR_PRE_BODY} contains side-effect code from
3716 +operands @code{OMP_FOR_INIT}, @code{OMP_FOR_COND} and
3717 +@code{OMP_FOR_INC}. These side-effects are part of the
3718 +@code{OMP_FOR} block but must be evaluated before the start of
3719 +loop body.
3721 +The loop index variable @code{VAR} must be a signed integer variable,
3722 +which is implicitly private to each thread. Bounds
3723 +@code{N1} and @code{N2} and the increment expression
3724 +@code{INCR} are required to be loop invariant integer
3725 +expressions that are evaluated without any synchronization. The
3726 +evaluation order, frequency of evaluation and side-effects are
3727 +unspecified by the standard.
3729 +@item OMP_SECTIONS
3731 +Represents @code{#pragma omp sections [clause1 @dots{} clauseN]}.
3733 +Operand @code{OMP_SECTIONS_BODY} contains the sections body,
3734 +which in turn contains a set of @code{OMP_SECTION} nodes for
3735 +each of the concurrent sections delimited by @code{#pragma omp
3736 +section}.
3738 +Operand @code{OMP_SECTIONS_CLAUSES} is the list of clauses
3739 +associated with the directive.
3741 +@item OMP_SECTION
3743 +Section delimiter for @code{OMP_SECTIONS}.
3745 +@item OMP_SINGLE
3747 +Represents @code{#pragma omp single}.
3749 +Operand @code{OMP_SINGLE_BODY} contains the body of code to be
3750 +executed by a single thread.
3752 +Operand @code{OMP_SINGLE_CLAUSES} is the list of clauses
3753 +associated with the directive.
3755 +@item OMP_MASTER
3757 +Represents @code{#pragma omp master}.
3759 +Operand @code{OMP_MASTER_BODY} contains the body of code to be
3760 +executed by the master thread.
3762 +@item OMP_ORDERED
3764 +Represents @code{#pragma omp ordered}.
3766 +Operand @code{OMP_ORDERED_BODY} contains the body of code to be
3767 +executed in the sequential order dictated by the loop index
3768 +variable.
3770 +@item OMP_CRITICAL
3772 +Represents @code{#pragma omp critical [name]}.
3774 +Operand @code{OMP_CRITICAL_BODY} is the critical section.
3776 +Operand @code{OMP_CRITICAL_NAME} is an optional identifier to
3777 +label the critical section.
3779 +@item OMP_RETURN
3781 +This does not represent any OpenMP directive, it is an artificial
3782 +marker to indicate the end of the body of an OpenMP@. It is used
3783 +by the flow graph (@code{tree-cfg.c}) and OpenMP region
3784 +building code (@code{omp-low.c}).
3786 +@item OMP_CONTINUE
3788 +Similarly, this instruction does not represent an OpenMP
3789 +directive, it is used by @code{OMP_FOR} and
3790 +@code{OMP_SECTIONS} to mark the place where the code needs to
3791 +loop to the next iteration (in the case of @code{OMP_FOR}) or
3792 +the next section (in the case of @code{OMP_SECTIONS}).
3794 +In some cases, @code{OMP_CONTINUE} is placed right before
3795 +@code{OMP_RETURN}. But if there are cleanups that need to
3796 +occur right after the looping body, it will be emitted between
3797 +@code{OMP_CONTINUE} and @code{OMP_RETURN}.
3799 +@item OMP_ATOMIC
3801 +Represents @code{#pragma omp atomic}.
3803 +Operand 0 is the address at which the atomic operation is to be
3804 +performed.
3806 +Operand 1 is the expression to evaluate. The gimplifier tries
3807 +three alternative code generation strategies. Whenever possible,
3808 +an atomic update built-in is used. If that fails, a
3809 +compare-and-swap loop is attempted. If that also fails, a
3810 +regular critical section around the expression is used.
3812 +@item OMP_CLAUSE
3814 +Represents clauses associated with one of the @code{OMP_} directives.
3815 +Clauses are represented by separate sub-codes defined in
3816 +@file{tree.h}. Clauses codes can be one of:
3817 +@code{OMP_CLAUSE_PRIVATE}, @code{OMP_CLAUSE_SHARED},
3818 +@code{OMP_CLAUSE_FIRSTPRIVATE},
3819 +@code{OMP_CLAUSE_LASTPRIVATE}, @code{OMP_CLAUSE_COPYIN},
3820 +@code{OMP_CLAUSE_COPYPRIVATE}, @code{OMP_CLAUSE_IF},
3821 +@code{OMP_CLAUSE_NUM_THREADS}, @code{OMP_CLAUSE_SCHEDULE},
3822 +@code{OMP_CLAUSE_NOWAIT}, @code{OMP_CLAUSE_ORDERED},
3823 +@code{OMP_CLAUSE_DEFAULT}, and @code{OMP_CLAUSE_REDUCTION}. Each code
3824 +represents the corresponding OpenMP clause.
3826 +Clauses associated with the same directive are chained together
3827 +via @code{OMP_CLAUSE_CHAIN}. Those clauses that accept a list
3828 +of variables are restricted to exactly one, accessed with
3829 +@code{OMP_CLAUSE_VAR}. Therefore, multiple variables under the
3830 +same clause @code{C} need to be represented as multiple @code{C} clauses
3831 +chained together. This facilitates adding new clauses during
3832 +compilation.
3834 +@end table
3836 +@c ---------------------------------------------------------------------
3837 +@c Functions
3838 +@c ---------------------------------------------------------------------
3840 +@node Functions
3841 +@section Functions
3842 +@cindex function
3843 +@tindex FUNCTION_DECL
3845 +A function is represented by a @code{FUNCTION_DECL} node. It stores
3846 +the basic pieces of the function such as body, parameters, and return
3847 +type as well as information on the surrounding context, visibility,
3848 +and linkage.
3850 +@menu
3851 +* Function Basics:: Function names, body, and parameters.
3852 +* Function Properties:: Context, linkage, etc.
3853 +@end menu
3855 +@c ---------------------------------------------------------------------
3856 +@c Function Basics
3857 +@c ---------------------------------------------------------------------
3859 +@node Function Basics
3860 +@subsection Function Basics
3861 +@findex DECL_NAME
3862 +@findex DECL_ASSEMBLER_NAME
3863 +@findex TREE_PUBLIC
3864 +@findex DECL_ARTIFICIAL
3865 +@findex DECL_FUNCTION_SPECIFIC_TARGET
3866 +@findex DECL_FUNCTION_SPECIFIC_OPTIMIZATION
3868 +A function has four core parts: the name, the parameters, the result,
3869 +and the body. The following macros and functions access these parts
3870 +of a @code{FUNCTION_DECL} as well as other basic features:
3871 +@ftable @code
3872 +@item DECL_NAME
3873 +This macro returns the unqualified name of the function, as an
3874 +@code{IDENTIFIER_NODE}. For an instantiation of a function template,
3875 +the @code{DECL_NAME} is the unqualified name of the template, not
3876 +something like @code{f<int>}. The value of @code{DECL_NAME} is
3877 +undefined when used on a constructor, destructor, overloaded operator,
3878 +or type-conversion operator, or any function that is implicitly
3879 +generated by the compiler. See below for macros that can be used to
3880 +distinguish these cases.
3882 +@item DECL_ASSEMBLER_NAME
3883 +This macro returns the mangled name of the function, also an
3884 +@code{IDENTIFIER_NODE}. This name does not contain leading underscores
3885 +on systems that prefix all identifiers with underscores. The mangled
3886 +name is computed in the same way on all platforms; if special processing
3887 +is required to deal with the object file format used on a particular
3888 +platform, it is the responsibility of the back end to perform those
3889 +modifications. (Of course, the back end should not modify
3890 +@code{DECL_ASSEMBLER_NAME} itself.)
3892 +Using @code{DECL_ASSEMBLER_NAME} will cause additional memory to be
3893 +allocated (for the mangled name of the entity) so it should be used
3894 +only when emitting assembly code. It should not be used within the
3895 +optimizers to determine whether or not two declarations are the same,
3896 +even though some of the existing optimizers do use it in that way.
3897 +These uses will be removed over time.
3899 +@item DECL_ARGUMENTS
3900 +This macro returns the @code{PARM_DECL} for the first argument to the
3901 +function. Subsequent @code{PARM_DECL} nodes can be obtained by
3902 +following the @code{TREE_CHAIN} links.
3904 +@item DECL_RESULT
3905 +This macro returns the @code{RESULT_DECL} for the function.
3907 +@item DECL_SAVED_TREE
3908 +This macro returns the complete body of the function.
3910 +@item TREE_TYPE
3911 +This macro returns the @code{FUNCTION_TYPE} or @code{METHOD_TYPE} for
3912 +the function.
3914 +@item DECL_INITIAL
3915 +A function that has a definition in the current translation unit will
3916 +have a non-@code{NULL} @code{DECL_INITIAL}. However, back ends should not make
3917 +use of the particular value given by @code{DECL_INITIAL}.
3919 +It should contain a tree of @code{BLOCK} nodes that mirrors the scopes
3920 +that variables are bound in the function. Each block contains a list
3921 +of decls declared in a basic block, a pointer to a chain of blocks at
3922 +the next lower scope level, then a pointer to the next block at the
3923 +same level and a backpointer to the parent @code{BLOCK} or
3924 +@code{FUNCTION_DECL}. So given a function as follows:
3926 +@smallexample
3927 +void foo()
3929 + int a;
3930 + @{
3931 + int b;
3932 + @}
3933 + int c;
3935 +@end smallexample
3937 +you would get the following:
3939 +@smallexample
3940 +tree foo = FUNCTION_DECL;
3941 +tree decl_a = VAR_DECL;
3942 +tree decl_b = VAR_DECL;
3943 +tree decl_c = VAR_DECL;
3944 +tree block_a = BLOCK;
3945 +tree block_b = BLOCK;
3946 +tree block_c = BLOCK;
3947 +BLOCK_VARS(block_a) = decl_a;
3948 +BLOCK_SUBBLOCKS(block_a) = block_b;
3949 +BLOCK_CHAIN(block_a) = block_c;
3950 +BLOCK_SUPERCONTEXT(block_a) = foo;
3951 +BLOCK_VARS(block_b) = decl_b;
3952 +BLOCK_SUPERCONTEXT(block_b) = block_a;
3953 +BLOCK_VARS(block_c) = decl_c;
3954 +BLOCK_SUPERCONTEXT(block_c) = foo;
3955 +DECL_INITIAL(foo) = block_a;
3956 +@end smallexample
3958 +@end ftable
3960 +@c ---------------------------------------------------------------------
3961 +@c Function Properties
3962 +@c ---------------------------------------------------------------------
3964 +@node Function Properties
3965 +@subsection Function Properties
3966 +@cindex function properties
3967 +@cindex statements
3969 +To determine the scope of a function, you can use the
3970 +@code{DECL_CONTEXT} macro. This macro will return the class
3971 +(either a @code{RECORD_TYPE} or a @code{UNION_TYPE}) or namespace (a
3972 +@code{NAMESPACE_DECL}) of which the function is a member. For a virtual
3973 +function, this macro returns the class in which the function was
3974 +actually defined, not the base class in which the virtual declaration
3975 +occurred.
3977 +In C, the @code{DECL_CONTEXT} for a function maybe another function.
3978 +This representation indicates that the GNU nested function extension
3979 +is in use. For details on the semantics of nested functions, see the
3980 +GCC Manual. The nested function can refer to local variables in its
3981 +containing function. Such references are not explicitly marked in the
3982 +tree structure; back ends must look at the @code{DECL_CONTEXT} for the
3983 +referenced @code{VAR_DECL}. If the @code{DECL_CONTEXT} for the
3984 +referenced @code{VAR_DECL} is not the same as the function currently
3985 +being processed, and neither @code{DECL_EXTERNAL} nor
3986 +@code{TREE_STATIC} hold, then the reference is to a local variable in
3987 +a containing function, and the back end must take appropriate action.
3989 +@ftable @code
3990 +@item DECL_EXTERNAL
3991 +This predicate holds if the function is undefined.
3993 +@item TREE_PUBLIC
3994 +This predicate holds if the function has external linkage.
3996 +@item TREE_STATIC
3997 +This predicate holds if the function has been defined.
3999 +@item TREE_THIS_VOLATILE
4000 +This predicate holds if the function does not return normally.
4002 +@item TREE_READONLY
4003 +This predicate holds if the function can only read its arguments.
4005 +@item DECL_PURE_P
4006 +This predicate holds if the function can only read its arguments, but
4007 +may also read global memory.
4009 +@item DECL_VIRTUAL_P
4010 +This predicate holds if the function is virtual.
4012 +@item DECL_ARTIFICIAL
4013 +This macro holds if the function was implicitly generated by the
4014 +compiler, rather than explicitly declared. In addition to implicitly
4015 +generated class member functions, this macro holds for the special
4016 +functions created to implement static initialization and destruction, to
4017 +compute run-time type information, and so forth.
4019 +@item DECL_FUNCTION_SPECIFIC_TARGET
4020 +This macro returns a tree node that holds the target options that are
4021 +to be used to compile this particular function or @code{NULL_TREE} if
4022 +the function is to be compiled with the target options specified on
4023 +the command line.
4025 +@item DECL_FUNCTION_SPECIFIC_OPTIMIZATION
4026 +This macro returns a tree node that holds the optimization options
4027 +that are to be used to compile this particular function or
4028 +@code{NULL_TREE} if the function is to be compiled with the
4029 +optimization options specified on the command line.
4031 +@end ftable
4033 +@c ---------------------------------------------------------------------
4034 +@c Language-dependent trees
4035 +@c ---------------------------------------------------------------------
4037 +@node Language-dependent trees
4038 +@section Language-dependent trees
4039 +@cindex language-dependent trees
4041 +Front ends may wish to keep some state associated with various GENERIC
4042 +trees while parsing. To support this, trees provide a set of flags
4043 +that may be used by the front end. They are accessed using
4044 +@code{TREE_LANG_FLAG_n} where @samp{n} is currently 0 through 6.
4046 +If necessary, a front end can use some language-dependent tree
4047 +codes in its GENERIC representation, so long as it provides a
4048 +hook for converting them to GIMPLE and doesn't expect them to
4049 +work with any (hypothetical) optimizers that run before the
4050 +conversion to GIMPLE@. The intermediate representation used while
4051 +parsing C and C++ looks very little like GENERIC, but the C and
4052 +C++ gimplifier hooks are perfectly happy to take it as input and
4053 +spit out GIMPLE@.
4057 +@node C and C++ Trees
4058 +@section C and C++ Trees
4060 +This section documents the internal representation used by GCC to
4061 +represent C and C++ source programs. When presented with a C or C++
4062 +source program, GCC parses the program, performs semantic analysis
4063 +(including the generation of error messages), and then produces the
4064 +internal representation described here. This representation contains a
4065 +complete representation for the entire translation unit provided as
4066 +input to the front end. This representation is then typically processed
4067 +by a code-generator in order to produce machine code, but could also be
4068 +used in the creation of source browsers, intelligent editors, automatic
4069 +documentation generators, interpreters, and any other programs needing
4070 +the ability to process C or C++ code.
4072 +This section explains the internal representation. In particular, it
4073 +documents the internal representation for C and C++ source
4074 +constructs, and the macros, functions, and variables that can be used to
4075 +access these constructs. The C++ representation is largely a superset
4076 +of the representation used in the C front end. There is only one
4077 +construct used in C that does not appear in the C++ front end and that
4078 +is the GNU ``nested function'' extension. Many of the macros documented
4079 +here do not apply in C because the corresponding language constructs do
4080 +not appear in C@.
4082 +The C and C++ front ends generate a mix of GENERIC trees and ones
4083 +specific to C and C++. These language-specific trees are higher-level
4084 +constructs than the ones in GENERIC to make the parser's job easier.
4085 +This section describes those trees that aren't part of GENERIC as well
4086 +as aspects of GENERIC trees that are treated in a language-specific
4087 +manner.
4089 +If you are developing a ``back end'', be it is a code-generator or some
4090 +other tool, that uses this representation, you may occasionally find
4091 +that you need to ask questions not easily answered by the functions and
4092 +macros available here. If that situation occurs, it is quite likely
4093 +that GCC already supports the functionality you desire, but that the
4094 +interface is simply not documented here. In that case, you should ask
4095 +the GCC maintainers (via mail to @email{gcc@@gcc.gnu.org}) about
4096 +documenting the functionality you require. Similarly, if you find
4097 +yourself writing functions that do not deal directly with your back end,
4098 +but instead might be useful to other people using the GCC front end, you
4099 +should submit your patches for inclusion in GCC@.
4101 +@menu
4102 +* Types for C++:: Fundamental and aggregate types.
4103 +* Namespaces:: Namespaces.
4104 +* Classes:: Classes.
4105 +* Functions for C++:: Overloading and accessors for C++.
4106 +* Statements for C++:: Statements specific to C and C++.
4107 +* C++ Expressions:: From @code{typeid} to @code{throw}.
4108 +@end menu
4110 +@node Types for C++
4111 +@subsection Types for C++
4112 +@tindex UNKNOWN_TYPE
4113 +@tindex TYPENAME_TYPE
4114 +@tindex TYPEOF_TYPE
4115 +@findex CP_TYPE_QUALS
4116 +@findex TYPE_UNQUALIFIED
4117 +@findex TYPE_QUAL_CONST
4118 +@findex TYPE_QUAL_VOLATILE
4119 +@findex TYPE_QUAL_RESTRICT
4120 +@findex TYPE_MAIN_VARIANT
4121 +@cindex qualified type
4122 +@findex TYPE_SIZE
4123 +@findex TYPE_ALIGN
4124 +@findex TYPE_PRECISION
4125 +@findex TYPE_ARG_TYPES
4126 +@findex TYPE_METHOD_BASETYPE
4127 +@findex TYPE_PTRMEM_P
4128 +@findex TYPE_OFFSET_BASETYPE
4129 +@findex TREE_TYPE
4130 +@findex TYPE_CONTEXT
4131 +@findex TYPE_NAME
4132 +@findex TYPENAME_TYPE_FULLNAME
4133 +@findex TYPE_FIELDS
4134 +@findex TYPE_PTROBV_P
4136 +In C++, an array type is not qualified; rather the type of the array
4137 +elements is qualified. This situation is reflected in the intermediate
4138 +representation. The macros described here will always examine the
4139 +qualification of the underlying element type when applied to an array
4140 +type. (If the element type is itself an array, then the recursion
4141 +continues until a non-array type is found, and the qualification of this
4142 +type is examined.) So, for example, @code{CP_TYPE_CONST_P} will hold of
4143 +the type @code{const int ()[7]}, denoting an array of seven @code{int}s.
4145 +The following functions and macros deal with cv-qualification of types:
4146 +@ftable @code
4147 +@item CP_TYPE_QUALS
4148 +This macro returns the set of type qualifiers applied to this type.
4149 +This value is @code{TYPE_UNQUALIFIED} if no qualifiers have been
4150 +applied. The @code{TYPE_QUAL_CONST} bit is set if the type is
4151 +@code{const}-qualified. The @code{TYPE_QUAL_VOLATILE} bit is set if the
4152 +type is @code{volatile}-qualified. The @code{TYPE_QUAL_RESTRICT} bit is
4153 +set if the type is @code{restrict}-qualified.
4155 +@item CP_TYPE_CONST_P
4156 +This macro holds if the type is @code{const}-qualified.
4158 +@item CP_TYPE_VOLATILE_P
4159 +This macro holds if the type is @code{volatile}-qualified.
4161 +@item CP_TYPE_RESTRICT_P
4162 +This macro holds if the type is @code{restrict}-qualified.
4164 +@item CP_TYPE_CONST_NON_VOLATILE_P
4165 +This predicate holds for a type that is @code{const}-qualified, but
4166 +@emph{not} @code{volatile}-qualified; other cv-qualifiers are ignored as
4167 +well: only the @code{const}-ness is tested.
4169 +@end ftable
4171 +A few other macros and functions are usable with all types:
4172 +@ftable @code
4173 +@item TYPE_SIZE
4174 +The number of bits required to represent the type, represented as an
4175 +@code{INTEGER_CST}. For an incomplete type, @code{TYPE_SIZE} will be
4176 +@code{NULL_TREE}.
4178 +@item TYPE_ALIGN
4179 +The alignment of the type, in bits, represented as an @code{int}.
4181 +@item TYPE_NAME
4182 +This macro returns a declaration (in the form of a @code{TYPE_DECL}) for
4183 +the type. (Note this macro does @emph{not} return an
4184 +@code{IDENTIFIER_NODE}, as you might expect, given its name!) You can
4185 +look at the @code{DECL_NAME} of the @code{TYPE_DECL} to obtain the
4186 +actual name of the type. The @code{TYPE_NAME} will be @code{NULL_TREE}
4187 +for a type that is not a built-in type, the result of a typedef, or a
4188 +named class type.
4190 +@item CP_INTEGRAL_TYPE
4191 +This predicate holds if the type is an integral type. Notice that in
4192 +C++, enumerations are @emph{not} integral types.
4194 +@item ARITHMETIC_TYPE_P
4195 +This predicate holds if the type is an integral type (in the C++ sense)
4196 +or a floating point type.
4198 +@item CLASS_TYPE_P
4199 +This predicate holds for a class-type.
4201 +@item TYPE_BUILT_IN
4202 +This predicate holds for a built-in type.
4204 +@item TYPE_PTRMEM_P
4205 +This predicate holds if the type is a pointer to data member.
4207 +@item TYPE_PTR_P
4208 +This predicate holds if the type is a pointer type, and the pointee is
4209 +not a data member.
4211 +@item TYPE_PTRFN_P
4212 +This predicate holds for a pointer to function type.
4214 +@item TYPE_PTROB_P
4215 +This predicate holds for a pointer to object type. Note however that it
4216 +does not hold for the generic pointer to object type @code{void *}. You
4217 +may use @code{TYPE_PTROBV_P} to test for a pointer to object type as
4218 +well as @code{void *}.
4220 +@end ftable
4222 +The table below describes types specific to C and C++ as well as
4223 +language-dependent info about GENERIC types.
4225 +@table @code
4227 +@item POINTER_TYPE
4228 +Used to represent pointer types, and pointer to data member types. If
4229 +@code{TREE_TYPE}
4230 +is a pointer to data member type, then @code{TYPE_PTRMEM_P} will hold.
4231 +For a pointer to data member type of the form @samp{T X::*},
4232 +@code{TYPE_PTRMEM_CLASS_TYPE} will be the type @code{X}, while
4233 +@code{TYPE_PTRMEM_POINTED_TO_TYPE} will be the type @code{T}.
4235 +@item RECORD_TYPE
4236 +Used to represent @code{struct} and @code{class} types in C and C++. If
4237 +@code{TYPE_PTRMEMFUNC_P} holds, then this type is a pointer-to-member
4238 +type. In that case, the @code{TYPE_PTRMEMFUNC_FN_TYPE} is a
4239 +@code{POINTER_TYPE} pointing to a @code{METHOD_TYPE}. The
4240 +@code{METHOD_TYPE} is the type of a function pointed to by the
4241 +pointer-to-member function. If @code{TYPE_PTRMEMFUNC_P} does not hold,
4242 +this type is a class type. For more information, @pxref{Classes}.
4244 +@item UNKNOWN_TYPE
4245 +This node is used to represent a type the knowledge of which is
4246 +insufficient for a sound processing.
4248 +@item TYPENAME_TYPE
4249 +Used to represent a construct of the form @code{typename T::A}. The
4250 +@code{TYPE_CONTEXT} is @code{T}; the @code{TYPE_NAME} is an
4251 +@code{IDENTIFIER_NODE} for @code{A}. If the type is specified via a
4252 +template-id, then @code{TYPENAME_TYPE_FULLNAME} yields a
4253 +@code{TEMPLATE_ID_EXPR}. The @code{TREE_TYPE} is non-@code{NULL} if the
4254 +node is implicitly generated in support for the implicit typename
4255 +extension; in which case the @code{TREE_TYPE} is a type node for the
4256 +base-class.
4258 +@item TYPEOF_TYPE
4259 +Used to represent the @code{__typeof__} extension. The
4260 +@code{TYPE_FIELDS} is the expression the type of which is being
4261 +represented.
4263 +@end table
4266 +@c ---------------------------------------------------------------------
4267 +@c Namespaces
4268 +@c ---------------------------------------------------------------------
4270 +@node Namespaces
4271 +@subsection Namespaces
4272 +@cindex namespace, scope
4273 +@tindex NAMESPACE_DECL
4275 +The root of the entire intermediate representation is the variable
4276 +@code{global_namespace}. This is the namespace specified with @code{::}
4277 +in C++ source code. All other namespaces, types, variables, functions,
4278 +and so forth can be found starting with this namespace.
4280 +However, except for the fact that it is distinguished as the root of the
4281 +representation, the global namespace is no different from any other
4282 +namespace. Thus, in what follows, we describe namespaces generally,
4283 +rather than the global namespace in particular.
4285 +A namespace is represented by a @code{NAMESPACE_DECL} node.
4287 +The following macros and functions can be used on a @code{NAMESPACE_DECL}:
4289 +@ftable @code
4290 +@item DECL_NAME
4291 +This macro is used to obtain the @code{IDENTIFIER_NODE} corresponding to
4292 +the unqualified name of the name of the namespace (@pxref{Identifiers}).
4293 +The name of the global namespace is @samp{::}, even though in C++ the
4294 +global namespace is unnamed. However, you should use comparison with
4295 +@code{global_namespace}, rather than @code{DECL_NAME} to determine
4296 +whether or not a namespace is the global one. An unnamed namespace
4297 +will have a @code{DECL_NAME} equal to @code{anonymous_namespace_name}.
4298 +Within a single translation unit, all unnamed namespaces will have the
4299 +same name.
4301 +@item DECL_CONTEXT
4302 +This macro returns the enclosing namespace. The @code{DECL_CONTEXT} for
4303 +the @code{global_namespace} is @code{NULL_TREE}.
4305 +@item DECL_NAMESPACE_ALIAS
4306 +If this declaration is for a namespace alias, then
4307 +@code{DECL_NAMESPACE_ALIAS} is the namespace for which this one is an
4308 +alias.
4310 +Do not attempt to use @code{cp_namespace_decls} for a namespace which is
4311 +an alias. Instead, follow @code{DECL_NAMESPACE_ALIAS} links until you
4312 +reach an ordinary, non-alias, namespace, and call
4313 +@code{cp_namespace_decls} there.
4315 +@item DECL_NAMESPACE_STD_P
4316 +This predicate holds if the namespace is the special @code{::std}
4317 +namespace.
4319 +@item cp_namespace_decls
4320 +This function will return the declarations contained in the namespace,
4321 +including types, overloaded functions, other namespaces, and so forth.
4322 +If there are no declarations, this function will return
4323 +@code{NULL_TREE}. The declarations are connected through their
4324 +@code{TREE_CHAIN} fields.
4326 +Although most entries on this list will be declarations,
4327 +@code{TREE_LIST} nodes may also appear. In this case, the
4328 +@code{TREE_VALUE} will be an @code{OVERLOAD}. The value of the
4329 +@code{TREE_PURPOSE} is unspecified; back ends should ignore this value.
4330 +As with the other kinds of declarations returned by
4331 +@code{cp_namespace_decls}, the @code{TREE_CHAIN} will point to the next
4332 +declaration in this list.
4334 +For more information on the kinds of declarations that can occur on this
4335 +list, @xref{Declarations}. Some declarations will not appear on this
4336 +list. In particular, no @code{FIELD_DECL}, @code{LABEL_DECL}, or
4337 +@code{PARM_DECL} nodes will appear here.
4339 +This function cannot be used with namespaces that have
4340 +@code{DECL_NAMESPACE_ALIAS} set.
4342 +@end ftable
4344 +@c ---------------------------------------------------------------------
4345 +@c Classes
4346 +@c ---------------------------------------------------------------------
4348 +@node Classes
4349 +@subsection Classes
4350 +@cindex class, scope
4351 +@tindex RECORD_TYPE
4352 +@tindex UNION_TYPE
4353 +@findex CLASSTYPE_DECLARED_CLASS
4354 +@findex TYPE_BINFO
4355 +@findex BINFO_TYPE
4356 +@findex TYPE_FIELDS
4357 +@findex TYPE_VFIELD
4358 +@findex TYPE_METHODS
4360 +Besides namespaces, the other high-level scoping construct in C++ is the
4361 +class. (Throughout this manual the term @dfn{class} is used to mean the
4362 +types referred to in the ANSI/ISO C++ Standard as classes; these include
4363 +types defined with the @code{class}, @code{struct}, and @code{union}
4364 +keywords.)
4366 +A class type is represented by either a @code{RECORD_TYPE} or a
4367 +@code{UNION_TYPE}. A class declared with the @code{union} tag is
4368 +represented by a @code{UNION_TYPE}, while classes declared with either
4369 +the @code{struct} or the @code{class} tag are represented by
4370 +@code{RECORD_TYPE}s. You can use the @code{CLASSTYPE_DECLARED_CLASS}
4371 +macro to discern whether or not a particular type is a @code{class} as
4372 +opposed to a @code{struct}. This macro will be true only for classes
4373 +declared with the @code{class} tag.
4375 +Almost all non-function members are available on the @code{TYPE_FIELDS}
4376 +list. Given one member, the next can be found by following the
4377 +@code{TREE_CHAIN}. You should not depend in any way on the order in
4378 +which fields appear on this list. All nodes on this list will be
4379 +@samp{DECL} nodes. A @code{FIELD_DECL} is used to represent a non-static
4380 +data member, a @code{VAR_DECL} is used to represent a static data
4381 +member, and a @code{TYPE_DECL} is used to represent a type. Note that
4382 +the @code{CONST_DECL} for an enumeration constant will appear on this
4383 +list, if the enumeration type was declared in the class. (Of course,
4384 +the @code{TYPE_DECL} for the enumeration type will appear here as well.)
4385 +There are no entries for base classes on this list. In particular,
4386 +there is no @code{FIELD_DECL} for the ``base-class portion'' of an
4387 +object.
4389 +The @code{TYPE_VFIELD} is a compiler-generated field used to point to
4390 +virtual function tables. It may or may not appear on the
4391 +@code{TYPE_FIELDS} list. However, back ends should handle the
4392 +@code{TYPE_VFIELD} just like all the entries on the @code{TYPE_FIELDS}
4393 +list.
4395 +The function members are available on the @code{TYPE_METHODS} list.
4396 +Again, subsequent members are found by following the @code{TREE_CHAIN}
4397 +field. If a function is overloaded, each of the overloaded functions
4398 +appears; no @code{OVERLOAD} nodes appear on the @code{TYPE_METHODS}
4399 +list. Implicitly declared functions (including default constructors,
4400 +copy constructors, assignment operators, and destructors) will appear on
4401 +this list as well.
4403 +Every class has an associated @dfn{binfo}, which can be obtained with
4404 +@code{TYPE_BINFO}. Binfos are used to represent base-classes. The
4405 +binfo given by @code{TYPE_BINFO} is the degenerate case, whereby every
4406 +class is considered to be its own base-class. The base binfos for a
4407 +particular binfo are held in a vector, whose length is obtained with
4408 +@code{BINFO_N_BASE_BINFOS}. The base binfos themselves are obtained
4409 +with @code{BINFO_BASE_BINFO} and @code{BINFO_BASE_ITERATE}. To add a
4410 +new binfo, use @code{BINFO_BASE_APPEND}. The vector of base binfos can
4411 +be obtained with @code{BINFO_BASE_BINFOS}, but normally you do not need
4412 +to use that. The class type associated with a binfo is given by
4413 +@code{BINFO_TYPE}. It is not always the case that @code{BINFO_TYPE
4414 +(TYPE_BINFO (x))}, because of typedefs and qualified types. Neither is
4415 +it the case that @code{TYPE_BINFO (BINFO_TYPE (y))} is the same binfo as
4416 +@code{y}. The reason is that if @code{y} is a binfo representing a
4417 +base-class @code{B} of a derived class @code{D}, then @code{BINFO_TYPE
4418 +(y)} will be @code{B}, and @code{TYPE_BINFO (BINFO_TYPE (y))} will be
4419 +@code{B} as its own base-class, rather than as a base-class of @code{D}.
4421 +The access to a base type can be found with @code{BINFO_BASE_ACCESS}.
4422 +This will produce @code{access_public_node}, @code{access_private_node}
4423 +or @code{access_protected_node}. If bases are always public,
4424 +@code{BINFO_BASE_ACCESSES} may be @code{NULL}.
4426 +@code{BINFO_VIRTUAL_P} is used to specify whether the binfo is inherited
4427 +virtually or not. The other flags, @code{BINFO_MARKED_P} and
4428 +@code{BINFO_FLAG_1} to @code{BINFO_FLAG_6} can be used for language
4429 +specific use.
4431 +The following macros can be used on a tree node representing a class-type.
4433 +@ftable @code
4434 +@item LOCAL_CLASS_P
4435 +This predicate holds if the class is local class @emph{i.e.}@: declared
4436 +inside a function body.
4438 +@item TYPE_POLYMORPHIC_P
4439 +This predicate holds if the class has at least one virtual function
4440 +(declared or inherited).
4442 +@item TYPE_HAS_DEFAULT_CONSTRUCTOR
4443 +This predicate holds whenever its argument represents a class-type with
4444 +default constructor.
4446 +@item CLASSTYPE_HAS_MUTABLE
4447 +@itemx TYPE_HAS_MUTABLE_P
4448 +These predicates hold for a class-type having a mutable data member.
4450 +@item CLASSTYPE_NON_POD_P
4451 +This predicate holds only for class-types that are not PODs.
4453 +@item TYPE_HAS_NEW_OPERATOR
4454 +This predicate holds for a class-type that defines
4455 +@code{operator new}.
4457 +@item TYPE_HAS_ARRAY_NEW_OPERATOR
4458 +This predicate holds for a class-type for which
4459 +@code{operator new[]} is defined.
4461 +@item TYPE_OVERLOADS_CALL_EXPR
4462 +This predicate holds for class-type for which the function call
4463 +@code{operator()} is overloaded.
4465 +@item TYPE_OVERLOADS_ARRAY_REF
4466 +This predicate holds for a class-type that overloads
4467 +@code{operator[]}
4469 +@item TYPE_OVERLOADS_ARROW
4470 +This predicate holds for a class-type for which @code{operator->} is
4471 +overloaded.
4473 +@end ftable
4475 +@node Functions for C++
4476 +@subsection Functions for C++
4477 +@cindex function
4478 +@tindex FUNCTION_DECL
4479 +@tindex OVERLOAD
4480 +@findex OVL_CURRENT
4481 +@findex OVL_NEXT
4483 +A function is represented by a @code{FUNCTION_DECL} node. A set of
4484 +overloaded functions is sometimes represented by an @code{OVERLOAD} node.
4486 +An @code{OVERLOAD} node is not a declaration, so none of the
4487 +@samp{DECL_} macros should be used on an @code{OVERLOAD}. An
4488 +@code{OVERLOAD} node is similar to a @code{TREE_LIST}. Use
4489 +@code{OVL_CURRENT} to get the function associated with an
4490 +@code{OVERLOAD} node; use @code{OVL_NEXT} to get the next
4491 +@code{OVERLOAD} node in the list of overloaded functions. The macros
4492 +@code{OVL_CURRENT} and @code{OVL_NEXT} are actually polymorphic; you can
4493 +use them to work with @code{FUNCTION_DECL} nodes as well as with
4494 +overloads. In the case of a @code{FUNCTION_DECL}, @code{OVL_CURRENT}
4495 +will always return the function itself, and @code{OVL_NEXT} will always
4496 +be @code{NULL_TREE}.
4498 +To determine the scope of a function, you can use the
4499 +@code{DECL_CONTEXT} macro. This macro will return the class
4500 +(either a @code{RECORD_TYPE} or a @code{UNION_TYPE}) or namespace (a
4501 +@code{NAMESPACE_DECL}) of which the function is a member. For a virtual
4502 +function, this macro returns the class in which the function was
4503 +actually defined, not the base class in which the virtual declaration
4504 +occurred.
4506 +If a friend function is defined in a class scope, the
4507 +@code{DECL_FRIEND_CONTEXT} macro can be used to determine the class in
4508 +which it was defined. For example, in
4509 +@smallexample
4510 +class C @{ friend void f() @{@} @};
4511 +@end smallexample
4512 +@noindent
4513 +the @code{DECL_CONTEXT} for @code{f} will be the
4514 +@code{global_namespace}, but the @code{DECL_FRIEND_CONTEXT} will be the
4515 +@code{RECORD_TYPE} for @code{C}.
4518 +The following macros and functions can be used on a @code{FUNCTION_DECL}:
4519 +@ftable @code
4520 +@item DECL_MAIN_P
4521 +This predicate holds for a function that is the program entry point
4522 +@code{::code}.
4524 +@item DECL_LOCAL_FUNCTION_P
4525 +This predicate holds if the function was declared at block scope, even
4526 +though it has a global scope.
4528 +@item DECL_ANTICIPATED
4529 +This predicate holds if the function is a built-in function but its
4530 +prototype is not yet explicitly declared.
4532 +@item DECL_EXTERN_C_FUNCTION_P
4533 +This predicate holds if the function is declared as an
4534 +`@code{extern "C"}' function.
4536 +@item DECL_LINKONCE_P
4537 +This macro holds if multiple copies of this function may be emitted in
4538 +various translation units. It is the responsibility of the linker to
4539 +merge the various copies. Template instantiations are the most common
4540 +example of functions for which @code{DECL_LINKONCE_P} holds; G++
4541 +instantiates needed templates in all translation units which require them,
4542 +and then relies on the linker to remove duplicate instantiations.
4544 +FIXME: This macro is not yet implemented.
4546 +@item DECL_FUNCTION_MEMBER_P
4547 +This macro holds if the function is a member of a class, rather than a
4548 +member of a namespace.
4550 +@item DECL_STATIC_FUNCTION_P
4551 +This predicate holds if the function a static member function.
4553 +@item DECL_NONSTATIC_MEMBER_FUNCTION_P
4554 +This macro holds for a non-static member function.
4556 +@item DECL_CONST_MEMFUNC_P
4557 +This predicate holds for a @code{const}-member function.
4559 +@item DECL_VOLATILE_MEMFUNC_P
4560 +This predicate holds for a @code{volatile}-member function.
4562 +@item DECL_CONSTRUCTOR_P
4563 +This macro holds if the function is a constructor.
4565 +@item DECL_NONCONVERTING_P
4566 +This predicate holds if the constructor is a non-converting constructor.
4568 +@item DECL_COMPLETE_CONSTRUCTOR_P
4569 +This predicate holds for a function which is a constructor for an object
4570 +of a complete type.
4572 +@item DECL_BASE_CONSTRUCTOR_P
4573 +This predicate holds for a function which is a constructor for a base
4574 +class sub-object.
4576 +@item DECL_COPY_CONSTRUCTOR_P
4577 +This predicate holds for a function which is a copy-constructor.
4579 +@item DECL_DESTRUCTOR_P
4580 +This macro holds if the function is a destructor.
4582 +@item DECL_COMPLETE_DESTRUCTOR_P
4583 +This predicate holds if the function is the destructor for an object a
4584 +complete type.
4586 +@item DECL_OVERLOADED_OPERATOR_P
4587 +This macro holds if the function is an overloaded operator.
4589 +@item DECL_CONV_FN_P
4590 +This macro holds if the function is a type-conversion operator.
4592 +@item DECL_GLOBAL_CTOR_P
4593 +This predicate holds if the function is a file-scope initialization
4594 +function.
4596 +@item DECL_GLOBAL_DTOR_P
4597 +This predicate holds if the function is a file-scope finalization
4598 +function.
4600 +@item DECL_THUNK_P
4601 +This predicate holds if the function is a thunk.
4603 +These functions represent stub code that adjusts the @code{this} pointer
4604 +and then jumps to another function. When the jumped-to function
4605 +returns, control is transferred directly to the caller, without
4606 +returning to the thunk. The first parameter to the thunk is always the
4607 +@code{this} pointer; the thunk should add @code{THUNK_DELTA} to this
4608 +value. (The @code{THUNK_DELTA} is an @code{int}, not an
4609 +@code{INTEGER_CST}.)
4611 +Then, if @code{THUNK_VCALL_OFFSET} (an @code{INTEGER_CST}) is nonzero
4612 +the adjusted @code{this} pointer must be adjusted again. The complete
4613 +calculation is given by the following pseudo-code:
4615 +@smallexample
4616 +this += THUNK_DELTA
4617 +if (THUNK_VCALL_OFFSET)
4618 + this += (*((ptrdiff_t **) this))[THUNK_VCALL_OFFSET]
4619 +@end smallexample
4621 +Finally, the thunk should jump to the location given
4622 +by @code{DECL_INITIAL}; this will always be an expression for the
4623 +address of a function.
4625 +@item DECL_NON_THUNK_FUNCTION_P
4626 +This predicate holds if the function is @emph{not} a thunk function.
4628 +@item GLOBAL_INIT_PRIORITY
4629 +If either @code{DECL_GLOBAL_CTOR_P} or @code{DECL_GLOBAL_DTOR_P} holds,
4630 +then this gives the initialization priority for the function. The
4631 +linker will arrange that all functions for which
4632 +@code{DECL_GLOBAL_CTOR_P} holds are run in increasing order of priority
4633 +before @code{main} is called. When the program exits, all functions for
4634 +which @code{DECL_GLOBAL_DTOR_P} holds are run in the reverse order.
4636 +@item TYPE_RAISES_EXCEPTIONS
4637 +This macro returns the list of exceptions that a (member-)function can
4638 +raise. The returned list, if non @code{NULL}, is comprised of nodes
4639 +whose @code{TREE_VALUE} represents a type.
4641 +@item TYPE_NOTHROW_P
4642 +This predicate holds when the exception-specification of its arguments
4643 +is of the form `@code{()}'.
4645 +@item DECL_ARRAY_DELETE_OPERATOR_P
4646 +This predicate holds if the function an overloaded
4647 +@code{operator delete[]}.
4649 +@end ftable
4651 +@c ---------------------------------------------------------------------
4652 +@c Function Bodies
4653 +@c ---------------------------------------------------------------------
4655 +@node Statements for C++
4656 +@subsection Statements for C++
4657 +@cindex statements
4658 +@tindex BREAK_STMT
4659 +@tindex CLEANUP_STMT
4660 +@findex CLEANUP_DECL
4661 +@findex CLEANUP_EXPR
4662 +@tindex CONTINUE_STMT
4663 +@tindex DECL_STMT
4664 +@findex DECL_STMT_DECL
4665 +@tindex DO_STMT
4666 +@findex DO_BODY
4667 +@findex DO_COND
4668 +@tindex EMPTY_CLASS_EXPR
4669 +@tindex EXPR_STMT
4670 +@findex EXPR_STMT_EXPR
4671 +@tindex FOR_STMT
4672 +@findex FOR_INIT_STMT
4673 +@findex FOR_COND
4674 +@findex FOR_EXPR
4675 +@findex FOR_BODY
4676 +@tindex HANDLER
4677 +@tindex IF_STMT
4678 +@findex IF_COND
4679 +@findex THEN_CLAUSE
4680 +@findex ELSE_CLAUSE
4681 +@tindex RETURN_STMT
4682 +@findex RETURN_EXPR
4683 +@tindex SUBOBJECT
4684 +@findex SUBOBJECT_CLEANUP
4685 +@tindex SWITCH_STMT
4686 +@findex SWITCH_COND
4687 +@findex SWITCH_BODY
4688 +@tindex TRY_BLOCK
4689 +@findex TRY_STMTS
4690 +@findex TRY_HANDLERS
4691 +@findex HANDLER_PARMS
4692 +@findex HANDLER_BODY
4693 +@findex USING_STMT
4694 +@tindex WHILE_STMT
4695 +@findex WHILE_BODY
4696 +@findex WHILE_COND
4698 +A function that has a definition in the current translation unit will
4699 +have a non-@code{NULL} @code{DECL_INITIAL}. However, back ends should not make
4700 +use of the particular value given by @code{DECL_INITIAL}.
4702 +The @code{DECL_SAVED_TREE} macro will give the complete body of the
4703 +function.
4705 +@subsubsection Statements
4707 +There are tree nodes corresponding to all of the source-level
4708 +statement constructs, used within the C and C++ frontends. These are
4709 +enumerated here, together with a list of the various macros that can
4710 +be used to obtain information about them. There are a few macros that
4711 +can be used with all statements:
4713 +@ftable @code
4714 +@item STMT_IS_FULL_EXPR_P
4715 +In C++, statements normally constitute ``full expressions''; temporaries
4716 +created during a statement are destroyed when the statement is complete.
4717 +However, G++ sometimes represents expressions by statements; these
4718 +statements will not have @code{STMT_IS_FULL_EXPR_P} set. Temporaries
4719 +created during such statements should be destroyed when the innermost
4720 +enclosing statement with @code{STMT_IS_FULL_EXPR_P} set is exited.
4722 +@end ftable
4724 +Here is the list of the various statement nodes, and the macros used to
4725 +access them. This documentation describes the use of these nodes in
4726 +non-template functions (including instantiations of template functions).
4727 +In template functions, the same nodes are used, but sometimes in
4728 +slightly different ways.
4730 +Many of the statements have substatements. For example, a @code{while}
4731 +loop will have a body, which is itself a statement. If the substatement
4732 +is @code{NULL_TREE}, it is considered equivalent to a statement
4733 +consisting of a single @code{;}, i.e., an expression statement in which
4734 +the expression has been omitted. A substatement may in fact be a list
4735 +of statements, connected via their @code{TREE_CHAIN}s. So, you should
4736 +always process the statement tree by looping over substatements, like
4737 +this:
4738 +@smallexample
4739 +void process_stmt (stmt)
4740 + tree stmt;
4742 + while (stmt)
4743 + @{
4744 + switch (TREE_CODE (stmt))
4745 + @{
4746 + case IF_STMT:
4747 + process_stmt (THEN_CLAUSE (stmt));
4748 + /* @r{More processing here.} */
4749 + break;
4751 + @dots{}
4752 + @}
4754 + stmt = TREE_CHAIN (stmt);
4755 + @}
4757 +@end smallexample
4758 +In other words, while the @code{then} clause of an @code{if} statement
4759 +in C++ can be only one statement (although that one statement may be a
4760 +compound statement), the intermediate representation will sometimes use
4761 +several statements chained together.
4763 +@table @code
4764 +@item BREAK_STMT
4766 +Used to represent a @code{break} statement. There are no additional
4767 +fields.
4769 +@item CLEANUP_STMT
4771 +Used to represent an action that should take place upon exit from the
4772 +enclosing scope. Typically, these actions are calls to destructors for
4773 +local objects, but back ends cannot rely on this fact. If these nodes
4774 +are in fact representing such destructors, @code{CLEANUP_DECL} will be
4775 +the @code{VAR_DECL} destroyed. Otherwise, @code{CLEANUP_DECL} will be
4776 +@code{NULL_TREE}. In any case, the @code{CLEANUP_EXPR} is the
4777 +expression to execute. The cleanups executed on exit from a scope
4778 +should be run in the reverse order of the order in which the associated
4779 +@code{CLEANUP_STMT}s were encountered.
4781 +@item CONTINUE_STMT
4783 +Used to represent a @code{continue} statement. There are no additional
4784 +fields.
4786 +@item CTOR_STMT
4788 +Used to mark the beginning (if @code{CTOR_BEGIN_P} holds) or end (if
4789 +@code{CTOR_END_P} holds of the main body of a constructor. See also
4790 +@code{SUBOBJECT} for more information on how to use these nodes.
4792 +@item DO_STMT
4794 +Used to represent a @code{do} loop. The body of the loop is given by
4795 +@code{DO_BODY} while the termination condition for the loop is given by
4796 +@code{DO_COND}. The condition for a @code{do}-statement is always an
4797 +expression.
4799 +@item EMPTY_CLASS_EXPR
4801 +Used to represent a temporary object of a class with no data whose
4802 +address is never taken. (All such objects are interchangeable.) The
4803 +@code{TREE_TYPE} represents the type of the object.
4805 +@item EXPR_STMT
4807 +Used to represent an expression statement. Use @code{EXPR_STMT_EXPR} to
4808 +obtain the expression.
4810 +@item FOR_STMT
4812 +Used to represent a @code{for} statement. The @code{FOR_INIT_STMT} is
4813 +the initialization statement for the loop. The @code{FOR_COND} is the
4814 +termination condition. The @code{FOR_EXPR} is the expression executed
4815 +right before the @code{FOR_COND} on each loop iteration; often, this
4816 +expression increments a counter. The body of the loop is given by
4817 +@code{FOR_BODY}. Note that @code{FOR_INIT_STMT} and @code{FOR_BODY}
4818 +return statements, while @code{FOR_COND} and @code{FOR_EXPR} return
4819 +expressions.
4821 +@item HANDLER
4823 +Used to represent a C++ @code{catch} block. The @code{HANDLER_TYPE}
4824 +is the type of exception that will be caught by this handler; it is
4825 +equal (by pointer equality) to @code{NULL} if this handler is for all
4826 +types. @code{HANDLER_PARMS} is the @code{DECL_STMT} for the catch
4827 +parameter, and @code{HANDLER_BODY} is the code for the block itself.
4829 +@item IF_STMT
4831 +Used to represent an @code{if} statement. The @code{IF_COND} is the
4832 +expression.
4834 +If the condition is a @code{TREE_LIST}, then the @code{TREE_PURPOSE} is
4835 +a statement (usually a @code{DECL_STMT}). Each time the condition is
4836 +evaluated, the statement should be executed. Then, the
4837 +@code{TREE_VALUE} should be used as the conditional expression itself.
4838 +This representation is used to handle C++ code like this:
4840 +C++ distinguishes between this and @code{COND_EXPR} for handling templates.
4842 +@smallexample
4843 +if (int i = 7) @dots{}
4844 +@end smallexample
4846 +where there is a new local variable (or variables) declared within the
4847 +condition.
4849 +The @code{THEN_CLAUSE} represents the statement given by the @code{then}
4850 +condition, while the @code{ELSE_CLAUSE} represents the statement given
4851 +by the @code{else} condition.
4853 +@item SUBOBJECT
4855 +In a constructor, these nodes are used to mark the point at which a
4856 +subobject of @code{this} is fully constructed. If, after this point, an
4857 +exception is thrown before a @code{CTOR_STMT} with @code{CTOR_END_P} set
4858 +is encountered, the @code{SUBOBJECT_CLEANUP} must be executed. The
4859 +cleanups must be executed in the reverse order in which they appear.
4861 +@item SWITCH_STMT
4863 +Used to represent a @code{switch} statement. The @code{SWITCH_STMT_COND}
4864 +is the expression on which the switch is occurring. See the documentation
4865 +for an @code{IF_STMT} for more information on the representation used
4866 +for the condition. The @code{SWITCH_STMT_BODY} is the body of the switch
4867 +statement. The @code{SWITCH_STMT_TYPE} is the original type of switch
4868 +expression as given in the source, before any compiler conversions.
4870 +@item TRY_BLOCK
4871 +Used to represent a @code{try} block. The body of the try block is
4872 +given by @code{TRY_STMTS}. Each of the catch blocks is a @code{HANDLER}
4873 +node. The first handler is given by @code{TRY_HANDLERS}. Subsequent
4874 +handlers are obtained by following the @code{TREE_CHAIN} link from one
4875 +handler to the next. The body of the handler is given by
4876 +@code{HANDLER_BODY}.
4878 +If @code{CLEANUP_P} holds of the @code{TRY_BLOCK}, then the
4879 +@code{TRY_HANDLERS} will not be a @code{HANDLER} node. Instead, it will
4880 +be an expression that should be executed if an exception is thrown in
4881 +the try block. It must rethrow the exception after executing that code.
4882 +And, if an exception is thrown while the expression is executing,
4883 +@code{terminate} must be called.
4885 +@item USING_STMT
4886 +Used to represent a @code{using} directive. The namespace is given by
4887 +@code{USING_STMT_NAMESPACE}, which will be a NAMESPACE_DECL@. This node
4888 +is needed inside template functions, to implement using directives
4889 +during instantiation.
4891 +@item WHILE_STMT
4893 +Used to represent a @code{while} loop. The @code{WHILE_COND} is the
4894 +termination condition for the loop. See the documentation for an
4895 +@code{IF_STMT} for more information on the representation used for the
4896 +condition.
4898 +The @code{WHILE_BODY} is the body of the loop.
4900 +@end table
4902 +@node C++ Expressions
4903 +@subsection C++ Expressions
4905 +This section describes expressions specific to the C and C++ front
4906 +ends.
4908 +@table @code
4909 +@item TYPEID_EXPR
4911 +Used to represent a @code{typeid} expression.
4913 +@item NEW_EXPR
4914 +@itemx VEC_NEW_EXPR
4916 +Used to represent a call to @code{new} and @code{new[]} respectively.
4918 +@item DELETE_EXPR
4919 +@itemx VEC_DELETE_EXPR
4921 +Used to represent a call to @code{delete} and @code{delete[]} respectively.
4923 +@item MEMBER_REF
4925 +Represents a reference to a member of a class.
4927 +@item THROW_EXPR
4929 +Represents an instance of @code{throw} in the program. Operand 0,
4930 +which is the expression to throw, may be @code{NULL_TREE}.
4933 +@item AGGR_INIT_EXPR
4934 +An @code{AGGR_INIT_EXPR} represents the initialization as the return
4935 +value of a function call, or as the result of a constructor. An
4936 +@code{AGGR_INIT_EXPR} will only appear as a full-expression, or as the
4937 +second operand of a @code{TARGET_EXPR}. @code{AGGR_INIT_EXPR}s have
4938 +a representation similar to that of @code{CALL_EXPR}s. You can use
4939 +the @code{AGGR_INIT_EXPR_FN} and @code{AGGR_INIT_EXPR_ARG} macros to access
4940 +the function to call and the arguments to pass.
4942 +If @code{AGGR_INIT_VIA_CTOR_P} holds of the @code{AGGR_INIT_EXPR}, then
4943 +the initialization is via a constructor call. The address of the
4944 +@code{AGGR_INIT_EXPR_SLOT} operand, which is always a @code{VAR_DECL},
4945 +is taken, and this value replaces the first argument in the argument
4946 +list.
4948 +In either case, the expression is void.
4951 +@end table
4954 +@node Java Trees
4955 +@section Java Trees
4956 diff -urN gcc-4.8.1/gcc/doc/generic.texi.rej.old gcc-4.8.1.new/gcc/doc/generic.texi.rej.old
4957 --- gcc-4.8.1/gcc/doc/generic.texi.rej.old 1969-12-31 19:00:00.000000000 -0500
4958 +++ gcc-4.8.1.new/gcc/doc/generic.texi.rej.old 2013-12-02 20:22:15.924776226 -0500
4959 @@ -0,0 +1,11 @@
4960 +--- gcc/doc/generic.texi 2011-01-02 02:30:55.000000000 +0100
4961 ++++ gcc/doc/generic.texi 2013-08-26 07:55:42.000000000 +0200
4962 +@@ -1421,7 +1421,7 @@
4963 + integer type compatible with sizetype. This is the only binary
4964 + arithmetic operand that can operate on pointer types.
4966 +-@itemx PLUS_EXPR
4967 ++@item PLUS_EXPR
4968 + @itemx MINUS_EXPR
4969 + @itemx MULT_EXPR
4970 + These nodes represent various binary arithmetic operations.
4971 diff -urN gcc-4.8.1/gcc/doc/invoke.texi.old gcc-4.8.1.new/gcc/doc/invoke.texi.old
4972 --- gcc-4.8.1/gcc/doc/invoke.texi.old 1969-12-31 19:00:00.000000000 -0500
4973 +++ gcc-4.8.1.new/gcc/doc/invoke.texi.old 2013-03-20 07:08:52.000000000 -0400
4974 @@ -0,0 +1,18730 @@
4975 +@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4976 +@c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4977 +@c Free Software Foundation, Inc.
4978 +@c This is part of the GCC manual.
4979 +@c For copying conditions, see the file gcc.texi.
4981 +@ignore
4982 +@c man begin INCLUDE
4983 +@include gcc-vers.texi
4984 +@c man end
4986 +@c man begin COPYRIGHT
4987 +Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
4988 +1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4989 +Free Software Foundation, Inc.
4991 +Permission is granted to copy, distribute and/or modify this document
4992 +under the terms of the GNU Free Documentation License, Version 1.3 or
4993 +any later version published by the Free Software Foundation; with the
4994 +Invariant Sections being ``GNU General Public License'' and ``Funding
4995 +Free Software'', the Front-Cover texts being (a) (see below), and with
4996 +the Back-Cover Texts being (b) (see below). A copy of the license is
4997 +included in the gfdl(7) man page.
4999 +(a) The FSF's Front-Cover Text is:
5001 + A GNU Manual
5003 +(b) The FSF's Back-Cover Text is:
5005 + You have freedom to copy and modify this GNU Manual, like GNU
5006 + software. Copies published by the Free Software Foundation raise
5007 + funds for GNU development.
5008 +@c man end
5009 +@c Set file name and title for the man page.
5010 +@setfilename gcc
5011 +@settitle GNU project C and C++ compiler
5012 +@c man begin SYNOPSIS
5013 +gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
5014 + [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
5015 + [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
5016 + [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
5017 + [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
5018 + [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
5019 + [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
5021 +Only the most useful options are listed here; see below for the
5022 +remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
5023 +@c man end
5024 +@c man begin SEEALSO
5025 +gpl(7), gfdl(7), fsf-funding(7),
5026 +cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
5027 +and the Info entries for @file{gcc}, @file{cpp}, @file{as},
5028 +@file{ld}, @file{binutils} and @file{gdb}.
5029 +@c man end
5030 +@c man begin BUGS
5031 +For instructions on reporting bugs, see
5032 +@w{@value{BUGURL}}.
5033 +@c man end
5034 +@c man begin AUTHOR
5035 +See the Info entry for @command{gcc}, or
5036 +@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
5037 +for contributors to GCC@.
5038 +@c man end
5039 +@end ignore
5041 +@node Invoking GCC
5042 +@chapter GCC Command Options
5043 +@cindex GCC command options
5044 +@cindex command options
5045 +@cindex options, GCC command
5047 +@c man begin DESCRIPTION
5048 +When you invoke GCC, it normally does preprocessing, compilation,
5049 +assembly and linking. The ``overall options'' allow you to stop this
5050 +process at an intermediate stage. For example, the @option{-c} option
5051 +says not to run the linker. Then the output consists of object files
5052 +output by the assembler.
5054 +Other options are passed on to one stage of processing. Some options
5055 +control the preprocessor and others the compiler itself. Yet other
5056 +options control the assembler and linker; most of these are not
5057 +documented here, since you rarely need to use any of them.
5059 +@cindex C compilation options
5060 +Most of the command line options that you can use with GCC are useful
5061 +for C programs; when an option is only useful with another language
5062 +(usually C++), the explanation says so explicitly. If the description
5063 +for a particular option does not mention a source language, you can use
5064 +that option with all supported languages.
5066 +@cindex C++ compilation options
5067 +@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
5068 +options for compiling C++ programs.
5070 +@cindex grouping options
5071 +@cindex options, grouping
5072 +The @command{gcc} program accepts options and file names as operands. Many
5073 +options have multi-letter names; therefore multiple single-letter options
5074 +may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
5075 +-v}}.
5077 +@cindex order of options
5078 +@cindex options, order
5079 +You can mix options and other arguments. For the most part, the order
5080 +you use doesn't matter. Order does matter when you use several
5081 +options of the same kind; for example, if you specify @option{-L} more
5082 +than once, the directories are searched in the order specified. Also,
5083 +the placement of the @option{-l} option is significant.
5085 +Many options have long names starting with @samp{-f} or with
5086 +@samp{-W}---for example,
5087 +@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
5088 +these have both positive and negative forms; the negative form of
5089 +@option{-ffoo} would be @option{-fno-foo}. This manual documents
5090 +only one of these two forms, whichever one is not the default.
5092 +@c man end
5094 +@xref{Option Index}, for an index to GCC's options.
5096 +@menu
5097 +* Option Summary:: Brief list of all options, without explanations.
5098 +* Overall Options:: Controlling the kind of output:
5099 + an executable, object files, assembler files,
5100 + or preprocessed source.
5101 +* Invoking G++:: Compiling C++ programs.
5102 +* C Dialect Options:: Controlling the variant of C language compiled.
5103 +* C++ Dialect Options:: Variations on C++.
5104 +* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
5105 + and Objective-C++.
5106 +* Language Independent Options:: Controlling how diagnostics should be
5107 + formatted.
5108 +* Warning Options:: How picky should the compiler be?
5109 +* Debugging Options:: Symbol tables, measurements, and debugging dumps.
5110 +* Optimize Options:: How much optimization?
5111 +* Preprocessor Options:: Controlling header files and macro definitions.
5112 + Also, getting dependency information for Make.
5113 +* Assembler Options:: Passing options to the assembler.
5114 +* Link Options:: Specifying libraries and so on.
5115 +* Directory Options:: Where to find header files and libraries.
5116 + Where to find the compiler executable files.
5117 +* Spec Files:: How to pass switches to sub-processes.
5118 +* Target Options:: Running a cross-compiler, or an old version of GCC.
5119 +* Submodel Options:: Specifying minor hardware or convention variations,
5120 + such as 68010 vs 68020.
5121 +* Code Gen Options:: Specifying conventions for function calls, data layout
5122 + and register usage.
5123 +* Environment Variables:: Env vars that affect GCC.
5124 +* Precompiled Headers:: Compiling a header once, and using it many times.
5125 +@end menu
5127 +@c man begin OPTIONS
5129 +@node Option Summary
5130 +@section Option Summary
5132 +Here is a summary of all the options, grouped by type. Explanations are
5133 +in the following sections.
5135 +@table @emph
5136 +@item Overall Options
5137 +@xref{Overall Options,,Options Controlling the Kind of Output}.
5138 +@gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol
5139 +-pipe -pass-exit-codes @gol
5140 +-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
5141 +--version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
5142 +-fdump-ada-spec@r{[}-slim@r{]} -fdump-go-spec=@var{file}}
5144 +@item C Language Options
5145 +@xref{C Dialect Options,,Options Controlling C Dialect}.
5146 +@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
5147 +-aux-info @var{filename} @gol
5148 +-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
5149 +-fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
5150 +-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
5151 +-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
5152 +-fsigned-bitfields -fsigned-char @gol
5153 +-funsigned-bitfields -funsigned-char}
5155 +@item C++ Language Options
5156 +@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
5157 +@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
5158 +-fconserve-space -fconstexpr-depth=@var{n} -ffriend-injection @gol
5159 +-fno-elide-constructors @gol
5160 +-fno-enforce-eh-specs @gol
5161 +-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
5162 +-fno-implicit-templates @gol
5163 +-fno-implicit-inline-templates @gol
5164 +-fno-implement-inlines -fms-extensions @gol
5165 +-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
5166 +-fno-optional-diags -fpermissive @gol
5167 +-fno-pretty-templates @gol
5168 +-frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
5169 +-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
5170 +-fno-default-inline -fvisibility-inlines-hidden @gol
5171 +-fvisibility-ms-compat @gol
5172 +-Wabi -Wconversion-null -Wctor-dtor-privacy @gol
5173 +-Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
5174 +-Weffc++ -Wstrict-null-sentinel @gol
5175 +-Wno-non-template-friend -Wold-style-cast @gol
5176 +-Woverloaded-virtual -Wno-pmf-conversions @gol
5177 +-Wsign-promo}
5179 +@item Objective-C and Objective-C++ Language Options
5180 +@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
5181 +Objective-C and Objective-C++ Dialects}.
5182 +@gccoptlist{-fconstant-string-class=@var{class-name} @gol
5183 +-fgnu-runtime -fnext-runtime @gol
5184 +-fno-nil-receivers @gol
5185 +-fobjc-abi-version=@var{n} @gol
5186 +-fobjc-call-cxx-cdtors @gol
5187 +-fobjc-direct-dispatch @gol
5188 +-fobjc-exceptions @gol
5189 +-fobjc-gc @gol
5190 +-fobjc-nilcheck @gol
5191 +-fobjc-std=objc1 @gol
5192 +-freplace-objc-classes @gol
5193 +-fzero-link @gol
5194 +-gen-decls @gol
5195 +-Wassign-intercept @gol
5196 +-Wno-protocol -Wselector @gol
5197 +-Wstrict-selector-match @gol
5198 +-Wundeclared-selector}
5200 +@item Language Independent Options
5201 +@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
5202 +@gccoptlist{-fmessage-length=@var{n} @gol
5203 +-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
5204 +-fno-diagnostics-show-option}
5206 +@item Warning Options
5207 +@xref{Warning Options,,Options to Request or Suppress Warnings}.
5208 +@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -pedantic @gol
5209 +-pedantic-errors @gol
5210 +-w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
5211 +-Wno-attributes -Wno-builtin-macro-redefined @gol
5212 +-Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
5213 +-Wchar-subscripts -Wclobbered -Wcomment @gol
5214 +-Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
5215 +-Wno-deprecated-declarations -Wdisabled-optimization @gol
5216 +-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
5217 +-Wno-endif-labels -Werror -Werror=* @gol
5218 +-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
5219 +-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
5220 +-Wformat-security -Wformat-y2k @gol
5221 +-Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
5222 +-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
5223 +-Winit-self -Winline @gol
5224 +-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
5225 +-Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
5226 +-Wlogical-op -Wlong-long @gol
5227 +-Wmain -Wmissing-braces -Wmissing-field-initializers @gol
5228 +-Wmissing-format-attribute -Wmissing-include-dirs @gol
5229 +-Wno-mudflap @gol
5230 +-Wno-multichar -Wnonnull -Wno-overflow @gol
5231 +-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
5232 +-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
5233 +-Wpointer-arith -Wno-pointer-to-int-cast @gol
5234 +-Wredundant-decls @gol
5235 +-Wreturn-type -Wsequence-point -Wshadow @gol
5236 +-Wsign-compare -Wsign-conversion -Wstack-protector @gol
5237 +-Wstrict-aliasing -Wstrict-aliasing=n @gol
5238 +-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
5239 +-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
5240 +-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
5241 +-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
5242 +-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
5243 +-Wunsuffixed-float-constants -Wunused -Wunused-function @gol
5244 +-Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value @gol
5245 +-Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable @gol
5246 +-Wvariadic-macros -Wvla -Wvolatile-register-var -Wwrite-strings}
5248 +@item C and Objective-C-only Warning Options
5249 +@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
5250 +-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
5251 +-Wold-style-declaration -Wold-style-definition @gol
5252 +-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
5253 +-Wdeclaration-after-statement -Wpointer-sign}
5255 +@item Debugging Options
5256 +@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
5257 +@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
5258 +-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
5259 +-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
5260 +-fdump-translation-unit@r{[}-@var{n}@r{]} @gol
5261 +-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
5262 +-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
5263 +-fdump-statistics @gol
5264 +-fdump-tree-all @gol
5265 +-fdump-tree-original@r{[}-@var{n}@r{]} @gol
5266 +-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
5267 +-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
5268 +-fdump-tree-ch @gol
5269 +-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
5270 +-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
5271 +-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
5272 +-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
5273 +-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
5274 +-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
5275 +-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
5276 +-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
5277 +-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
5278 +-fdump-tree-nrv -fdump-tree-vect @gol
5279 +-fdump-tree-sink @gol
5280 +-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
5281 +-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
5282 +-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
5283 +-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
5284 +-ftree-vectorizer-verbose=@var{n} @gol
5285 +-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
5286 +-fdump-final-insns=@var{file} @gol
5287 +-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
5288 +-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
5289 +-feliminate-unused-debug-symbols -femit-class-debug-always @gol
5290 +-fenable-icf-debug @gol
5291 +-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
5292 +-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
5293 +-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
5294 +-fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
5295 +-fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
5296 +-g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
5297 +-ggdb -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
5298 +-gvms -gxcoff -gxcoff+ @gol
5299 +-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
5300 +-fdebug-prefix-map=@var{old}=@var{new} @gol
5301 +-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
5302 +-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
5303 +-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
5304 +-print-multi-directory -print-multi-lib -print-multi-os-directory @gol
5305 +-print-prog-name=@var{program} -print-search-dirs -Q @gol
5306 +-print-sysroot -print-sysroot-headers-suffix @gol
5307 +-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
5309 +@item Optimization Options
5310 +@xref{Optimize Options,,Options that Control Optimization}.
5311 +@gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
5312 +-falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
5313 +-fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
5314 +-fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
5315 +-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
5316 +-fcompare-elim -fcprop-registers -fcrossjumping @gol
5317 +-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
5318 +-fcx-limited-range @gol
5319 +-fdata-sections -fdce -fdce -fdelayed-branch @gol
5320 +-fdelete-null-pointer-checks -fdse -fdevirtualize -fdse @gol
5321 +-fearly-inlining -fipa-sra -fexpensive-optimizations -ffast-math @gol
5322 +-ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
5323 +-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
5324 +-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
5325 +-fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
5326 +-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
5327 +-finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
5328 +-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
5329 +-fipa-struct-reorg -fira-algorithm=@var{algorithm} @gol
5330 +-fira-region=@var{region} @gol
5331 +-fira-loop-pressure -fno-ira-share-save-slots @gol
5332 +-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
5333 +-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
5334 +-floop-block -floop-flatten -floop-interchange -floop-strip-mine @gol
5335 +-floop-parallelize-all -flto -flto-compression-level
5336 +-flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
5337 +-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
5338 +-fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
5339 +-fno-default-inline @gol
5340 +-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
5341 +-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
5342 +-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
5343 +-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
5344 +-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
5345 +-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
5346 +-fprefetch-loop-arrays @gol
5347 +-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
5348 +-fprofile-generate=@var{path} @gol
5349 +-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
5350 +-freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
5351 +-freorder-blocks-and-partition -freorder-functions @gol
5352 +-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
5353 +-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
5354 +-fsched-spec-load -fsched-spec-load-dangerous @gol
5355 +-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
5356 +-fsched-group-heuristic -fsched-critical-path-heuristic @gol
5357 +-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
5358 +-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
5359 +-fschedule-insns -fschedule-insns2 -fsection-anchors @gol
5360 +-fselective-scheduling -fselective-scheduling2 @gol
5361 +-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
5362 +-fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
5363 +-fsplit-wide-types -fstack-protector -fstack-protector-all @gol
5364 +-fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
5365 +-ftree-bit-ccp @gol
5366 +-ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
5367 +-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
5368 +-ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
5369 +-ftree-loop-if-convert-stores -ftree-loop-im @gol
5370 +-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
5371 +-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
5372 +-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
5373 +-ftree-sink -ftree-sra -ftree-switch-conversion @gol
5374 +-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
5375 +-funit-at-a-time -funroll-all-loops -funroll-loops @gol
5376 +-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
5377 +-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
5378 +-fwhole-program -fwpa -fuse-linker-plugin @gol
5379 +--param @var{name}=@var{value}
5380 +-O -O0 -O1 -O2 -O3 -Os -Ofast}
5382 +@item Preprocessor Options
5383 +@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
5384 +@gccoptlist{-A@var{question}=@var{answer} @gol
5385 +-A-@var{question}@r{[}=@var{answer}@r{]} @gol
5386 +-C -dD -dI -dM -dN @gol
5387 +-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
5388 +-idirafter @var{dir} @gol
5389 +-include @var{file} -imacros @var{file} @gol
5390 +-iprefix @var{file} -iwithprefix @var{dir} @gol
5391 +-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
5392 +-imultilib @var{dir} -isysroot @var{dir} @gol
5393 +-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
5394 +-P -fworking-directory -remap @gol
5395 +-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
5396 +-Xpreprocessor @var{option}}
5398 +@item Assembler Option
5399 +@xref{Assembler Options,,Passing Options to the Assembler}.
5400 +@gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
5402 +@item Linker Options
5403 +@xref{Link Options,,Options for Linking}.
5404 +@gccoptlist{@var{object-file-name} -l@var{library} @gol
5405 +-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
5406 +-s -static -static-libgcc -static-libstdc++ -shared @gol
5407 +-shared-libgcc -symbolic @gol
5408 +-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
5409 +-u @var{symbol}}
5411 +@item Directory Options
5412 +@xref{Directory Options,,Options for Directory Search}.
5413 +@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir}}
5414 +-iquote@var{dir} -L@var{dir} -specs=@var{file} -I-
5415 +--sysroot=@var{dir}
5417 +@item Machine Dependent Options
5418 +@xref{Submodel Options,,Hardware Models and Configurations}.
5419 +@c This list is ordered alphanumerically by subsection name.
5420 +@c Try and put the significant identifier (CPU or system) first,
5421 +@c so users have a clue at guessing where the ones they want will be.
5423 +@emph{ARC Options}
5424 +@gccoptlist{-EB -EL @gol
5425 +-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
5426 +-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
5428 +@emph{ARM Options}
5429 +@gccoptlist{-mapcs-frame -mno-apcs-frame @gol
5430 +-mabi=@var{name} @gol
5431 +-mapcs-stack-check -mno-apcs-stack-check @gol
5432 +-mapcs-float -mno-apcs-float @gol
5433 +-mapcs-reentrant -mno-apcs-reentrant @gol
5434 +-msched-prolog -mno-sched-prolog @gol
5435 +-mlittle-endian -mbig-endian -mwords-little-endian @gol
5436 +-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
5437 +-mfp16-format=@var{name}
5438 +-mthumb-interwork -mno-thumb-interwork @gol
5439 +-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
5440 +-mstructure-size-boundary=@var{n} @gol
5441 +-mabort-on-noreturn @gol
5442 +-mlong-calls -mno-long-calls @gol
5443 +-msingle-pic-base -mno-single-pic-base @gol
5444 +-mpic-register=@var{reg} @gol
5445 +-mnop-fun-dllimport @gol
5446 +-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
5447 +-mpoke-function-name @gol
5448 +-mthumb -marm @gol
5449 +-mtpcs-frame -mtpcs-leaf-frame @gol
5450 +-mcaller-super-interworking -mcallee-super-interworking @gol
5451 +-mtp=@var{name} @gol
5452 +-mword-relocations @gol
5453 +-mfix-cortex-m3-ldrd}
5455 +@emph{AVR Options}
5456 +@gccoptlist{-mmcu=@var{mcu} -mno-interrupts @gol
5457 +-mcall-prologues -mtiny-stack -mint8}
5459 +@emph{Blackfin Options}
5460 +@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
5461 +-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
5462 +-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
5463 +-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
5464 +-mno-id-shared-library -mshared-library-id=@var{n} @gol
5465 +-mleaf-id-shared-library -mno-leaf-id-shared-library @gol
5466 +-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
5467 +-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
5468 +-micplb}
5470 +@emph{CRIS Options}
5471 +@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
5472 +-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
5473 +-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
5474 +-mstack-align -mdata-align -mconst-align @gol
5475 +-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
5476 +-melf -maout -melinux -mlinux -sim -sim2 @gol
5477 +-mmul-bug-workaround -mno-mul-bug-workaround}
5479 +@emph{CRX Options}
5480 +@gccoptlist{-mmac -mpush-args}
5482 +@emph{Darwin Options}
5483 +@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
5484 +-arch_only -bind_at_load -bundle -bundle_loader @gol
5485 +-client_name -compatibility_version -current_version @gol
5486 +-dead_strip @gol
5487 +-dependency-file -dylib_file -dylinker_install_name @gol
5488 +-dynamic -dynamiclib -exported_symbols_list @gol
5489 +-filelist -flat_namespace -force_cpusubtype_ALL @gol
5490 +-force_flat_namespace -headerpad_max_install_names @gol
5491 +-iframework @gol
5492 +-image_base -init -install_name -keep_private_externs @gol
5493 +-multi_module -multiply_defined -multiply_defined_unused @gol
5494 +-noall_load -no_dead_strip_inits_and_terms @gol
5495 +-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
5496 +-pagezero_size -prebind -prebind_all_twolevel_modules @gol
5497 +-private_bundle -read_only_relocs -sectalign @gol
5498 +-sectobjectsymbols -whyload -seg1addr @gol
5499 +-sectcreate -sectobjectsymbols -sectorder @gol
5500 +-segaddr -segs_read_only_addr -segs_read_write_addr @gol
5501 +-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
5502 +-segprot -segs_read_only_addr -segs_read_write_addr @gol
5503 +-single_module -static -sub_library -sub_umbrella @gol
5504 +-twolevel_namespace -umbrella -undefined @gol
5505 +-unexported_symbols_list -weak_reference_mismatches @gol
5506 +-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
5507 +-mkernel -mone-byte-bool}
5509 +@emph{DEC Alpha Options}
5510 +@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
5511 +-mieee -mieee-with-inexact -mieee-conformant @gol
5512 +-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
5513 +-mtrap-precision=@var{mode} -mbuild-constants @gol
5514 +-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
5515 +-mbwx -mmax -mfix -mcix @gol
5516 +-mfloat-vax -mfloat-ieee @gol
5517 +-mexplicit-relocs -msmall-data -mlarge-data @gol
5518 +-msmall-text -mlarge-text @gol
5519 +-mmemory-latency=@var{time}}
5521 +@emph{DEC Alpha/VMS Options}
5522 +@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
5524 +@emph{FR30 Options}
5525 +@gccoptlist{-msmall-model -mno-lsim}
5527 +@emph{FRV Options}
5528 +@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
5529 +-mhard-float -msoft-float @gol
5530 +-malloc-cc -mfixed-cc -mdword -mno-dword @gol
5531 +-mdouble -mno-double @gol
5532 +-mmedia -mno-media -mmuladd -mno-muladd @gol
5533 +-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
5534 +-mlinked-fp -mlong-calls -malign-labels @gol
5535 +-mlibrary-pic -macc-4 -macc-8 @gol
5536 +-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
5537 +-moptimize-membar -mno-optimize-membar @gol
5538 +-mscc -mno-scc -mcond-exec -mno-cond-exec @gol
5539 +-mvliw-branch -mno-vliw-branch @gol
5540 +-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
5541 +-mno-nested-cond-exec -mtomcat-stats @gol
5542 +-mTLS -mtls @gol
5543 +-mcpu=@var{cpu}}
5545 +@emph{GNU/Linux Options}
5546 +@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
5547 +-tno-android-cc -tno-android-ld}
5549 +@emph{H8/300 Options}
5550 +@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
5552 +@emph{HPPA Options}
5553 +@gccoptlist{-march=@var{architecture-type} @gol
5554 +-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
5555 +-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
5556 +-mfixed-range=@var{register-range} @gol
5557 +-mjump-in-delay -mlinker-opt -mlong-calls @gol
5558 +-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
5559 +-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
5560 +-mno-jump-in-delay -mno-long-load-store @gol
5561 +-mno-portable-runtime -mno-soft-float @gol
5562 +-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
5563 +-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
5564 +-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
5565 +-munix=@var{unix-std} -nolibdld -static -threads}
5567 +@emph{i386 and x86-64 Options}
5568 +@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
5569 +-mfpmath=@var{unit} @gol
5570 +-masm=@var{dialect} -mno-fancy-math-387 @gol
5571 +-mno-fp-ret-in-387 -msoft-float @gol
5572 +-mno-wide-multiply -mrtd -malign-double @gol
5573 +-mpreferred-stack-boundary=@var{num}
5574 +-mincoming-stack-boundary=@var{num} @gol
5575 +-mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip @gol
5576 +-mvzeroupper -mprefer-avx128 @gol
5577 +-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
5578 +-maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfused-madd @gol
5579 +-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlwp @gol
5580 +-mthreads -mno-align-stringops -minline-all-stringops @gol
5581 +-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
5582 +-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
5583 +-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
5584 +-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
5585 +-mpc32 -mpc64 -mpc80 -mstackrealign @gol
5586 +-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
5587 +-mcmodel=@var{code-model} -mabi=@var{name} @gol
5588 +-m32 -m64 -mlarge-data-threshold=@var{num} @gol
5589 +-msse2avx -mfentry -m8bit-idiv @gol
5590 +-mavx256-split-unaligned-load -mavx256-split-unaligned-store}
5592 +@emph{i386 and x86-64 Windows Options}
5593 +@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
5594 +-mnop-fun-dllimport -mthread @gol
5595 +-municode -mwin32 -mwindows -fno-set-stack-executable}
5597 +@emph{IA-64 Options}
5598 +@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
5599 +-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
5600 +-mconstant-gp -mauto-pic -mfused-madd @gol
5601 +-minline-float-divide-min-latency @gol
5602 +-minline-float-divide-max-throughput @gol
5603 +-mno-inline-float-divide @gol
5604 +-minline-int-divide-min-latency @gol
5605 +-minline-int-divide-max-throughput @gol
5606 +-mno-inline-int-divide @gol
5607 +-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
5608 +-mno-inline-sqrt @gol
5609 +-mdwarf2-asm -mearly-stop-bits @gol
5610 +-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
5611 +-mtune=@var{cpu-type} -milp32 -mlp64 @gol
5612 +-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
5613 +-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
5614 +-msched-spec-ldc -msched-spec-control-ldc @gol
5615 +-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
5616 +-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
5617 +-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
5618 +-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
5620 +@emph{IA-64/VMS Options}
5621 +@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
5623 +@emph{LM32 Options}
5624 +@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
5625 +-msign-extend-enabled -muser-enabled}
5627 +@emph{M32R/D Options}
5628 +@gccoptlist{-m32r2 -m32rx -m32r @gol
5629 +-mdebug @gol
5630 +-malign-loops -mno-align-loops @gol
5631 +-missue-rate=@var{number} @gol
5632 +-mbranch-cost=@var{number} @gol
5633 +-mmodel=@var{code-size-model-type} @gol
5634 +-msdata=@var{sdata-type} @gol
5635 +-mno-flush-func -mflush-func=@var{name} @gol
5636 +-mno-flush-trap -mflush-trap=@var{number} @gol
5637 +-G @var{num}}
5639 +@emph{M32C Options}
5640 +@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
5642 +@emph{M680x0 Options}
5643 +@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
5644 +-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
5645 +-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
5646 +-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
5647 +-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
5648 +-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
5649 +-malign-int -mstrict-align -msep-data -mno-sep-data @gol
5650 +-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
5651 +-mxgot -mno-xgot}
5653 +@emph{M68hc1x Options}
5654 +@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
5655 +-mauto-incdec -minmax -mlong-calls -mshort @gol
5656 +-msoft-reg-count=@var{count}}
5658 +@emph{MCore Options}
5659 +@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
5660 +-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
5661 +-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
5662 +-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
5663 +-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
5665 +@emph{MeP Options}
5666 +@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
5667 +-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
5668 +-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
5669 +-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
5670 +-mtiny=@var{n}}
5672 +@emph{MicroBlaze Options}
5673 +@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
5674 +-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
5675 +-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
5676 +-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
5677 +-mxl-mode-@var{app-model}}
5679 +@emph{MIPS Options}
5680 +@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
5681 +-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
5682 +-mips64 -mips64r2 @gol
5683 +-mips16 -mno-mips16 -mflip-mips16 @gol
5684 +-minterlink-mips16 -mno-interlink-mips16 @gol
5685 +-mabi=@var{abi} -mabicalls -mno-abicalls @gol
5686 +-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
5687 +-mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
5688 +-msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
5689 +-mfpu=@var{fpu-type} @gol
5690 +-msmartmips -mno-smartmips @gol
5691 +-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
5692 +-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
5693 +-mlong64 -mlong32 -msym32 -mno-sym32 @gol
5694 +-G@var{num} -mlocal-sdata -mno-local-sdata @gol
5695 +-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
5696 +-membedded-data -mno-embedded-data @gol
5697 +-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
5698 +-mcode-readable=@var{setting} @gol
5699 +-msplit-addresses -mno-split-addresses @gol
5700 +-mexplicit-relocs -mno-explicit-relocs @gol
5701 +-mcheck-zero-division -mno-check-zero-division @gol
5702 +-mdivide-traps -mdivide-breaks @gol
5703 +-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
5704 +-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
5705 +-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
5706 +-mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
5707 +-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
5708 +-mflush-func=@var{func} -mno-flush-func @gol
5709 +-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
5710 +-mfp-exceptions -mno-fp-exceptions @gol
5711 +-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
5712 +-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
5714 +@emph{MMIX Options}
5715 +@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
5716 +-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
5717 +-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
5718 +-mno-base-addresses -msingle-exit -mno-single-exit}
5720 +@emph{MN10300 Options}
5721 +@gccoptlist{-mmult-bug -mno-mult-bug @gol
5722 +-mno-am33 -mam33 -mam33-2 -mam34 @gol
5723 +-mtune=@var{cpu-type} @gol
5724 +-mreturn-pointer-on-d0 @gol
5725 +-mno-crt0 -mrelax -mliw}
5727 +@emph{PDP-11 Options}
5728 +@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
5729 +-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
5730 +-mint16 -mno-int32 -mfloat32 -mno-float64 @gol
5731 +-mfloat64 -mno-float32 -mabshi -mno-abshi @gol
5732 +-mbranch-expensive -mbranch-cheap @gol
5733 +-munix-asm -mdec-asm}
5735 +@emph{picoChip Options}
5736 +@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
5737 +-msymbol-as-address -mno-inefficient-warnings}
5739 +@emph{PowerPC Options}
5740 +See RS/6000 and PowerPC Options.
5742 +@emph{RS/6000 and PowerPC Options}
5743 +@gccoptlist{-mcpu=@var{cpu-type} @gol
5744 +-mtune=@var{cpu-type} @gol
5745 +-mcmodel=@var{code-model} @gol
5746 +-mpower -mno-power -mpower2 -mno-power2 @gol
5747 +-mpowerpc -mpowerpc64 -mno-powerpc @gol
5748 +-maltivec -mno-altivec @gol
5749 +-mpowerpc-gpopt -mno-powerpc-gpopt @gol
5750 +-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
5751 +-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
5752 +-mfprnd -mno-fprnd @gol
5753 +-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
5754 +-mnew-mnemonics -mold-mnemonics @gol
5755 +-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
5756 +-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
5757 +-malign-power -malign-natural @gol
5758 +-msoft-float -mhard-float -mmultiple -mno-multiple @gol
5759 +-msingle-float -mdouble-float -msimple-fpu @gol
5760 +-mstring -mno-string -mupdate -mno-update @gol
5761 +-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
5762 +-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
5763 +-mstrict-align -mno-strict-align -mrelocatable @gol
5764 +-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
5765 +-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
5766 +-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
5767 +-mprioritize-restricted-insns=@var{priority} @gol
5768 +-msched-costly-dep=@var{dependence_type} @gol
5769 +-minsert-sched-nops=@var{scheme} @gol
5770 +-mcall-sysv -mcall-netbsd @gol
5771 +-maix-struct-return -msvr4-struct-return @gol
5772 +-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
5773 +-mblock-move-inline-limit=@var{num} @gol
5774 +-misel -mno-isel @gol
5775 +-misel=yes -misel=no @gol
5776 +-mspe -mno-spe @gol
5777 +-mspe=yes -mspe=no @gol
5778 +-mpaired @gol
5779 +-mgen-cell-microcode -mwarn-cell-microcode @gol
5780 +-mvrsave -mno-vrsave @gol
5781 +-mmulhw -mno-mulhw @gol
5782 +-mdlmzb -mno-dlmzb @gol
5783 +-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
5784 +-mprototype -mno-prototype @gol
5785 +-msim -mmvme -mads -myellowknife -memb -msdata @gol
5786 +-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
5787 +-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision
5788 +-mno-recip-precision @gol
5789 +-mveclibabi=@var{type} -mfriz -mno-friz}
5791 +@emph{RX Options}
5792 +@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
5793 +-mcpu=@gol
5794 +-mbig-endian-data -mlittle-endian-data @gol
5795 +-msmall-data @gol
5796 +-msim -mno-sim@gol
5797 +-mas100-syntax -mno-as100-syntax@gol
5798 +-mrelax@gol
5799 +-mmax-constant-size=@gol
5800 +-mint-register=@gol
5801 +-msave-acc-in-interrupts}
5803 +@emph{S/390 and zSeries Options}
5804 +@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
5805 +-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
5806 +-mlong-double-64 -mlong-double-128 @gol
5807 +-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
5808 +-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
5809 +-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
5810 +-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
5811 +-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
5813 +@emph{Score Options}
5814 +@gccoptlist{-meb -mel @gol
5815 +-mnhwloop @gol
5816 +-muls @gol
5817 +-mmac @gol
5818 +-mscore5 -mscore5u -mscore7 -mscore7d}
5820 +@emph{SH Options}
5821 +@gccoptlist{-m1 -m2 -m2e @gol
5822 +-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
5823 +-m3 -m3e @gol
5824 +-m4-nofpu -m4-single-only -m4-single -m4 @gol
5825 +-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
5826 +-m5-64media -m5-64media-nofpu @gol
5827 +-m5-32media -m5-32media-nofpu @gol
5828 +-m5-compact -m5-compact-nofpu @gol
5829 +-mb -ml -mdalign -mrelax @gol
5830 +-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
5831 +-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
5832 +-mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
5833 +-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
5834 +-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
5835 +-maccumulate-outgoing-args -minvalid-symbols}
5837 +@emph{Solaris 2 Options}
5838 +@gccoptlist{-mimpure-text -mno-impure-text @gol
5839 +-threads -pthreads -pthread}
5841 +@emph{SPARC Options}
5842 +@gccoptlist{-mcpu=@var{cpu-type} @gol
5843 +-mtune=@var{cpu-type} @gol
5844 +-mcmodel=@var{code-model} @gol
5845 +-m32 -m64 -mapp-regs -mno-app-regs @gol
5846 +-mfaster-structs -mno-faster-structs @gol
5847 +-mfpu -mno-fpu -mhard-float -msoft-float @gol
5848 +-mhard-quad-float -msoft-quad-float @gol
5849 +-mlittle-endian @gol
5850 +-mstack-bias -mno-stack-bias @gol
5851 +-munaligned-doubles -mno-unaligned-doubles @gol
5852 +-mv8plus -mno-v8plus -mvis -mno-vis @gol
5853 +-mfix-at697f}
5855 +@emph{SPU Options}
5856 +@gccoptlist{-mwarn-reloc -merror-reloc @gol
5857 +-msafe-dma -munsafe-dma @gol
5858 +-mbranch-hints @gol
5859 +-msmall-mem -mlarge-mem -mstdmain @gol
5860 +-mfixed-range=@var{register-range} @gol
5861 +-mea32 -mea64 @gol
5862 +-maddress-space-conversion -mno-address-space-conversion @gol
5863 +-mcache-size=@var{cache-size} @gol
5864 +-matomic-updates -mno-atomic-updates}
5866 +@emph{System V Options}
5867 +@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
5869 +@emph{V850 Options}
5870 +@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
5871 +-mprolog-function -mno-prolog-function -mspace @gol
5872 +-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
5873 +-mapp-regs -mno-app-regs @gol
5874 +-mdisable-callt -mno-disable-callt @gol
5875 +-mv850e2v3 @gol
5876 +-mv850e2 @gol
5877 +-mv850e1 -mv850es @gol
5878 +-mv850e @gol
5879 +-mv850 -mbig-switch}
5881 +@emph{VAX Options}
5882 +@gccoptlist{-mg -mgnu -munix}
5884 +@emph{VxWorks Options}
5885 +@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
5886 +-Xbind-lazy -Xbind-now}
5888 +@emph{x86-64 Options}
5889 +See i386 and x86-64 Options.
5891 +@emph{Xstormy16 Options}
5892 +@gccoptlist{-msim}
5894 +@emph{Xtensa Options}
5895 +@gccoptlist{-mconst16 -mno-const16 @gol
5896 +-mfused-madd -mno-fused-madd @gol
5897 +-mforce-no-pic @gol
5898 +-mserialize-volatile -mno-serialize-volatile @gol
5899 +-mtext-section-literals -mno-text-section-literals @gol
5900 +-mtarget-align -mno-target-align @gol
5901 +-mlongcalls -mno-longcalls}
5903 +@emph{zSeries Options}
5904 +See S/390 and zSeries Options.
5906 +@item Code Generation Options
5907 +@xref{Code Gen Options,,Options for Code Generation Conventions}.
5908 +@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
5909 +-ffixed-@var{reg} -fexceptions @gol
5910 +-fnon-call-exceptions -funwind-tables @gol
5911 +-fasynchronous-unwind-tables @gol
5912 +-finhibit-size-directive -finstrument-functions @gol
5913 +-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
5914 +-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
5915 +-fno-common -fno-ident @gol
5916 +-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
5917 +-fno-jump-tables @gol
5918 +-frecord-gcc-switches @gol
5919 +-freg-struct-return -fshort-enums @gol
5920 +-fshort-double -fshort-wchar @gol
5921 +-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
5922 +-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
5923 +-fno-stack-limit -fsplit-stack @gol
5924 +-fleading-underscore -ftls-model=@var{model} @gol
5925 +-ftrapv -fwrapv -fbounds-check @gol
5926 +-fvisibility -fstrict-volatile-bitfields}
5927 +@end table
5929 +@menu
5930 +* Overall Options:: Controlling the kind of output:
5931 + an executable, object files, assembler files,
5932 + or preprocessed source.
5933 +* C Dialect Options:: Controlling the variant of C language compiled.
5934 +* C++ Dialect Options:: Variations on C++.
5935 +* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
5936 + and Objective-C++.
5937 +* Language Independent Options:: Controlling how diagnostics should be
5938 + formatted.
5939 +* Warning Options:: How picky should the compiler be?
5940 +* Debugging Options:: Symbol tables, measurements, and debugging dumps.
5941 +* Optimize Options:: How much optimization?
5942 +* Preprocessor Options:: Controlling header files and macro definitions.
5943 + Also, getting dependency information for Make.
5944 +* Assembler Options:: Passing options to the assembler.
5945 +* Link Options:: Specifying libraries and so on.
5946 +* Directory Options:: Where to find header files and libraries.
5947 + Where to find the compiler executable files.
5948 +* Spec Files:: How to pass switches to sub-processes.
5949 +* Target Options:: Running a cross-compiler, or an old version of GCC.
5950 +@end menu
5952 +@node Overall Options
5953 +@section Options Controlling the Kind of Output
5955 +Compilation can involve up to four stages: preprocessing, compilation
5956 +proper, assembly and linking, always in that order. GCC is capable of
5957 +preprocessing and compiling several files either into several
5958 +assembler input files, or into one assembler input file; then each
5959 +assembler input file produces an object file, and linking combines all
5960 +the object files (those newly compiled, and those specified as input)
5961 +into an executable file.
5963 +@cindex file name suffix
5964 +For any given input file, the file name suffix determines what kind of
5965 +compilation is done:
5967 +@table @gcctabopt
5968 +@item @var{file}.c
5969 +C source code which must be preprocessed.
5971 +@item @var{file}.i
5972 +C source code which should not be preprocessed.
5974 +@item @var{file}.ii
5975 +C++ source code which should not be preprocessed.
5977 +@item @var{file}.m
5978 +Objective-C source code. Note that you must link with the @file{libobjc}
5979 +library to make an Objective-C program work.
5981 +@item @var{file}.mi
5982 +Objective-C source code which should not be preprocessed.
5984 +@item @var{file}.mm
5985 +@itemx @var{file}.M
5986 +Objective-C++ source code. Note that you must link with the @file{libobjc}
5987 +library to make an Objective-C++ program work. Note that @samp{.M} refers
5988 +to a literal capital M@.
5990 +@item @var{file}.mii
5991 +Objective-C++ source code which should not be preprocessed.
5993 +@item @var{file}.h
5994 +C, C++, Objective-C or Objective-C++ header file to be turned into a
5995 +precompiled header (default), or C, C++ header file to be turned into an
5996 +Ada spec (via the @option{-fdump-ada-spec} switch).
5998 +@item @var{file}.cc
5999 +@itemx @var{file}.cp
6000 +@itemx @var{file}.cxx
6001 +@itemx @var{file}.cpp
6002 +@itemx @var{file}.CPP
6003 +@itemx @var{file}.c++
6004 +@itemx @var{file}.C
6005 +C++ source code which must be preprocessed. Note that in @samp{.cxx},
6006 +the last two letters must both be literally @samp{x}. Likewise,
6007 +@samp{.C} refers to a literal capital C@.
6009 +@item @var{file}.mm
6010 +@itemx @var{file}.M
6011 +Objective-C++ source code which must be preprocessed.
6013 +@item @var{file}.mii
6014 +Objective-C++ source code which should not be preprocessed.
6016 +@item @var{file}.hh
6017 +@itemx @var{file}.H
6018 +@itemx @var{file}.hp
6019 +@itemx @var{file}.hxx
6020 +@itemx @var{file}.hpp
6021 +@itemx @var{file}.HPP
6022 +@itemx @var{file}.h++
6023 +@itemx @var{file}.tcc
6024 +C++ header file to be turned into a precompiled header or Ada spec.
6026 +@item @var{file}.f
6027 +@itemx @var{file}.for
6028 +@itemx @var{file}.ftn
6029 +Fixed form Fortran source code which should not be preprocessed.
6031 +@item @var{file}.F
6032 +@itemx @var{file}.FOR
6033 +@itemx @var{file}.fpp
6034 +@itemx @var{file}.FPP
6035 +@itemx @var{file}.FTN
6036 +Fixed form Fortran source code which must be preprocessed (with the traditional
6037 +preprocessor).
6039 +@item @var{file}.f90
6040 +@itemx @var{file}.f95
6041 +@itemx @var{file}.f03
6042 +@itemx @var{file}.f08
6043 +Free form Fortran source code which should not be preprocessed.
6045 +@item @var{file}.F90
6046 +@itemx @var{file}.F95
6047 +@itemx @var{file}.F03
6048 +@itemx @var{file}.F08
6049 +Free form Fortran source code which must be preprocessed (with the
6050 +traditional preprocessor).
6052 +@item @var{file}.go
6053 +Go source code.
6055 +@c FIXME: Descriptions of Java file types.
6056 +@c @var{file}.java
6057 +@c @var{file}.class
6058 +@c @var{file}.zip
6059 +@c @var{file}.jar
6061 +@item @var{file}.ads
6062 +Ada source code file which contains a library unit declaration (a
6063 +declaration of a package, subprogram, or generic, or a generic
6064 +instantiation), or a library unit renaming declaration (a package,
6065 +generic, or subprogram renaming declaration). Such files are also
6066 +called @dfn{specs}.
6068 +@item @var{file}.adb
6069 +Ada source code file containing a library unit body (a subprogram or
6070 +package body). Such files are also called @dfn{bodies}.
6072 +@c GCC also knows about some suffixes for languages not yet included:
6073 +@c Pascal:
6074 +@c @var{file}.p
6075 +@c @var{file}.pas
6076 +@c Ratfor:
6077 +@c @var{file}.r
6079 +@item @var{file}.s
6080 +Assembler code.
6082 +@item @var{file}.S
6083 +@itemx @var{file}.sx
6084 +Assembler code which must be preprocessed.
6086 +@item @var{other}
6087 +An object file to be fed straight into linking.
6088 +Any file name with no recognized suffix is treated this way.
6089 +@end table
6091 +@opindex x
6092 +You can specify the input language explicitly with the @option{-x} option:
6094 +@table @gcctabopt
6095 +@item -x @var{language}
6096 +Specify explicitly the @var{language} for the following input files
6097 +(rather than letting the compiler choose a default based on the file
6098 +name suffix). This option applies to all following input files until
6099 +the next @option{-x} option. Possible values for @var{language} are:
6100 +@smallexample
6101 +c c-header cpp-output
6102 +c++ c++-header c++-cpp-output
6103 +objective-c objective-c-header objective-c-cpp-output
6104 +objective-c++ objective-c++-header objective-c++-cpp-output
6105 +assembler assembler-with-cpp
6106 +ada
6107 +f77 f77-cpp-input f95 f95-cpp-input
6109 +java
6110 +@end smallexample
6112 +@item -x none
6113 +Turn off any specification of a language, so that subsequent files are
6114 +handled according to their file name suffixes (as they are if @option{-x}
6115 +has not been used at all).
6117 +@item -pass-exit-codes
6118 +@opindex pass-exit-codes
6119 +Normally the @command{gcc} program will exit with the code of 1 if any
6120 +phase of the compiler returns a non-success return code. If you specify
6121 +@option{-pass-exit-codes}, the @command{gcc} program will instead return with
6122 +numerically highest error produced by any phase that returned an error
6123 +indication. The C, C++, and Fortran frontends return 4, if an internal
6124 +compiler error is encountered.
6125 +@end table
6127 +If you only want some of the stages of compilation, you can use
6128 +@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
6129 +one of the options @option{-c}, @option{-S}, or @option{-E} to say where
6130 +@command{gcc} is to stop. Note that some combinations (for example,
6131 +@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
6133 +@table @gcctabopt
6134 +@item -c
6135 +@opindex c
6136 +Compile or assemble the source files, but do not link. The linking
6137 +stage simply is not done. The ultimate output is in the form of an
6138 +object file for each source file.
6140 +By default, the object file name for a source file is made by replacing
6141 +the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
6143 +Unrecognized input files, not requiring compilation or assembly, are
6144 +ignored.
6146 +@item -S
6147 +@opindex S
6148 +Stop after the stage of compilation proper; do not assemble. The output
6149 +is in the form of an assembler code file for each non-assembler input
6150 +file specified.
6152 +By default, the assembler file name for a source file is made by
6153 +replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
6155 +Input files that don't require compilation are ignored.
6157 +@item -E
6158 +@opindex E
6159 +Stop after the preprocessing stage; do not run the compiler proper. The
6160 +output is in the form of preprocessed source code, which is sent to the
6161 +standard output.
6163 +Input files which don't require preprocessing are ignored.
6165 +@cindex output file option
6166 +@item -o @var{file}
6167 +@opindex o
6168 +Place output in file @var{file}. This applies regardless to whatever
6169 +sort of output is being produced, whether it be an executable file,
6170 +an object file, an assembler file or preprocessed C code.
6172 +If @option{-o} is not specified, the default is to put an executable
6173 +file in @file{a.out}, the object file for
6174 +@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
6175 +assembler file in @file{@var{source}.s}, a precompiled header file in
6176 +@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
6177 +standard output.
6179 +@item -v
6180 +@opindex v
6181 +Print (on standard error output) the commands executed to run the stages
6182 +of compilation. Also print the version number of the compiler driver
6183 +program and of the preprocessor and the compiler proper.
6185 +@item -###
6186 +@opindex ###
6187 +Like @option{-v} except the commands are not executed and arguments
6188 +are quoted unless they contain only alphanumeric characters or @code{./-_}.
6189 +This is useful for shell scripts to capture the driver-generated command lines.
6191 +@item -pipe
6192 +@opindex pipe
6193 +Use pipes rather than temporary files for communication between the
6194 +various stages of compilation. This fails to work on some systems where
6195 +the assembler is unable to read from a pipe; but the GNU assembler has
6196 +no trouble.
6198 +@item --help
6199 +@opindex help
6200 +Print (on the standard output) a description of the command line options
6201 +understood by @command{gcc}. If the @option{-v} option is also specified
6202 +then @option{--help} will also be passed on to the various processes
6203 +invoked by @command{gcc}, so that they can display the command line options
6204 +they accept. If the @option{-Wextra} option has also been specified
6205 +(prior to the @option{--help} option), then command line options which
6206 +have no documentation associated with them will also be displayed.
6208 +@item --target-help
6209 +@opindex target-help
6210 +Print (on the standard output) a description of target-specific command
6211 +line options for each tool. For some targets extra target-specific
6212 +information may also be printed.
6214 +@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
6215 +Print (on the standard output) a description of the command line
6216 +options understood by the compiler that fit into all specified classes
6217 +and qualifiers. These are the supported classes:
6219 +@table @asis
6220 +@item @samp{optimizers}
6221 +This will display all of the optimization options supported by the
6222 +compiler.
6224 +@item @samp{warnings}
6225 +This will display all of the options controlling warning messages
6226 +produced by the compiler.
6228 +@item @samp{target}
6229 +This will display target-specific options. Unlike the
6230 +@option{--target-help} option however, target-specific options of the
6231 +linker and assembler will not be displayed. This is because those
6232 +tools do not currently support the extended @option{--help=} syntax.
6234 +@item @samp{params}
6235 +This will display the values recognized by the @option{--param}
6236 +option.
6238 +@item @var{language}
6239 +This will display the options supported for @var{language}, where
6240 +@var{language} is the name of one of the languages supported in this
6241 +version of GCC.
6243 +@item @samp{common}
6244 +This will display the options that are common to all languages.
6245 +@end table
6247 +These are the supported qualifiers:
6249 +@table @asis
6250 +@item @samp{undocumented}
6251 +Display only those options which are undocumented.
6253 +@item @samp{joined}
6254 +Display options which take an argument that appears after an equal
6255 +sign in the same continuous piece of text, such as:
6256 +@samp{--help=target}.
6258 +@item @samp{separate}
6259 +Display options which take an argument that appears as a separate word
6260 +following the original option, such as: @samp{-o output-file}.
6261 +@end table
6263 +Thus for example to display all the undocumented target-specific
6264 +switches supported by the compiler the following can be used:
6266 +@smallexample
6267 +--help=target,undocumented
6268 +@end smallexample
6270 +The sense of a qualifier can be inverted by prefixing it with the
6271 +@samp{^} character, so for example to display all binary warning
6272 +options (i.e., ones that are either on or off and that do not take an
6273 +argument), which have a description the following can be used:
6275 +@smallexample
6276 +--help=warnings,^joined,^undocumented
6277 +@end smallexample
6279 +The argument to @option{--help=} should not consist solely of inverted
6280 +qualifiers.
6282 +Combining several classes is possible, although this usually
6283 +restricts the output by so much that there is nothing to display. One
6284 +case where it does work however is when one of the classes is
6285 +@var{target}. So for example to display all the target-specific
6286 +optimization options the following can be used:
6288 +@smallexample
6289 +--help=target,optimizers
6290 +@end smallexample
6292 +The @option{--help=} option can be repeated on the command line. Each
6293 +successive use will display its requested class of options, skipping
6294 +those that have already been displayed.
6296 +If the @option{-Q} option appears on the command line before the
6297 +@option{--help=} option, then the descriptive text displayed by
6298 +@option{--help=} is changed. Instead of describing the displayed
6299 +options, an indication is given as to whether the option is enabled,
6300 +disabled or set to a specific value (assuming that the compiler
6301 +knows this at the point where the @option{--help=} option is used).
6303 +Here is a truncated example from the ARM port of @command{gcc}:
6305 +@smallexample
6306 + % gcc -Q -mabi=2 --help=target -c
6307 + The following options are target specific:
6308 + -mabi= 2
6309 + -mabort-on-noreturn [disabled]
6310 + -mapcs [disabled]
6311 +@end smallexample
6313 +The output is sensitive to the effects of previous command line
6314 +options, so for example it is possible to find out which optimizations
6315 +are enabled at @option{-O2} by using:
6317 +@smallexample
6318 +-Q -O2 --help=optimizers
6319 +@end smallexample
6321 +Alternatively you can discover which binary optimizations are enabled
6322 +by @option{-O3} by using:
6324 +@smallexample
6325 +gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
6326 +gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
6327 +diff /tmp/O2-opts /tmp/O3-opts | grep enabled
6328 +@end smallexample
6330 +@item -no-canonical-prefixes
6331 +@opindex no-canonical-prefixes
6332 +Do not expand any symbolic links, resolve references to @samp{/../}
6333 +or @samp{/./}, or make the path absolute when generating a relative
6334 +prefix.
6336 +@item --version
6337 +@opindex version
6338 +Display the version number and copyrights of the invoked GCC@.
6340 +@item -wrapper
6341 +@opindex wrapper
6342 +Invoke all subcommands under a wrapper program. The name of the
6343 +wrapper program and its parameters are passed as a comma separated
6344 +list.
6346 +@smallexample
6347 +gcc -c t.c -wrapper gdb,--args
6348 +@end smallexample
6350 +This will invoke all subprograms of @command{gcc} under
6351 +@samp{gdb --args}, thus the invocation of @command{cc1} will be
6352 +@samp{gdb --args cc1 @dots{}}.
6354 +@item -fplugin=@var{name}.so
6355 +Load the plugin code in file @var{name}.so, assumed to be a
6356 +shared object to be dlopen'd by the compiler. The base name of
6357 +the shared object file is used to identify the plugin for the
6358 +purposes of argument parsing (See
6359 +@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
6360 +Each plugin should define the callback functions specified in the
6361 +Plugins API.
6363 +@item -fplugin-arg-@var{name}-@var{key}=@var{value}
6364 +Define an argument called @var{key} with a value of @var{value}
6365 +for the plugin called @var{name}.
6367 +@item -fdump-ada-spec@r{[}-slim@r{]}
6368 +For C and C++ source and include files, generate corresponding Ada
6369 +specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
6370 +GNAT User's Guide}, which provides detailed documentation on this feature.
6372 +@item -fdump-go-spec=@var{file}
6373 +For input files in any language, generate corresponding Go
6374 +declarations in @var{file}. This generates Go @code{const},
6375 +@code{type}, @code{var}, and @code{func} declarations which may be a
6376 +useful way to start writing a Go interface to code written in some
6377 +other language.
6379 +@include @value{srcdir}/../libiberty/at-file.texi
6380 +@end table
6382 +@node Invoking G++
6383 +@section Compiling C++ Programs
6385 +@cindex suffixes for C++ source
6386 +@cindex C++ source file suffixes
6387 +C++ source files conventionally use one of the suffixes @samp{.C},
6388 +@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
6389 +@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
6390 +@samp{.H}, or (for shared template code) @samp{.tcc}; and
6391 +preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
6392 +files with these names and compiles them as C++ programs even if you
6393 +call the compiler the same way as for compiling C programs (usually
6394 +with the name @command{gcc}).
6396 +@findex g++
6397 +@findex c++
6398 +However, the use of @command{gcc} does not add the C++ library.
6399 +@command{g++} is a program that calls GCC and treats @samp{.c},
6400 +@samp{.h} and @samp{.i} files as C++ source files instead of C source
6401 +files unless @option{-x} is used, and automatically specifies linking
6402 +against the C++ library. This program is also useful when
6403 +precompiling a C header file with a @samp{.h} extension for use in C++
6404 +compilations. On many systems, @command{g++} is also installed with
6405 +the name @command{c++}.
6407 +@cindex invoking @command{g++}
6408 +When you compile C++ programs, you may specify many of the same
6409 +command-line options that you use for compiling programs in any
6410 +language; or command-line options meaningful for C and related
6411 +languages; or options that are meaningful only for C++ programs.
6412 +@xref{C Dialect Options,,Options Controlling C Dialect}, for
6413 +explanations of options for languages related to C@.
6414 +@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
6415 +explanations of options that are meaningful only for C++ programs.
6417 +@node C Dialect Options
6418 +@section Options Controlling C Dialect
6419 +@cindex dialect options
6420 +@cindex language dialect options
6421 +@cindex options, dialect
6423 +The following options control the dialect of C (or languages derived
6424 +from C, such as C++, Objective-C and Objective-C++) that the compiler
6425 +accepts:
6427 +@table @gcctabopt
6428 +@cindex ANSI support
6429 +@cindex ISO support
6430 +@item -ansi
6431 +@opindex ansi
6432 +In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
6433 +equivalent to @samp{-std=c++98}.
6435 +This turns off certain features of GCC that are incompatible with ISO
6436 +C90 (when compiling C code), or of standard C++ (when compiling C++ code),
6437 +such as the @code{asm} and @code{typeof} keywords, and
6438 +predefined macros such as @code{unix} and @code{vax} that identify the
6439 +type of system you are using. It also enables the undesirable and
6440 +rarely used ISO trigraph feature. For the C compiler,
6441 +it disables recognition of C++ style @samp{//} comments as well as
6442 +the @code{inline} keyword.
6444 +The alternate keywords @code{__asm__}, @code{__extension__},
6445 +@code{__inline__} and @code{__typeof__} continue to work despite
6446 +@option{-ansi}. You would not want to use them in an ISO C program, of
6447 +course, but it is useful to put them in header files that might be included
6448 +in compilations done with @option{-ansi}. Alternate predefined macros
6449 +such as @code{__unix__} and @code{__vax__} are also available, with or
6450 +without @option{-ansi}.
6452 +The @option{-ansi} option does not cause non-ISO programs to be
6453 +rejected gratuitously. For that, @option{-pedantic} is required in
6454 +addition to @option{-ansi}. @xref{Warning Options}.
6456 +The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
6457 +option is used. Some header files may notice this macro and refrain
6458 +from declaring certain functions or defining certain macros that the
6459 +ISO standard doesn't call for; this is to avoid interfering with any
6460 +programs that might use these names for other things.
6462 +Functions that would normally be built in but do not have semantics
6463 +defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
6464 +functions when @option{-ansi} is used. @xref{Other Builtins,,Other
6465 +built-in functions provided by GCC}, for details of the functions
6466 +affected.
6468 +@item -std=
6469 +@opindex std
6470 +Determine the language standard. @xref{Standards,,Language Standards
6471 +Supported by GCC}, for details of these standard versions. This option
6472 +is currently only supported when compiling C or C++.
6474 +The compiler can accept several base standards, such as @samp{c90} or
6475 +@samp{c++98}, and GNU dialects of those standards, such as
6476 +@samp{gnu90} or @samp{gnu++98}. By specifying a base standard, the
6477 +compiler will accept all programs following that standard and those
6478 +using GNU extensions that do not contradict it. For example,
6479 +@samp{-std=c90} turns off certain features of GCC that are
6480 +incompatible with ISO C90, such as the @code{asm} and @code{typeof}
6481 +keywords, but not other GNU extensions that do not have a meaning in
6482 +ISO C90, such as omitting the middle term of a @code{?:}
6483 +expression. On the other hand, by specifying a GNU dialect of a
6484 +standard, all features the compiler support are enabled, even when
6485 +those features change the meaning of the base standard and some
6486 +strict-conforming programs may be rejected. The particular standard
6487 +is used by @option{-pedantic} to identify which features are GNU
6488 +extensions given that version of the standard. For example
6489 +@samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
6490 +comments, while @samp{-std=gnu99 -pedantic} would not.
6492 +A value for this option must be provided; possible values are
6494 +@table @samp
6495 +@item c90
6496 +@itemx c89
6497 +@itemx iso9899:1990
6498 +Support all ISO C90 programs (certain GNU extensions that conflict
6499 +with ISO C90 are disabled). Same as @option{-ansi} for C code.
6501 +@item iso9899:199409
6502 +ISO C90 as modified in amendment 1.
6504 +@item c99
6505 +@itemx c9x
6506 +@itemx iso9899:1999
6507 +@itemx iso9899:199x
6508 +ISO C99. Note that this standard is not yet fully supported; see
6509 +@w{@uref{http://gcc.gnu.org/gcc-4.6/c99status.html}} for more information. The
6510 +names @samp{c9x} and @samp{iso9899:199x} are deprecated.
6512 +@item c1x
6513 +ISO C1X, the draft of the next revision of the ISO C standard.
6514 +Support is limited and experimental and features enabled by this
6515 +option may be changed or removed if changed in or removed from the
6516 +standard draft.
6518 +@item gnu90
6519 +@itemx gnu89
6520 +GNU dialect of ISO C90 (including some C99 features). This
6521 +is the default for C code.
6523 +@item gnu99
6524 +@itemx gnu9x
6525 +GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
6526 +this will become the default. The name @samp{gnu9x} is deprecated.
6528 +@item gnu1x
6529 +GNU dialect of ISO C1X. Support is limited and experimental and
6530 +features enabled by this option may be changed or removed if changed
6531 +in or removed from the standard draft.
6533 +@item c++98
6534 +The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
6535 +C++ code.
6537 +@item gnu++98
6538 +GNU dialect of @option{-std=c++98}. This is the default for
6539 +C++ code.
6541 +@item c++0x
6542 +The working draft of the upcoming ISO C++0x standard. This option
6543 +enables experimental features that are likely to be included in
6544 +C++0x. The working draft is constantly changing, and any feature that is
6545 +enabled by this flag may be removed from future versions of GCC if it is
6546 +not part of the C++0x standard.
6548 +@item gnu++0x
6549 +GNU dialect of @option{-std=c++0x}. This option enables
6550 +experimental features that may be removed in future versions of GCC.
6551 +@end table
6553 +@item -fgnu89-inline
6554 +@opindex fgnu89-inline
6555 +The option @option{-fgnu89-inline} tells GCC to use the traditional
6556 +GNU semantics for @code{inline} functions when in C99 mode.
6557 +@xref{Inline,,An Inline Function is As Fast As a Macro}. This option
6558 +is accepted and ignored by GCC versions 4.1.3 up to but not including
6559 +4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
6560 +C99 mode. Using this option is roughly equivalent to adding the
6561 +@code{gnu_inline} function attribute to all inline functions
6562 +(@pxref{Function Attributes}).
6564 +The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
6565 +C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
6566 +specifies the default behavior). This option was first supported in
6567 +GCC 4.3. This option is not supported in @option{-std=c90} or
6568 +@option{-std=gnu90} mode.
6570 +The preprocessor macros @code{__GNUC_GNU_INLINE__} and
6571 +@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
6572 +in effect for @code{inline} functions. @xref{Common Predefined
6573 +Macros,,,cpp,The C Preprocessor}.
6575 +@item -aux-info @var{filename}
6576 +@opindex aux-info
6577 +Output to the given filename prototyped declarations for all functions
6578 +declared and/or defined in a translation unit, including those in header
6579 +files. This option is silently ignored in any language other than C@.
6581 +Besides declarations, the file indicates, in comments, the origin of
6582 +each declaration (source file and line), whether the declaration was
6583 +implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
6584 +@samp{O} for old, respectively, in the first character after the line
6585 +number and the colon), and whether it came from a declaration or a
6586 +definition (@samp{C} or @samp{F}, respectively, in the following
6587 +character). In the case of function definitions, a K&R-style list of
6588 +arguments followed by their declarations is also provided, inside
6589 +comments, after the declaration.
6591 +@item -fno-asm
6592 +@opindex fno-asm
6593 +Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
6594 +keyword, so that code can use these words as identifiers. You can use
6595 +the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
6596 +instead. @option{-ansi} implies @option{-fno-asm}.
6598 +In C++, this switch only affects the @code{typeof} keyword, since
6599 +@code{asm} and @code{inline} are standard keywords. You may want to
6600 +use the @option{-fno-gnu-keywords} flag instead, which has the same
6601 +effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
6602 +switch only affects the @code{asm} and @code{typeof} keywords, since
6603 +@code{inline} is a standard keyword in ISO C99.
6605 +@item -fno-builtin
6606 +@itemx -fno-builtin-@var{function}
6607 +@opindex fno-builtin
6608 +@cindex built-in functions
6609 +Don't recognize built-in functions that do not begin with
6610 +@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
6611 +functions provided by GCC}, for details of the functions affected,
6612 +including those which are not built-in functions when @option{-ansi} or
6613 +@option{-std} options for strict ISO C conformance are used because they
6614 +do not have an ISO standard meaning.
6616 +GCC normally generates special code to handle certain built-in functions
6617 +more efficiently; for instance, calls to @code{alloca} may become single
6618 +instructions that adjust the stack directly, and calls to @code{memcpy}
6619 +may become inline copy loops. The resulting code is often both smaller
6620 +and faster, but since the function calls no longer appear as such, you
6621 +cannot set a breakpoint on those calls, nor can you change the behavior
6622 +of the functions by linking with a different library. In addition,
6623 +when a function is recognized as a built-in function, GCC may use
6624 +information about that function to warn about problems with calls to
6625 +that function, or to generate more efficient code, even if the
6626 +resulting code still contains calls to that function. For example,
6627 +warnings are given with @option{-Wformat} for bad calls to
6628 +@code{printf}, when @code{printf} is built in, and @code{strlen} is
6629 +known not to modify global memory.
6631 +With the @option{-fno-builtin-@var{function}} option
6632 +only the built-in function @var{function} is
6633 +disabled. @var{function} must not begin with @samp{__builtin_}. If a
6634 +function is named that is not built-in in this version of GCC, this
6635 +option is ignored. There is no corresponding
6636 +@option{-fbuiltin-@var{function}} option; if you wish to enable
6637 +built-in functions selectively when using @option{-fno-builtin} or
6638 +@option{-ffreestanding}, you may define macros such as:
6640 +@smallexample
6641 +#define abs(n) __builtin_abs ((n))
6642 +#define strcpy(d, s) __builtin_strcpy ((d), (s))
6643 +@end smallexample
6645 +@item -fhosted
6646 +@opindex fhosted
6647 +@cindex hosted environment
6649 +Assert that compilation takes place in a hosted environment. This implies
6650 +@option{-fbuiltin}. A hosted environment is one in which the
6651 +entire standard library is available, and in which @code{main} has a return
6652 +type of @code{int}. Examples are nearly everything except a kernel.
6653 +This is equivalent to @option{-fno-freestanding}.
6655 +@item -ffreestanding
6656 +@opindex ffreestanding
6657 +@cindex hosted environment
6659 +Assert that compilation takes place in a freestanding environment. This
6660 +implies @option{-fno-builtin}. A freestanding environment
6661 +is one in which the standard library may not exist, and program startup may
6662 +not necessarily be at @code{main}. The most obvious example is an OS kernel.
6663 +This is equivalent to @option{-fno-hosted}.
6665 +@xref{Standards,,Language Standards Supported by GCC}, for details of
6666 +freestanding and hosted environments.
6668 +@item -fopenmp
6669 +@opindex fopenmp
6670 +@cindex OpenMP parallel
6671 +Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
6672 +@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
6673 +compiler generates parallel code according to the OpenMP Application
6674 +Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
6675 +implies @option{-pthread}, and thus is only supported on targets that
6676 +have support for @option{-pthread}.
6678 +@item -fms-extensions
6679 +@opindex fms-extensions
6680 +Accept some non-standard constructs used in Microsoft header files.
6682 +In C++ code, this allows member names in structures to be similar
6683 +to previous types declarations.
6685 +@smallexample
6686 +typedef int UOW;
6687 +struct ABC @{
6688 + UOW UOW;
6689 +@};
6690 +@end smallexample
6692 +Some cases of unnamed fields in structures and unions are only
6693 +accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
6694 +fields within structs/unions}, for details.
6696 +@item -fplan9-extensions
6697 +Accept some non-standard constructs used in Plan 9 code.
6699 +This enables @option{-fms-extensions}, permits passing pointers to
6700 +structures with anonymous fields to functions which expect pointers to
6701 +elements of the type of the field, and permits referring to anonymous
6702 +fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
6703 +struct/union fields within structs/unions}, for details. This is only
6704 +supported for C, not C++.
6706 +@item -trigraphs
6707 +@opindex trigraphs
6708 +Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
6709 +options for strict ISO C conformance) implies @option{-trigraphs}.
6711 +@item -no-integrated-cpp
6712 +@opindex no-integrated-cpp
6713 +Performs a compilation in two passes: preprocessing and compiling. This
6714 +option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
6715 +@option{-B} option. The user supplied compilation step can then add in
6716 +an additional preprocessing step after normal preprocessing but before
6717 +compiling. The default is to use the integrated cpp (internal cpp)
6719 +The semantics of this option will change if "cc1", "cc1plus", and
6720 +"cc1obj" are merged.
6722 +@cindex traditional C language
6723 +@cindex C language, traditional
6724 +@item -traditional
6725 +@itemx -traditional-cpp
6726 +@opindex traditional-cpp
6727 +@opindex traditional
6728 +Formerly, these options caused GCC to attempt to emulate a pre-standard
6729 +C compiler. They are now only supported with the @option{-E} switch.
6730 +The preprocessor continues to support a pre-standard mode. See the GNU
6731 +CPP manual for details.
6733 +@item -fcond-mismatch
6734 +@opindex fcond-mismatch
6735 +Allow conditional expressions with mismatched types in the second and
6736 +third arguments. The value of such an expression is void. This option
6737 +is not supported for C++.
6739 +@item -flax-vector-conversions
6740 +@opindex flax-vector-conversions
6741 +Allow implicit conversions between vectors with differing numbers of
6742 +elements and/or incompatible element types. This option should not be
6743 +used for new code.
6745 +@item -funsigned-char
6746 +@opindex funsigned-char
6747 +Let the type @code{char} be unsigned, like @code{unsigned char}.
6749 +Each kind of machine has a default for what @code{char} should
6750 +be. It is either like @code{unsigned char} by default or like
6751 +@code{signed char} by default.
6753 +Ideally, a portable program should always use @code{signed char} or
6754 +@code{unsigned char} when it depends on the signedness of an object.
6755 +But many programs have been written to use plain @code{char} and
6756 +expect it to be signed, or expect it to be unsigned, depending on the
6757 +machines they were written for. This option, and its inverse, let you
6758 +make such a program work with the opposite default.
6760 +The type @code{char} is always a distinct type from each of
6761 +@code{signed char} or @code{unsigned char}, even though its behavior
6762 +is always just like one of those two.
6764 +@item -fsigned-char
6765 +@opindex fsigned-char
6766 +Let the type @code{char} be signed, like @code{signed char}.
6768 +Note that this is equivalent to @option{-fno-unsigned-char}, which is
6769 +the negative form of @option{-funsigned-char}. Likewise, the option
6770 +@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
6772 +@item -fsigned-bitfields
6773 +@itemx -funsigned-bitfields
6774 +@itemx -fno-signed-bitfields
6775 +@itemx -fno-unsigned-bitfields
6776 +@opindex fsigned-bitfields
6777 +@opindex funsigned-bitfields
6778 +@opindex fno-signed-bitfields
6779 +@opindex fno-unsigned-bitfields
6780 +These options control whether a bit-field is signed or unsigned, when the
6781 +declaration does not use either @code{signed} or @code{unsigned}. By
6782 +default, such a bit-field is signed, because this is consistent: the
6783 +basic integer types such as @code{int} are signed types.
6784 +@end table
6786 +@node C++ Dialect Options
6787 +@section Options Controlling C++ Dialect
6789 +@cindex compiler options, C++
6790 +@cindex C++ options, command line
6791 +@cindex options, C++
6792 +This section describes the command-line options that are only meaningful
6793 +for C++ programs; but you can also use most of the GNU compiler options
6794 +regardless of what language your program is in. For example, you
6795 +might compile a file @code{firstClass.C} like this:
6797 +@smallexample
6798 +g++ -g -frepo -O -c firstClass.C
6799 +@end smallexample
6801 +@noindent
6802 +In this example, only @option{-frepo} is an option meant
6803 +only for C++ programs; you can use the other options with any
6804 +language supported by GCC@.
6806 +Here is a list of options that are @emph{only} for compiling C++ programs:
6808 +@table @gcctabopt
6810 +@item -fabi-version=@var{n}
6811 +@opindex fabi-version
6812 +Use version @var{n} of the C++ ABI@. Version 2 is the version of the
6813 +C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
6814 +the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
6815 +the version that conforms most closely to the C++ ABI specification.
6816 +Therefore, the ABI obtained using version 0 will change as ABI bugs
6817 +are fixed.
6819 +The default is version 2.
6821 +Version 3 corrects an error in mangling a constant address as a
6822 +template argument.
6824 +Version 4 implements a standard mangling for vector types.
6826 +Version 5 corrects the mangling of attribute const/volatile on
6827 +function pointer types, decltype of a plain decl, and use of a
6828 +function parameter in the declaration of another parameter.
6830 +See also @option{-Wabi}.
6832 +@item -fno-access-control
6833 +@opindex fno-access-control
6834 +Turn off all access checking. This switch is mainly useful for working
6835 +around bugs in the access control code.
6837 +@item -fcheck-new
6838 +@opindex fcheck-new
6839 +Check that the pointer returned by @code{operator new} is non-null
6840 +before attempting to modify the storage allocated. This check is
6841 +normally unnecessary because the C++ standard specifies that
6842 +@code{operator new} will only return @code{0} if it is declared
6843 +@samp{throw()}, in which case the compiler will always check the
6844 +return value even without this option. In all other cases, when
6845 +@code{operator new} has a non-empty exception specification, memory
6846 +exhaustion is signalled by throwing @code{std::bad_alloc}. See also
6847 +@samp{new (nothrow)}.
6849 +@item -fconserve-space
6850 +@opindex fconserve-space
6851 +Put uninitialized or runtime-initialized global variables into the
6852 +common segment, as C does. This saves space in the executable at the
6853 +cost of not diagnosing duplicate definitions. If you compile with this
6854 +flag and your program mysteriously crashes after @code{main()} has
6855 +completed, you may have an object that is being destroyed twice because
6856 +two definitions were merged.
6858 +This option is no longer useful on most targets, now that support has
6859 +been added for putting variables into BSS without making them common.
6861 +@item -fconstexpr-depth=@var{n}
6862 +@opindex fconstexpr-depth
6863 +Set the maximum nested evaluation depth for C++0x constexpr functions
6864 +to @var{n}. A limit is needed to detect endless recursion during
6865 +constant expression evaluation. The minimum specified by the standard
6866 +is 512.
6868 +@item -fno-deduce-init-list
6869 +@opindex fno-deduce-init-list
6870 +Disable deduction of a template type parameter as
6871 +std::initializer_list from a brace-enclosed initializer list, i.e.
6873 +@smallexample
6874 +template <class T> auto forward(T t) -> decltype (realfn (t))
6876 + return realfn (t);
6879 +void f()
6881 + forward(@{1,2@}); // call forward<std::initializer_list<int>>
6883 +@end smallexample
6885 +This option is present because this deduction is an extension to the
6886 +current specification in the C++0x working draft, and there was
6887 +some concern about potential overload resolution problems.
6889 +@item -ffriend-injection
6890 +@opindex ffriend-injection
6891 +Inject friend functions into the enclosing namespace, so that they are
6892 +visible outside the scope of the class in which they are declared.
6893 +Friend functions were documented to work this way in the old Annotated
6894 +C++ Reference Manual, and versions of G++ before 4.1 always worked
6895 +that way. However, in ISO C++ a friend function which is not declared
6896 +in an enclosing scope can only be found using argument dependent
6897 +lookup. This option causes friends to be injected as they were in
6898 +earlier releases.
6900 +This option is for compatibility, and may be removed in a future
6901 +release of G++.
6903 +@item -fno-elide-constructors
6904 +@opindex fno-elide-constructors
6905 +The C++ standard allows an implementation to omit creating a temporary
6906 +which is only used to initialize another object of the same type.
6907 +Specifying this option disables that optimization, and forces G++ to
6908 +call the copy constructor in all cases.
6910 +@item -fno-enforce-eh-specs
6911 +@opindex fno-enforce-eh-specs
6912 +Don't generate code to check for violation of exception specifications
6913 +at runtime. This option violates the C++ standard, but may be useful
6914 +for reducing code size in production builds, much like defining
6915 +@samp{NDEBUG}. This does not give user code permission to throw
6916 +exceptions in violation of the exception specifications; the compiler
6917 +will still optimize based on the specifications, so throwing an
6918 +unexpected exception will result in undefined behavior.
6920 +@item -ffor-scope
6921 +@itemx -fno-for-scope
6922 +@opindex ffor-scope
6923 +@opindex fno-for-scope
6924 +If @option{-ffor-scope} is specified, the scope of variables declared in
6925 +a @i{for-init-statement} is limited to the @samp{for} loop itself,
6926 +as specified by the C++ standard.
6927 +If @option{-fno-for-scope} is specified, the scope of variables declared in
6928 +a @i{for-init-statement} extends to the end of the enclosing scope,
6929 +as was the case in old versions of G++, and other (traditional)
6930 +implementations of C++.
6932 +The default if neither flag is given to follow the standard,
6933 +but to allow and give a warning for old-style code that would
6934 +otherwise be invalid, or have different behavior.
6936 +@item -fno-gnu-keywords
6937 +@opindex fno-gnu-keywords
6938 +Do not recognize @code{typeof} as a keyword, so that code can use this
6939 +word as an identifier. You can use the keyword @code{__typeof__} instead.
6940 +@option{-ansi} implies @option{-fno-gnu-keywords}.
6942 +@item -fno-implicit-templates
6943 +@opindex fno-implicit-templates
6944 +Never emit code for non-inline templates which are instantiated
6945 +implicitly (i.e.@: by use); only emit code for explicit instantiations.
6946 +@xref{Template Instantiation}, for more information.
6948 +@item -fno-implicit-inline-templates
6949 +@opindex fno-implicit-inline-templates
6950 +Don't emit code for implicit instantiations of inline templates, either.
6951 +The default is to handle inlines differently so that compiles with and
6952 +without optimization will need the same set of explicit instantiations.
6954 +@item -fno-implement-inlines
6955 +@opindex fno-implement-inlines
6956 +To save space, do not emit out-of-line copies of inline functions
6957 +controlled by @samp{#pragma implementation}. This will cause linker
6958 +errors if these functions are not inlined everywhere they are called.
6960 +@item -fms-extensions
6961 +@opindex fms-extensions
6962 +Disable pedantic warnings about constructs used in MFC, such as implicit
6963 +int and getting a pointer to member function via non-standard syntax.
6965 +@item -fno-nonansi-builtins
6966 +@opindex fno-nonansi-builtins
6967 +Disable built-in declarations of functions that are not mandated by
6968 +ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
6969 +@code{index}, @code{bzero}, @code{conjf}, and other related functions.
6971 +@item -fnothrow-opt
6972 +@opindex fnothrow-opt
6973 +Treat a @code{throw()} exception specification as though it were a
6974 +@code{noexcept} specification to reduce or eliminate the text size
6975 +overhead relative to a function with no exception specification. If
6976 +the function has local variables of types with non-trivial
6977 +destructors, the exception specification will actually make the
6978 +function smaller because the EH cleanups for those variables can be
6979 +optimized away. The semantic effect is that an exception thrown out of
6980 +a function with such an exception specification will result in a call
6981 +to @code{terminate} rather than @code{unexpected}.
6983 +@item -fno-operator-names
6984 +@opindex fno-operator-names
6985 +Do not treat the operator name keywords @code{and}, @code{bitand},
6986 +@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
6987 +synonyms as keywords.
6989 +@item -fno-optional-diags
6990 +@opindex fno-optional-diags
6991 +Disable diagnostics that the standard says a compiler does not need to
6992 +issue. Currently, the only such diagnostic issued by G++ is the one for
6993 +a name having multiple meanings within a class.
6995 +@item -fpermissive
6996 +@opindex fpermissive
6997 +Downgrade some diagnostics about nonconformant code from errors to
6998 +warnings. Thus, using @option{-fpermissive} will allow some
6999 +nonconforming code to compile.
7001 +@item -fno-pretty-templates
7002 +@opindex fno-pretty-templates
7003 +When an error message refers to a specialization of a function
7004 +template, the compiler will normally print the signature of the
7005 +template followed by the template arguments and any typedefs or
7006 +typenames in the signature (e.g. @code{void f(T) [with T = int]}
7007 +rather than @code{void f(int)}) so that it's clear which template is
7008 +involved. When an error message refers to a specialization of a class
7009 +template, the compiler will omit any template arguments which match
7010 +the default template arguments for that template. If either of these
7011 +behaviors make it harder to understand the error message rather than
7012 +easier, using @option{-fno-pretty-templates} will disable them.
7014 +@item -frepo
7015 +@opindex frepo
7016 +Enable automatic template instantiation at link time. This option also
7017 +implies @option{-fno-implicit-templates}. @xref{Template
7018 +Instantiation}, for more information.
7020 +@item -fno-rtti
7021 +@opindex fno-rtti
7022 +Disable generation of information about every class with virtual
7023 +functions for use by the C++ runtime type identification features
7024 +(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
7025 +of the language, you can save some space by using this flag. Note that
7026 +exception handling uses the same information, but it will generate it as
7027 +needed. The @samp{dynamic_cast} operator can still be used for casts that
7028 +do not require runtime type information, i.e.@: casts to @code{void *} or to
7029 +unambiguous base classes.
7031 +@item -fstats
7032 +@opindex fstats
7033 +Emit statistics about front-end processing at the end of the compilation.
7034 +This information is generally only useful to the G++ development team.
7036 +@item -fstrict-enums
7037 +@opindex fstrict-enums
7038 +Allow the compiler to optimize using the assumption that a value of
7039 +enumeration type can only be one of the values of the enumeration (as
7040 +defined in the C++ standard; basically, a value which can be
7041 +represented in the minimum number of bits needed to represent all the
7042 +enumerators). This assumption may not be valid if the program uses a
7043 +cast to convert an arbitrary integer value to the enumeration type.
7045 +@item -ftemplate-depth=@var{n}
7046 +@opindex ftemplate-depth
7047 +Set the maximum instantiation depth for template classes to @var{n}.
7048 +A limit on the template instantiation depth is needed to detect
7049 +endless recursions during template class instantiation. ANSI/ISO C++
7050 +conforming programs must not rely on a maximum depth greater than 17
7051 +(changed to 1024 in C++0x).
7053 +@item -fno-threadsafe-statics
7054 +@opindex fno-threadsafe-statics
7055 +Do not emit the extra code to use the routines specified in the C++
7056 +ABI for thread-safe initialization of local statics. You can use this
7057 +option to reduce code size slightly in code that doesn't need to be
7058 +thread-safe.
7060 +@item -fuse-cxa-atexit
7061 +@opindex fuse-cxa-atexit
7062 +Register destructors for objects with static storage duration with the
7063 +@code{__cxa_atexit} function rather than the @code{atexit} function.
7064 +This option is required for fully standards-compliant handling of static
7065 +destructors, but will only work if your C library supports
7066 +@code{__cxa_atexit}.
7068 +@item -fno-use-cxa-get-exception-ptr
7069 +@opindex fno-use-cxa-get-exception-ptr
7070 +Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
7071 +will cause @code{std::uncaught_exception} to be incorrect, but is necessary
7072 +if the runtime routine is not available.
7074 +@item -fvisibility-inlines-hidden
7075 +@opindex fvisibility-inlines-hidden
7076 +This switch declares that the user does not attempt to compare
7077 +pointers to inline methods where the addresses of the two functions
7078 +were taken in different shared objects.
7080 +The effect of this is that GCC may, effectively, mark inline methods with
7081 +@code{__attribute__ ((visibility ("hidden")))} so that they do not
7082 +appear in the export table of a DSO and do not require a PLT indirection
7083 +when used within the DSO@. Enabling this option can have a dramatic effect
7084 +on load and link times of a DSO as it massively reduces the size of the
7085 +dynamic export table when the library makes heavy use of templates.
7087 +The behavior of this switch is not quite the same as marking the
7088 +methods as hidden directly, because it does not affect static variables
7089 +local to the function or cause the compiler to deduce that
7090 +the function is defined in only one shared object.
7092 +You may mark a method as having a visibility explicitly to negate the
7093 +effect of the switch for that method. For example, if you do want to
7094 +compare pointers to a particular inline method, you might mark it as
7095 +having default visibility. Marking the enclosing class with explicit
7096 +visibility will have no effect.
7098 +Explicitly instantiated inline methods are unaffected by this option
7099 +as their linkage might otherwise cross a shared library boundary.
7100 +@xref{Template Instantiation}.
7102 +@item -fvisibility-ms-compat
7103 +@opindex fvisibility-ms-compat
7104 +This flag attempts to use visibility settings to make GCC's C++
7105 +linkage model compatible with that of Microsoft Visual Studio.
7107 +The flag makes these changes to GCC's linkage model:
7109 +@enumerate
7110 +@item
7111 +It sets the default visibility to @code{hidden}, like
7112 +@option{-fvisibility=hidden}.
7114 +@item
7115 +Types, but not their members, are not hidden by default.
7117 +@item
7118 +The One Definition Rule is relaxed for types without explicit
7119 +visibility specifications which are defined in more than one different
7120 +shared object: those declarations are permitted if they would have
7121 +been permitted when this option was not used.
7122 +@end enumerate
7124 +In new code it is better to use @option{-fvisibility=hidden} and
7125 +export those classes which are intended to be externally visible.
7126 +Unfortunately it is possible for code to rely, perhaps accidentally,
7127 +on the Visual Studio behavior.
7129 +Among the consequences of these changes are that static data members
7130 +of the same type with the same name but defined in different shared
7131 +objects will be different, so changing one will not change the other;
7132 +and that pointers to function members defined in different shared
7133 +objects may not compare equal. When this flag is given, it is a
7134 +violation of the ODR to define types with the same name differently.
7136 +@item -fno-weak
7137 +@opindex fno-weak
7138 +Do not use weak symbol support, even if it is provided by the linker.
7139 +By default, G++ will use weak symbols if they are available. This
7140 +option exists only for testing, and should not be used by end-users;
7141 +it will result in inferior code and has no benefits. This option may
7142 +be removed in a future release of G++.
7144 +@item -nostdinc++
7145 +@opindex nostdinc++
7146 +Do not search for header files in the standard directories specific to
7147 +C++, but do still search the other standard directories. (This option
7148 +is used when building the C++ library.)
7149 +@end table
7151 +In addition, these optimization, warning, and code generation options
7152 +have meanings only for C++ programs:
7154 +@table @gcctabopt
7155 +@item -fno-default-inline
7156 +@opindex fno-default-inline
7157 +Do not assume @samp{inline} for functions defined inside a class scope.
7158 +@xref{Optimize Options,,Options That Control Optimization}. Note that these
7159 +functions will have linkage like inline functions; they just won't be
7160 +inlined by default.
7162 +@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
7163 +@opindex Wabi
7164 +@opindex Wno-abi
7165 +Warn when G++ generates code that is probably not compatible with the
7166 +vendor-neutral C++ ABI@. Although an effort has been made to warn about
7167 +all such cases, there are probably some cases that are not warned about,
7168 +even though G++ is generating incompatible code. There may also be
7169 +cases where warnings are emitted even though the code that is generated
7170 +will be compatible.
7172 +You should rewrite your code to avoid these warnings if you are
7173 +concerned about the fact that code generated by G++ may not be binary
7174 +compatible with code generated by other compilers.
7176 +The known incompatibilities in @option{-fabi-version=2} (the default) include:
7178 +@itemize @bullet
7180 +@item
7181 +A template with a non-type template parameter of reference type is
7182 +mangled incorrectly:
7183 +@smallexample
7184 +extern int N;
7185 +template <int &> struct S @{@};
7186 +void n (S<N>) @{2@}
7187 +@end smallexample
7189 +This is fixed in @option{-fabi-version=3}.
7191 +@item
7192 +SIMD vector types declared using @code{__attribute ((vector_size))} are
7193 +mangled in a non-standard way that does not allow for overloading of
7194 +functions taking vectors of different sizes.
7196 +The mangling is changed in @option{-fabi-version=4}.
7197 +@end itemize
7199 +The known incompatibilities in @option{-fabi-version=1} include:
7201 +@itemize @bullet
7203 +@item
7204 +Incorrect handling of tail-padding for bit-fields. G++ may attempt to
7205 +pack data into the same byte as a base class. For example:
7207 +@smallexample
7208 +struct A @{ virtual void f(); int f1 : 1; @};
7209 +struct B : public A @{ int f2 : 1; @};
7210 +@end smallexample
7212 +@noindent
7213 +In this case, G++ will place @code{B::f2} into the same byte
7214 +as@code{A::f1}; other compilers will not. You can avoid this problem
7215 +by explicitly padding @code{A} so that its size is a multiple of the
7216 +byte size on your platform; that will cause G++ and other compilers to
7217 +layout @code{B} identically.
7219 +@item
7220 +Incorrect handling of tail-padding for virtual bases. G++ does not use
7221 +tail padding when laying out virtual bases. For example:
7223 +@smallexample
7224 +struct A @{ virtual void f(); char c1; @};
7225 +struct B @{ B(); char c2; @};
7226 +struct C : public A, public virtual B @{@};
7227 +@end smallexample
7229 +@noindent
7230 +In this case, G++ will not place @code{B} into the tail-padding for
7231 +@code{A}; other compilers will. You can avoid this problem by
7232 +explicitly padding @code{A} so that its size is a multiple of its
7233 +alignment (ignoring virtual base classes); that will cause G++ and other
7234 +compilers to layout @code{C} identically.
7236 +@item
7237 +Incorrect handling of bit-fields with declared widths greater than that
7238 +of their underlying types, when the bit-fields appear in a union. For
7239 +example:
7241 +@smallexample
7242 +union U @{ int i : 4096; @};
7243 +@end smallexample
7245 +@noindent
7246 +Assuming that an @code{int} does not have 4096 bits, G++ will make the
7247 +union too small by the number of bits in an @code{int}.
7249 +@item
7250 +Empty classes can be placed at incorrect offsets. For example:
7252 +@smallexample
7253 +struct A @{@};
7255 +struct B @{
7256 + A a;
7257 + virtual void f ();
7258 +@};
7260 +struct C : public B, public A @{@};
7261 +@end smallexample
7263 +@noindent
7264 +G++ will place the @code{A} base class of @code{C} at a nonzero offset;
7265 +it should be placed at offset zero. G++ mistakenly believes that the
7266 +@code{A} data member of @code{B} is already at offset zero.
7268 +@item
7269 +Names of template functions whose types involve @code{typename} or
7270 +template template parameters can be mangled incorrectly.
7272 +@smallexample
7273 +template <typename Q>
7274 +void f(typename Q::X) @{@}
7276 +template <template <typename> class Q>
7277 +void f(typename Q<int>::X) @{@}
7278 +@end smallexample
7280 +@noindent
7281 +Instantiations of these templates may be mangled incorrectly.
7283 +@end itemize
7285 +It also warns psABI related changes. The known psABI changes at this
7286 +point include:
7288 +@itemize @bullet
7290 +@item
7291 +For SYSV/x86-64, when passing union with long double, it is changed to
7292 +pass in memory as specified in psABI. For example:
7294 +@smallexample
7295 +union U @{
7296 + long double ld;
7297 + int i;
7298 +@};
7299 +@end smallexample
7301 +@noindent
7302 +@code{union U} will always be passed in memory.
7304 +@end itemize
7306 +@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
7307 +@opindex Wctor-dtor-privacy
7308 +@opindex Wno-ctor-dtor-privacy
7309 +Warn when a class seems unusable because all the constructors or
7310 +destructors in that class are private, and it has neither friends nor
7311 +public static member functions.
7313 +@item -Wnoexcept @r{(C++ and Objective-C++ only)}
7314 +@opindex Wnoexcept
7315 +@opindex Wno-noexcept
7316 +Warn when a noexcept-expression evaluates to false because of a call
7317 +to a function that does not have a non-throwing exception
7318 +specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
7319 +the compiler to never throw an exception.
7321 +@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
7322 +@opindex Wnon-virtual-dtor
7323 +@opindex Wno-non-virtual-dtor
7324 +Warn when a class has virtual functions and accessible non-virtual
7325 +destructor, in which case it would be possible but unsafe to delete
7326 +an instance of a derived class through a pointer to the base class.
7327 +This warning is also enabled if -Weffc++ is specified.
7329 +@item -Wreorder @r{(C++ and Objective-C++ only)}
7330 +@opindex Wreorder
7331 +@opindex Wno-reorder
7332 +@cindex reordering, warning
7333 +@cindex warning for reordering of member initializers
7334 +Warn when the order of member initializers given in the code does not
7335 +match the order in which they must be executed. For instance:
7337 +@smallexample
7338 +struct A @{
7339 + int i;
7340 + int j;
7341 + A(): j (0), i (1) @{ @}
7342 +@};
7343 +@end smallexample
7345 +The compiler will rearrange the member initializers for @samp{i}
7346 +and @samp{j} to match the declaration order of the members, emitting
7347 +a warning to that effect. This warning is enabled by @option{-Wall}.
7348 +@end table
7350 +The following @option{-W@dots{}} options are not affected by @option{-Wall}.
7352 +@table @gcctabopt
7353 +@item -Weffc++ @r{(C++ and Objective-C++ only)}
7354 +@opindex Weffc++
7355 +@opindex Wno-effc++
7356 +Warn about violations of the following style guidelines from Scott Meyers'
7357 +@cite{Effective C++} book:
7359 +@itemize @bullet
7360 +@item
7361 +Item 11: Define a copy constructor and an assignment operator for classes
7362 +with dynamically allocated memory.
7364 +@item
7365 +Item 12: Prefer initialization to assignment in constructors.
7367 +@item
7368 +Item 14: Make destructors virtual in base classes.
7370 +@item
7371 +Item 15: Have @code{operator=} return a reference to @code{*this}.
7373 +@item
7374 +Item 23: Don't try to return a reference when you must return an object.
7376 +@end itemize
7378 +Also warn about violations of the following style guidelines from
7379 +Scott Meyers' @cite{More Effective C++} book:
7381 +@itemize @bullet
7382 +@item
7383 +Item 6: Distinguish between prefix and postfix forms of increment and
7384 +decrement operators.
7386 +@item
7387 +Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
7389 +@end itemize
7391 +When selecting this option, be aware that the standard library
7392 +headers do not obey all of these guidelines; use @samp{grep -v}
7393 +to filter out those warnings.
7395 +@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
7396 +@opindex Wstrict-null-sentinel
7397 +@opindex Wno-strict-null-sentinel
7398 +Warn also about the use of an uncasted @code{NULL} as sentinel. When
7399 +compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
7400 +to @code{__null}. Although it is a null pointer constant not a null pointer,
7401 +it is guaranteed to be of the same size as a pointer. But this use is
7402 +not portable across different compilers.
7404 +@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
7405 +@opindex Wno-non-template-friend
7406 +@opindex Wnon-template-friend
7407 +Disable warnings when non-templatized friend functions are declared
7408 +within a template. Since the advent of explicit template specification
7409 +support in G++, if the name of the friend is an unqualified-id (i.e.,
7410 +@samp{friend foo(int)}), the C++ language specification demands that the
7411 +friend declare or define an ordinary, nontemplate function. (Section
7412 +14.5.3). Before G++ implemented explicit specification, unqualified-ids
7413 +could be interpreted as a particular specialization of a templatized
7414 +function. Because this non-conforming behavior is no longer the default
7415 +behavior for G++, @option{-Wnon-template-friend} allows the compiler to
7416 +check existing code for potential trouble spots and is on by default.
7417 +This new compiler behavior can be turned off with
7418 +@option{-Wno-non-template-friend} which keeps the conformant compiler code
7419 +but disables the helpful warning.
7421 +@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
7422 +@opindex Wold-style-cast
7423 +@opindex Wno-old-style-cast
7424 +Warn if an old-style (C-style) cast to a non-void type is used within
7425 +a C++ program. The new-style casts (@samp{dynamic_cast},
7426 +@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
7427 +less vulnerable to unintended effects and much easier to search for.
7429 +@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
7430 +@opindex Woverloaded-virtual
7431 +@opindex Wno-overloaded-virtual
7432 +@cindex overloaded virtual function, warning
7433 +@cindex warning for overloaded virtual function
7434 +Warn when a function declaration hides virtual functions from a
7435 +base class. For example, in:
7437 +@smallexample
7438 +struct A @{
7439 + virtual void f();
7440 +@};
7442 +struct B: public A @{
7443 + void f(int);
7444 +@};
7445 +@end smallexample
7447 +the @code{A} class version of @code{f} is hidden in @code{B}, and code
7448 +like:
7450 +@smallexample
7451 +B* b;
7452 +b->f();
7453 +@end smallexample
7455 +will fail to compile.
7457 +@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
7458 +@opindex Wno-pmf-conversions
7459 +@opindex Wpmf-conversions
7460 +Disable the diagnostic for converting a bound pointer to member function
7461 +to a plain pointer.
7463 +@item -Wsign-promo @r{(C++ and Objective-C++ only)}
7464 +@opindex Wsign-promo
7465 +@opindex Wno-sign-promo
7466 +Warn when overload resolution chooses a promotion from unsigned or
7467 +enumerated type to a signed type, over a conversion to an unsigned type of
7468 +the same size. Previous versions of G++ would try to preserve
7469 +unsignedness, but the standard mandates the current behavior.
7471 +@smallexample
7472 +struct A @{
7473 + operator int ();
7474 + A& operator = (int);
7475 +@};
7477 +main ()
7479 + A a,b;
7480 + a = b;
7482 +@end smallexample
7484 +In this example, G++ will synthesize a default @samp{A& operator =
7485 +(const A&);}, while cfront will use the user-defined @samp{operator =}.
7486 +@end table
7488 +@node Objective-C and Objective-C++ Dialect Options
7489 +@section Options Controlling Objective-C and Objective-C++ Dialects
7491 +@cindex compiler options, Objective-C and Objective-C++
7492 +@cindex Objective-C and Objective-C++ options, command line
7493 +@cindex options, Objective-C and Objective-C++
7494 +(NOTE: This manual does not describe the Objective-C and Objective-C++
7495 +languages themselves. @xref{Standards,,Language Standards
7496 +Supported by GCC}, for references.)
7498 +This section describes the command-line options that are only meaningful
7499 +for Objective-C and Objective-C++ programs, but you can also use most of
7500 +the language-independent GNU compiler options.
7501 +For example, you might compile a file @code{some_class.m} like this:
7503 +@smallexample
7504 +gcc -g -fgnu-runtime -O -c some_class.m
7505 +@end smallexample
7507 +@noindent
7508 +In this example, @option{-fgnu-runtime} is an option meant only for
7509 +Objective-C and Objective-C++ programs; you can use the other options with
7510 +any language supported by GCC@.
7512 +Note that since Objective-C is an extension of the C language, Objective-C
7513 +compilations may also use options specific to the C front-end (e.g.,
7514 +@option{-Wtraditional}). Similarly, Objective-C++ compilations may use
7515 +C++-specific options (e.g., @option{-Wabi}).
7517 +Here is a list of options that are @emph{only} for compiling Objective-C
7518 +and Objective-C++ programs:
7520 +@table @gcctabopt
7521 +@item -fconstant-string-class=@var{class-name}
7522 +@opindex fconstant-string-class
7523 +Use @var{class-name} as the name of the class to instantiate for each
7524 +literal string specified with the syntax @code{@@"@dots{}"}. The default
7525 +class name is @code{NXConstantString} if the GNU runtime is being used, and
7526 +@code{NSConstantString} if the NeXT runtime is being used (see below). The
7527 +@option{-fconstant-cfstrings} option, if also present, will override the
7528 +@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
7529 +to be laid out as constant CoreFoundation strings.
7531 +@item -fgnu-runtime
7532 +@opindex fgnu-runtime
7533 +Generate object code compatible with the standard GNU Objective-C
7534 +runtime. This is the default for most types of systems.
7536 +@item -fnext-runtime
7537 +@opindex fnext-runtime
7538 +Generate output compatible with the NeXT runtime. This is the default
7539 +for NeXT-based systems, including Darwin and Mac OS X@. The macro
7540 +@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
7541 +used.
7543 +@item -fno-nil-receivers
7544 +@opindex fno-nil-receivers
7545 +Assume that all Objective-C message dispatches (@code{[receiver
7546 +message:arg]}) in this translation unit ensure that the receiver is
7547 +not @code{nil}. This allows for more efficient entry points in the
7548 +runtime to be used. This option is only available in conjunction with
7549 +the NeXT runtime and ABI version 0 or 1.
7551 +@item -fobjc-abi-version=@var{n}
7552 +@opindex fobjc-abi-version
7553 +Use version @var{n} of the Objective-C ABI for the selected runtime.
7554 +This option is currently supported only for the NeXT runtime. In that
7555 +case, Version 0 is the traditional (32-bit) ABI without support for
7556 +properties and other Objective-C 2.0 additions. Version 1 is the
7557 +traditional (32-bit) ABI with support for properties and other
7558 +Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
7559 +nothing is specified, the default is Version 0 on 32-bit target
7560 +machines, and Version 2 on 64-bit target machines.
7562 +@item -fobjc-call-cxx-cdtors
7563 +@opindex fobjc-call-cxx-cdtors
7564 +For each Objective-C class, check if any of its instance variables is a
7565 +C++ object with a non-trivial default constructor. If so, synthesize a
7566 +special @code{- (id) .cxx_construct} instance method that will run
7567 +non-trivial default constructors on any such instance variables, in order,
7568 +and then return @code{self}. Similarly, check if any instance variable
7569 +is a C++ object with a non-trivial destructor, and if so, synthesize a
7570 +special @code{- (void) .cxx_destruct} method that will run
7571 +all such default destructors, in reverse order.
7573 +The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
7574 +methods thusly generated will only operate on instance variables
7575 +declared in the current Objective-C class, and not those inherited
7576 +from superclasses. It is the responsibility of the Objective-C
7577 +runtime to invoke all such methods in an object's inheritance
7578 +hierarchy. The @code{- (id) .cxx_construct} methods will be invoked
7579 +by the runtime immediately after a new object instance is allocated;
7580 +the @code{- (void) .cxx_destruct} methods will be invoked immediately
7581 +before the runtime deallocates an object instance.
7583 +As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
7584 +support for invoking the @code{- (id) .cxx_construct} and
7585 +@code{- (void) .cxx_destruct} methods.
7587 +@item -fobjc-direct-dispatch
7588 +@opindex fobjc-direct-dispatch
7589 +Allow fast jumps to the message dispatcher. On Darwin this is
7590 +accomplished via the comm page.
7592 +@item -fobjc-exceptions
7593 +@opindex fobjc-exceptions
7594 +Enable syntactic support for structured exception handling in
7595 +Objective-C, similar to what is offered by C++ and Java. This option
7596 +is required to use the Objective-C keywords @code{@@try},
7597 +@code{@@throw}, @code{@@catch}, @code{@@finally} and
7598 +@code{@@synchronized}. This option is available with both the GNU
7599 +runtime and the NeXT runtime (but not available in conjunction with
7600 +the NeXT runtime on Mac OS X 10.2 and earlier).
7602 +@item -fobjc-gc
7603 +@opindex fobjc-gc
7604 +Enable garbage collection (GC) in Objective-C and Objective-C++
7605 +programs. This option is only available with the NeXT runtime; the
7606 +GNU runtime has a different garbage collection implementation that
7607 +does not require special compiler flags.
7609 +@item -fobjc-nilcheck
7610 +@opindex fobjc-nilcheck
7611 +For the NeXT runtime with version 2 of the ABI, check for a nil
7612 +receiver in method invocations before doing the actual method call.
7613 +This is the default and can be disabled using
7614 +@option{-fno-objc-nilcheck}. Class methods and super calls are never
7615 +checked for nil in this way no matter what this flag is set to.
7616 +Currently this flag does nothing when the GNU runtime, or an older
7617 +version of the NeXT runtime ABI, is used.
7619 +@item -fobjc-std=objc1
7620 +@opindex fobjc-std
7621 +Conform to the language syntax of Objective-C 1.0, the language
7622 +recognized by GCC 4.0. This only affects the Objective-C additions to
7623 +the C/C++ language; it does not affect conformance to C/C++ standards,
7624 +which is controlled by the separate C/C++ dialect option flags. When
7625 +this option is used with the Objective-C or Objective-C++ compiler,
7626 +any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
7627 +This is useful if you need to make sure that your Objective-C code can
7628 +be compiled with older versions of GCC.
7630 +@item -freplace-objc-classes
7631 +@opindex freplace-objc-classes
7632 +Emit a special marker instructing @command{ld(1)} not to statically link in
7633 +the resulting object file, and allow @command{dyld(1)} to load it in at
7634 +run time instead. This is used in conjunction with the Fix-and-Continue
7635 +debugging mode, where the object file in question may be recompiled and
7636 +dynamically reloaded in the course of program execution, without the need
7637 +to restart the program itself. Currently, Fix-and-Continue functionality
7638 +is only available in conjunction with the NeXT runtime on Mac OS X 10.3
7639 +and later.
7641 +@item -fzero-link
7642 +@opindex fzero-link
7643 +When compiling for the NeXT runtime, the compiler ordinarily replaces calls
7644 +to @code{objc_getClass("@dots{}")} (when the name of the class is known at
7645 +compile time) with static class references that get initialized at load time,
7646 +which improves run-time performance. Specifying the @option{-fzero-link} flag
7647 +suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
7648 +to be retained. This is useful in Zero-Link debugging mode, since it allows
7649 +for individual class implementations to be modified during program execution.
7650 +The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
7651 +regardless of command line options.
7653 +@item -gen-decls
7654 +@opindex gen-decls
7655 +Dump interface declarations for all classes seen in the source file to a
7656 +file named @file{@var{sourcename}.decl}.
7658 +@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
7659 +@opindex Wassign-intercept
7660 +@opindex Wno-assign-intercept
7661 +Warn whenever an Objective-C assignment is being intercepted by the
7662 +garbage collector.
7664 +@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
7665 +@opindex Wno-protocol
7666 +@opindex Wprotocol
7667 +If a class is declared to implement a protocol, a warning is issued for
7668 +every method in the protocol that is not implemented by the class. The
7669 +default behavior is to issue a warning for every method not explicitly
7670 +implemented in the class, even if a method implementation is inherited
7671 +from the superclass. If you use the @option{-Wno-protocol} option, then
7672 +methods inherited from the superclass are considered to be implemented,
7673 +and no warning is issued for them.
7675 +@item -Wselector @r{(Objective-C and Objective-C++ only)}
7676 +@opindex Wselector
7677 +@opindex Wno-selector
7678 +Warn if multiple methods of different types for the same selector are
7679 +found during compilation. The check is performed on the list of methods
7680 +in the final stage of compilation. Additionally, a check is performed
7681 +for each selector appearing in a @code{@@selector(@dots{})}
7682 +expression, and a corresponding method for that selector has been found
7683 +during compilation. Because these checks scan the method table only at
7684 +the end of compilation, these warnings are not produced if the final
7685 +stage of compilation is not reached, for example because an error is
7686 +found during compilation, or because the @option{-fsyntax-only} option is
7687 +being used.
7689 +@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
7690 +@opindex Wstrict-selector-match
7691 +@opindex Wno-strict-selector-match
7692 +Warn if multiple methods with differing argument and/or return types are
7693 +found for a given selector when attempting to send a message using this
7694 +selector to a receiver of type @code{id} or @code{Class}. When this flag
7695 +is off (which is the default behavior), the compiler will omit such warnings
7696 +if any differences found are confined to types which share the same size
7697 +and alignment.
7699 +@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
7700 +@opindex Wundeclared-selector
7701 +@opindex Wno-undeclared-selector
7702 +Warn if a @code{@@selector(@dots{})} expression referring to an
7703 +undeclared selector is found. A selector is considered undeclared if no
7704 +method with that name has been declared before the
7705 +@code{@@selector(@dots{})} expression, either explicitly in an
7706 +@code{@@interface} or @code{@@protocol} declaration, or implicitly in
7707 +an @code{@@implementation} section. This option always performs its
7708 +checks as soon as a @code{@@selector(@dots{})} expression is found,
7709 +while @option{-Wselector} only performs its checks in the final stage of
7710 +compilation. This also enforces the coding style convention
7711 +that methods and selectors must be declared before being used.
7713 +@item -print-objc-runtime-info
7714 +@opindex print-objc-runtime-info
7715 +Generate C header describing the largest structure that is passed by
7716 +value, if any.
7718 +@end table
7720 +@node Language Independent Options
7721 +@section Options to Control Diagnostic Messages Formatting
7722 +@cindex options to control diagnostics formatting
7723 +@cindex diagnostic messages
7724 +@cindex message formatting
7726 +Traditionally, diagnostic messages have been formatted irrespective of
7727 +the output device's aspect (e.g.@: its width, @dots{}). The options described
7728 +below can be used to control the diagnostic messages formatting
7729 +algorithm, e.g.@: how many characters per line, how often source location
7730 +information should be reported. Right now, only the C++ front end can
7731 +honor these options. However it is expected, in the near future, that
7732 +the remaining front ends would be able to digest them correctly.
7734 +@table @gcctabopt
7735 +@item -fmessage-length=@var{n}
7736 +@opindex fmessage-length
7737 +Try to format error messages so that they fit on lines of about @var{n}
7738 +characters. The default is 72 characters for @command{g++} and 0 for the rest of
7739 +the front ends supported by GCC@. If @var{n} is zero, then no
7740 +line-wrapping will be done; each error message will appear on a single
7741 +line.
7743 +@opindex fdiagnostics-show-location
7744 +@item -fdiagnostics-show-location=once
7745 +Only meaningful in line-wrapping mode. Instructs the diagnostic messages
7746 +reporter to emit @emph{once} source location information; that is, in
7747 +case the message is too long to fit on a single physical line and has to
7748 +be wrapped, the source location won't be emitted (as prefix) again,
7749 +over and over, in subsequent continuation lines. This is the default
7750 +behavior.
7752 +@item -fdiagnostics-show-location=every-line
7753 +Only meaningful in line-wrapping mode. Instructs the diagnostic
7754 +messages reporter to emit the same source location information (as
7755 +prefix) for physical lines that result from the process of breaking
7756 +a message which is too long to fit on a single line.
7758 +@item -fno-diagnostics-show-option
7759 +@opindex fno-diagnostics-show-option
7760 +@opindex fdiagnostics-show-option
7761 +By default, each diagnostic emitted includes text which indicates the
7762 +command line option that directly controls the diagnostic (if such an
7763 +option is known to the diagnostic machinery). Specifying the
7764 +@option{-fno-diagnostics-show-option} flag suppresses that behavior.
7766 +@item -Wcoverage-mismatch
7767 +@opindex Wcoverage-mismatch
7768 +Warn if feedback profiles do not match when using the
7769 +@option{-fprofile-use} option.
7770 +If a source file was changed between @option{-fprofile-gen} and
7771 +@option{-fprofile-use}, the files with the profile feedback can fail
7772 +to match the source file and GCC can not use the profile feedback
7773 +information. By default, this warning is enabled and is treated as an
7774 +error. @option{-Wno-coverage-mismatch} can be used to disable the
7775 +warning or @option{-Wno-error=coverage-mismatch} can be used to
7776 +disable the error. Disable the error for this warning can result in
7777 +poorly optimized code, so disabling the error is useful only in the
7778 +case of very minor changes such as bug fixes to an existing code-base.
7779 +Completely disabling the warning is not recommended.
7781 +@end table
7783 +@node Warning Options
7784 +@section Options to Request or Suppress Warnings
7785 +@cindex options to control warnings
7786 +@cindex warning messages
7787 +@cindex messages, warning
7788 +@cindex suppressing warnings
7790 +Warnings are diagnostic messages that report constructions which
7791 +are not inherently erroneous but which are risky or suggest there
7792 +may have been an error.
7794 +The following language-independent options do not enable specific
7795 +warnings but control the kinds of diagnostics produced by GCC.
7797 +@table @gcctabopt
7798 +@cindex syntax checking
7799 +@item -fsyntax-only
7800 +@opindex fsyntax-only
7801 +Check the code for syntax errors, but don't do anything beyond that.
7803 +@item -fmax-errors=@var{n}
7804 +@opindex fmax-errors
7805 +Limits the maximum number of error messages to @var{n}, at which point
7806 +GCC bails out rather than attempting to continue processing the source
7807 +code. If @var{n} is 0 (the default), there is no limit on the number
7808 +of error messages produced. If @option{-Wfatal-errors} is also
7809 +specified, then @option{-Wfatal-errors} takes precedence over this
7810 +option.
7812 +@item -w
7813 +@opindex w
7814 +Inhibit all warning messages.
7816 +@item -Werror
7817 +@opindex Werror
7818 +@opindex Wno-error
7819 +Make all warnings into errors.
7821 +@item -Werror=
7822 +@opindex Werror=
7823 +@opindex Wno-error=
7824 +Make the specified warning into an error. The specifier for a warning
7825 +is appended, for example @option{-Werror=switch} turns the warnings
7826 +controlled by @option{-Wswitch} into errors. This switch takes a
7827 +negative form, to be used to negate @option{-Werror} for specific
7828 +warnings, for example @option{-Wno-error=switch} makes
7829 +@option{-Wswitch} warnings not be errors, even when @option{-Werror}
7830 +is in effect.
7832 +The warning message for each controllable warning includes the
7833 +option which controls the warning. That option can then be used with
7834 +@option{-Werror=} and @option{-Wno-error=} as described above.
7835 +(Printing of the option in the warning message can be disabled using the
7836 +@option{-fno-diagnostics-show-option} flag.)
7838 +Note that specifying @option{-Werror=}@var{foo} automatically implies
7839 +@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
7840 +imply anything.
7842 +@item -Wfatal-errors
7843 +@opindex Wfatal-errors
7844 +@opindex Wno-fatal-errors
7845 +This option causes the compiler to abort compilation on the first error
7846 +occurred rather than trying to keep going and printing further error
7847 +messages.
7849 +@end table
7851 +You can request many specific warnings with options beginning
7852 +@samp{-W}, for example @option{-Wimplicit} to request warnings on
7853 +implicit declarations. Each of these specific warning options also
7854 +has a negative form beginning @samp{-Wno-} to turn off warnings; for
7855 +example, @option{-Wno-implicit}. This manual lists only one of the
7856 +two forms, whichever is not the default. For further,
7857 +language-specific options also refer to @ref{C++ Dialect Options} and
7858 +@ref{Objective-C and Objective-C++ Dialect Options}.
7860 +When an unrecognized warning option is requested (e.g.,
7861 +@option{-Wunknown-warning}), GCC will emit a diagnostic stating
7862 +that the option is not recognized. However, if the @option{-Wno-} form
7863 +is used, the behavior is slightly different: No diagnostic will be
7864 +produced for @option{-Wno-unknown-warning} unless other diagnostics
7865 +are being produced. This allows the use of new @option{-Wno-} options
7866 +with old compilers, but if something goes wrong, the compiler will
7867 +warn that an unrecognized option was used.
7869 +@table @gcctabopt
7870 +@item -pedantic
7871 +@opindex pedantic
7872 +Issue all the warnings demanded by strict ISO C and ISO C++;
7873 +reject all programs that use forbidden extensions, and some other
7874 +programs that do not follow ISO C and ISO C++. For ISO C, follows the
7875 +version of the ISO C standard specified by any @option{-std} option used.
7877 +Valid ISO C and ISO C++ programs should compile properly with or without
7878 +this option (though a rare few will require @option{-ansi} or a
7879 +@option{-std} option specifying the required version of ISO C)@. However,
7880 +without this option, certain GNU extensions and traditional C and C++
7881 +features are supported as well. With this option, they are rejected.
7883 +@option{-pedantic} does not cause warning messages for use of the
7884 +alternate keywords whose names begin and end with @samp{__}. Pedantic
7885 +warnings are also disabled in the expression that follows
7886 +@code{__extension__}. However, only system header files should use
7887 +these escape routes; application programs should avoid them.
7888 +@xref{Alternate Keywords}.
7890 +Some users try to use @option{-pedantic} to check programs for strict ISO
7891 +C conformance. They soon find that it does not do quite what they want:
7892 +it finds some non-ISO practices, but not all---only those for which
7893 +ISO C @emph{requires} a diagnostic, and some others for which
7894 +diagnostics have been added.
7896 +A feature to report any failure to conform to ISO C might be useful in
7897 +some instances, but would require considerable additional work and would
7898 +be quite different from @option{-pedantic}. We don't have plans to
7899 +support such a feature in the near future.
7901 +Where the standard specified with @option{-std} represents a GNU
7902 +extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
7903 +corresponding @dfn{base standard}, the version of ISO C on which the GNU
7904 +extended dialect is based. Warnings from @option{-pedantic} are given
7905 +where they are required by the base standard. (It would not make sense
7906 +for such warnings to be given only for features not in the specified GNU
7907 +C dialect, since by definition the GNU dialects of C include all
7908 +features the compiler supports with the given option, and there would be
7909 +nothing to warn about.)
7911 +@item -pedantic-errors
7912 +@opindex pedantic-errors
7913 +Like @option{-pedantic}, except that errors are produced rather than
7914 +warnings.
7916 +@item -Wall
7917 +@opindex Wall
7918 +@opindex Wno-all
7919 +This enables all the warnings about constructions that some users
7920 +consider questionable, and that are easy to avoid (or modify to
7921 +prevent the warning), even in conjunction with macros. This also
7922 +enables some language-specific warnings described in @ref{C++ Dialect
7923 +Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
7925 +@option{-Wall} turns on the following warning flags:
7927 +@gccoptlist{-Waddress @gol
7928 +-Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
7929 +-Wc++0x-compat @gol
7930 +-Wchar-subscripts @gol
7931 +-Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
7932 +-Wimplicit-int @r{(C and Objective-C only)} @gol
7933 +-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
7934 +-Wcomment @gol
7935 +-Wformat @gol
7936 +-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
7937 +-Wmissing-braces @gol
7938 +-Wnonnull @gol
7939 +-Wparentheses @gol
7940 +-Wpointer-sign @gol
7941 +-Wreorder @gol
7942 +-Wreturn-type @gol
7943 +-Wsequence-point @gol
7944 +-Wsign-compare @r{(only in C++)} @gol
7945 +-Wstrict-aliasing @gol
7946 +-Wstrict-overflow=1 @gol
7947 +-Wswitch @gol
7948 +-Wtrigraphs @gol
7949 +-Wuninitialized @gol
7950 +-Wunknown-pragmas @gol
7951 +-Wunused-function @gol
7952 +-Wunused-label @gol
7953 +-Wunused-value @gol
7954 +-Wunused-variable @gol
7955 +-Wvolatile-register-var @gol
7958 +Note that some warning flags are not implied by @option{-Wall}. Some of
7959 +them warn about constructions that users generally do not consider
7960 +questionable, but which occasionally you might wish to check for;
7961 +others warn about constructions that are necessary or hard to avoid in
7962 +some cases, and there is no simple way to modify the code to suppress
7963 +the warning. Some of them are enabled by @option{-Wextra} but many of
7964 +them must be enabled individually.
7966 +@item -Wextra
7967 +@opindex W
7968 +@opindex Wextra
7969 +@opindex Wno-extra
7970 +This enables some extra warning flags that are not enabled by
7971 +@option{-Wall}. (This option used to be called @option{-W}. The older
7972 +name is still supported, but the newer name is more descriptive.)
7974 +@gccoptlist{-Wclobbered @gol
7975 +-Wempty-body @gol
7976 +-Wignored-qualifiers @gol
7977 +-Wmissing-field-initializers @gol
7978 +-Wmissing-parameter-type @r{(C only)} @gol
7979 +-Wold-style-declaration @r{(C only)} @gol
7980 +-Woverride-init @gol
7981 +-Wsign-compare @gol
7982 +-Wtype-limits @gol
7983 +-Wuninitialized @gol
7984 +-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
7985 +-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
7988 +The option @option{-Wextra} also prints warning messages for the
7989 +following cases:
7991 +@itemize @bullet
7993 +@item
7994 +A pointer is compared against integer zero with @samp{<}, @samp{<=},
7995 +@samp{>}, or @samp{>=}.
7997 +@item
7998 +(C++ only) An enumerator and a non-enumerator both appear in a
7999 +conditional expression.
8001 +@item
8002 +(C++ only) Ambiguous virtual bases.
8004 +@item
8005 +(C++ only) Subscripting an array which has been declared @samp{register}.
8007 +@item
8008 +(C++ only) Taking the address of a variable which has been declared
8009 +@samp{register}.
8011 +@item
8012 +(C++ only) A base class is not initialized in a derived class' copy
8013 +constructor.
8015 +@end itemize
8017 +@item -Wchar-subscripts
8018 +@opindex Wchar-subscripts
8019 +@opindex Wno-char-subscripts
8020 +Warn if an array subscript has type @code{char}. This is a common cause
8021 +of error, as programmers often forget that this type is signed on some
8022 +machines.
8023 +This warning is enabled by @option{-Wall}.
8025 +@item -Wcomment
8026 +@opindex Wcomment
8027 +@opindex Wno-comment
8028 +Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
8029 +comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
8030 +This warning is enabled by @option{-Wall}.
8032 +@item -Wno-cpp
8033 +@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
8035 +Suppress warning messages emitted by @code{#warning} directives.
8037 +@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
8038 +@opindex Wdouble-promotion
8039 +@opindex Wno-double-promotion
8040 +Give a warning when a value of type @code{float} is implicitly
8041 +promoted to @code{double}. CPUs with a 32-bit ``single-precision''
8042 +floating-point unit implement @code{float} in hardware, but emulate
8043 +@code{double} in software. On such a machine, doing computations
8044 +using @code{double} values is much more expensive because of the
8045 +overhead required for software emulation.
8047 +It is easy to accidentally do computations with @code{double} because
8048 +floating-point literals are implicitly of type @code{double}. For
8049 +example, in:
8050 +@smallexample
8051 +@group
8052 +float area(float radius)
8054 + return 3.14159 * radius * radius;
8056 +@end group
8057 +@end smallexample
8058 +the compiler will perform the entire computation with @code{double}
8059 +because the floating-point literal is a @code{double}.
8061 +@item -Wformat
8062 +@opindex Wformat
8063 +@opindex Wno-format
8064 +@opindex ffreestanding
8065 +@opindex fno-builtin
8066 +Check calls to @code{printf} and @code{scanf}, etc., to make sure that
8067 +the arguments supplied have types appropriate to the format string
8068 +specified, and that the conversions specified in the format string make
8069 +sense. This includes standard functions, and others specified by format
8070 +attributes (@pxref{Function Attributes}), in the @code{printf},
8071 +@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
8072 +not in the C standard) families (or other target-specific families).
8073 +Which functions are checked without format attributes having been
8074 +specified depends on the standard version selected, and such checks of
8075 +functions without the attribute specified are disabled by
8076 +@option{-ffreestanding} or @option{-fno-builtin}.
8078 +The formats are checked against the format features supported by GNU
8079 +libc version 2.2. These include all ISO C90 and C99 features, as well
8080 +as features from the Single Unix Specification and some BSD and GNU
8081 +extensions. Other library implementations may not support all these
8082 +features; GCC does not support warning about features that go beyond a
8083 +particular library's limitations. However, if @option{-pedantic} is used
8084 +with @option{-Wformat}, warnings will be given about format features not
8085 +in the selected standard version (but not for @code{strfmon} formats,
8086 +since those are not in any version of the C standard). @xref{C Dialect
8087 +Options,,Options Controlling C Dialect}.
8089 +Since @option{-Wformat} also checks for null format arguments for
8090 +several functions, @option{-Wformat} also implies @option{-Wnonnull}.
8092 +@option{-Wformat} is included in @option{-Wall}. For more control over some
8093 +aspects of format checking, the options @option{-Wformat-y2k},
8094 +@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
8095 +@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
8096 +@option{-Wformat=2} are available, but are not included in @option{-Wall}.
8098 +@item -Wformat-y2k
8099 +@opindex Wformat-y2k
8100 +@opindex Wno-format-y2k
8101 +If @option{-Wformat} is specified, also warn about @code{strftime}
8102 +formats which may yield only a two-digit year.
8104 +@item -Wno-format-contains-nul
8105 +@opindex Wno-format-contains-nul
8106 +@opindex Wformat-contains-nul
8107 +If @option{-Wformat} is specified, do not warn about format strings that
8108 +contain NUL bytes.
8110 +@item -Wno-format-extra-args
8111 +@opindex Wno-format-extra-args
8112 +@opindex Wformat-extra-args
8113 +If @option{-Wformat} is specified, do not warn about excess arguments to a
8114 +@code{printf} or @code{scanf} format function. The C standard specifies
8115 +that such arguments are ignored.
8117 +Where the unused arguments lie between used arguments that are
8118 +specified with @samp{$} operand number specifications, normally
8119 +warnings are still given, since the implementation could not know what
8120 +type to pass to @code{va_arg} to skip the unused arguments. However,
8121 +in the case of @code{scanf} formats, this option will suppress the
8122 +warning if the unused arguments are all pointers, since the Single
8123 +Unix Specification says that such unused arguments are allowed.
8125 +@item -Wno-format-zero-length @r{(C and Objective-C only)}
8126 +@opindex Wno-format-zero-length
8127 +@opindex Wformat-zero-length
8128 +If @option{-Wformat} is specified, do not warn about zero-length formats.
8129 +The C standard specifies that zero-length formats are allowed.
8131 +@item -Wformat-nonliteral
8132 +@opindex Wformat-nonliteral
8133 +@opindex Wno-format-nonliteral
8134 +If @option{-Wformat} is specified, also warn if the format string is not a
8135 +string literal and so cannot be checked, unless the format function
8136 +takes its format arguments as a @code{va_list}.
8138 +@item -Wformat-security
8139 +@opindex Wformat-security
8140 +@opindex Wno-format-security
8141 +If @option{-Wformat} is specified, also warn about uses of format
8142 +functions that represent possible security problems. At present, this
8143 +warns about calls to @code{printf} and @code{scanf} functions where the
8144 +format string is not a string literal and there are no format arguments,
8145 +as in @code{printf (foo);}. This may be a security hole if the format
8146 +string came from untrusted input and contains @samp{%n}. (This is
8147 +currently a subset of what @option{-Wformat-nonliteral} warns about, but
8148 +in future warnings may be added to @option{-Wformat-security} that are not
8149 +included in @option{-Wformat-nonliteral}.)
8151 +@item -Wformat=2
8152 +@opindex Wformat=2
8153 +@opindex Wno-format=2
8154 +Enable @option{-Wformat} plus format checks not included in
8155 +@option{-Wformat}. Currently equivalent to @samp{-Wformat
8156 +-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
8158 +@item -Wnonnull @r{(C and Objective-C only)}
8159 +@opindex Wnonnull
8160 +@opindex Wno-nonnull
8161 +Warn about passing a null pointer for arguments marked as
8162 +requiring a non-null value by the @code{nonnull} function attribute.
8164 +@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
8165 +can be disabled with the @option{-Wno-nonnull} option.
8167 +@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
8168 +@opindex Winit-self
8169 +@opindex Wno-init-self
8170 +Warn about uninitialized variables which are initialized with themselves.
8171 +Note this option can only be used with the @option{-Wuninitialized} option.
8173 +For example, GCC will warn about @code{i} being uninitialized in the
8174 +following snippet only when @option{-Winit-self} has been specified:
8175 +@smallexample
8176 +@group
8177 +int f()
8179 + int i = i;
8180 + return i;
8182 +@end group
8183 +@end smallexample
8185 +@item -Wimplicit-int @r{(C and Objective-C only)}
8186 +@opindex Wimplicit-int
8187 +@opindex Wno-implicit-int
8188 +Warn when a declaration does not specify a type.
8189 +This warning is enabled by @option{-Wall}.
8191 +@item -Wimplicit-function-declaration @r{(C and Objective-C only)}
8192 +@opindex Wimplicit-function-declaration
8193 +@opindex Wno-implicit-function-declaration
8194 +Give a warning whenever a function is used before being declared. In
8195 +C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
8196 +enabled by default and it is made into an error by
8197 +@option{-pedantic-errors}. This warning is also enabled by
8198 +@option{-Wall}.
8200 +@item -Wimplicit @r{(C and Objective-C only)}
8201 +@opindex Wimplicit
8202 +@opindex Wno-implicit
8203 +Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
8204 +This warning is enabled by @option{-Wall}.
8206 +@item -Wignored-qualifiers @r{(C and C++ only)}
8207 +@opindex Wignored-qualifiers
8208 +@opindex Wno-ignored-qualifiers
8209 +Warn if the return type of a function has a type qualifier
8210 +such as @code{const}. For ISO C such a type qualifier has no effect,
8211 +since the value returned by a function is not an lvalue.
8212 +For C++, the warning is only emitted for scalar types or @code{void}.
8213 +ISO C prohibits qualified @code{void} return types on function
8214 +definitions, so such return types always receive a warning
8215 +even without this option.
8217 +This warning is also enabled by @option{-Wextra}.
8219 +@item -Wmain
8220 +@opindex Wmain
8221 +@opindex Wno-main
8222 +Warn if the type of @samp{main} is suspicious. @samp{main} should be
8223 +a function with external linkage, returning int, taking either zero
8224 +arguments, two, or three arguments of appropriate types. This warning
8225 +is enabled by default in C++ and is enabled by either @option{-Wall}
8226 +or @option{-pedantic}.
8228 +@item -Wmissing-braces
8229 +@opindex Wmissing-braces
8230 +@opindex Wno-missing-braces
8231 +Warn if an aggregate or union initializer is not fully bracketed. In
8232 +the following example, the initializer for @samp{a} is not fully
8233 +bracketed, but that for @samp{b} is fully bracketed.
8235 +@smallexample
8236 +int a[2][2] = @{ 0, 1, 2, 3 @};
8237 +int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
8238 +@end smallexample
8240 +This warning is enabled by @option{-Wall}.
8242 +@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
8243 +@opindex Wmissing-include-dirs
8244 +@opindex Wno-missing-include-dirs
8245 +Warn if a user-supplied include directory does not exist.
8247 +@item -Wparentheses
8248 +@opindex Wparentheses
8249 +@opindex Wno-parentheses
8250 +Warn if parentheses are omitted in certain contexts, such
8251 +as when there is an assignment in a context where a truth value
8252 +is expected, or when operators are nested whose precedence people
8253 +often get confused about.
8255 +Also warn if a comparison like @samp{x<=y<=z} appears; this is
8256 +equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
8257 +interpretation from that of ordinary mathematical notation.
8259 +Also warn about constructions where there may be confusion to which
8260 +@code{if} statement an @code{else} branch belongs. Here is an example of
8261 +such a case:
8263 +@smallexample
8264 +@group
8266 + if (a)
8267 + if (b)
8268 + foo ();
8269 + else
8270 + bar ();
8272 +@end group
8273 +@end smallexample
8275 +In C/C++, every @code{else} branch belongs to the innermost possible
8276 +@code{if} statement, which in this example is @code{if (b)}. This is
8277 +often not what the programmer expected, as illustrated in the above
8278 +example by indentation the programmer chose. When there is the
8279 +potential for this confusion, GCC will issue a warning when this flag
8280 +is specified. To eliminate the warning, add explicit braces around
8281 +the innermost @code{if} statement so there is no way the @code{else}
8282 +could belong to the enclosing @code{if}. The resulting code would
8283 +look like this:
8285 +@smallexample
8286 +@group
8288 + if (a)
8289 + @{
8290 + if (b)
8291 + foo ();
8292 + else
8293 + bar ();
8294 + @}
8296 +@end group
8297 +@end smallexample
8299 +Also warn for dangerous uses of the
8300 +?: with omitted middle operand GNU extension. When the condition
8301 +in the ?: operator is a boolean expression the omitted value will
8302 +be always 1. Often the user expects it to be a value computed
8303 +inside the conditional expression instead.
8305 +This warning is enabled by @option{-Wall}.
8307 +@item -Wsequence-point
8308 +@opindex Wsequence-point
8309 +@opindex Wno-sequence-point
8310 +Warn about code that may have undefined semantics because of violations
8311 +of sequence point rules in the C and C++ standards.
8313 +The C and C++ standards defines the order in which expressions in a C/C++
8314 +program are evaluated in terms of @dfn{sequence points}, which represent
8315 +a partial ordering between the execution of parts of the program: those
8316 +executed before the sequence point, and those executed after it. These
8317 +occur after the evaluation of a full expression (one which is not part
8318 +of a larger expression), after the evaluation of the first operand of a
8319 +@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
8320 +function is called (but after the evaluation of its arguments and the
8321 +expression denoting the called function), and in certain other places.
8322 +Other than as expressed by the sequence point rules, the order of
8323 +evaluation of subexpressions of an expression is not specified. All
8324 +these rules describe only a partial order rather than a total order,
8325 +since, for example, if two functions are called within one expression
8326 +with no sequence point between them, the order in which the functions
8327 +are called is not specified. However, the standards committee have
8328 +ruled that function calls do not overlap.
8330 +It is not specified when between sequence points modifications to the
8331 +values of objects take effect. Programs whose behavior depends on this
8332 +have undefined behavior; the C and C++ standards specify that ``Between
8333 +the previous and next sequence point an object shall have its stored
8334 +value modified at most once by the evaluation of an expression.
8335 +Furthermore, the prior value shall be read only to determine the value
8336 +to be stored.''. If a program breaks these rules, the results on any
8337 +particular implementation are entirely unpredictable.
8339 +Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
8340 += b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
8341 +diagnosed by this option, and it may give an occasional false positive
8342 +result, but in general it has been found fairly effective at detecting
8343 +this sort of problem in programs.
8345 +The standard is worded confusingly, therefore there is some debate
8346 +over the precise meaning of the sequence point rules in subtle cases.
8347 +Links to discussions of the problem, including proposed formal
8348 +definitions, may be found on the GCC readings page, at
8349 +@uref{http://gcc.gnu.org/@/readings.html}.
8351 +This warning is enabled by @option{-Wall} for C and C++.
8353 +@item -Wreturn-type
8354 +@opindex Wreturn-type
8355 +@opindex Wno-return-type
8356 +Warn whenever a function is defined with a return-type that defaults
8357 +to @code{int}. Also warn about any @code{return} statement with no
8358 +return-value in a function whose return-type is not @code{void}
8359 +(falling off the end of the function body is considered returning
8360 +without a value), and about a @code{return} statement with an
8361 +expression in a function whose return-type is @code{void}.
8363 +For C++, a function without return type always produces a diagnostic
8364 +message, even when @option{-Wno-return-type} is specified. The only
8365 +exceptions are @samp{main} and functions defined in system headers.
8367 +This warning is enabled by @option{-Wall}.
8369 +@item -Wswitch
8370 +@opindex Wswitch
8371 +@opindex Wno-switch
8372 +Warn whenever a @code{switch} statement has an index of enumerated type
8373 +and lacks a @code{case} for one or more of the named codes of that
8374 +enumeration. (The presence of a @code{default} label prevents this
8375 +warning.) @code{case} labels outside the enumeration range also
8376 +provoke warnings when this option is used (even if there is a
8377 +@code{default} label).
8378 +This warning is enabled by @option{-Wall}.
8380 +@item -Wswitch-default
8381 +@opindex Wswitch-default
8382 +@opindex Wno-switch-default
8383 +Warn whenever a @code{switch} statement does not have a @code{default}
8384 +case.
8386 +@item -Wswitch-enum
8387 +@opindex Wswitch-enum
8388 +@opindex Wno-switch-enum
8389 +Warn whenever a @code{switch} statement has an index of enumerated type
8390 +and lacks a @code{case} for one or more of the named codes of that
8391 +enumeration. @code{case} labels outside the enumeration range also
8392 +provoke warnings when this option is used. The only difference
8393 +between @option{-Wswitch} and this option is that this option gives a
8394 +warning about an omitted enumeration code even if there is a
8395 +@code{default} label.
8397 +@item -Wsync-nand @r{(C and C++ only)}
8398 +@opindex Wsync-nand
8399 +@opindex Wno-sync-nand
8400 +Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
8401 +built-in functions are used. These functions changed semantics in GCC 4.4.
8403 +@item -Wtrigraphs
8404 +@opindex Wtrigraphs
8405 +@opindex Wno-trigraphs
8406 +Warn if any trigraphs are encountered that might change the meaning of
8407 +the program (trigraphs within comments are not warned about).
8408 +This warning is enabled by @option{-Wall}.
8410 +@item -Wunused-but-set-parameter
8411 +@opindex Wunused-but-set-parameter
8412 +@opindex Wno-unused-but-set-parameter
8413 +Warn whenever a function parameter is assigned to, but otherwise unused
8414 +(aside from its declaration).
8416 +To suppress this warning use the @samp{unused} attribute
8417 +(@pxref{Variable Attributes}).
8419 +This warning is also enabled by @option{-Wunused} together with
8420 +@option{-Wextra}.
8422 +@item -Wunused-but-set-variable
8423 +@opindex Wunused-but-set-variable
8424 +@opindex Wno-unused-but-set-variable
8425 +Warn whenever a local variable is assigned to, but otherwise unused
8426 +(aside from its declaration).
8427 +This warning is enabled by @option{-Wall}.
8429 +To suppress this warning use the @samp{unused} attribute
8430 +(@pxref{Variable Attributes}).
8432 +This warning is also enabled by @option{-Wunused}, which is enabled
8433 +by @option{-Wall}.
8435 +@item -Wunused-function
8436 +@opindex Wunused-function
8437 +@opindex Wno-unused-function
8438 +Warn whenever a static function is declared but not defined or a
8439 +non-inline static function is unused.
8440 +This warning is enabled by @option{-Wall}.
8442 +@item -Wunused-label
8443 +@opindex Wunused-label
8444 +@opindex Wno-unused-label
8445 +Warn whenever a label is declared but not used.
8446 +This warning is enabled by @option{-Wall}.
8448 +To suppress this warning use the @samp{unused} attribute
8449 +(@pxref{Variable Attributes}).
8451 +@item -Wunused-parameter
8452 +@opindex Wunused-parameter
8453 +@opindex Wno-unused-parameter
8454 +Warn whenever a function parameter is unused aside from its declaration.
8456 +To suppress this warning use the @samp{unused} attribute
8457 +(@pxref{Variable Attributes}).
8459 +@item -Wno-unused-result
8460 +@opindex Wunused-result
8461 +@opindex Wno-unused-result
8462 +Do not warn if a caller of a function marked with attribute
8463 +@code{warn_unused_result} (@pxref{Variable Attributes}) does not use
8464 +its return value. The default is @option{-Wunused-result}.
8466 +@item -Wunused-variable
8467 +@opindex Wunused-variable
8468 +@opindex Wno-unused-variable
8469 +Warn whenever a local variable or non-constant static variable is unused
8470 +aside from its declaration.
8471 +This warning is enabled by @option{-Wall}.
8473 +To suppress this warning use the @samp{unused} attribute
8474 +(@pxref{Variable Attributes}).
8476 +@item -Wunused-value
8477 +@opindex Wunused-value
8478 +@opindex Wno-unused-value
8479 +Warn whenever a statement computes a result that is explicitly not
8480 +used. To suppress this warning cast the unused expression to
8481 +@samp{void}. This includes an expression-statement or the left-hand
8482 +side of a comma expression that contains no side effects. For example,
8483 +an expression such as @samp{x[i,j]} will cause a warning, while
8484 +@samp{x[(void)i,j]} will not.
8486 +This warning is enabled by @option{-Wall}.
8488 +@item -Wunused
8489 +@opindex Wunused
8490 +@opindex Wno-unused
8491 +All the above @option{-Wunused} options combined.
8493 +In order to get a warning about an unused function parameter, you must
8494 +either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
8495 +@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
8497 +@item -Wuninitialized
8498 +@opindex Wuninitialized
8499 +@opindex Wno-uninitialized
8500 +Warn if an automatic variable is used without first being initialized
8501 +or if a variable may be clobbered by a @code{setjmp} call. In C++,
8502 +warn if a non-static reference or non-static @samp{const} member
8503 +appears in a class without constructors.
8505 +If you want to warn about code which uses the uninitialized value of the
8506 +variable in its own initializer, use the @option{-Winit-self} option.
8508 +These warnings occur for individual uninitialized or clobbered
8509 +elements of structure, union or array variables as well as for
8510 +variables which are uninitialized or clobbered as a whole. They do
8511 +not occur for variables or elements declared @code{volatile}. Because
8512 +these warnings depend on optimization, the exact variables or elements
8513 +for which there are warnings will depend on the precise optimization
8514 +options and version of GCC used.
8516 +Note that there may be no warning about a variable that is used only
8517 +to compute a value that itself is never used, because such
8518 +computations may be deleted by data flow analysis before the warnings
8519 +are printed.
8521 +These warnings are made optional because GCC is not smart
8522 +enough to see all the reasons why the code might be correct
8523 +despite appearing to have an error. Here is one example of how
8524 +this can happen:
8526 +@smallexample
8527 +@group
8529 + int x;
8530 + switch (y)
8531 + @{
8532 + case 1: x = 1;
8533 + break;
8534 + case 2: x = 4;
8535 + break;
8536 + case 3: x = 5;
8537 + @}
8538 + foo (x);
8540 +@end group
8541 +@end smallexample
8543 +@noindent
8544 +If the value of @code{y} is always 1, 2 or 3, then @code{x} is
8545 +always initialized, but GCC doesn't know this. Here is
8546 +another common case:
8548 +@smallexample
8550 + int save_y;
8551 + if (change_y) save_y = y, y = new_y;
8552 + @dots{}
8553 + if (change_y) y = save_y;
8555 +@end smallexample
8557 +@noindent
8558 +This has no bug because @code{save_y} is used only if it is set.
8560 +@cindex @code{longjmp} warnings
8561 +This option also warns when a non-volatile automatic variable might be
8562 +changed by a call to @code{longjmp}. These warnings as well are possible
8563 +only in optimizing compilation.
8565 +The compiler sees only the calls to @code{setjmp}. It cannot know
8566 +where @code{longjmp} will be called; in fact, a signal handler could
8567 +call it at any point in the code. As a result, you may get a warning
8568 +even when there is in fact no problem because @code{longjmp} cannot
8569 +in fact be called at the place which would cause a problem.
8571 +Some spurious warnings can be avoided if you declare all the functions
8572 +you use that never return as @code{noreturn}. @xref{Function
8573 +Attributes}.
8575 +This warning is enabled by @option{-Wall} or @option{-Wextra}.
8577 +@item -Wunknown-pragmas
8578 +@opindex Wunknown-pragmas
8579 +@opindex Wno-unknown-pragmas
8580 +@cindex warning for unknown pragmas
8581 +@cindex unknown pragmas, warning
8582 +@cindex pragmas, warning of unknown
8583 +Warn when a #pragma directive is encountered which is not understood by
8584 +GCC@. If this command line option is used, warnings will even be issued
8585 +for unknown pragmas in system header files. This is not the case if
8586 +the warnings were only enabled by the @option{-Wall} command line option.
8588 +@item -Wno-pragmas
8589 +@opindex Wno-pragmas
8590 +@opindex Wpragmas
8591 +Do not warn about misuses of pragmas, such as incorrect parameters,
8592 +invalid syntax, or conflicts between pragmas. See also
8593 +@samp{-Wunknown-pragmas}.
8595 +@item -Wstrict-aliasing
8596 +@opindex Wstrict-aliasing
8597 +@opindex Wno-strict-aliasing
8598 +This option is only active when @option{-fstrict-aliasing} is active.
8599 +It warns about code which might break the strict aliasing rules that the
8600 +compiler is using for optimization. The warning does not catch all
8601 +cases, but does attempt to catch the more common pitfalls. It is
8602 +included in @option{-Wall}.
8603 +It is equivalent to @option{-Wstrict-aliasing=3}
8605 +@item -Wstrict-aliasing=n
8606 +@opindex Wstrict-aliasing=n
8607 +@opindex Wno-strict-aliasing=n
8608 +This option is only active when @option{-fstrict-aliasing} is active.
8609 +It warns about code which might break the strict aliasing rules that the
8610 +compiler is using for optimization.
8611 +Higher levels correspond to higher accuracy (fewer false positives).
8612 +Higher levels also correspond to more effort, similar to the way -O works.
8613 +@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
8614 +with n=3.
8616 +Level 1: Most aggressive, quick, least accurate.
8617 +Possibly useful when higher levels
8618 +do not warn but -fstrict-aliasing still breaks the code, as it has very few
8619 +false negatives. However, it has many false positives.
8620 +Warns for all pointer conversions between possibly incompatible types,
8621 +even if never dereferenced. Runs in the frontend only.
8623 +Level 2: Aggressive, quick, not too precise.
8624 +May still have many false positives (not as many as level 1 though),
8625 +and few false negatives (but possibly more than level 1).
8626 +Unlike level 1, it only warns when an address is taken. Warns about
8627 +incomplete types. Runs in the frontend only.
8629 +Level 3 (default for @option{-Wstrict-aliasing}):
8630 +Should have very few false positives and few false
8631 +negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
8632 +Takes care of the common pun+dereference pattern in the frontend:
8633 +@code{*(int*)&some_float}.
8634 +If optimization is enabled, it also runs in the backend, where it deals
8635 +with multiple statement cases using flow-sensitive points-to information.
8636 +Only warns when the converted pointer is dereferenced.
8637 +Does not warn about incomplete types.
8639 +@item -Wstrict-overflow
8640 +@itemx -Wstrict-overflow=@var{n}
8641 +@opindex Wstrict-overflow
8642 +@opindex Wno-strict-overflow
8643 +This option is only active when @option{-fstrict-overflow} is active.
8644 +It warns about cases where the compiler optimizes based on the
8645 +assumption that signed overflow does not occur. Note that it does not
8646 +warn about all cases where the code might overflow: it only warns
8647 +about cases where the compiler implements some optimization. Thus
8648 +this warning depends on the optimization level.
8650 +An optimization which assumes that signed overflow does not occur is
8651 +perfectly safe if the values of the variables involved are such that
8652 +overflow never does, in fact, occur. Therefore this warning can
8653 +easily give a false positive: a warning about code which is not
8654 +actually a problem. To help focus on important issues, several
8655 +warning levels are defined. No warnings are issued for the use of
8656 +undefined signed overflow when estimating how many iterations a loop
8657 +will require, in particular when determining whether a loop will be
8658 +executed at all.
8660 +@table @gcctabopt
8661 +@item -Wstrict-overflow=1
8662 +Warn about cases which are both questionable and easy to avoid. For
8663 +example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
8664 +compiler will simplify this to @code{1}. This level of
8665 +@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
8666 +are not, and must be explicitly requested.
8668 +@item -Wstrict-overflow=2
8669 +Also warn about other cases where a comparison is simplified to a
8670 +constant. For example: @code{abs (x) >= 0}. This can only be
8671 +simplified when @option{-fstrict-overflow} is in effect, because
8672 +@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
8673 +zero. @option{-Wstrict-overflow} (with no level) is the same as
8674 +@option{-Wstrict-overflow=2}.
8676 +@item -Wstrict-overflow=3
8677 +Also warn about other cases where a comparison is simplified. For
8678 +example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
8680 +@item -Wstrict-overflow=4
8681 +Also warn about other simplifications not covered by the above cases.
8682 +For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
8684 +@item -Wstrict-overflow=5
8685 +Also warn about cases where the compiler reduces the magnitude of a
8686 +constant involved in a comparison. For example: @code{x + 2 > y} will
8687 +be simplified to @code{x + 1 >= y}. This is reported only at the
8688 +highest warning level because this simplification applies to many
8689 +comparisons, so this warning level will give a very large number of
8690 +false positives.
8691 +@end table
8693 +@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
8694 +@opindex Wsuggest-attribute=
8695 +@opindex Wno-suggest-attribute=
8696 +Warn for cases where adding an attribute may be beneficial. The
8697 +attributes currently supported are listed below.
8699 +@table @gcctabopt
8700 +@item -Wsuggest-attribute=pure
8701 +@itemx -Wsuggest-attribute=const
8702 +@itemx -Wsuggest-attribute=noreturn
8703 +@opindex Wsuggest-attribute=pure
8704 +@opindex Wno-suggest-attribute=pure
8705 +@opindex Wsuggest-attribute=const
8706 +@opindex Wno-suggest-attribute=const
8707 +@opindex Wsuggest-attribute=noreturn
8708 +@opindex Wno-suggest-attribute=noreturn
8710 +Warn about functions which might be candidates for attributes
8711 +@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
8712 +functions visible in other compilation units or (in the case of @code{pure} and
8713 +@code{const}) if it cannot prove that the function returns normally. A function
8714 +returns normally if it doesn't contain an infinite loop nor returns abnormally
8715 +by throwing, calling @code{abort()} or trapping. This analysis requires option
8716 +@option{-fipa-pure-const}, which is enabled by default at @option{-O} and
8717 +higher. Higher optimization levels improve the accuracy of the analysis.
8718 +@end table
8720 +@item -Warray-bounds
8721 +@opindex Wno-array-bounds
8722 +@opindex Warray-bounds
8723 +This option is only active when @option{-ftree-vrp} is active
8724 +(default for @option{-O2} and above). It warns about subscripts to arrays
8725 +that are always out of bounds. This warning is enabled by @option{-Wall}.
8727 +@item -Wno-div-by-zero
8728 +@opindex Wno-div-by-zero
8729 +@opindex Wdiv-by-zero
8730 +Do not warn about compile-time integer division by zero. Floating point
8731 +division by zero is not warned about, as it can be a legitimate way of
8732 +obtaining infinities and NaNs.
8734 +@item -Wsystem-headers
8735 +@opindex Wsystem-headers
8736 +@opindex Wno-system-headers
8737 +@cindex warnings from system headers
8738 +@cindex system headers, warnings from
8739 +Print warning messages for constructs found in system header files.
8740 +Warnings from system headers are normally suppressed, on the assumption
8741 +that they usually do not indicate real problems and would only make the
8742 +compiler output harder to read. Using this command line option tells
8743 +GCC to emit warnings from system headers as if they occurred in user
8744 +code. However, note that using @option{-Wall} in conjunction with this
8745 +option will @emph{not} warn about unknown pragmas in system
8746 +headers---for that, @option{-Wunknown-pragmas} must also be used.
8748 +@item -Wtrampolines
8749 +@opindex Wtrampolines
8750 +@opindex Wno-trampolines
8751 + Warn about trampolines generated for pointers to nested functions.
8753 + A trampoline is a small piece of data or code that is created at run
8754 + time on the stack when the address of a nested function is taken, and
8755 + is used to call the nested function indirectly. For some targets, it
8756 + is made up of data only and thus requires no special treatment. But,
8757 + for most targets, it is made up of code and thus requires the stack
8758 + to be made executable in order for the program to work properly.
8760 +@item -Wfloat-equal
8761 +@opindex Wfloat-equal
8762 +@opindex Wno-float-equal
8763 +Warn if floating point values are used in equality comparisons.
8765 +The idea behind this is that sometimes it is convenient (for the
8766 +programmer) to consider floating-point values as approximations to
8767 +infinitely precise real numbers. If you are doing this, then you need
8768 +to compute (by analyzing the code, or in some other way) the maximum or
8769 +likely maximum error that the computation introduces, and allow for it
8770 +when performing comparisons (and when producing output, but that's a
8771 +different problem). In particular, instead of testing for equality, you
8772 +would check to see whether the two values have ranges that overlap; and
8773 +this is done with the relational operators, so equality comparisons are
8774 +probably mistaken.
8776 +@item -Wtraditional @r{(C and Objective-C only)}
8777 +@opindex Wtraditional
8778 +@opindex Wno-traditional
8779 +Warn about certain constructs that behave differently in traditional and
8780 +ISO C@. Also warn about ISO C constructs that have no traditional C
8781 +equivalent, and/or problematic constructs which should be avoided.
8783 +@itemize @bullet
8784 +@item
8785 +Macro parameters that appear within string literals in the macro body.
8786 +In traditional C macro replacement takes place within string literals,
8787 +but does not in ISO C@.
8789 +@item
8790 +In traditional C, some preprocessor directives did not exist.
8791 +Traditional preprocessors would only consider a line to be a directive
8792 +if the @samp{#} appeared in column 1 on the line. Therefore
8793 +@option{-Wtraditional} warns about directives that traditional C
8794 +understands but would ignore because the @samp{#} does not appear as the
8795 +first character on the line. It also suggests you hide directives like
8796 +@samp{#pragma} not understood by traditional C by indenting them. Some
8797 +traditional implementations would not recognize @samp{#elif}, so it
8798 +suggests avoiding it altogether.
8800 +@item
8801 +A function-like macro that appears without arguments.
8803 +@item
8804 +The unary plus operator.
8806 +@item
8807 +The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
8808 +constant suffixes. (Traditional C does support the @samp{L} suffix on integer
8809 +constants.) Note, these suffixes appear in macros defined in the system
8810 +headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8811 +Use of these macros in user code might normally lead to spurious
8812 +warnings, however GCC's integrated preprocessor has enough context to
8813 +avoid warning in these cases.
8815 +@item
8816 +A function declared external in one block and then used after the end of
8817 +the block.
8819 +@item
8820 +A @code{switch} statement has an operand of type @code{long}.
8822 +@item
8823 +A non-@code{static} function declaration follows a @code{static} one.
8824 +This construct is not accepted by some traditional C compilers.
8826 +@item
8827 +The ISO type of an integer constant has a different width or
8828 +signedness from its traditional type. This warning is only issued if
8829 +the base of the constant is ten. I.e.@: hexadecimal or octal values, which
8830 +typically represent bit patterns, are not warned about.
8832 +@item
8833 +Usage of ISO string concatenation is detected.
8835 +@item
8836 +Initialization of automatic aggregates.
8838 +@item
8839 +Identifier conflicts with labels. Traditional C lacks a separate
8840 +namespace for labels.
8842 +@item
8843 +Initialization of unions. If the initializer is zero, the warning is
8844 +omitted. This is done under the assumption that the zero initializer in
8845 +user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8846 +initializer warnings and relies on default initialization to zero in the
8847 +traditional C case.
8849 +@item
8850 +Conversions by prototypes between fixed/floating point values and vice
8851 +versa. The absence of these prototypes when compiling with traditional
8852 +C would cause serious problems. This is a subset of the possible
8853 +conversion warnings, for the full set use @option{-Wtraditional-conversion}.
8855 +@item
8856 +Use of ISO C style function definitions. This warning intentionally is
8857 +@emph{not} issued for prototype declarations or variadic functions
8858 +because these ISO C features will appear in your code when using
8859 +libiberty's traditional C compatibility macros, @code{PARAMS} and
8860 +@code{VPARAMS}. This warning is also bypassed for nested functions
8861 +because that feature is already a GCC extension and thus not relevant to
8862 +traditional C compatibility.
8863 +@end itemize
8865 +@item -Wtraditional-conversion @r{(C and Objective-C only)}
8866 +@opindex Wtraditional-conversion
8867 +@opindex Wno-traditional-conversion
8868 +Warn if a prototype causes a type conversion that is different from what
8869 +would happen to the same argument in the absence of a prototype. This
8870 +includes conversions of fixed point to floating and vice versa, and
8871 +conversions changing the width or signedness of a fixed point argument
8872 +except when the same as the default promotion.
8874 +@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8875 +@opindex Wdeclaration-after-statement
8876 +@opindex Wno-declaration-after-statement
8877 +Warn when a declaration is found after a statement in a block. This
8878 +construct, known from C++, was introduced with ISO C99 and is by default
8879 +allowed in GCC@. It is not supported by ISO C90 and was not supported by
8880 +GCC versions before GCC 3.0. @xref{Mixed Declarations}.
8882 +@item -Wundef
8883 +@opindex Wundef
8884 +@opindex Wno-undef
8885 +Warn if an undefined identifier is evaluated in an @samp{#if} directive.
8887 +@item -Wno-endif-labels
8888 +@opindex Wno-endif-labels
8889 +@opindex Wendif-labels
8890 +Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
8892 +@item -Wshadow
8893 +@opindex Wshadow
8894 +@opindex Wno-shadow
8895 +Warn whenever a local variable or type declaration shadows another variable,
8896 +parameter, type, or class member (in C++), or whenever a built-in function
8897 +is shadowed. Note that in C++, the compiler will not warn if a local variable
8898 +shadows a struct/class/enum, but will warn if it shadows an explicit typedef.
8900 +@item -Wlarger-than=@var{len}
8901 +@opindex Wlarger-than=@var{len}
8902 +@opindex Wlarger-than-@var{len}
8903 +Warn whenever an object of larger than @var{len} bytes is defined.
8905 +@item -Wframe-larger-than=@var{len}
8906 +@opindex Wframe-larger-than
8907 +Warn if the size of a function frame is larger than @var{len} bytes.
8908 +The computation done to determine the stack frame size is approximate
8909 +and not conservative.
8910 +The actual requirements may be somewhat greater than @var{len}
8911 +even if you do not get a warning. In addition, any space allocated
8912 +via @code{alloca}, variable-length arrays, or related constructs
8913 +is not included by the compiler when determining
8914 +whether or not to issue a warning.
8916 +@item -Wunsafe-loop-optimizations
8917 +@opindex Wunsafe-loop-optimizations
8918 +@opindex Wno-unsafe-loop-optimizations
8919 +Warn if the loop cannot be optimized because the compiler could not
8920 +assume anything on the bounds of the loop indices. With
8921 +@option{-funsafe-loop-optimizations} warn if the compiler made
8922 +such assumptions.
8924 +@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8925 +@opindex Wno-pedantic-ms-format
8926 +@opindex Wpedantic-ms-format
8927 +Disables the warnings about non-ISO @code{printf} / @code{scanf} format
8928 +width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
8929 +depending on the MS runtime, when you are using the options @option{-Wformat}
8930 +and @option{-pedantic} without gnu-extensions.
8932 +@item -Wpointer-arith
8933 +@opindex Wpointer-arith
8934 +@opindex Wno-pointer-arith
8935 +Warn about anything that depends on the ``size of'' a function type or
8936 +of @code{void}. GNU C assigns these types a size of 1, for
8937 +convenience in calculations with @code{void *} pointers and pointers
8938 +to functions. In C++, warn also when an arithmetic operation involves
8939 +@code{NULL}. This warning is also enabled by @option{-pedantic}.
8941 +@item -Wtype-limits
8942 +@opindex Wtype-limits
8943 +@opindex Wno-type-limits
8944 +Warn if a comparison is always true or always false due to the limited
8945 +range of the data type, but do not warn for constant expressions. For
8946 +example, warn if an unsigned variable is compared against zero with
8947 +@samp{<} or @samp{>=}. This warning is also enabled by
8948 +@option{-Wextra}.
8950 +@item -Wbad-function-cast @r{(C and Objective-C only)}
8951 +@opindex Wbad-function-cast
8952 +@opindex Wno-bad-function-cast
8953 +Warn whenever a function call is cast to a non-matching type.
8954 +For example, warn if @code{int malloc()} is cast to @code{anything *}.
8956 +@item -Wc++-compat @r{(C and Objective-C only)}
8957 +Warn about ISO C constructs that are outside of the common subset of
8958 +ISO C and ISO C++, e.g.@: request for implicit conversion from
8959 +@code{void *} to a pointer to non-@code{void} type.
8961 +@item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
8962 +Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
8963 +ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
8964 +in ISO C++ 200x. This warning is enabled by @option{-Wall}.
8966 +@item -Wcast-qual
8967 +@opindex Wcast-qual
8968 +@opindex Wno-cast-qual
8969 +Warn whenever a pointer is cast so as to remove a type qualifier from
8970 +the target type. For example, warn if a @code{const char *} is cast
8971 +to an ordinary @code{char *}.
8973 +Also warn when making a cast which introduces a type qualifier in an
8974 +unsafe way. For example, casting @code{char **} to @code{const char **}
8975 +is unsafe, as in this example:
8977 +@smallexample
8978 + /* p is char ** value. */
8979 + const char **q = (const char **) p;
8980 + /* Assignment of readonly string to const char * is OK. */
8981 + *q = "string";
8982 + /* Now char** pointer points to read-only memory. */
8983 + **p = 'b';
8984 +@end smallexample
8986 +@item -Wcast-align
8987 +@opindex Wcast-align
8988 +@opindex Wno-cast-align
8989 +Warn whenever a pointer is cast such that the required alignment of the
8990 +target is increased. For example, warn if a @code{char *} is cast to
8991 +an @code{int *} on machines where integers can only be accessed at
8992 +two- or four-byte boundaries.
8994 +@item -Wwrite-strings
8995 +@opindex Wwrite-strings
8996 +@opindex Wno-write-strings
8997 +When compiling C, give string constants the type @code{const
8998 +char[@var{length}]} so that copying the address of one into a
8999 +non-@code{const} @code{char *} pointer will get a warning. These
9000 +warnings will help you find at compile time code that can try to write
9001 +into a string constant, but only if you have been very careful about
9002 +using @code{const} in declarations and prototypes. Otherwise, it will
9003 +just be a nuisance. This is why we did not make @option{-Wall} request
9004 +these warnings.
9006 +When compiling C++, warn about the deprecated conversion from string
9007 +literals to @code{char *}. This warning is enabled by default for C++
9008 +programs.
9010 +@item -Wclobbered
9011 +@opindex Wclobbered
9012 +@opindex Wno-clobbered
9013 +Warn for variables that might be changed by @samp{longjmp} or
9014 +@samp{vfork}. This warning is also enabled by @option{-Wextra}.
9016 +@item -Wconversion
9017 +@opindex Wconversion
9018 +@opindex Wno-conversion
9019 +Warn for implicit conversions that may alter a value. This includes
9020 +conversions between real and integer, like @code{abs (x)} when
9021 +@code{x} is @code{double}; conversions between signed and unsigned,
9022 +like @code{unsigned ui = -1}; and conversions to smaller types, like
9023 +@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9024 +((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9025 +changed by the conversion like in @code{abs (2.0)}. Warnings about
9026 +conversions between signed and unsigned integers can be disabled by
9027 +using @option{-Wno-sign-conversion}.
9029 +For C++, also warn for confusing overload resolution for user-defined
9030 +conversions; and conversions that will never use a type conversion
9031 +operator: conversions to @code{void}, the same type, a base class or a
9032 +reference to them. Warnings about conversions between signed and
9033 +unsigned integers are disabled by default in C++ unless
9034 +@option{-Wsign-conversion} is explicitly enabled.
9036 +@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
9037 +@opindex Wconversion-null
9038 +@opindex Wno-conversion-null
9039 +Do not warn for conversions between @code{NULL} and non-pointer
9040 +types. @option{-Wconversion-null} is enabled by default.
9042 +@item -Wempty-body
9043 +@opindex Wempty-body
9044 +@opindex Wno-empty-body
9045 +Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
9046 +while} statement. This warning is also enabled by @option{-Wextra}.
9048 +@item -Wenum-compare
9049 +@opindex Wenum-compare
9050 +@opindex Wno-enum-compare
9051 +Warn about a comparison between values of different enum types. In C++
9052 +this warning is enabled by default. In C this warning is enabled by
9053 +@option{-Wall}.
9055 +@item -Wjump-misses-init @r{(C, Objective-C only)}
9056 +@opindex Wjump-misses-init
9057 +@opindex Wno-jump-misses-init
9058 +Warn if a @code{goto} statement or a @code{switch} statement jumps
9059 +forward across the initialization of a variable, or jumps backward to a
9060 +label after the variable has been initialized. This only warns about
9061 +variables which are initialized when they are declared. This warning is
9062 +only supported for C and Objective C; in C++ this sort of branch is an
9063 +error in any case.
9065 +@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
9066 +can be disabled with the @option{-Wno-jump-misses-init} option.
9068 +@item -Wsign-compare
9069 +@opindex Wsign-compare
9070 +@opindex Wno-sign-compare
9071 +@cindex warning for comparison of signed and unsigned values
9072 +@cindex comparison of signed and unsigned values, warning
9073 +@cindex signed and unsigned values, comparison warning
9074 +Warn when a comparison between signed and unsigned values could produce
9075 +an incorrect result when the signed value is converted to unsigned.
9076 +This warning is also enabled by @option{-Wextra}; to get the other warnings
9077 +of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
9079 +@item -Wsign-conversion
9080 +@opindex Wsign-conversion
9081 +@opindex Wno-sign-conversion
9082 +Warn for implicit conversions that may change the sign of an integer
9083 +value, like assigning a signed integer expression to an unsigned
9084 +integer variable. An explicit cast silences the warning. In C, this
9085 +option is enabled also by @option{-Wconversion}.
9087 +@item -Waddress
9088 +@opindex Waddress
9089 +@opindex Wno-address
9090 +Warn about suspicious uses of memory addresses. These include using
9091 +the address of a function in a conditional expression, such as
9092 +@code{void func(void); if (func)}, and comparisons against the memory
9093 +address of a string literal, such as @code{if (x == "abc")}. Such
9094 +uses typically indicate a programmer error: the address of a function
9095 +always evaluates to true, so their use in a conditional usually
9096 +indicate that the programmer forgot the parentheses in a function
9097 +call; and comparisons against string literals result in unspecified
9098 +behavior and are not portable in C, so they usually indicate that the
9099 +programmer intended to use @code{strcmp}. This warning is enabled by
9100 +@option{-Wall}.
9102 +@item -Wlogical-op
9103 +@opindex Wlogical-op
9104 +@opindex Wno-logical-op
9105 +Warn about suspicious uses of logical operators in expressions.
9106 +This includes using logical operators in contexts where a
9107 +bit-wise operator is likely to be expected.
9109 +@item -Waggregate-return
9110 +@opindex Waggregate-return
9111 +@opindex Wno-aggregate-return
9112 +Warn if any functions that return structures or unions are defined or
9113 +called. (In languages where you can return an array, this also elicits
9114 +a warning.)
9116 +@item -Wno-attributes
9117 +@opindex Wno-attributes
9118 +@opindex Wattributes
9119 +Do not warn if an unexpected @code{__attribute__} is used, such as
9120 +unrecognized attributes, function attributes applied to variables,
9121 +etc. This will not stop errors for incorrect use of supported
9122 +attributes.
9124 +@item -Wno-builtin-macro-redefined
9125 +@opindex Wno-builtin-macro-redefined
9126 +@opindex Wbuiltin-macro-redefined
9127 +Do not warn if certain built-in macros are redefined. This suppresses
9128 +warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9129 +@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9131 +@item -Wstrict-prototypes @r{(C and Objective-C only)}
9132 +@opindex Wstrict-prototypes
9133 +@opindex Wno-strict-prototypes
9134 +Warn if a function is declared or defined without specifying the
9135 +argument types. (An old-style function definition is permitted without
9136 +a warning if preceded by a declaration which specifies the argument
9137 +types.)
9139 +@item -Wold-style-declaration @r{(C and Objective-C only)}
9140 +@opindex Wold-style-declaration
9141 +@opindex Wno-old-style-declaration
9142 +Warn for obsolescent usages, according to the C Standard, in a
9143 +declaration. For example, warn if storage-class specifiers like
9144 +@code{static} are not the first things in a declaration. This warning
9145 +is also enabled by @option{-Wextra}.
9147 +@item -Wold-style-definition @r{(C and Objective-C only)}
9148 +@opindex Wold-style-definition
9149 +@opindex Wno-old-style-definition
9150 +Warn if an old-style function definition is used. A warning is given
9151 +even if there is a previous prototype.
9153 +@item -Wmissing-parameter-type @r{(C and Objective-C only)}
9154 +@opindex Wmissing-parameter-type
9155 +@opindex Wno-missing-parameter-type
9156 +A function parameter is declared without a type specifier in K&R-style
9157 +functions:
9159 +@smallexample
9160 +void foo(bar) @{ @}
9161 +@end smallexample
9163 +This warning is also enabled by @option{-Wextra}.
9165 +@item -Wmissing-prototypes @r{(C and Objective-C only)}
9166 +@opindex Wmissing-prototypes
9167 +@opindex Wno-missing-prototypes
9168 +Warn if a global function is defined without a previous prototype
9169 +declaration. This warning is issued even if the definition itself
9170 +provides a prototype. The aim is to detect global functions that fail
9171 +to be declared in header files.
9173 +@item -Wmissing-declarations
9174 +@opindex Wmissing-declarations
9175 +@opindex Wno-missing-declarations
9176 +Warn if a global function is defined without a previous declaration.
9177 +Do so even if the definition itself provides a prototype.
9178 +Use this option to detect global functions that are not declared in
9179 +header files. In C++, no warnings are issued for function templates,
9180 +or for inline functions, or for functions in anonymous namespaces.
9182 +@item -Wmissing-field-initializers
9183 +@opindex Wmissing-field-initializers
9184 +@opindex Wno-missing-field-initializers
9185 +@opindex W
9186 +@opindex Wextra
9187 +@opindex Wno-extra
9188 +Warn if a structure's initializer has some fields missing. For
9189 +example, the following code would cause such a warning, because
9190 +@code{x.h} is implicitly zero:
9192 +@smallexample
9193 +struct s @{ int f, g, h; @};
9194 +struct s x = @{ 3, 4 @};
9195 +@end smallexample
9197 +This option does not warn about designated initializers, so the following
9198 +modification would not trigger a warning:
9200 +@smallexample
9201 +struct s @{ int f, g, h; @};
9202 +struct s x = @{ .f = 3, .g = 4 @};
9203 +@end smallexample
9205 +This warning is included in @option{-Wextra}. To get other @option{-Wextra}
9206 +warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
9208 +@item -Wmissing-format-attribute
9209 +@opindex Wmissing-format-attribute
9210 +@opindex Wno-missing-format-attribute
9211 +@opindex Wformat
9212 +@opindex Wno-format
9213 +Warn about function pointers which might be candidates for @code{format}
9214 +attributes. Note these are only possible candidates, not absolute ones.
9215 +GCC will guess that function pointers with @code{format} attributes that
9216 +are used in assignment, initialization, parameter passing or return
9217 +statements should have a corresponding @code{format} attribute in the
9218 +resulting type. I.e.@: the left-hand side of the assignment or
9219 +initialization, the type of the parameter variable, or the return type
9220 +of the containing function respectively should also have a @code{format}
9221 +attribute to avoid the warning.
9223 +GCC will also warn about function definitions which might be
9224 +candidates for @code{format} attributes. Again, these are only
9225 +possible candidates. GCC will guess that @code{format} attributes
9226 +might be appropriate for any function that calls a function like
9227 +@code{vprintf} or @code{vscanf}, but this might not always be the
9228 +case, and some functions for which @code{format} attributes are
9229 +appropriate may not be detected.
9231 +@item -Wno-multichar
9232 +@opindex Wno-multichar
9233 +@opindex Wmultichar
9234 +Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9235 +Usually they indicate a typo in the user's code, as they have
9236 +implementation-defined values, and should not be used in portable code.
9238 +@item -Wnormalized=<none|id|nfc|nfkc>
9239 +@opindex Wnormalized=
9240 +@cindex NFC
9241 +@cindex NFKC
9242 +@cindex character set, input normalization
9243 +In ISO C and ISO C++, two identifiers are different if they are
9244 +different sequences of characters. However, sometimes when characters
9245 +outside the basic ASCII character set are used, you can have two
9246 +different character sequences that look the same. To avoid confusion,
9247 +the ISO 10646 standard sets out some @dfn{normalization rules} which
9248 +when applied ensure that two sequences that look the same are turned into
9249 +the same sequence. GCC can warn you if you are using identifiers which
9250 +have not been normalized; this option controls that warning.
9252 +There are four levels of warning that GCC supports. The default is
9253 +@option{-Wnormalized=nfc}, which warns about any identifier which is
9254 +not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
9255 +recommended form for most uses.
9257 +Unfortunately, there are some characters which ISO C and ISO C++ allow
9258 +in identifiers that when turned into NFC aren't allowable as
9259 +identifiers. That is, there's no way to use these symbols in portable
9260 +ISO C or C++ and have all your identifiers in NFC@.
9261 +@option{-Wnormalized=id} suppresses the warning for these characters.
9262 +It is hoped that future versions of the standards involved will correct
9263 +this, which is why this option is not the default.
9265 +You can switch the warning off for all characters by writing
9266 +@option{-Wnormalized=none}. You would only want to do this if you
9267 +were using some other normalization scheme (like ``D''), because
9268 +otherwise you can easily create bugs that are literally impossible to see.
9270 +Some characters in ISO 10646 have distinct meanings but look identical
9271 +in some fonts or display methodologies, especially once formatting has
9272 +been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9273 +LETTER N'', will display just like a regular @code{n} which has been
9274 +placed in a superscript. ISO 10646 defines the @dfn{NFKC}
9275 +normalization scheme to convert all these into a standard form as
9276 +well, and GCC will warn if your code is not in NFKC if you use
9277 +@option{-Wnormalized=nfkc}. This warning is comparable to warning
9278 +about every identifier that contains the letter O because it might be
9279 +confused with the digit 0, and so is not the default, but may be
9280 +useful as a local coding convention if the programming environment is
9281 +unable to be fixed to display these characters distinctly.
9283 +@item -Wno-deprecated
9284 +@opindex Wno-deprecated
9285 +@opindex Wdeprecated
9286 +Do not warn about usage of deprecated features. @xref{Deprecated Features}.
9288 +@item -Wno-deprecated-declarations
9289 +@opindex Wno-deprecated-declarations
9290 +@opindex Wdeprecated-declarations
9291 +Do not warn about uses of functions (@pxref{Function Attributes}),
9292 +variables (@pxref{Variable Attributes}), and types (@pxref{Type
9293 +Attributes}) marked as deprecated by using the @code{deprecated}
9294 +attribute.
9296 +@item -Wno-overflow
9297 +@opindex Wno-overflow
9298 +@opindex Woverflow
9299 +Do not warn about compile-time overflow in constant expressions.
9301 +@item -Woverride-init @r{(C and Objective-C only)}
9302 +@opindex Woverride-init
9303 +@opindex Wno-override-init
9304 +@opindex W
9305 +@opindex Wextra
9306 +@opindex Wno-extra
9307 +Warn if an initialized field without side effects is overridden when
9308 +using designated initializers (@pxref{Designated Inits, , Designated
9309 +Initializers}).
9311 +This warning is included in @option{-Wextra}. To get other
9312 +@option{-Wextra} warnings without this one, use @samp{-Wextra
9313 +-Wno-override-init}.
9315 +@item -Wpacked
9316 +@opindex Wpacked
9317 +@opindex Wno-packed
9318 +Warn if a structure is given the packed attribute, but the packed
9319 +attribute has no effect on the layout or size of the structure.
9320 +Such structures may be mis-aligned for little benefit. For
9321 +instance, in this code, the variable @code{f.x} in @code{struct bar}
9322 +will be misaligned even though @code{struct bar} does not itself
9323 +have the packed attribute:
9325 +@smallexample
9326 +@group
9327 +struct foo @{
9328 + int x;
9329 + char a, b, c, d;
9330 +@} __attribute__((packed));
9331 +struct bar @{
9332 + char z;
9333 + struct foo f;
9334 +@};
9335 +@end group
9336 +@end smallexample
9338 +@item -Wpacked-bitfield-compat
9339 +@opindex Wpacked-bitfield-compat
9340 +@opindex Wno-packed-bitfield-compat
9341 +The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9342 +on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
9343 +the change can lead to differences in the structure layout. GCC
9344 +informs you when the offset of such a field has changed in GCC 4.4.
9345 +For example there is no longer a 4-bit padding between field @code{a}
9346 +and @code{b} in this structure:
9348 +@smallexample
9349 +struct foo
9351 + char a:4;
9352 + char b:8;
9353 +@} __attribute__ ((packed));
9354 +@end smallexample
9356 +This warning is enabled by default. Use
9357 +@option{-Wno-packed-bitfield-compat} to disable this warning.
9359 +@item -Wpadded
9360 +@opindex Wpadded
9361 +@opindex Wno-padded
9362 +Warn if padding is included in a structure, either to align an element
9363 +of the structure or to align the whole structure. Sometimes when this
9364 +happens it is possible to rearrange the fields of the structure to
9365 +reduce the padding and so make the structure smaller.
9367 +@item -Wredundant-decls
9368 +@opindex Wredundant-decls
9369 +@opindex Wno-redundant-decls
9370 +Warn if anything is declared more than once in the same scope, even in
9371 +cases where multiple declaration is valid and changes nothing.
9373 +@item -Wnested-externs @r{(C and Objective-C only)}
9374 +@opindex Wnested-externs
9375 +@opindex Wno-nested-externs
9376 +Warn if an @code{extern} declaration is encountered within a function.
9378 +@item -Winline
9379 +@opindex Winline
9380 +@opindex Wno-inline
9381 +Warn if a function can not be inlined and it was declared as inline.
9382 +Even with this option, the compiler will not warn about failures to
9383 +inline functions declared in system headers.
9385 +The compiler uses a variety of heuristics to determine whether or not
9386 +to inline a function. For example, the compiler takes into account
9387 +the size of the function being inlined and the amount of inlining
9388 +that has already been done in the current function. Therefore,
9389 +seemingly insignificant changes in the source program can cause the
9390 +warnings produced by @option{-Winline} to appear or disappear.
9392 +@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
9393 +@opindex Wno-invalid-offsetof
9394 +@opindex Winvalid-offsetof
9395 +Suppress warnings from applying the @samp{offsetof} macro to a non-POD
9396 +type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
9397 +to a non-POD type is undefined. In existing C++ implementations,
9398 +however, @samp{offsetof} typically gives meaningful results even when
9399 +applied to certain kinds of non-POD types. (Such as a simple
9400 +@samp{struct} that fails to be a POD type only by virtue of having a
9401 +constructor.) This flag is for users who are aware that they are
9402 +writing nonportable code and who have deliberately chosen to ignore the
9403 +warning about it.
9405 +The restrictions on @samp{offsetof} may be relaxed in a future version
9406 +of the C++ standard.
9408 +@item -Wno-int-to-pointer-cast
9409 +@opindex Wno-int-to-pointer-cast
9410 +@opindex Wint-to-pointer-cast
9411 +Suppress warnings from casts to pointer type of an integer of a
9412 +different size. In C++, casting to a pointer type of smaller size is
9413 +an error. @option{Wint-to-pointer-cast} is enabled by default.
9416 +@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9417 +@opindex Wno-pointer-to-int-cast
9418 +@opindex Wpointer-to-int-cast
9419 +Suppress warnings from casts from a pointer to an integer type of a
9420 +different size.
9422 +@item -Winvalid-pch
9423 +@opindex Winvalid-pch
9424 +@opindex Wno-invalid-pch
9425 +Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9426 +the search path but can't be used.
9428 +@item -Wlong-long
9429 +@opindex Wlong-long
9430 +@opindex Wno-long-long
9431 +Warn if @samp{long long} type is used. This is enabled by either
9432 +@option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
9433 +modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9435 +@item -Wvariadic-macros
9436 +@opindex Wvariadic-macros
9437 +@opindex Wno-variadic-macros
9438 +Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
9439 +alternate syntax when in pedantic ISO C99 mode. This is default.
9440 +To inhibit the warning messages, use @option{-Wno-variadic-macros}.
9442 +@item -Wvla
9443 +@opindex Wvla
9444 +@opindex Wno-vla
9445 +Warn if variable length array is used in the code.
9446 +@option{-Wno-vla} will prevent the @option{-pedantic} warning of
9447 +the variable length array.
9449 +@item -Wvolatile-register-var
9450 +@opindex Wvolatile-register-var
9451 +@opindex Wno-volatile-register-var
9452 +Warn if a register variable is declared volatile. The volatile
9453 +modifier does not inhibit all optimizations that may eliminate reads
9454 +and/or writes to register variables. This warning is enabled by
9455 +@option{-Wall}.
9457 +@item -Wdisabled-optimization
9458 +@opindex Wdisabled-optimization
9459 +@opindex Wno-disabled-optimization
9460 +Warn if a requested optimization pass is disabled. This warning does
9461 +not generally indicate that there is anything wrong with your code; it
9462 +merely indicates that GCC's optimizers were unable to handle the code
9463 +effectively. Often, the problem is that your code is too big or too
9464 +complex; GCC will refuse to optimize programs when the optimization
9465 +itself is likely to take inordinate amounts of time.
9467 +@item -Wpointer-sign @r{(C and Objective-C only)}
9468 +@opindex Wpointer-sign
9469 +@opindex Wno-pointer-sign
9470 +Warn for pointer argument passing or assignment with different signedness.
9471 +This option is only supported for C and Objective-C@. It is implied by
9472 +@option{-Wall} and by @option{-pedantic}, which can be disabled with
9473 +@option{-Wno-pointer-sign}.
9475 +@item -Wstack-protector
9476 +@opindex Wstack-protector
9477 +@opindex Wno-stack-protector
9478 +This option is only active when @option{-fstack-protector} is active. It
9479 +warns about functions that will not be protected against stack smashing.
9481 +@item -Wno-mudflap
9482 +@opindex Wno-mudflap
9483 +Suppress warnings about constructs that cannot be instrumented by
9484 +@option{-fmudflap}.
9486 +@item -Woverlength-strings
9487 +@opindex Woverlength-strings
9488 +@opindex Wno-overlength-strings
9489 +Warn about string constants which are longer than the ``minimum
9490 +maximum'' length specified in the C standard. Modern compilers
9491 +generally allow string constants which are much longer than the
9492 +standard's minimum limit, but very portable programs should avoid
9493 +using longer strings.
9495 +The limit applies @emph{after} string constant concatenation, and does
9496 +not count the trailing NUL@. In C90, the limit was 509 characters; in
9497 +C99, it was raised to 4095. C++98 does not specify a normative
9498 +minimum maximum, so we do not diagnose overlength strings in C++@.
9500 +This option is implied by @option{-pedantic}, and can be disabled with
9501 +@option{-Wno-overlength-strings}.
9503 +@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9504 +@opindex Wunsuffixed-float-constants
9506 +GCC will issue a warning for any floating constant that does not have
9507 +a suffix. When used together with @option{-Wsystem-headers} it will
9508 +warn about such constants in system header files. This can be useful
9509 +when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9510 +from the decimal floating-point extension to C99.
9511 +@end table
9513 +@node Debugging Options
9514 +@section Options for Debugging Your Program or GCC
9515 +@cindex options, debugging
9516 +@cindex debugging information options
9518 +GCC has various special options that are used for debugging
9519 +either your program or GCC:
9521 +@table @gcctabopt
9522 +@item -g
9523 +@opindex g
9524 +Produce debugging information in the operating system's native format
9525 +(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
9526 +information.
9528 +On most systems that use stabs format, @option{-g} enables use of extra
9529 +debugging information that only GDB can use; this extra information
9530 +makes debugging work better in GDB but will probably make other debuggers
9531 +crash or
9532 +refuse to read the program. If you want to control for certain whether
9533 +to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
9534 +@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
9536 +GCC allows you to use @option{-g} with
9537 +@option{-O}. The shortcuts taken by optimized code may occasionally
9538 +produce surprising results: some variables you declared may not exist
9539 +at all; flow of control may briefly move where you did not expect it;
9540 +some statements may not be executed because they compute constant
9541 +results or their values were already at hand; some statements may
9542 +execute in different places because they were moved out of loops.
9544 +Nevertheless it proves possible to debug optimized output. This makes
9545 +it reasonable to use the optimizer for programs that might have bugs.
9547 +The following options are useful when GCC is generated with the
9548 +capability for more than one debugging format.
9550 +@item -ggdb
9551 +@opindex ggdb
9552 +Produce debugging information for use by GDB@. This means to use the
9553 +most expressive format available (DWARF 2, stabs, or the native format
9554 +if neither of those are supported), including GDB extensions if at all
9555 +possible.
9557 +@item -gstabs
9558 +@opindex gstabs
9559 +Produce debugging information in stabs format (if that is supported),
9560 +without GDB extensions. This is the format used by DBX on most BSD
9561 +systems. On MIPS, Alpha and System V Release 4 systems this option
9562 +produces stabs debugging output which is not understood by DBX or SDB@.
9563 +On System V Release 4 systems this option requires the GNU assembler.
9565 +@item -feliminate-unused-debug-symbols
9566 +@opindex feliminate-unused-debug-symbols
9567 +Produce debugging information in stabs format (if that is supported),
9568 +for only symbols that are actually used.
9570 +@item -femit-class-debug-always
9571 +Instead of emitting debugging information for a C++ class in only one
9572 +object file, emit it in all object files using the class. This option
9573 +should be used only with debuggers that are unable to handle the way GCC
9574 +normally emits debugging information for classes because using this
9575 +option will increase the size of debugging information by as much as a
9576 +factor of two.
9578 +@item -gstabs+
9579 +@opindex gstabs+
9580 +Produce debugging information in stabs format (if that is supported),
9581 +using GNU extensions understood only by the GNU debugger (GDB)@. The
9582 +use of these extensions is likely to make other debuggers crash or
9583 +refuse to read the program.
9585 +@item -gcoff
9586 +@opindex gcoff
9587 +Produce debugging information in COFF format (if that is supported).
9588 +This is the format used by SDB on most System V systems prior to
9589 +System V Release 4.
9591 +@item -gxcoff
9592 +@opindex gxcoff
9593 +Produce debugging information in XCOFF format (if that is supported).
9594 +This is the format used by the DBX debugger on IBM RS/6000 systems.
9596 +@item -gxcoff+
9597 +@opindex gxcoff+
9598 +Produce debugging information in XCOFF format (if that is supported),
9599 +using GNU extensions understood only by the GNU debugger (GDB)@. The
9600 +use of these extensions is likely to make other debuggers crash or
9601 +refuse to read the program, and may cause assemblers other than the GNU
9602 +assembler (GAS) to fail with an error.
9604 +@item -gdwarf-@var{version}
9605 +@opindex gdwarf-@var{version}
9606 +Produce debugging information in DWARF format (if that is
9607 +supported). This is the format used by DBX on IRIX 6. The value
9608 +of @var{version} may be either 2, 3 or 4; the default version is 2.
9610 +Note that with DWARF version 2 some ports require, and will always
9611 +use, some non-conflicting DWARF 3 extensions in the unwind tables.
9613 +Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
9614 +for maximum benefit.
9616 +@item -gstrict-dwarf
9617 +@opindex gstrict-dwarf
9618 +Disallow using extensions of later DWARF standard version than selected
9619 +with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
9620 +DWARF extensions from later standard versions is allowed.
9622 +@item -gno-strict-dwarf
9623 +@opindex gno-strict-dwarf
9624 +Allow using extensions of later DWARF standard version than selected with
9625 +@option{-gdwarf-@var{version}}.
9627 +@item -gvms
9628 +@opindex gvms
9629 +Produce debugging information in VMS debug format (if that is
9630 +supported). This is the format used by DEBUG on VMS systems.
9632 +@item -g@var{level}
9633 +@itemx -ggdb@var{level}
9634 +@itemx -gstabs@var{level}
9635 +@itemx -gcoff@var{level}
9636 +@itemx -gxcoff@var{level}
9637 +@itemx -gvms@var{level}
9638 +Request debugging information and also use @var{level} to specify how
9639 +much information. The default level is 2.
9641 +Level 0 produces no debug information at all. Thus, @option{-g0} negates
9642 +@option{-g}.
9644 +Level 1 produces minimal information, enough for making backtraces in
9645 +parts of the program that you don't plan to debug. This includes
9646 +descriptions of functions and external variables, but no information
9647 +about local variables and no line numbers.
9649 +Level 3 includes extra information, such as all the macro definitions
9650 +present in the program. Some debuggers support macro expansion when
9651 +you use @option{-g3}.
9653 +@option{-gdwarf-2} does not accept a concatenated debug level, because
9654 +GCC used to support an option @option{-gdwarf} that meant to generate
9655 +debug information in version 1 of the DWARF format (which is very
9656 +different from version 2), and it would have been too confusing. That
9657 +debug format is long obsolete, but the option cannot be changed now.
9658 +Instead use an additional @option{-g@var{level}} option to change the
9659 +debug level for DWARF.
9661 +@item -gtoggle
9662 +@opindex gtoggle
9663 +Turn off generation of debug info, if leaving out this option would have
9664 +generated it, or turn it on at level 2 otherwise. The position of this
9665 +argument in the command line does not matter, it takes effect after all
9666 +other options are processed, and it does so only once, no matter how
9667 +many times it is given. This is mainly intended to be used with
9668 +@option{-fcompare-debug}.
9670 +@item -fdump-final-insns@r{[}=@var{file}@r{]}
9671 +@opindex fdump-final-insns
9672 +Dump the final internal representation (RTL) to @var{file}. If the
9673 +optional argument is omitted (or if @var{file} is @code{.}), the name
9674 +of the dump file will be determined by appending @code{.gkd} to the
9675 +compilation output file name.
9677 +@item -fcompare-debug@r{[}=@var{opts}@r{]}
9678 +@opindex fcompare-debug
9679 +@opindex fno-compare-debug
9680 +If no error occurs during compilation, run the compiler a second time,
9681 +adding @var{opts} and @option{-fcompare-debug-second} to the arguments
9682 +passed to the second compilation. Dump the final internal
9683 +representation in both compilations, and print an error if they differ.
9685 +If the equal sign is omitted, the default @option{-gtoggle} is used.
9687 +The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
9688 +and nonzero, implicitly enables @option{-fcompare-debug}. If
9689 +@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
9690 +then it is used for @var{opts}, otherwise the default @option{-gtoggle}
9691 +is used.
9693 +@option{-fcompare-debug=}, with the equal sign but without @var{opts},
9694 +is equivalent to @option{-fno-compare-debug}, which disables the dumping
9695 +of the final representation and the second compilation, preventing even
9696 +@env{GCC_COMPARE_DEBUG} from taking effect.
9698 +To verify full coverage during @option{-fcompare-debug} testing, set
9699 +@env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
9700 +which GCC will reject as an invalid option in any actual compilation
9701 +(rather than preprocessing, assembly or linking). To get just a
9702 +warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
9703 +not overridden} will do.
9705 +@item -fcompare-debug-second
9706 +@opindex fcompare-debug-second
9707 +This option is implicitly passed to the compiler for the second
9708 +compilation requested by @option{-fcompare-debug}, along with options to
9709 +silence warnings, and omitting other options that would cause
9710 +side-effect compiler outputs to files or to the standard output. Dump
9711 +files and preserved temporary files are renamed so as to contain the
9712 +@code{.gk} additional extension during the second compilation, to avoid
9713 +overwriting those generated by the first.
9715 +When this option is passed to the compiler driver, it causes the
9716 +@emph{first} compilation to be skipped, which makes it useful for little
9717 +other than debugging the compiler proper.
9719 +@item -feliminate-dwarf2-dups
9720 +@opindex feliminate-dwarf2-dups
9721 +Compress DWARF2 debugging information by eliminating duplicated
9722 +information about each symbol. This option only makes sense when
9723 +generating DWARF2 debugging information with @option{-gdwarf-2}.
9725 +@item -femit-struct-debug-baseonly
9726 +Emit debug information for struct-like types
9727 +only when the base name of the compilation source file
9728 +matches the base name of file in which the struct was defined.
9730 +This option substantially reduces the size of debugging information,
9731 +but at significant potential loss in type information to the debugger.
9732 +See @option{-femit-struct-debug-reduced} for a less aggressive option.
9733 +See @option{-femit-struct-debug-detailed} for more detailed control.
9735 +This option works only with DWARF 2.
9737 +@item -femit-struct-debug-reduced
9738 +Emit debug information for struct-like types
9739 +only when the base name of the compilation source file
9740 +matches the base name of file in which the type was defined,
9741 +unless the struct is a template or defined in a system header.
9743 +This option significantly reduces the size of debugging information,
9744 +with some potential loss in type information to the debugger.
9745 +See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9746 +See @option{-femit-struct-debug-detailed} for more detailed control.
9748 +This option works only with DWARF 2.
9750 +@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9751 +Specify the struct-like types
9752 +for which the compiler will generate debug information.
9753 +The intent is to reduce duplicate struct debug information
9754 +between different object files within the same program.
9756 +This option is a detailed version of
9757 +@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9758 +which will serve for most needs.
9760 +A specification has the syntax@*
9761 +[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9763 +The optional first word limits the specification to
9764 +structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9765 +A struct type is used directly when it is the type of a variable, member.
9766 +Indirect uses arise through pointers to structs.
9767 +That is, when use of an incomplete struct would be legal, the use is indirect.
9768 +An example is
9769 +@samp{struct one direct; struct two * indirect;}.
9771 +The optional second word limits the specification to
9772 +ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9773 +Generic structs are a bit complicated to explain.
9774 +For C++, these are non-explicit specializations of template classes,
9775 +or non-template classes within the above.
9776 +Other programming languages have generics,
9777 +but @samp{-femit-struct-debug-detailed} does not yet implement them.
9779 +The third word specifies the source files for those
9780 +structs for which the compiler will emit debug information.
9781 +The values @samp{none} and @samp{any} have the normal meaning.
9782 +The value @samp{base} means that
9783 +the base of name of the file in which the type declaration appears
9784 +must match the base of the name of the main compilation file.
9785 +In practice, this means that
9786 +types declared in @file{foo.c} and @file{foo.h} will have debug information,
9787 +but types declared in other header will not.
9788 +The value @samp{sys} means those types satisfying @samp{base}
9789 +or declared in system or compiler headers.
9791 +You may need to experiment to determine the best settings for your application.
9793 +The default is @samp{-femit-struct-debug-detailed=all}.
9795 +This option works only with DWARF 2.
9797 +@item -fenable-icf-debug
9798 +@opindex fenable-icf-debug
9799 +Generate additional debug information to support identical code folding (ICF).
9800 +This option only works with DWARF version 2 or higher.
9802 +@item -fno-merge-debug-strings
9803 +@opindex fmerge-debug-strings
9804 +@opindex fno-merge-debug-strings
9805 +Direct the linker to not merge together strings in the debugging
9806 +information which are identical in different object files. Merging is
9807 +not supported by all assemblers or linkers. Merging decreases the size
9808 +of the debug information in the output file at the cost of increasing
9809 +link processing time. Merging is enabled by default.
9811 +@item -fdebug-prefix-map=@var{old}=@var{new}
9812 +@opindex fdebug-prefix-map
9813 +When compiling files in directory @file{@var{old}}, record debugging
9814 +information describing them as in @file{@var{new}} instead.
9816 +@item -fno-dwarf2-cfi-asm
9817 +@opindex fdwarf2-cfi-asm
9818 +@opindex fno-dwarf2-cfi-asm
9819 +Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
9820 +instead of using GAS @code{.cfi_*} directives.
9822 +@cindex @command{prof}
9823 +@item -p
9824 +@opindex p
9825 +Generate extra code to write profile information suitable for the
9826 +analysis program @command{prof}. You must use this option when compiling
9827 +the source files you want data about, and you must also use it when
9828 +linking.
9830 +@cindex @command{gprof}
9831 +@item -pg
9832 +@opindex pg
9833 +Generate extra code to write profile information suitable for the
9834 +analysis program @command{gprof}. You must use this option when compiling
9835 +the source files you want data about, and you must also use it when
9836 +linking.
9838 +@item -Q
9839 +@opindex Q
9840 +Makes the compiler print out each function name as it is compiled, and
9841 +print some statistics about each pass when it finishes.
9843 +@item -ftime-report
9844 +@opindex ftime-report
9845 +Makes the compiler print some statistics about the time consumed by each
9846 +pass when it finishes.
9848 +@item -fmem-report
9849 +@opindex fmem-report
9850 +Makes the compiler print some statistics about permanent memory
9851 +allocation when it finishes.
9853 +@item -fpre-ipa-mem-report
9854 +@opindex fpre-ipa-mem-report
9855 +@item -fpost-ipa-mem-report
9856 +@opindex fpost-ipa-mem-report
9857 +Makes the compiler print some statistics about permanent memory
9858 +allocation before or after interprocedural optimization.
9860 +@item -fstack-usage
9861 +@opindex fstack-usage
9862 +Makes the compiler output stack usage information for the program, on a
9863 +per-function basis. The filename for the dump is made by appending
9864 +@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
9865 +the output file, if explicitly specified and it is not an executable,
9866 +otherwise it is the basename of the source file. An entry is made up
9867 +of three fields:
9869 +@itemize
9870 +@item
9871 +The name of the function.
9872 +@item
9873 +A number of bytes.
9874 +@item
9875 +One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
9876 +@end itemize
9878 +The qualifier @code{static} means that the function manipulates the stack
9879 +statically: a fixed number of bytes are allocated for the frame on function
9880 +entry and released on function exit; no stack adjustments are otherwise made
9881 +in the function. The second field is this fixed number of bytes.
9883 +The qualifier @code{dynamic} means that the function manipulates the stack
9884 +dynamically: in addition to the static allocation described above, stack
9885 +adjustments are made in the body of the function, for example to push/pop
9886 +arguments around function calls. If the qualifier @code{bounded} is also
9887 +present, the amount of these adjustments is bounded at compile-time and
9888 +the second field is an upper bound of the total amount of stack used by
9889 +the function. If it is not present, the amount of these adjustments is
9890 +not bounded at compile-time and the second field only represents the
9891 +bounded part.
9893 +@item -fprofile-arcs
9894 +@opindex fprofile-arcs
9895 +Add code so that program flow @dfn{arcs} are instrumented. During
9896 +execution the program records how many times each branch and call is
9897 +executed and how many times it is taken or returns. When the compiled
9898 +program exits it saves this data to a file called
9899 +@file{@var{auxname}.gcda} for each source file. The data may be used for
9900 +profile-directed optimizations (@option{-fbranch-probabilities}), or for
9901 +test coverage analysis (@option{-ftest-coverage}). Each object file's
9902 +@var{auxname} is generated from the name of the output file, if
9903 +explicitly specified and it is not the final executable, otherwise it is
9904 +the basename of the source file. In both cases any suffix is removed
9905 +(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9906 +@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9907 +@xref{Cross-profiling}.
9909 +@cindex @command{gcov}
9910 +@item --coverage
9911 +@opindex coverage
9913 +This option is used to compile and link code instrumented for coverage
9914 +analysis. The option is a synonym for @option{-fprofile-arcs}
9915 +@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9916 +linking). See the documentation for those options for more details.
9918 +@itemize
9920 +@item
9921 +Compile the source files with @option{-fprofile-arcs} plus optimization
9922 +and code generation options. For test coverage analysis, use the
9923 +additional @option{-ftest-coverage} option. You do not need to profile
9924 +every source file in a program.
9926 +@item
9927 +Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9928 +(the latter implies the former).
9930 +@item
9931 +Run the program on a representative workload to generate the arc profile
9932 +information. This may be repeated any number of times. You can run
9933 +concurrent instances of your program, and provided that the file system
9934 +supports locking, the data files will be correctly updated. Also
9935 +@code{fork} calls are detected and correctly handled (double counting
9936 +will not happen).
9938 +@item
9939 +For profile-directed optimizations, compile the source files again with
9940 +the same optimization and code generation options plus
9941 +@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9942 +Control Optimization}).
9944 +@item
9945 +For test coverage analysis, use @command{gcov} to produce human readable
9946 +information from the @file{.gcno} and @file{.gcda} files. Refer to the
9947 +@command{gcov} documentation for further information.
9949 +@end itemize
9951 +With @option{-fprofile-arcs}, for each function of your program GCC
9952 +creates a program flow graph, then finds a spanning tree for the graph.
9953 +Only arcs that are not on the spanning tree have to be instrumented: the
9954 +compiler adds code to count the number of times that these arcs are
9955 +executed. When an arc is the only exit or only entrance to a block, the
9956 +instrumentation code can be added to the block; otherwise, a new basic
9957 +block must be created to hold the instrumentation code.
9959 +@need 2000
9960 +@item -ftest-coverage
9961 +@opindex ftest-coverage
9962 +Produce a notes file that the @command{gcov} code-coverage utility
9963 +(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9964 +show program coverage. Each source file's note file is called
9965 +@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9966 +above for a description of @var{auxname} and instructions on how to
9967 +generate test coverage data. Coverage data will match the source files
9968 +more closely, if you do not optimize.
9970 +@item -fdbg-cnt-list
9971 +@opindex fdbg-cnt-list
9972 +Print the name and the counter upper bound for all debug counters.
9974 +@item -fdbg-cnt=@var{counter-value-list}
9975 +@opindex fdbg-cnt
9976 +Set the internal debug counter upper bound. @var{counter-value-list}
9977 +is a comma-separated list of @var{name}:@var{value} pairs
9978 +which sets the upper bound of each debug counter @var{name} to @var{value}.
9979 +All debug counters have the initial upper bound of @var{UINT_MAX},
9980 +thus dbg_cnt() returns true always unless the upper bound is set by this option.
9981 +e.g. With -fdbg-cnt=dce:10,tail_call:0
9982 +dbg_cnt(dce) will return true only for first 10 invocations
9983 +and dbg_cnt(tail_call) will return false always.
9985 +@item -d@var{letters}
9986 +@itemx -fdump-rtl-@var{pass}
9987 +@opindex d
9988 +Says to make debugging dumps during compilation at times specified by
9989 +@var{letters}. This is used for debugging the RTL-based passes of the
9990 +compiler. The file names for most of the dumps are made by appending
9991 +a pass number and a word to the @var{dumpname}, and the files are
9992 +created in the directory of the output file. Note that the pass
9993 +number is computed statically as passes get registered into the pass
9994 +manager. Thus the numbering is not related to the dynamic order of
9995 +execution of passes. In particular, a pass installed by a plugin
9996 +could have a number over 200 even if it executed quite early.
9997 +@var{dumpname} is generated from the name of the output file, if
9998 +explicitly specified and it is not an executable, otherwise it is the
9999 +basename of the source file. These switches may have different effects
10000 +when @option{-E} is used for preprocessing.
10002 +Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
10003 +@option{-d} option @var{letters}. Here are the possible
10004 +letters for use in @var{pass} and @var{letters}, and their meanings:
10006 +@table @gcctabopt
10008 +@item -fdump-rtl-alignments
10009 +@opindex fdump-rtl-alignments
10010 +Dump after branch alignments have been computed.
10012 +@item -fdump-rtl-asmcons
10013 +@opindex fdump-rtl-asmcons
10014 +Dump after fixing rtl statements that have unsatisfied in/out constraints.
10016 +@item -fdump-rtl-auto_inc_dec
10017 +@opindex fdump-rtl-auto_inc_dec
10018 +Dump after auto-inc-dec discovery. This pass is only run on
10019 +architectures that have auto inc or auto dec instructions.
10021 +@item -fdump-rtl-barriers
10022 +@opindex fdump-rtl-barriers
10023 +Dump after cleaning up the barrier instructions.
10025 +@item -fdump-rtl-bbpart
10026 +@opindex fdump-rtl-bbpart
10027 +Dump after partitioning hot and cold basic blocks.
10029 +@item -fdump-rtl-bbro
10030 +@opindex fdump-rtl-bbro
10031 +Dump after block reordering.
10033 +@item -fdump-rtl-btl1
10034 +@itemx -fdump-rtl-btl2
10035 +@opindex fdump-rtl-btl2
10036 +@opindex fdump-rtl-btl2
10037 +@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
10038 +after the two branch
10039 +target load optimization passes.
10041 +@item -fdump-rtl-bypass
10042 +@opindex fdump-rtl-bypass
10043 +Dump after jump bypassing and control flow optimizations.
10045 +@item -fdump-rtl-combine
10046 +@opindex fdump-rtl-combine
10047 +Dump after the RTL instruction combination pass.
10049 +@item -fdump-rtl-compgotos
10050 +@opindex fdump-rtl-compgotos
10051 +Dump after duplicating the computed gotos.
10053 +@item -fdump-rtl-ce1
10054 +@itemx -fdump-rtl-ce2
10055 +@itemx -fdump-rtl-ce3
10056 +@opindex fdump-rtl-ce1
10057 +@opindex fdump-rtl-ce2
10058 +@opindex fdump-rtl-ce3
10059 +@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
10060 +@option{-fdump-rtl-ce3} enable dumping after the three
10061 +if conversion passes.
10063 +@item -fdump-rtl-cprop_hardreg
10064 +@opindex fdump-rtl-cprop_hardreg
10065 +Dump after hard register copy propagation.
10067 +@item -fdump-rtl-csa
10068 +@opindex fdump-rtl-csa
10069 +Dump after combining stack adjustments.
10071 +@item -fdump-rtl-cse1
10072 +@itemx -fdump-rtl-cse2
10073 +@opindex fdump-rtl-cse1
10074 +@opindex fdump-rtl-cse2
10075 +@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
10076 +the two common sub-expression elimination passes.
10078 +@item -fdump-rtl-dce
10079 +@opindex fdump-rtl-dce
10080 +Dump after the standalone dead code elimination passes.
10082 +@item -fdump-rtl-dbr
10083 +@opindex fdump-rtl-dbr
10084 +Dump after delayed branch scheduling.
10086 +@item -fdump-rtl-dce1
10087 +@itemx -fdump-rtl-dce2
10088 +@opindex fdump-rtl-dce1
10089 +@opindex fdump-rtl-dce2
10090 +@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
10091 +the two dead store elimination passes.
10093 +@item -fdump-rtl-eh
10094 +@opindex fdump-rtl-eh
10095 +Dump after finalization of EH handling code.
10097 +@item -fdump-rtl-eh_ranges
10098 +@opindex fdump-rtl-eh_ranges
10099 +Dump after conversion of EH handling range regions.
10101 +@item -fdump-rtl-expand
10102 +@opindex fdump-rtl-expand
10103 +Dump after RTL generation.
10105 +@item -fdump-rtl-fwprop1
10106 +@itemx -fdump-rtl-fwprop2
10107 +@opindex fdump-rtl-fwprop1
10108 +@opindex fdump-rtl-fwprop2
10109 +@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
10110 +dumping after the two forward propagation passes.
10112 +@item -fdump-rtl-gcse1
10113 +@itemx -fdump-rtl-gcse2
10114 +@opindex fdump-rtl-gcse1
10115 +@opindex fdump-rtl-gcse2
10116 +@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
10117 +after global common subexpression elimination.
10119 +@item -fdump-rtl-init-regs
10120 +@opindex fdump-rtl-init-regs
10121 +Dump after the initialization of the registers.
10123 +@item -fdump-rtl-initvals
10124 +@opindex fdump-rtl-initvals
10125 +Dump after the computation of the initial value sets.
10127 +@item -fdump-rtl-into_cfglayout
10128 +@opindex fdump-rtl-into_cfglayout
10129 +Dump after converting to cfglayout mode.
10131 +@item -fdump-rtl-ira
10132 +@opindex fdump-rtl-ira
10133 +Dump after iterated register allocation.
10135 +@item -fdump-rtl-jump
10136 +@opindex fdump-rtl-jump
10137 +Dump after the second jump optimization.
10139 +@item -fdump-rtl-loop2
10140 +@opindex fdump-rtl-loop2
10141 +@option{-fdump-rtl-loop2} enables dumping after the rtl
10142 +loop optimization passes.
10144 +@item -fdump-rtl-mach
10145 +@opindex fdump-rtl-mach
10146 +Dump after performing the machine dependent reorganization pass, if that
10147 +pass exists.
10149 +@item -fdump-rtl-mode_sw
10150 +@opindex fdump-rtl-mode_sw
10151 +Dump after removing redundant mode switches.
10153 +@item -fdump-rtl-rnreg
10154 +@opindex fdump-rtl-rnreg
10155 +Dump after register renumbering.
10157 +@item -fdump-rtl-outof_cfglayout
10158 +@opindex fdump-rtl-outof_cfglayout
10159 +Dump after converting from cfglayout mode.
10161 +@item -fdump-rtl-peephole2
10162 +@opindex fdump-rtl-peephole2
10163 +Dump after the peephole pass.
10165 +@item -fdump-rtl-postreload
10166 +@opindex fdump-rtl-postreload
10167 +Dump after post-reload optimizations.
10169 +@item -fdump-rtl-pro_and_epilogue
10170 +@opindex fdump-rtl-pro_and_epilogue
10171 +Dump after generating the function pro and epilogues.
10173 +@item -fdump-rtl-regmove
10174 +@opindex fdump-rtl-regmove
10175 +Dump after the register move pass.
10177 +@item -fdump-rtl-sched1
10178 +@itemx -fdump-rtl-sched2
10179 +@opindex fdump-rtl-sched1
10180 +@opindex fdump-rtl-sched2
10181 +@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
10182 +after the basic block scheduling passes.
10184 +@item -fdump-rtl-see
10185 +@opindex fdump-rtl-see
10186 +Dump after sign extension elimination.
10188 +@item -fdump-rtl-seqabstr
10189 +@opindex fdump-rtl-seqabstr
10190 +Dump after common sequence discovery.
10192 +@item -fdump-rtl-shorten
10193 +@opindex fdump-rtl-shorten
10194 +Dump after shortening branches.
10196 +@item -fdump-rtl-sibling
10197 +@opindex fdump-rtl-sibling
10198 +Dump after sibling call optimizations.
10200 +@item -fdump-rtl-split1
10201 +@itemx -fdump-rtl-split2
10202 +@itemx -fdump-rtl-split3
10203 +@itemx -fdump-rtl-split4
10204 +@itemx -fdump-rtl-split5
10205 +@opindex fdump-rtl-split1
10206 +@opindex fdump-rtl-split2
10207 +@opindex fdump-rtl-split3
10208 +@opindex fdump-rtl-split4
10209 +@opindex fdump-rtl-split5
10210 +@option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
10211 +@option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
10212 +@option{-fdump-rtl-split5} enable dumping after five rounds of
10213 +instruction splitting.
10215 +@item -fdump-rtl-sms
10216 +@opindex fdump-rtl-sms
10217 +Dump after modulo scheduling. This pass is only run on some
10218 +architectures.
10220 +@item -fdump-rtl-stack
10221 +@opindex fdump-rtl-stack
10222 +Dump after conversion from GCC's "flat register file" registers to the
10223 +x87's stack-like registers. This pass is only run on x86 variants.
10225 +@item -fdump-rtl-subreg1
10226 +@itemx -fdump-rtl-subreg2
10227 +@opindex fdump-rtl-subreg1
10228 +@opindex fdump-rtl-subreg2
10229 +@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
10230 +the two subreg expansion passes.
10232 +@item -fdump-rtl-unshare
10233 +@opindex fdump-rtl-unshare
10234 +Dump after all rtl has been unshared.
10236 +@item -fdump-rtl-vartrack
10237 +@opindex fdump-rtl-vartrack
10238 +Dump after variable tracking.
10240 +@item -fdump-rtl-vregs
10241 +@opindex fdump-rtl-vregs
10242 +Dump after converting virtual registers to hard registers.
10244 +@item -fdump-rtl-web
10245 +@opindex fdump-rtl-web
10246 +Dump after live range splitting.
10248 +@item -fdump-rtl-regclass
10249 +@itemx -fdump-rtl-subregs_of_mode_init
10250 +@itemx -fdump-rtl-subregs_of_mode_finish
10251 +@itemx -fdump-rtl-dfinit
10252 +@itemx -fdump-rtl-dfinish
10253 +@opindex fdump-rtl-regclass
10254 +@opindex fdump-rtl-subregs_of_mode_init
10255 +@opindex fdump-rtl-subregs_of_mode_finish
10256 +@opindex fdump-rtl-dfinit
10257 +@opindex fdump-rtl-dfinish
10258 +These dumps are defined but always produce empty files.
10260 +@item -da
10261 +@itemx -fdump-rtl-all
10262 +@opindex da
10263 +@opindex fdump-rtl-all
10264 +Produce all the dumps listed above.
10266 +@item -dA
10267 +@opindex dA
10268 +Annotate the assembler output with miscellaneous debugging information.
10270 +@item -dD
10271 +@opindex dD
10272 +Dump all macro definitions, at the end of preprocessing, in addition to
10273 +normal output.
10275 +@item -dH
10276 +@opindex dH
10277 +Produce a core dump whenever an error occurs.
10279 +@item -dp
10280 +@opindex dp
10281 +Annotate the assembler output with a comment indicating which
10282 +pattern and alternative was used. The length of each instruction is
10283 +also printed.
10285 +@item -dP
10286 +@opindex dP
10287 +Dump the RTL in the assembler output as a comment before each instruction.
10288 +Also turns on @option{-dp} annotation.
10290 +@item -dv
10291 +@opindex dv
10292 +For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
10293 +dump a representation of the control flow graph suitable for viewing with VCG
10294 +to @file{@var{file}.@var{pass}.vcg}.
10296 +@item -dx
10297 +@opindex dx
10298 +Just generate RTL for a function instead of compiling it. Usually used
10299 +with @option{-fdump-rtl-expand}.
10300 +@end table
10302 +@item -fdump-noaddr
10303 +@opindex fdump-noaddr
10304 +When doing debugging dumps, suppress address output. This makes it more
10305 +feasible to use diff on debugging dumps for compiler invocations with
10306 +different compiler binaries and/or different
10307 +text / bss / data / heap / stack / dso start locations.
10309 +@item -fdump-unnumbered
10310 +@opindex fdump-unnumbered
10311 +When doing debugging dumps, suppress instruction numbers and address output.
10312 +This makes it more feasible to use diff on debugging dumps for compiler
10313 +invocations with different options, in particular with and without
10314 +@option{-g}.
10316 +@item -fdump-unnumbered-links
10317 +@opindex fdump-unnumbered-links
10318 +When doing debugging dumps (see @option{-d} option above), suppress
10319 +instruction numbers for the links to the previous and next instructions
10320 +in a sequence.
10322 +@item -fdump-translation-unit @r{(C++ only)}
10323 +@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
10324 +@opindex fdump-translation-unit
10325 +Dump a representation of the tree structure for the entire translation
10326 +unit to a file. The file name is made by appending @file{.tu} to the
10327 +source file name, and the file is created in the same directory as the
10328 +output file. If the @samp{-@var{options}} form is used, @var{options}
10329 +controls the details of the dump as described for the
10330 +@option{-fdump-tree} options.
10332 +@item -fdump-class-hierarchy @r{(C++ only)}
10333 +@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
10334 +@opindex fdump-class-hierarchy
10335 +Dump a representation of each class's hierarchy and virtual function
10336 +table layout to a file. The file name is made by appending
10337 +@file{.class} to the source file name, and the file is created in the
10338 +same directory as the output file. If the @samp{-@var{options}} form
10339 +is used, @var{options} controls the details of the dump as described
10340 +for the @option{-fdump-tree} options.
10342 +@item -fdump-ipa-@var{switch}
10343 +@opindex fdump-ipa
10344 +Control the dumping at various stages of inter-procedural analysis
10345 +language tree to a file. The file name is generated by appending a
10346 +switch specific suffix to the source file name, and the file is created
10347 +in the same directory as the output file. The following dumps are
10348 +possible:
10350 +@table @samp
10351 +@item all
10352 +Enables all inter-procedural analysis dumps.
10354 +@item cgraph
10355 +Dumps information about call-graph optimization, unused function removal,
10356 +and inlining decisions.
10358 +@item inline
10359 +Dump after function inlining.
10361 +@end table
10363 +@item -fdump-statistics-@var{option}
10364 +@opindex fdump-statistics
10365 +Enable and control dumping of pass statistics in a separate file. The
10366 +file name is generated by appending a suffix ending in
10367 +@samp{.statistics} to the source file name, and the file is created in
10368 +the same directory as the output file. If the @samp{-@var{option}}
10369 +form is used, @samp{-stats} will cause counters to be summed over the
10370 +whole compilation unit while @samp{-details} will dump every event as
10371 +the passes generate them. The default with no option is to sum
10372 +counters for each function compiled.
10374 +@item -fdump-tree-@var{switch}
10375 +@itemx -fdump-tree-@var{switch}-@var{options}
10376 +@opindex fdump-tree
10377 +Control the dumping at various stages of processing the intermediate
10378 +language tree to a file. The file name is generated by appending a
10379 +switch specific suffix to the source file name, and the file is
10380 +created in the same directory as the output file. If the
10381 +@samp{-@var{options}} form is used, @var{options} is a list of
10382 +@samp{-} separated options that control the details of the dump. Not
10383 +all options are applicable to all dumps, those which are not
10384 +meaningful will be ignored. The following options are available
10386 +@table @samp
10387 +@item address
10388 +Print the address of each node. Usually this is not meaningful as it
10389 +changes according to the environment and source file. Its primary use
10390 +is for tying up a dump file with a debug environment.
10391 +@item asmname
10392 +If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
10393 +in the dump instead of @code{DECL_NAME}. Its primary use is ease of
10394 +use working backward from mangled names in the assembly file.
10395 +@item slim
10396 +Inhibit dumping of members of a scope or body of a function merely
10397 +because that scope has been reached. Only dump such items when they
10398 +are directly reachable by some other path. When dumping pretty-printed
10399 +trees, this option inhibits dumping the bodies of control structures.
10400 +@item raw
10401 +Print a raw representation of the tree. By default, trees are
10402 +pretty-printed into a C-like representation.
10403 +@item details
10404 +Enable more detailed dumps (not honored by every dump option).
10405 +@item stats
10406 +Enable dumping various statistics about the pass (not honored by every dump
10407 +option).
10408 +@item blocks
10409 +Enable showing basic block boundaries (disabled in raw dumps).
10410 +@item vops
10411 +Enable showing virtual operands for every statement.
10412 +@item lineno
10413 +Enable showing line numbers for statements.
10414 +@item uid
10415 +Enable showing the unique ID (@code{DECL_UID}) for each variable.
10416 +@item verbose
10417 +Enable showing the tree dump for each statement.
10418 +@item eh
10419 +Enable showing the EH region number holding each statement.
10420 +@item all
10421 +Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
10422 +and @option{lineno}.
10423 +@end table
10425 +The following tree dumps are possible:
10426 +@table @samp
10428 +@item original
10429 +@opindex fdump-tree-original
10430 +Dump before any tree based optimization, to @file{@var{file}.original}.
10432 +@item optimized
10433 +@opindex fdump-tree-optimized
10434 +Dump after all tree based optimization, to @file{@var{file}.optimized}.
10436 +@item gimple
10437 +@opindex fdump-tree-gimple
10438 +Dump each function before and after the gimplification pass to a file. The
10439 +file name is made by appending @file{.gimple} to the source file name.
10441 +@item cfg
10442 +@opindex fdump-tree-cfg
10443 +Dump the control flow graph of each function to a file. The file name is
10444 +made by appending @file{.cfg} to the source file name.
10446 +@item vcg
10447 +@opindex fdump-tree-vcg
10448 +Dump the control flow graph of each function to a file in VCG format. The
10449 +file name is made by appending @file{.vcg} to the source file name. Note
10450 +that if the file contains more than one function, the generated file cannot
10451 +be used directly by VCG@. You will need to cut and paste each function's
10452 +graph into its own separate file first.
10454 +@item ch
10455 +@opindex fdump-tree-ch
10456 +Dump each function after copying loop headers. The file name is made by
10457 +appending @file{.ch} to the source file name.
10459 +@item ssa
10460 +@opindex fdump-tree-ssa
10461 +Dump SSA related information to a file. The file name is made by appending
10462 +@file{.ssa} to the source file name.
10464 +@item alias
10465 +@opindex fdump-tree-alias
10466 +Dump aliasing information for each function. The file name is made by
10467 +appending @file{.alias} to the source file name.
10469 +@item ccp
10470 +@opindex fdump-tree-ccp
10471 +Dump each function after CCP@. The file name is made by appending
10472 +@file{.ccp} to the source file name.
10474 +@item storeccp
10475 +@opindex fdump-tree-storeccp
10476 +Dump each function after STORE-CCP@. The file name is made by appending
10477 +@file{.storeccp} to the source file name.
10479 +@item pre
10480 +@opindex fdump-tree-pre
10481 +Dump trees after partial redundancy elimination. The file name is made
10482 +by appending @file{.pre} to the source file name.
10484 +@item fre
10485 +@opindex fdump-tree-fre
10486 +Dump trees after full redundancy elimination. The file name is made
10487 +by appending @file{.fre} to the source file name.
10489 +@item copyprop
10490 +@opindex fdump-tree-copyprop
10491 +Dump trees after copy propagation. The file name is made
10492 +by appending @file{.copyprop} to the source file name.
10494 +@item store_copyprop
10495 +@opindex fdump-tree-store_copyprop
10496 +Dump trees after store copy-propagation. The file name is made
10497 +by appending @file{.store_copyprop} to the source file name.
10499 +@item dce
10500 +@opindex fdump-tree-dce
10501 +Dump each function after dead code elimination. The file name is made by
10502 +appending @file{.dce} to the source file name.
10504 +@item mudflap
10505 +@opindex fdump-tree-mudflap
10506 +Dump each function after adding mudflap instrumentation. The file name is
10507 +made by appending @file{.mudflap} to the source file name.
10509 +@item sra
10510 +@opindex fdump-tree-sra
10511 +Dump each function after performing scalar replacement of aggregates. The
10512 +file name is made by appending @file{.sra} to the source file name.
10514 +@item sink
10515 +@opindex fdump-tree-sink
10516 +Dump each function after performing code sinking. The file name is made
10517 +by appending @file{.sink} to the source file name.
10519 +@item dom
10520 +@opindex fdump-tree-dom
10521 +Dump each function after applying dominator tree optimizations. The file
10522 +name is made by appending @file{.dom} to the source file name.
10524 +@item dse
10525 +@opindex fdump-tree-dse
10526 +Dump each function after applying dead store elimination. The file
10527 +name is made by appending @file{.dse} to the source file name.
10529 +@item phiopt
10530 +@opindex fdump-tree-phiopt
10531 +Dump each function after optimizing PHI nodes into straightline code. The file
10532 +name is made by appending @file{.phiopt} to the source file name.
10534 +@item forwprop
10535 +@opindex fdump-tree-forwprop
10536 +Dump each function after forward propagating single use variables. The file
10537 +name is made by appending @file{.forwprop} to the source file name.
10539 +@item copyrename
10540 +@opindex fdump-tree-copyrename
10541 +Dump each function after applying the copy rename optimization. The file
10542 +name is made by appending @file{.copyrename} to the source file name.
10544 +@item nrv
10545 +@opindex fdump-tree-nrv
10546 +Dump each function after applying the named return value optimization on
10547 +generic trees. The file name is made by appending @file{.nrv} to the source
10548 +file name.
10550 +@item vect
10551 +@opindex fdump-tree-vect
10552 +Dump each function after applying vectorization of loops. The file name is
10553 +made by appending @file{.vect} to the source file name.
10555 +@item slp
10556 +@opindex fdump-tree-slp
10557 +Dump each function after applying vectorization of basic blocks. The file name
10558 +is made by appending @file{.slp} to the source file name.
10560 +@item vrp
10561 +@opindex fdump-tree-vrp
10562 +Dump each function after Value Range Propagation (VRP). The file name
10563 +is made by appending @file{.vrp} to the source file name.
10565 +@item all
10566 +@opindex fdump-tree-all
10567 +Enable all the available tree dumps with the flags provided in this option.
10568 +@end table
10570 +@item -ftree-vectorizer-verbose=@var{n}
10571 +@opindex ftree-vectorizer-verbose
10572 +This option controls the amount of debugging output the vectorizer prints.
10573 +This information is written to standard error, unless
10574 +@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
10575 +in which case it is output to the usual dump listing file, @file{.vect}.
10576 +For @var{n}=0 no diagnostic information is reported.
10577 +If @var{n}=1 the vectorizer reports each loop that got vectorized,
10578 +and the total number of loops that got vectorized.
10579 +If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
10580 +the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
10581 +inner-most, single-bb, single-entry/exit loops. This is the same verbosity
10582 +level that @option{-fdump-tree-vect-stats} uses.
10583 +Higher verbosity levels mean either more information dumped for each
10584 +reported loop, or same amount of information reported for more loops:
10585 +if @var{n}=3, vectorizer cost model information is reported.
10586 +If @var{n}=4, alignment related information is added to the reports.
10587 +If @var{n}=5, data-references related information (e.g.@: memory dependences,
10588 +memory access-patterns) is added to the reports.
10589 +If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops
10590 +that did not pass the first analysis phase (i.e., may not be countable, or
10591 +may have complicated control-flow).
10592 +If @var{n}=7, the vectorizer reports also non-vectorized nested loops.
10593 +If @var{n}=8, SLP related information is added to the reports.
10594 +For @var{n}=9, all the information the vectorizer generates during its
10595 +analysis and transformation is reported. This is the same verbosity level
10596 +that @option{-fdump-tree-vect-details} uses.
10598 +@item -frandom-seed=@var{string}
10599 +@opindex frandom-seed
10600 +This option provides a seed that GCC uses when it would otherwise use
10601 +random numbers. It is used to generate certain symbol names
10602 +that have to be different in every compiled file. It is also used to
10603 +place unique stamps in coverage data files and the object files that
10604 +produce them. You can use the @option{-frandom-seed} option to produce
10605 +reproducibly identical object files.
10607 +The @var{string} should be different for every file you compile.
10609 +@item -fsched-verbose=@var{n}
10610 +@opindex fsched-verbose
10611 +On targets that use instruction scheduling, this option controls the
10612 +amount of debugging output the scheduler prints. This information is
10613 +written to standard error, unless @option{-fdump-rtl-sched1} or
10614 +@option{-fdump-rtl-sched2} is specified, in which case it is output
10615 +to the usual dump listing file, @file{.sched1} or @file{.sched2}
10616 +respectively. However for @var{n} greater than nine, the output is
10617 +always printed to standard error.
10619 +For @var{n} greater than zero, @option{-fsched-verbose} outputs the
10620 +same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
10621 +For @var{n} greater than one, it also output basic block probabilities,
10622 +detailed ready list information and unit/insn info. For @var{n} greater
10623 +than two, it includes RTL at abort point, control-flow and regions info.
10624 +And for @var{n} over four, @option{-fsched-verbose} also includes
10625 +dependence info.
10627 +@item -save-temps
10628 +@itemx -save-temps=cwd
10629 +@opindex save-temps
10630 +Store the usual ``temporary'' intermediate files permanently; place them
10631 +in the current directory and name them based on the source file. Thus,
10632 +compiling @file{foo.c} with @samp{-c -save-temps} would produce files
10633 +@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
10634 +preprocessed @file{foo.i} output file even though the compiler now
10635 +normally uses an integrated preprocessor.
10637 +When used in combination with the @option{-x} command line option,
10638 +@option{-save-temps} is sensible enough to avoid over writing an
10639 +input source file with the same extension as an intermediate file.
10640 +The corresponding intermediate file may be obtained by renaming the
10641 +source file before using @option{-save-temps}.
10643 +If you invoke GCC in parallel, compiling several different source
10644 +files that share a common base name in different subdirectories or the
10645 +same source file compiled for multiple output destinations, it is
10646 +likely that the different parallel compilers will interfere with each
10647 +other, and overwrite the temporary files. For instance:
10649 +@smallexample
10650 +gcc -save-temps -o outdir1/foo.o indir1/foo.c&
10651 +gcc -save-temps -o outdir2/foo.o indir2/foo.c&
10652 +@end smallexample
10654 +may result in @file{foo.i} and @file{foo.o} being written to
10655 +simultaneously by both compilers.
10657 +@item -save-temps=obj
10658 +@opindex save-temps=obj
10659 +Store the usual ``temporary'' intermediate files permanently. If the
10660 +@option{-o} option is used, the temporary files are based on the
10661 +object file. If the @option{-o} option is not used, the
10662 +@option{-save-temps=obj} switch behaves like @option{-save-temps}.
10664 +For example:
10666 +@smallexample
10667 +gcc -save-temps=obj -c foo.c
10668 +gcc -save-temps=obj -c bar.c -o dir/xbar.o
10669 +gcc -save-temps=obj foobar.c -o dir2/yfoobar
10670 +@end smallexample
10672 +would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
10673 +@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
10674 +@file{dir2/yfoobar.o}.
10676 +@item -time@r{[}=@var{file}@r{]}
10677 +@opindex time
10678 +Report the CPU time taken by each subprocess in the compilation
10679 +sequence. For C source files, this is the compiler proper and assembler
10680 +(plus the linker if linking is done).
10682 +Without the specification of an output file, the output looks like this:
10684 +@smallexample
10685 +# cc1 0.12 0.01
10686 +# as 0.00 0.01
10687 +@end smallexample
10689 +The first number on each line is the ``user time'', that is time spent
10690 +executing the program itself. The second number is ``system time'',
10691 +time spent executing operating system routines on behalf of the program.
10692 +Both numbers are in seconds.
10694 +With the specification of an output file, the output is appended to the
10695 +named file, and it looks like this:
10697 +@smallexample
10698 +0.12 0.01 cc1 @var{options}
10699 +0.00 0.01 as @var{options}
10700 +@end smallexample
10702 +The ``user time'' and the ``system time'' are moved before the program
10703 +name, and the options passed to the program are displayed, so that one
10704 +can later tell what file was being compiled, and with which options.
10706 +@item -fvar-tracking
10707 +@opindex fvar-tracking
10708 +Run variable tracking pass. It computes where variables are stored at each
10709 +position in code. Better debugging information is then generated
10710 +(if the debugging information format supports this information).
10712 +It is enabled by default when compiling with optimization (@option{-Os},
10713 +@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
10714 +the debug info format supports it.
10716 +@item -fvar-tracking-assignments
10717 +@opindex fvar-tracking-assignments
10718 +@opindex fno-var-tracking-assignments
10719 +Annotate assignments to user variables early in the compilation and
10720 +attempt to carry the annotations over throughout the compilation all the
10721 +way to the end, in an attempt to improve debug information while
10722 +optimizing. Use of @option{-gdwarf-4} is recommended along with it.
10724 +It can be enabled even if var-tracking is disabled, in which case
10725 +annotations will be created and maintained, but discarded at the end.
10727 +@item -fvar-tracking-assignments-toggle
10728 +@opindex fvar-tracking-assignments-toggle
10729 +@opindex fno-var-tracking-assignments-toggle
10730 +Toggle @option{-fvar-tracking-assignments}, in the same way that
10731 +@option{-gtoggle} toggles @option{-g}.
10733 +@item -print-file-name=@var{library}
10734 +@opindex print-file-name
10735 +Print the full absolute name of the library file @var{library} that
10736 +would be used when linking---and don't do anything else. With this
10737 +option, GCC does not compile or link anything; it just prints the
10738 +file name.
10740 +@item -print-multi-directory
10741 +@opindex print-multi-directory
10742 +Print the directory name corresponding to the multilib selected by any
10743 +other switches present in the command line. This directory is supposed
10744 +to exist in @env{GCC_EXEC_PREFIX}.
10746 +@item -print-multi-lib
10747 +@opindex print-multi-lib
10748 +Print the mapping from multilib directory names to compiler switches
10749 +that enable them. The directory name is separated from the switches by
10750 +@samp{;}, and each switch starts with an @samp{@@} instead of the
10751 +@samp{-}, without spaces between multiple switches. This is supposed to
10752 +ease shell-processing.
10754 +@item -print-multi-os-directory
10755 +@opindex print-multi-os-directory
10756 +Print the path to OS libraries for the selected
10757 +multilib, relative to some @file{lib} subdirectory. If OS libraries are
10758 +present in the @file{lib} subdirectory and no multilibs are used, this is
10759 +usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
10760 +sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
10761 +@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
10762 +subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
10764 +@item -print-multiarch
10765 +@opindex print-multiarch
10766 +Print the path to OS libraries for the selected multiarch,
10767 +relative to some @file{lib} subdirectory.
10769 +@item -print-prog-name=@var{program}
10770 +@opindex print-prog-name
10771 +Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
10773 +@item -print-libgcc-file-name
10774 +@opindex print-libgcc-file-name
10775 +Same as @option{-print-file-name=libgcc.a}.
10777 +This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
10778 +but you do want to link with @file{libgcc.a}. You can do
10780 +@smallexample
10781 +gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
10782 +@end smallexample
10784 +@item -print-search-dirs
10785 +@opindex print-search-dirs
10786 +Print the name of the configured installation directory and a list of
10787 +program and library directories @command{gcc} will search---and don't do anything else.
10789 +This is useful when @command{gcc} prints the error message
10790 +@samp{installation problem, cannot exec cpp0: No such file or directory}.
10791 +To resolve this you either need to put @file{cpp0} and the other compiler
10792 +components where @command{gcc} expects to find them, or you can set the environment
10793 +variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
10794 +Don't forget the trailing @samp{/}.
10795 +@xref{Environment Variables}.
10797 +@item -print-sysroot
10798 +@opindex print-sysroot
10799 +Print the target sysroot directory that will be used during
10800 +compilation. This is the target sysroot specified either at configure
10801 +time or using the @option{--sysroot} option, possibly with an extra
10802 +suffix that depends on compilation options. If no target sysroot is
10803 +specified, the option prints nothing.
10805 +@item -print-sysroot-headers-suffix
10806 +@opindex print-sysroot-headers-suffix
10807 +Print the suffix added to the target sysroot when searching for
10808 +headers, or give an error if the compiler is not configured with such
10809 +a suffix---and don't do anything else.
10811 +@item -dumpmachine
10812 +@opindex dumpmachine
10813 +Print the compiler's target machine (for example,
10814 +@samp{i686-pc-linux-gnu})---and don't do anything else.
10816 +@item -dumpversion
10817 +@opindex dumpversion
10818 +Print the compiler version (for example, @samp{3.0})---and don't do
10819 +anything else.
10821 +@item -dumpspecs
10822 +@opindex dumpspecs
10823 +Print the compiler's built-in specs---and don't do anything else. (This
10824 +is used when GCC itself is being built.) @xref{Spec Files}.
10826 +@item -feliminate-unused-debug-types
10827 +@opindex feliminate-unused-debug-types
10828 +Normally, when producing DWARF2 output, GCC will emit debugging
10829 +information for all types declared in a compilation
10830 +unit, regardless of whether or not they are actually used
10831 +in that compilation unit. Sometimes this is useful, such as
10832 +if, in the debugger, you want to cast a value to a type that is
10833 +not actually used in your program (but is declared). More often,
10834 +however, this results in a significant amount of wasted space.
10835 +With this option, GCC will avoid producing debug symbol output
10836 +for types that are nowhere used in the source file being compiled.
10837 +@end table
10839 +@node Optimize Options
10840 +@section Options That Control Optimization
10841 +@cindex optimize options
10842 +@cindex options, optimization
10844 +These options control various sorts of optimizations.
10846 +Without any optimization option, the compiler's goal is to reduce the
10847 +cost of compilation and to make debugging produce the expected
10848 +results. Statements are independent: if you stop the program with a
10849 +breakpoint between statements, you can then assign a new value to any
10850 +variable or change the program counter to any other statement in the
10851 +function and get exactly the results you would expect from the source
10852 +code.
10854 +Turning on optimization flags makes the compiler attempt to improve
10855 +the performance and/or code size at the expense of compilation time
10856 +and possibly the ability to debug the program.
10858 +The compiler performs optimization based on the knowledge it has of the
10859 +program. Compiling multiple files at once to a single output file mode allows
10860 +the compiler to use information gained from all of the files when compiling
10861 +each of them.
10863 +Not all optimizations are controlled directly by a flag. Only
10864 +optimizations that have a flag are listed in this section.
10866 +Most optimizations are only enabled if an @option{-O} level is set on
10867 +the command line. Otherwise they are disabled, even if individual
10868 +optimization flags are specified.
10870 +Depending on the target and how GCC was configured, a slightly different
10871 +set of optimizations may be enabled at each @option{-O} level than
10872 +those listed here. You can invoke GCC with @samp{-Q --help=optimizers}
10873 +to find out the exact set of optimizations that are enabled at each level.
10874 +@xref{Overall Options}, for examples.
10876 +@table @gcctabopt
10877 +@item -O
10878 +@itemx -O1
10879 +@opindex O
10880 +@opindex O1
10881 +Optimize. Optimizing compilation takes somewhat more time, and a lot
10882 +more memory for a large function.
10884 +With @option{-O}, the compiler tries to reduce code size and execution
10885 +time, without performing any optimizations that take a great deal of
10886 +compilation time.
10888 +@option{-O} turns on the following optimization flags:
10889 +@gccoptlist{
10890 +-fauto-inc-dec @gol
10891 +-fcompare-elim @gol
10892 +-fcprop-registers @gol
10893 +-fdce @gol
10894 +-fdefer-pop @gol
10895 +-fdelayed-branch @gol
10896 +-fdse @gol
10897 +-fguess-branch-probability @gol
10898 +-fif-conversion2 @gol
10899 +-fif-conversion @gol
10900 +-fipa-pure-const @gol
10901 +-fipa-profile @gol
10902 +-fipa-reference @gol
10903 +-fmerge-constants
10904 +-fsplit-wide-types @gol
10905 +-ftree-bit-ccp @gol
10906 +-ftree-builtin-call-dce @gol
10907 +-ftree-ccp @gol
10908 +-ftree-ch @gol
10909 +-ftree-copyrename @gol
10910 +-ftree-dce @gol
10911 +-ftree-dominator-opts @gol
10912 +-ftree-dse @gol
10913 +-ftree-forwprop @gol
10914 +-ftree-fre @gol
10915 +-ftree-phiprop @gol
10916 +-ftree-sra @gol
10917 +-ftree-pta @gol
10918 +-ftree-ter @gol
10919 +-funit-at-a-time}
10921 +@option{-O} also turns on @option{-fomit-frame-pointer} on machines
10922 +where doing so does not interfere with debugging.
10924 +@item -O2
10925 +@opindex O2
10926 +Optimize even more. GCC performs nearly all supported optimizations
10927 +that do not involve a space-speed tradeoff.
10928 +As compared to @option{-O}, this option increases both compilation time
10929 +and the performance of the generated code.
10931 +@option{-O2} turns on all optimization flags specified by @option{-O}. It
10932 +also turns on the following optimization flags:
10933 +@gccoptlist{-fthread-jumps @gol
10934 +-falign-functions -falign-jumps @gol
10935 +-falign-loops -falign-labels @gol
10936 +-fcaller-saves @gol
10937 +-fcrossjumping @gol
10938 +-fcse-follow-jumps -fcse-skip-blocks @gol
10939 +-fdelete-null-pointer-checks @gol
10940 +-fdevirtualize @gol
10941 +-fexpensive-optimizations @gol
10942 +-fgcse -fgcse-lm @gol
10943 +-finline-small-functions @gol
10944 +-findirect-inlining @gol
10945 +-fipa-sra @gol
10946 +-foptimize-sibling-calls @gol
10947 +-fpartial-inlining @gol
10948 +-fpeephole2 @gol
10949 +-fregmove @gol
10950 +-freorder-blocks -freorder-functions @gol
10951 +-frerun-cse-after-loop @gol
10952 +-fsched-interblock -fsched-spec @gol
10953 +-fschedule-insns -fschedule-insns2 @gol
10954 +-fstrict-aliasing -fstrict-overflow @gol
10955 +-ftree-switch-conversion @gol
10956 +-ftree-pre @gol
10957 +-ftree-vrp}
10959 +Please note the warning under @option{-fgcse} about
10960 +invoking @option{-O2} on programs that use computed gotos.
10962 +@item -O3
10963 +@opindex O3
10964 +Optimize yet more. @option{-O3} turns on all optimizations specified
10965 +by @option{-O2} and also turns on the @option{-finline-functions},
10966 +@option{-funswitch-loops}, @option{-fpredictive-commoning},
10967 +@option{-fgcse-after-reload}, @option{-ftree-vectorize} and
10968 +@option{-fipa-cp-clone} options.
10970 +@item -O0
10971 +@opindex O0
10972 +Reduce compilation time and make debugging produce the expected
10973 +results. This is the default.
10975 +@item -Os
10976 +@opindex Os
10977 +Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
10978 +do not typically increase code size. It also performs further
10979 +optimizations designed to reduce code size.
10981 +@option{-Os} disables the following optimization flags:
10982 +@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
10983 +-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
10984 +-fprefetch-loop-arrays -ftree-vect-loop-version}
10986 +@item -Ofast
10987 +@opindex Ofast
10988 +Disregard strict standards compliance. @option{-Ofast} enables all
10989 +@option{-O3} optimizations. It also enables optimizations that are not
10990 +valid for all standard compliant programs.
10991 +It turns on @option{-ffast-math}.
10993 +If you use multiple @option{-O} options, with or without level numbers,
10994 +the last such option is the one that is effective.
10995 +@end table
10997 +Options of the form @option{-f@var{flag}} specify machine-independent
10998 +flags. Most flags have both positive and negative forms; the negative
10999 +form of @option{-ffoo} would be @option{-fno-foo}. In the table
11000 +below, only one of the forms is listed---the one you typically will
11001 +use. You can figure out the other form by either removing @samp{no-}
11002 +or adding it.
11004 +The following options control specific optimizations. They are either
11005 +activated by @option{-O} options or are related to ones that are. You
11006 +can use the following flags in the rare cases when ``fine-tuning'' of
11007 +optimizations to be performed is desired.
11009 +@table @gcctabopt
11010 +@item -fno-default-inline
11011 +@opindex fno-default-inline
11012 +Do not make member functions inline by default merely because they are
11013 +defined inside the class scope (C++ only). Otherwise, when you specify
11014 +@w{@option{-O}}, member functions defined inside class scope are compiled
11015 +inline by default; i.e., you don't need to add @samp{inline} in front of
11016 +the member function name.
11018 +@item -fno-defer-pop
11019 +@opindex fno-defer-pop
11020 +Always pop the arguments to each function call as soon as that function
11021 +returns. For machines which must pop arguments after a function call,
11022 +the compiler normally lets arguments accumulate on the stack for several
11023 +function calls and pops them all at once.
11025 +Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11027 +@item -fforward-propagate
11028 +@opindex fforward-propagate
11029 +Perform a forward propagation pass on RTL@. The pass tries to combine two
11030 +instructions and checks if the result can be simplified. If loop unrolling
11031 +is active, two passes are performed and the second is scheduled after
11032 +loop unrolling.
11034 +This option is enabled by default at optimization levels @option{-O},
11035 +@option{-O2}, @option{-O3}, @option{-Os}.
11037 +@item -ffp-contract=@var{style}
11038 +@opindex ffp-contract
11039 +@option{-ffp-contract=off} disables floating-point expression contraction.
11040 +@option{-ffp-contract=fast} enables floating-point expression contraction
11041 +such as forming of fused multiply-add operations if the target has
11042 +native support for them.
11043 +@option{-ffp-contract=on} enables floating-point expression contraction
11044 +if allowed by the language standard. This is currently not implemented
11045 +and treated equal to @option{-ffp-contract=off}.
11047 +The default is @option{-ffp-contract=fast}.
11049 +@item -fomit-frame-pointer
11050 +@opindex fomit-frame-pointer
11051 +Don't keep the frame pointer in a register for functions that
11052 +don't need one. This avoids the instructions to save, set up and
11053 +restore frame pointers; it also makes an extra register available
11054 +in many functions. @strong{It also makes debugging impossible on
11055 +some machines.}
11057 +On some machines, such as the VAX, this flag has no effect, because
11058 +the standard calling sequence automatically handles the frame pointer
11059 +and nothing is saved by pretending it doesn't exist. The
11060 +machine-description macro @code{FRAME_POINTER_REQUIRED} controls
11061 +whether a target machine supports this flag. @xref{Registers,,Register
11062 +Usage, gccint, GNU Compiler Collection (GCC) Internals}.
11064 +Starting with GCC version 4.6, the default setting (when not optimizing for
11065 +size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to
11066 +@option{-fomit-frame-pointer}. The default can be reverted to
11067 +@option{-fno-omit-frame-pointer} by configuring GCC with the
11068 +@option{--enable-frame-pointer} configure option.
11070 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11072 +@item -foptimize-sibling-calls
11073 +@opindex foptimize-sibling-calls
11074 +Optimize sibling and tail recursive calls.
11076 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11078 +@item -fno-inline
11079 +@opindex fno-inline
11080 +Don't pay attention to the @code{inline} keyword. Normally this option
11081 +is used to keep the compiler from expanding any functions inline.
11082 +Note that if you are not optimizing, no functions can be expanded inline.
11084 +@item -finline-small-functions
11085 +@opindex finline-small-functions
11086 +Integrate functions into their callers when their body is smaller than expected
11087 +function call code (so overall size of program gets smaller). The compiler
11088 +heuristically decides which functions are simple enough to be worth integrating
11089 +in this way.
11091 +Enabled at level @option{-O2}.
11093 +@item -findirect-inlining
11094 +@opindex findirect-inlining
11095 +Inline also indirect calls that are discovered to be known at compile
11096 +time thanks to previous inlining. This option has any effect only
11097 +when inlining itself is turned on by the @option{-finline-functions}
11098 +or @option{-finline-small-functions} options.
11100 +Enabled at level @option{-O2}.
11102 +@item -finline-functions
11103 +@opindex finline-functions
11104 +Integrate all simple functions into their callers. The compiler
11105 +heuristically decides which functions are simple enough to be worth
11106 +integrating in this way.
11108 +If all calls to a given function are integrated, and the function is
11109 +declared @code{static}, then the function is normally not output as
11110 +assembler code in its own right.
11112 +Enabled at level @option{-O3}.
11114 +@item -finline-functions-called-once
11115 +@opindex finline-functions-called-once
11116 +Consider all @code{static} functions called once for inlining into their
11117 +caller even if they are not marked @code{inline}. If a call to a given
11118 +function is integrated, then the function is not output as assembler code
11119 +in its own right.
11121 +Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
11123 +@item -fearly-inlining
11124 +@opindex fearly-inlining
11125 +Inline functions marked by @code{always_inline} and functions whose body seems
11126 +smaller than the function call overhead early before doing
11127 +@option{-fprofile-generate} instrumentation and real inlining pass. Doing so
11128 +makes profiling significantly cheaper and usually inlining faster on programs
11129 +having large chains of nested wrapper functions.
11131 +Enabled by default.
11133 +@item -fipa-sra
11134 +@opindex fipa-sra
11135 +Perform interprocedural scalar replacement of aggregates, removal of
11136 +unused parameters and replacement of parameters passed by reference
11137 +by parameters passed by value.
11139 +Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
11141 +@item -finline-limit=@var{n}
11142 +@opindex finline-limit
11143 +By default, GCC limits the size of functions that can be inlined. This flag
11144 +allows coarse control of this limit. @var{n} is the size of functions that
11145 +can be inlined in number of pseudo instructions.
11147 +Inlining is actually controlled by a number of parameters, which may be
11148 +specified individually by using @option{--param @var{name}=@var{value}}.
11149 +The @option{-finline-limit=@var{n}} option sets some of these parameters
11150 +as follows:
11152 +@table @gcctabopt
11153 +@item max-inline-insns-single
11154 +is set to @var{n}/2.
11155 +@item max-inline-insns-auto
11156 +is set to @var{n}/2.
11157 +@end table
11159 +See below for a documentation of the individual
11160 +parameters controlling inlining and for the defaults of these parameters.
11162 +@emph{Note:} there may be no value to @option{-finline-limit} that results
11163 +in default behavior.
11165 +@emph{Note:} pseudo instruction represents, in this particular context, an
11166 +abstract measurement of function's size. In no way does it represent a count
11167 +of assembly instructions and as such its exact meaning might change from one
11168 +release to an another.
11170 +@item -fno-keep-inline-dllexport
11171 +@opindex -fno-keep-inline-dllexport
11172 +This is a more fine-grained version of @option{-fkeep-inline-functions},
11173 +which applies only to functions that are declared using the @code{dllexport}
11174 +attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
11175 +Functions}.)
11177 +@item -fkeep-inline-functions
11178 +@opindex fkeep-inline-functions
11179 +In C, emit @code{static} functions that are declared @code{inline}
11180 +into the object file, even if the function has been inlined into all
11181 +of its callers. This switch does not affect functions using the
11182 +@code{extern inline} extension in GNU C90@. In C++, emit any and all
11183 +inline functions into the object file.
11185 +@item -fkeep-static-consts
11186 +@opindex fkeep-static-consts
11187 +Emit variables declared @code{static const} when optimization isn't turned
11188 +on, even if the variables aren't referenced.
11190 +GCC enables this option by default. If you want to force the compiler to
11191 +check if the variable was referenced, regardless of whether or not
11192 +optimization is turned on, use the @option{-fno-keep-static-consts} option.
11194 +@item -fmerge-constants
11195 +@opindex fmerge-constants
11196 +Attempt to merge identical constants (string constants and floating point
11197 +constants) across compilation units.
11199 +This option is the default for optimized compilation if the assembler and
11200 +linker support it. Use @option{-fno-merge-constants} to inhibit this
11201 +behavior.
11203 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11205 +@item -fmerge-all-constants
11206 +@opindex fmerge-all-constants
11207 +Attempt to merge identical constants and identical variables.
11209 +This option implies @option{-fmerge-constants}. In addition to
11210 +@option{-fmerge-constants} this considers e.g.@: even constant initialized
11211 +arrays or initialized constant variables with integral or floating point
11212 +types. Languages like C or C++ require each variable, including multiple
11213 +instances of the same variable in recursive calls, to have distinct locations,
11214 +so using this option will result in non-conforming
11215 +behavior.
11217 +@item -fmodulo-sched
11218 +@opindex fmodulo-sched
11219 +Perform swing modulo scheduling immediately before the first scheduling
11220 +pass. This pass looks at innermost loops and reorders their
11221 +instructions by overlapping different iterations.
11223 +@item -fmodulo-sched-allow-regmoves
11224 +@opindex fmodulo-sched-allow-regmoves
11225 +Perform more aggressive SMS based modulo scheduling with register moves
11226 +allowed. By setting this flag certain anti-dependences edges will be
11227 +deleted which will trigger the generation of reg-moves based on the
11228 +life-range analysis. This option is effective only with
11229 +@option{-fmodulo-sched} enabled.
11231 +@item -fno-branch-count-reg
11232 +@opindex fno-branch-count-reg
11233 +Do not use ``decrement and branch'' instructions on a count register,
11234 +but instead generate a sequence of instructions that decrement a
11235 +register, compare it against zero, then branch based upon the result.
11236 +This option is only meaningful on architectures that support such
11237 +instructions, which include x86, PowerPC, IA-64 and S/390.
11239 +The default is @option{-fbranch-count-reg}.
11241 +@item -fno-function-cse
11242 +@opindex fno-function-cse
11243 +Do not put function addresses in registers; make each instruction that
11244 +calls a constant function contain the function's address explicitly.
11246 +This option results in less efficient code, but some strange hacks
11247 +that alter the assembler output may be confused by the optimizations
11248 +performed when this option is not used.
11250 +The default is @option{-ffunction-cse}
11252 +@item -fno-zero-initialized-in-bss
11253 +@opindex fno-zero-initialized-in-bss
11254 +If the target supports a BSS section, GCC by default puts variables that
11255 +are initialized to zero into BSS@. This can save space in the resulting
11256 +code.
11258 +This option turns off this behavior because some programs explicitly
11259 +rely on variables going to the data section. E.g., so that the
11260 +resulting executable can find the beginning of that section and/or make
11261 +assumptions based on that.
11263 +The default is @option{-fzero-initialized-in-bss}.
11265 +@item -fmudflap -fmudflapth -fmudflapir
11266 +@opindex fmudflap
11267 +@opindex fmudflapth
11268 +@opindex fmudflapir
11269 +@cindex bounds checking
11270 +@cindex mudflap
11271 +For front-ends that support it (C and C++), instrument all risky
11272 +pointer/array dereferencing operations, some standard library
11273 +string/heap functions, and some other associated constructs with
11274 +range/validity tests. Modules so instrumented should be immune to
11275 +buffer overflows, invalid heap use, and some other classes of C/C++
11276 +programming errors. The instrumentation relies on a separate runtime
11277 +library (@file{libmudflap}), which will be linked into a program if
11278 +@option{-fmudflap} is given at link time. Run-time behavior of the
11279 +instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
11280 +environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
11281 +for its options.
11283 +Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
11284 +link if your program is multi-threaded. Use @option{-fmudflapir}, in
11285 +addition to @option{-fmudflap} or @option{-fmudflapth}, if
11286 +instrumentation should ignore pointer reads. This produces less
11287 +instrumentation (and therefore faster execution) and still provides
11288 +some protection against outright memory corrupting writes, but allows
11289 +erroneously read data to propagate within a program.
11291 +@item -fthread-jumps
11292 +@opindex fthread-jumps
11293 +Perform optimizations where we check to see if a jump branches to a
11294 +location where another comparison subsumed by the first is found. If
11295 +so, the first branch is redirected to either the destination of the
11296 +second branch or a point immediately following it, depending on whether
11297 +the condition is known to be true or false.
11299 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11301 +@item -fsplit-wide-types
11302 +@opindex fsplit-wide-types
11303 +When using a type that occupies multiple registers, such as @code{long
11304 +long} on a 32-bit system, split the registers apart and allocate them
11305 +independently. This normally generates better code for those types,
11306 +but may make debugging more difficult.
11308 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
11309 +@option{-Os}.
11311 +@item -fcse-follow-jumps
11312 +@opindex fcse-follow-jumps
11313 +In common subexpression elimination (CSE), scan through jump instructions
11314 +when the target of the jump is not reached by any other path. For
11315 +example, when CSE encounters an @code{if} statement with an
11316 +@code{else} clause, CSE will follow the jump when the condition
11317 +tested is false.
11319 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11321 +@item -fcse-skip-blocks
11322 +@opindex fcse-skip-blocks
11323 +This is similar to @option{-fcse-follow-jumps}, but causes CSE to
11324 +follow jumps which conditionally skip over blocks. When CSE
11325 +encounters a simple @code{if} statement with no else clause,
11326 +@option{-fcse-skip-blocks} causes CSE to follow the jump around the
11327 +body of the @code{if}.
11329 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11331 +@item -frerun-cse-after-loop
11332 +@opindex frerun-cse-after-loop
11333 +Re-run common subexpression elimination after loop optimizations has been
11334 +performed.
11336 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11338 +@item -fgcse
11339 +@opindex fgcse
11340 +Perform a global common subexpression elimination pass.
11341 +This pass also performs global constant and copy propagation.
11343 +@emph{Note:} When compiling a program using computed gotos, a GCC
11344 +extension, you may get better runtime performance if you disable
11345 +the global common subexpression elimination pass by adding
11346 +@option{-fno-gcse} to the command line.
11348 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11350 +@item -fgcse-lm
11351 +@opindex fgcse-lm
11352 +When @option{-fgcse-lm} is enabled, global common subexpression elimination will
11353 +attempt to move loads which are only killed by stores into themselves. This
11354 +allows a loop containing a load/store sequence to be changed to a load outside
11355 +the loop, and a copy/store within the loop.
11357 +Enabled by default when gcse is enabled.
11359 +@item -fgcse-sm
11360 +@opindex fgcse-sm
11361 +When @option{-fgcse-sm} is enabled, a store motion pass is run after
11362 +global common subexpression elimination. This pass will attempt to move
11363 +stores out of loops. When used in conjunction with @option{-fgcse-lm},
11364 +loops containing a load/store sequence can be changed to a load before
11365 +the loop and a store after the loop.
11367 +Not enabled at any optimization level.
11369 +@item -fgcse-las
11370 +@opindex fgcse-las
11371 +When @option{-fgcse-las} is enabled, the global common subexpression
11372 +elimination pass eliminates redundant loads that come after stores to the
11373 +same memory location (both partial and full redundancies).
11375 +Not enabled at any optimization level.
11377 +@item -fgcse-after-reload
11378 +@opindex fgcse-after-reload
11379 +When @option{-fgcse-after-reload} is enabled, a redundant load elimination
11380 +pass is performed after reload. The purpose of this pass is to cleanup
11381 +redundant spilling.
11383 +@item -funsafe-loop-optimizations
11384 +@opindex funsafe-loop-optimizations
11385 +If given, the loop optimizer will assume that loop indices do not
11386 +overflow, and that the loops with nontrivial exit condition are not
11387 +infinite. This enables a wider range of loop optimizations even if
11388 +the loop optimizer itself cannot prove that these assumptions are valid.
11389 +Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
11390 +if it finds this kind of loop.
11392 +@item -fcrossjumping
11393 +@opindex fcrossjumping
11394 +Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
11395 +resulting code may or may not perform better than without cross-jumping.
11397 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11399 +@item -fauto-inc-dec
11400 +@opindex fauto-inc-dec
11401 +Combine increments or decrements of addresses with memory accesses.
11402 +This pass is always skipped on architectures that do not have
11403 +instructions to support this. Enabled by default at @option{-O} and
11404 +higher on architectures that support this.
11406 +@item -fdce
11407 +@opindex fdce
11408 +Perform dead code elimination (DCE) on RTL@.
11409 +Enabled by default at @option{-O} and higher.
11411 +@item -fdse
11412 +@opindex fdse
11413 +Perform dead store elimination (DSE) on RTL@.
11414 +Enabled by default at @option{-O} and higher.
11416 +@item -fif-conversion
11417 +@opindex fif-conversion
11418 +Attempt to transform conditional jumps into branch-less equivalents. This
11419 +include use of conditional moves, min, max, set flags and abs instructions, and
11420 +some tricks doable by standard arithmetics. The use of conditional execution
11421 +on chips where it is available is controlled by @code{if-conversion2}.
11423 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11425 +@item -fif-conversion2
11426 +@opindex fif-conversion2
11427 +Use conditional execution (where available) to transform conditional jumps into
11428 +branch-less equivalents.
11430 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11432 +@item -fdelete-null-pointer-checks
11433 +@opindex fdelete-null-pointer-checks
11434 +Assume that programs cannot safely dereference null pointers, and that
11435 +no code or data element resides there. This enables simple constant
11436 +folding optimizations at all optimization levels. In addition, other
11437 +optimization passes in GCC use this flag to control global dataflow
11438 +analyses that eliminate useless checks for null pointers; these assume
11439 +that if a pointer is checked after it has already been dereferenced,
11440 +it cannot be null.
11442 +Note however that in some environments this assumption is not true.
11443 +Use @option{-fno-delete-null-pointer-checks} to disable this optimization
11444 +for programs which depend on that behavior.
11446 +Some targets, especially embedded ones, disable this option at all levels.
11447 +Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
11448 +@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
11449 +are enabled independently at different optimization levels.
11451 +@item -fdevirtualize
11452 +@opindex fdevirtualize
11453 +Attempt to convert calls to virtual functions to direct calls. This
11454 +is done both within a procedure and interprocedurally as part of
11455 +indirect inlining (@code{-findirect-inlining}) and interprocedural constant
11456 +propagation (@option{-fipa-cp}).
11457 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11459 +@item -fexpensive-optimizations
11460 +@opindex fexpensive-optimizations
11461 +Perform a number of minor optimizations that are relatively expensive.
11463 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11465 +@item -foptimize-register-move
11466 +@itemx -fregmove
11467 +@opindex foptimize-register-move
11468 +@opindex fregmove
11469 +Attempt to reassign register numbers in move instructions and as
11470 +operands of other simple instructions in order to maximize the amount of
11471 +register tying. This is especially helpful on machines with two-operand
11472 +instructions.
11474 +Note @option{-fregmove} and @option{-foptimize-register-move} are the same
11475 +optimization.
11477 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11479 +@item -fira-algorithm=@var{algorithm}
11480 +Use specified coloring algorithm for the integrated register
11481 +allocator. The @var{algorithm} argument should be @code{priority} or
11482 +@code{CB}. The first algorithm specifies Chow's priority coloring,
11483 +the second one specifies Chaitin-Briggs coloring. The second
11484 +algorithm can be unimplemented for some architectures. If it is
11485 +implemented, it is the default because Chaitin-Briggs coloring as a
11486 +rule generates a better code.
11488 +@item -fira-region=@var{region}
11489 +Use specified regions for the integrated register allocator. The
11490 +@var{region} argument should be one of @code{all}, @code{mixed}, or
11491 +@code{one}. The first value means using all loops as register
11492 +allocation regions, the second value which is the default means using
11493 +all loops except for loops with small register pressure as the
11494 +regions, and third one means using all function as a single region.
11495 +The first value can give best result for machines with small size and
11496 +irregular register set, the third one results in faster and generates
11497 +decent code and the smallest size code, and the default value usually
11498 +give the best results in most cases and for most architectures.
11500 +@item -fira-loop-pressure
11501 +@opindex fira-loop-pressure
11502 +Use IRA to evaluate register pressure in loops for decision to move
11503 +loop invariants. Usage of this option usually results in generation
11504 +of faster and smaller code on machines with big register files (>= 32
11505 +registers) but it can slow compiler down.
11507 +This option is enabled at level @option{-O3} for some targets.
11509 +@item -fno-ira-share-save-slots
11510 +@opindex fno-ira-share-save-slots
11511 +Switch off sharing stack slots used for saving call used hard
11512 +registers living through a call. Each hard register will get a
11513 +separate stack slot and as a result function stack frame will be
11514 +bigger.
11516 +@item -fno-ira-share-spill-slots
11517 +@opindex fno-ira-share-spill-slots
11518 +Switch off sharing stack slots allocated for pseudo-registers. Each
11519 +pseudo-register which did not get a hard register will get a separate
11520 +stack slot and as a result function stack frame will be bigger.
11522 +@item -fira-verbose=@var{n}
11523 +@opindex fira-verbose
11524 +Set up how verbose dump file for the integrated register allocator
11525 +will be. Default value is 5. If the value is greater or equal to 10,
11526 +the dump file will be stderr as if the value were @var{n} minus 10.
11528 +@item -fdelayed-branch
11529 +@opindex fdelayed-branch
11530 +If supported for the target machine, attempt to reorder instructions
11531 +to exploit instruction slots available after delayed branch
11532 +instructions.
11534 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11536 +@item -fschedule-insns
11537 +@opindex fschedule-insns
11538 +If supported for the target machine, attempt to reorder instructions to
11539 +eliminate execution stalls due to required data being unavailable. This
11540 +helps machines that have slow floating point or memory load instructions
11541 +by allowing other instructions to be issued until the result of the load
11542 +or floating point instruction is required.
11544 +Enabled at levels @option{-O2}, @option{-O3}.
11546 +@item -fschedule-insns2
11547 +@opindex fschedule-insns2
11548 +Similar to @option{-fschedule-insns}, but requests an additional pass of
11549 +instruction scheduling after register allocation has been done. This is
11550 +especially useful on machines with a relatively small number of
11551 +registers and where memory load instructions take more than one cycle.
11553 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11555 +@item -fno-sched-interblock
11556 +@opindex fno-sched-interblock
11557 +Don't schedule instructions across basic blocks. This is normally
11558 +enabled by default when scheduling before register allocation, i.e.@:
11559 +with @option{-fschedule-insns} or at @option{-O2} or higher.
11561 +@item -fno-sched-spec
11562 +@opindex fno-sched-spec
11563 +Don't allow speculative motion of non-load instructions. This is normally
11564 +enabled by default when scheduling before register allocation, i.e.@:
11565 +with @option{-fschedule-insns} or at @option{-O2} or higher.
11567 +@item -fsched-pressure
11568 +@opindex fsched-pressure
11569 +Enable register pressure sensitive insn scheduling before the register
11570 +allocation. This only makes sense when scheduling before register
11571 +allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
11572 +@option{-O2} or higher. Usage of this option can improve the
11573 +generated code and decrease its size by preventing register pressure
11574 +increase above the number of available hard registers and as a
11575 +consequence register spills in the register allocation.
11577 +@item -fsched-spec-load
11578 +@opindex fsched-spec-load
11579 +Allow speculative motion of some load instructions. This only makes
11580 +sense when scheduling before register allocation, i.e.@: with
11581 +@option{-fschedule-insns} or at @option{-O2} or higher.
11583 +@item -fsched-spec-load-dangerous
11584 +@opindex fsched-spec-load-dangerous
11585 +Allow speculative motion of more load instructions. This only makes
11586 +sense when scheduling before register allocation, i.e.@: with
11587 +@option{-fschedule-insns} or at @option{-O2} or higher.
11589 +@item -fsched-stalled-insns
11590 +@itemx -fsched-stalled-insns=@var{n}
11591 +@opindex fsched-stalled-insns
11592 +Define how many insns (if any) can be moved prematurely from the queue
11593 +of stalled insns into the ready list, during the second scheduling pass.
11594 +@option{-fno-sched-stalled-insns} means that no insns will be moved
11595 +prematurely, @option{-fsched-stalled-insns=0} means there is no limit
11596 +on how many queued insns can be moved prematurely.
11597 +@option{-fsched-stalled-insns} without a value is equivalent to
11598 +@option{-fsched-stalled-insns=1}.
11600 +@item -fsched-stalled-insns-dep
11601 +@itemx -fsched-stalled-insns-dep=@var{n}
11602 +@opindex fsched-stalled-insns-dep
11603 +Define how many insn groups (cycles) will be examined for a dependency
11604 +on a stalled insn that is candidate for premature removal from the queue
11605 +of stalled insns. This has an effect only during the second scheduling pass,
11606 +and only if @option{-fsched-stalled-insns} is used.
11607 +@option{-fno-sched-stalled-insns-dep} is equivalent to
11608 +@option{-fsched-stalled-insns-dep=0}.
11609 +@option{-fsched-stalled-insns-dep} without a value is equivalent to
11610 +@option{-fsched-stalled-insns-dep=1}.
11612 +@item -fsched2-use-superblocks
11613 +@opindex fsched2-use-superblocks
11614 +When scheduling after register allocation, do use superblock scheduling
11615 +algorithm. Superblock scheduling allows motion across basic block boundaries
11616 +resulting on faster schedules. This option is experimental, as not all machine
11617 +descriptions used by GCC model the CPU closely enough to avoid unreliable
11618 +results from the algorithm.
11620 +This only makes sense when scheduling after register allocation, i.e.@: with
11621 +@option{-fschedule-insns2} or at @option{-O2} or higher.
11623 +@item -fsched-group-heuristic
11624 +@opindex fsched-group-heuristic
11625 +Enable the group heuristic in the scheduler. This heuristic favors
11626 +the instruction that belongs to a schedule group. This is enabled
11627 +by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11628 +or @option{-fschedule-insns2} or at @option{-O2} or higher.
11630 +@item -fsched-critical-path-heuristic
11631 +@opindex fsched-critical-path-heuristic
11632 +Enable the critical-path heuristic in the scheduler. This heuristic favors
11633 +instructions on the critical path. This is enabled by default when
11634 +scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11635 +or @option{-fschedule-insns2} or at @option{-O2} or higher.
11637 +@item -fsched-spec-insn-heuristic
11638 +@opindex fsched-spec-insn-heuristic
11639 +Enable the speculative instruction heuristic in the scheduler. This
11640 +heuristic favors speculative instructions with greater dependency weakness.
11641 +This is enabled by default when scheduling is enabled, i.e.@:
11642 +with @option{-fschedule-insns} or @option{-fschedule-insns2}
11643 +or at @option{-O2} or higher.
11645 +@item -fsched-rank-heuristic
11646 +@opindex fsched-rank-heuristic
11647 +Enable the rank heuristic in the scheduler. This heuristic favors
11648 +the instruction belonging to a basic block with greater size or frequency.
11649 +This is enabled by default when scheduling is enabled, i.e.@:
11650 +with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11651 +at @option{-O2} or higher.
11653 +@item -fsched-last-insn-heuristic
11654 +@opindex fsched-last-insn-heuristic
11655 +Enable the last-instruction heuristic in the scheduler. This heuristic
11656 +favors the instruction that is less dependent on the last instruction
11657 +scheduled. This is enabled by default when scheduling is enabled,
11658 +i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11659 +at @option{-O2} or higher.
11661 +@item -fsched-dep-count-heuristic
11662 +@opindex fsched-dep-count-heuristic
11663 +Enable the dependent-count heuristic in the scheduler. This heuristic
11664 +favors the instruction that has more instructions depending on it.
11665 +This is enabled by default when scheduling is enabled, i.e.@:
11666 +with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11667 +at @option{-O2} or higher.
11669 +@item -freschedule-modulo-scheduled-loops
11670 +@opindex freschedule-modulo-scheduled-loops
11671 +The modulo scheduling comes before the traditional scheduling, if a loop
11672 +was modulo scheduled we may want to prevent the later scheduling passes
11673 +from changing its schedule, we use this option to control that.
11675 +@item -fselective-scheduling
11676 +@opindex fselective-scheduling
11677 +Schedule instructions using selective scheduling algorithm. Selective
11678 +scheduling runs instead of the first scheduler pass.
11680 +@item -fselective-scheduling2
11681 +@opindex fselective-scheduling2
11682 +Schedule instructions using selective scheduling algorithm. Selective
11683 +scheduling runs instead of the second scheduler pass.
11685 +@item -fsel-sched-pipelining
11686 +@opindex fsel-sched-pipelining
11687 +Enable software pipelining of innermost loops during selective scheduling.
11688 +This option has no effect until one of @option{-fselective-scheduling} or
11689 +@option{-fselective-scheduling2} is turned on.
11691 +@item -fsel-sched-pipelining-outer-loops
11692 +@opindex fsel-sched-pipelining-outer-loops
11693 +When pipelining loops during selective scheduling, also pipeline outer loops.
11694 +This option has no effect until @option{-fsel-sched-pipelining} is turned on.
11696 +@item -fcaller-saves
11697 +@opindex fcaller-saves
11698 +Enable values to be allocated in registers that will be clobbered by
11699 +function calls, by emitting extra instructions to save and restore the
11700 +registers around such calls. Such allocation is done only when it
11701 +seems to result in better code than would otherwise be produced.
11703 +This option is always enabled by default on certain machines, usually
11704 +those which have no call-preserved registers to use instead.
11706 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11708 +@item -fcombine-stack-adjustments
11709 +@opindex fcombine-stack-adjustments
11710 +Tracks stack adjustments (pushes and pops) and stack memory references
11711 +and then tries to find ways to combine them.
11713 +Enabled by default at @option{-O1} and higher.
11715 +@item -fconserve-stack
11716 +@opindex fconserve-stack
11717 +Attempt to minimize stack usage. The compiler will attempt to use less
11718 +stack space, even if that makes the program slower. This option
11719 +implies setting the @option{large-stack-frame} parameter to 100
11720 +and the @option{large-stack-frame-growth} parameter to 400.
11722 +@item -ftree-reassoc
11723 +@opindex ftree-reassoc
11724 +Perform reassociation on trees. This flag is enabled by default
11725 +at @option{-O} and higher.
11727 +@item -ftree-pre
11728 +@opindex ftree-pre
11729 +Perform partial redundancy elimination (PRE) on trees. This flag is
11730 +enabled by default at @option{-O2} and @option{-O3}.
11732 +@item -ftree-forwprop
11733 +@opindex ftree-forwprop
11734 +Perform forward propagation on trees. This flag is enabled by default
11735 +at @option{-O} and higher.
11737 +@item -ftree-fre
11738 +@opindex ftree-fre
11739 +Perform full redundancy elimination (FRE) on trees. The difference
11740 +between FRE and PRE is that FRE only considers expressions
11741 +that are computed on all paths leading to the redundant computation.
11742 +This analysis is faster than PRE, though it exposes fewer redundancies.
11743 +This flag is enabled by default at @option{-O} and higher.
11745 +@item -ftree-phiprop
11746 +@opindex ftree-phiprop
11747 +Perform hoisting of loads from conditional pointers on trees. This
11748 +pass is enabled by default at @option{-O} and higher.
11750 +@item -ftree-copy-prop
11751 +@opindex ftree-copy-prop
11752 +Perform copy propagation on trees. This pass eliminates unnecessary
11753 +copy operations. This flag is enabled by default at @option{-O} and
11754 +higher.
11756 +@item -fipa-pure-const
11757 +@opindex fipa-pure-const
11758 +Discover which functions are pure or constant.
11759 +Enabled by default at @option{-O} and higher.
11761 +@item -fipa-reference
11762 +@opindex fipa-reference
11763 +Discover which static variables do not escape cannot escape the
11764 +compilation unit.
11765 +Enabled by default at @option{-O} and higher.
11767 +@item -fipa-struct-reorg
11768 +@opindex fipa-struct-reorg
11769 +Perform structure reorganization optimization, that change C-like structures
11770 +layout in order to better utilize spatial locality. This transformation is
11771 +affective for programs containing arrays of structures. Available in two
11772 +compilation modes: profile-based (enabled with @option{-fprofile-generate})
11773 +or static (which uses built-in heuristics). It works only in whole program
11774 +mode, so it requires @option{-fwhole-program} to be
11775 +enabled. Structures considered @samp{cold} by this transformation are not
11776 +affected (see @option{--param struct-reorg-cold-struct-ratio=@var{value}}).
11778 +With this flag, the program debug info reflects a new structure layout.
11780 +@item -fipa-pta
11781 +@opindex fipa-pta
11782 +Perform interprocedural pointer analysis and interprocedural modification
11783 +and reference analysis. This option can cause excessive memory and
11784 +compile-time usage on large compilation units. It is not enabled by
11785 +default at any optimization level.
11787 +@item -fipa-profile
11788 +@opindex fipa-profile
11789 +Perform interprocedural profile propagation. The functions called only from
11790 +cold functions are marked as cold. Also functions executed once (such as
11791 +@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
11792 +functions and loop less parts of functions executed once are then optimized for
11793 +size.
11794 +Enabled by default at @option{-O} and higher.
11796 +@item -fipa-cp
11797 +@opindex fipa-cp
11798 +Perform interprocedural constant propagation.
11799 +This optimization analyzes the program to determine when values passed
11800 +to functions are constants and then optimizes accordingly.
11801 +This optimization can substantially increase performance
11802 +if the application has constants passed to functions.
11803 +This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
11805 +@item -fipa-cp-clone
11806 +@opindex fipa-cp-clone
11807 +Perform function cloning to make interprocedural constant propagation stronger.
11808 +When enabled, interprocedural constant propagation will perform function cloning
11809 +when externally visible function can be called with constant arguments.
11810 +Because this optimization can create multiple copies of functions,
11811 +it may significantly increase code size
11812 +(see @option{--param ipcp-unit-growth=@var{value}}).
11813 +This flag is enabled by default at @option{-O3}.
11815 +@item -fipa-matrix-reorg
11816 +@opindex fipa-matrix-reorg
11817 +Perform matrix flattening and transposing.
11818 +Matrix flattening tries to replace an @math{m}-dimensional matrix
11819 +with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
11820 +This reduces the level of indirection needed for accessing the elements
11821 +of the matrix. The second optimization is matrix transposing that
11822 +attempts to change the order of the matrix's dimensions in order to
11823 +improve cache locality.
11824 +Both optimizations need the @option{-fwhole-program} flag.
11825 +Transposing is enabled only if profiling information is available.
11827 +@item -ftree-sink
11828 +@opindex ftree-sink
11829 +Perform forward store motion on trees. This flag is
11830 +enabled by default at @option{-O} and higher.
11832 +@item -ftree-bit-ccp
11833 +@opindex ftree-bit-ccp
11834 +Perform sparse conditional bit constant propagation on trees and propagate
11835 +pointer alignment information.
11836 +This pass only operates on local scalar variables and is enabled by default
11837 +at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
11839 +@item -ftree-ccp
11840 +@opindex ftree-ccp
11841 +Perform sparse conditional constant propagation (CCP) on trees. This
11842 +pass only operates on local scalar variables and is enabled by default
11843 +at @option{-O} and higher.
11845 +@item -ftree-switch-conversion
11846 +Perform conversion of simple initializations in a switch to
11847 +initializations from a scalar array. This flag is enabled by default
11848 +at @option{-O2} and higher.
11850 +@item -ftree-dce
11851 +@opindex ftree-dce
11852 +Perform dead code elimination (DCE) on trees. This flag is enabled by
11853 +default at @option{-O} and higher.
11855 +@item -ftree-builtin-call-dce
11856 +@opindex ftree-builtin-call-dce
11857 +Perform conditional dead code elimination (DCE) for calls to builtin functions
11858 +that may set @code{errno} but are otherwise side-effect free. This flag is
11859 +enabled by default at @option{-O2} and higher if @option{-Os} is not also
11860 +specified.
11862 +@item -ftree-dominator-opts
11863 +@opindex ftree-dominator-opts
11864 +Perform a variety of simple scalar cleanups (constant/copy
11865 +propagation, redundancy elimination, range propagation and expression
11866 +simplification) based on a dominator tree traversal. This also
11867 +performs jump threading (to reduce jumps to jumps). This flag is
11868 +enabled by default at @option{-O} and higher.
11870 +@item -ftree-dse
11871 +@opindex ftree-dse
11872 +Perform dead store elimination (DSE) on trees. A dead store is a store into
11873 +a memory location which will later be overwritten by another store without
11874 +any intervening loads. In this case the earlier store can be deleted. This
11875 +flag is enabled by default at @option{-O} and higher.
11877 +@item -ftree-ch
11878 +@opindex ftree-ch
11879 +Perform loop header copying on trees. This is beneficial since it increases
11880 +effectiveness of code motion optimizations. It also saves one jump. This flag
11881 +is enabled by default at @option{-O} and higher. It is not enabled
11882 +for @option{-Os}, since it usually increases code size.
11884 +@item -ftree-loop-optimize
11885 +@opindex ftree-loop-optimize
11886 +Perform loop optimizations on trees. This flag is enabled by default
11887 +at @option{-O} and higher.
11889 +@item -ftree-loop-linear
11890 +@opindex ftree-loop-linear
11891 +Perform loop interchange transformations on tree. Same as
11892 +@option{-floop-interchange}. To use this code transformation, GCC has
11893 +to be configured with @option{--with-ppl} and @option{--with-cloog} to
11894 +enable the Graphite loop transformation infrastructure.
11896 +@item -floop-interchange
11897 +@opindex floop-interchange
11898 +Perform loop interchange transformations on loops. Interchanging two
11899 +nested loops switches the inner and outer loops. For example, given a
11900 +loop like:
11901 +@smallexample
11902 +DO J = 1, M
11903 + DO I = 1, N
11904 + A(J, I) = A(J, I) * C
11905 + ENDDO
11906 +ENDDO
11907 +@end smallexample
11908 +loop interchange will transform the loop as if the user had written:
11909 +@smallexample
11910 +DO I = 1, N
11911 + DO J = 1, M
11912 + A(J, I) = A(J, I) * C
11913 + ENDDO
11914 +ENDDO
11915 +@end smallexample
11916 +which can be beneficial when @code{N} is larger than the caches,
11917 +because in Fortran, the elements of an array are stored in memory
11918 +contiguously by column, and the original loop iterates over rows,
11919 +potentially creating at each access a cache miss. This optimization
11920 +applies to all the languages supported by GCC and is not limited to
11921 +Fortran. To use this code transformation, GCC has to be configured
11922 +with @option{--with-ppl} and @option{--with-cloog} to enable the
11923 +Graphite loop transformation infrastructure.
11925 +@item -floop-strip-mine
11926 +@opindex floop-strip-mine
11927 +Perform loop strip mining transformations on loops. Strip mining
11928 +splits a loop into two nested loops. The outer loop has strides
11929 +equal to the strip size and the inner loop has strides of the
11930 +original loop within a strip. The strip length can be changed
11931 +using the @option{loop-block-tile-size} parameter. For example,
11932 +given a loop like:
11933 +@smallexample
11934 +DO I = 1, N
11935 + A(I) = A(I) + C
11936 +ENDDO
11937 +@end smallexample
11938 +loop strip mining will transform the loop as if the user had written:
11939 +@smallexample
11940 +DO II = 1, N, 51
11941 + DO I = II, min (II + 50, N)
11942 + A(I) = A(I) + C
11943 + ENDDO
11944 +ENDDO
11945 +@end smallexample
11946 +This optimization applies to all the languages supported by GCC and is
11947 +not limited to Fortran. To use this code transformation, GCC has to
11948 +be configured with @option{--with-ppl} and @option{--with-cloog} to
11949 +enable the Graphite loop transformation infrastructure.
11951 +@item -floop-block
11952 +@opindex floop-block
11953 +Perform loop blocking transformations on loops. Blocking strip mines
11954 +each loop in the loop nest such that the memory accesses of the
11955 +element loops fit inside caches. The strip length can be changed
11956 +using the @option{loop-block-tile-size} parameter. For example, given
11957 +a loop like:
11958 +@smallexample
11959 +DO I = 1, N
11960 + DO J = 1, M
11961 + A(J, I) = B(I) + C(J)
11962 + ENDDO
11963 +ENDDO
11964 +@end smallexample
11965 +loop blocking will transform the loop as if the user had written:
11966 +@smallexample
11967 +DO II = 1, N, 51
11968 + DO JJ = 1, M, 51
11969 + DO I = II, min (II + 50, N)
11970 + DO J = JJ, min (JJ + 50, M)
11971 + A(J, I) = B(I) + C(J)
11972 + ENDDO
11973 + ENDDO
11974 + ENDDO
11975 +ENDDO
11976 +@end smallexample
11977 +which can be beneficial when @code{M} is larger than the caches,
11978 +because the innermost loop will iterate over a smaller amount of data
11979 +that can be kept in the caches. This optimization applies to all the
11980 +languages supported by GCC and is not limited to Fortran. To use this
11981 +code transformation, GCC has to be configured with @option{--with-ppl}
11982 +and @option{--with-cloog} to enable the Graphite loop transformation
11983 +infrastructure.
11985 +@item -fgraphite-identity
11986 +@opindex fgraphite-identity
11987 +Enable the identity transformation for graphite. For every SCoP we generate
11988 +the polyhedral representation and transform it back to gimple. Using
11989 +@option{-fgraphite-identity} we can check the costs or benefits of the
11990 +GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
11991 +are also performed by the code generator CLooG, like index splitting and
11992 +dead code elimination in loops.
11994 +@item -floop-flatten
11995 +@opindex floop-flatten
11996 +Removes the loop nesting structure: transforms the loop nest into a
11997 +single loop. This transformation can be useful to vectorize all the
11998 +levels of the loop nest.
12000 +@item -floop-parallelize-all
12001 +@opindex floop-parallelize-all
12002 +Use the Graphite data dependence analysis to identify loops that can
12003 +be parallelized. Parallelize all the loops that can be analyzed to
12004 +not contain loop carried dependences without checking that it is
12005 +profitable to parallelize the loops.
12007 +@item -fcheck-data-deps
12008 +@opindex fcheck-data-deps
12009 +Compare the results of several data dependence analyzers. This option
12010 +is used for debugging the data dependence analyzers.
12012 +@item -ftree-loop-if-convert
12013 +Attempt to transform conditional jumps in the innermost loops to
12014 +branch-less equivalents. The intent is to remove control-flow from
12015 +the innermost loops in order to improve the ability of the
12016 +vectorization pass to handle these loops. This is enabled by default
12017 +if vectorization is enabled.
12019 +@item -ftree-loop-if-convert-stores
12020 +Attempt to also if-convert conditional jumps containing memory writes.
12021 +This transformation can be unsafe for multi-threaded programs as it
12022 +transforms conditional memory writes into unconditional memory writes.
12023 +For example,
12024 +@smallexample
12025 +for (i = 0; i < N; i++)
12026 + if (cond)
12027 + A[i] = expr;
12028 +@end smallexample
12029 +would be transformed to
12030 +@smallexample
12031 +for (i = 0; i < N; i++)
12032 + A[i] = cond ? expr : A[i];
12033 +@end smallexample
12034 +potentially producing data races.
12036 +@item -ftree-loop-distribution
12037 +Perform loop distribution. This flag can improve cache performance on
12038 +big loop bodies and allow further loop optimizations, like
12039 +parallelization or vectorization, to take place. For example, the loop
12040 +@smallexample
12041 +DO I = 1, N
12042 + A(I) = B(I) + C
12043 + D(I) = E(I) * F
12044 +ENDDO
12045 +@end smallexample
12046 +is transformed to
12047 +@smallexample
12048 +DO I = 1, N
12049 + A(I) = B(I) + C
12050 +ENDDO
12051 +DO I = 1, N
12052 + D(I) = E(I) * F
12053 +ENDDO
12054 +@end smallexample
12056 +@item -ftree-loop-distribute-patterns
12057 +Perform loop distribution of patterns that can be code generated with
12058 +calls to a library. This flag is enabled by default at @option{-O3}.
12060 +This pass distributes the initialization loops and generates a call to
12061 +memset zero. For example, the loop
12062 +@smallexample
12063 +DO I = 1, N
12064 + A(I) = 0
12065 + B(I) = A(I) + I
12066 +ENDDO
12067 +@end smallexample
12068 +is transformed to
12069 +@smallexample
12070 +DO I = 1, N
12071 + A(I) = 0
12072 +ENDDO
12073 +DO I = 1, N
12074 + B(I) = A(I) + I
12075 +ENDDO
12076 +@end smallexample
12077 +and the initialization loop is transformed into a call to memset zero.
12079 +@item -ftree-loop-im
12080 +@opindex ftree-loop-im
12081 +Perform loop invariant motion on trees. This pass moves only invariants that
12082 +would be hard to handle at RTL level (function calls, operations that expand to
12083 +nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
12084 +operands of conditions that are invariant out of the loop, so that we can use
12085 +just trivial invariantness analysis in loop unswitching. The pass also includes
12086 +store motion.
12088 +@item -ftree-loop-ivcanon
12089 +@opindex ftree-loop-ivcanon
12090 +Create a canonical counter for number of iterations in the loop for that
12091 +determining number of iterations requires complicated analysis. Later
12092 +optimizations then may determine the number easily. Useful especially
12093 +in connection with unrolling.
12095 +@item -fivopts
12096 +@opindex fivopts
12097 +Perform induction variable optimizations (strength reduction, induction
12098 +variable merging and induction variable elimination) on trees.
12100 +@item -ftree-parallelize-loops=n
12101 +@opindex ftree-parallelize-loops
12102 +Parallelize loops, i.e., split their iteration space to run in n threads.
12103 +This is only possible for loops whose iterations are independent
12104 +and can be arbitrarily reordered. The optimization is only
12105 +profitable on multiprocessor machines, for loops that are CPU-intensive,
12106 +rather than constrained e.g.@: by memory bandwidth. This option
12107 +implies @option{-pthread}, and thus is only supported on targets
12108 +that have support for @option{-pthread}.
12110 +@item -ftree-pta
12111 +@opindex ftree-pta
12112 +Perform function-local points-to analysis on trees. This flag is
12113 +enabled by default at @option{-O} and higher.
12115 +@item -ftree-sra
12116 +@opindex ftree-sra
12117 +Perform scalar replacement of aggregates. This pass replaces structure
12118 +references with scalars to prevent committing structures to memory too
12119 +early. This flag is enabled by default at @option{-O} and higher.
12121 +@item -ftree-copyrename
12122 +@opindex ftree-copyrename
12123 +Perform copy renaming on trees. This pass attempts to rename compiler
12124 +temporaries to other variables at copy locations, usually resulting in
12125 +variable names which more closely resemble the original variables. This flag
12126 +is enabled by default at @option{-O} and higher.
12128 +@item -ftree-ter
12129 +@opindex ftree-ter
12130 +Perform temporary expression replacement during the SSA->normal phase. Single
12131 +use/single def temporaries are replaced at their use location with their
12132 +defining expression. This results in non-GIMPLE code, but gives the expanders
12133 +much more complex trees to work on resulting in better RTL generation. This is
12134 +enabled by default at @option{-O} and higher.
12136 +@item -ftree-vectorize
12137 +@opindex ftree-vectorize
12138 +Perform loop vectorization on trees. This flag is enabled by default at
12139 +@option{-O3}.
12141 +@item -ftree-slp-vectorize
12142 +@opindex ftree-slp-vectorize
12143 +Perform basic block vectorization on trees. This flag is enabled by default at
12144 +@option{-O3} and when @option{-ftree-vectorize} is enabled.
12146 +@item -ftree-vect-loop-version
12147 +@opindex ftree-vect-loop-version
12148 +Perform loop versioning when doing loop vectorization on trees. When a loop
12149 +appears to be vectorizable except that data alignment or data dependence cannot
12150 +be determined at compile time then vectorized and non-vectorized versions of
12151 +the loop are generated along with runtime checks for alignment or dependence
12152 +to control which version is executed. This option is enabled by default
12153 +except at level @option{-Os} where it is disabled.
12155 +@item -fvect-cost-model
12156 +@opindex fvect-cost-model
12157 +Enable cost model for vectorization.
12159 +@item -ftree-vrp
12160 +@opindex ftree-vrp
12161 +Perform Value Range Propagation on trees. This is similar to the
12162 +constant propagation pass, but instead of values, ranges of values are
12163 +propagated. This allows the optimizers to remove unnecessary range
12164 +checks like array bound checks and null pointer checks. This is
12165 +enabled by default at @option{-O2} and higher. Null pointer check
12166 +elimination is only done if @option{-fdelete-null-pointer-checks} is
12167 +enabled.
12169 +@item -ftracer
12170 +@opindex ftracer
12171 +Perform tail duplication to enlarge superblock size. This transformation
12172 +simplifies the control flow of the function allowing other optimizations to do
12173 +better job.
12175 +@item -funroll-loops
12176 +@opindex funroll-loops
12177 +Unroll loops whose number of iterations can be determined at compile
12178 +time or upon entry to the loop. @option{-funroll-loops} implies
12179 +@option{-frerun-cse-after-loop}. This option makes code larger,
12180 +and may or may not make it run faster.
12182 +@item -funroll-all-loops
12183 +@opindex funroll-all-loops
12184 +Unroll all loops, even if their number of iterations is uncertain when
12185 +the loop is entered. This usually makes programs run more slowly.
12186 +@option{-funroll-all-loops} implies the same options as
12187 +@option{-funroll-loops},
12189 +@item -fsplit-ivs-in-unroller
12190 +@opindex fsplit-ivs-in-unroller
12191 +Enables expressing of values of induction variables in later iterations
12192 +of the unrolled loop using the value in the first iteration. This breaks
12193 +long dependency chains, thus improving efficiency of the scheduling passes.
12195 +Combination of @option{-fweb} and CSE is often sufficient to obtain the
12196 +same effect. However in cases the loop body is more complicated than
12197 +a single basic block, this is not reliable. It also does not work at all
12198 +on some of the architectures due to restrictions in the CSE pass.
12200 +This optimization is enabled by default.
12202 +@item -fvariable-expansion-in-unroller
12203 +@opindex fvariable-expansion-in-unroller
12204 +With this option, the compiler will create multiple copies of some
12205 +local variables when unrolling a loop which can result in superior code.
12207 +@item -fpartial-inlining
12208 +@opindex fpartial-inlining
12209 +Inline parts of functions. This option has any effect only
12210 +when inlining itself is turned on by the @option{-finline-functions}
12211 +or @option{-finline-small-functions} options.
12213 +Enabled at level @option{-O2}.
12215 +@item -fpredictive-commoning
12216 +@opindex fpredictive-commoning
12217 +Perform predictive commoning optimization, i.e., reusing computations
12218 +(especially memory loads and stores) performed in previous
12219 +iterations of loops.
12221 +This option is enabled at level @option{-O3}.
12223 +@item -fprefetch-loop-arrays
12224 +@opindex fprefetch-loop-arrays
12225 +If supported by the target machine, generate instructions to prefetch
12226 +memory to improve the performance of loops that access large arrays.
12228 +This option may generate better or worse code; results are highly
12229 +dependent on the structure of loops within the source code.
12231 +Disabled at level @option{-Os}.
12233 +@item -fno-peephole
12234 +@itemx -fno-peephole2
12235 +@opindex fno-peephole
12236 +@opindex fno-peephole2
12237 +Disable any machine-specific peephole optimizations. The difference
12238 +between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
12239 +are implemented in the compiler; some targets use one, some use the
12240 +other, a few use both.
12242 +@option{-fpeephole} is enabled by default.
12243 +@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12245 +@item -fno-guess-branch-probability
12246 +@opindex fno-guess-branch-probability
12247 +Do not guess branch probabilities using heuristics.
12249 +GCC will use heuristics to guess branch probabilities if they are
12250 +not provided by profiling feedback (@option{-fprofile-arcs}). These
12251 +heuristics are based on the control flow graph. If some branch probabilities
12252 +are specified by @samp{__builtin_expect}, then the heuristics will be
12253 +used to guess branch probabilities for the rest of the control flow graph,
12254 +taking the @samp{__builtin_expect} info into account. The interactions
12255 +between the heuristics and @samp{__builtin_expect} can be complex, and in
12256 +some cases, it may be useful to disable the heuristics so that the effects
12257 +of @samp{__builtin_expect} are easier to understand.
12259 +The default is @option{-fguess-branch-probability} at levels
12260 +@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12262 +@item -freorder-blocks
12263 +@opindex freorder-blocks
12264 +Reorder basic blocks in the compiled function in order to reduce number of
12265 +taken branches and improve code locality.
12267 +Enabled at levels @option{-O2}, @option{-O3}.
12269 +@item -freorder-blocks-and-partition
12270 +@opindex freorder-blocks-and-partition
12271 +In addition to reordering basic blocks in the compiled function, in order
12272 +to reduce number of taken branches, partitions hot and cold basic blocks
12273 +into separate sections of the assembly and .o files, to improve
12274 +paging and cache locality performance.
12276 +This optimization is automatically turned off in the presence of
12277 +exception handling, for linkonce sections, for functions with a user-defined
12278 +section attribute and on any architecture that does not support named
12279 +sections.
12281 +@item -freorder-functions
12282 +@opindex freorder-functions
12283 +Reorder functions in the object file in order to
12284 +improve code locality. This is implemented by using special
12285 +subsections @code{.text.hot} for most frequently executed functions and
12286 +@code{.text.unlikely} for unlikely executed functions. Reordering is done by
12287 +the linker so object file format must support named sections and linker must
12288 +place them in a reasonable way.
12290 +Also profile feedback must be available in to make this option effective. See
12291 +@option{-fprofile-arcs} for details.
12293 +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12295 +@item -fstrict-aliasing
12296 +@opindex fstrict-aliasing
12297 +Allow the compiler to assume the strictest aliasing rules applicable to
12298 +the language being compiled. For C (and C++), this activates
12299 +optimizations based on the type of expressions. In particular, an
12300 +object of one type is assumed never to reside at the same address as an
12301 +object of a different type, unless the types are almost the same. For
12302 +example, an @code{unsigned int} can alias an @code{int}, but not a
12303 +@code{void*} or a @code{double}. A character type may alias any other
12304 +type.
12306 +@anchor{Type-punning}Pay special attention to code like this:
12307 +@smallexample
12308 +union a_union @{
12309 + int i;
12310 + double d;
12311 +@};
12313 +int f() @{
12314 + union a_union t;
12315 + t.d = 3.0;
12316 + return t.i;
12318 +@end smallexample
12319 +The practice of reading from a different union member than the one most
12320 +recently written to (called ``type-punning'') is common. Even with
12321 +@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
12322 +is accessed through the union type. So, the code above will work as
12323 +expected. @xref{Structures unions enumerations and bit-fields
12324 +implementation}. However, this code might not:
12325 +@smallexample
12326 +int f() @{
12327 + union a_union t;
12328 + int* ip;
12329 + t.d = 3.0;
12330 + ip = &t.i;
12331 + return *ip;
12333 +@end smallexample
12335 +Similarly, access by taking the address, casting the resulting pointer
12336 +and dereferencing the result has undefined behavior, even if the cast
12337 +uses a union type, e.g.:
12338 +@smallexample
12339 +int f() @{
12340 + double d = 3.0;
12341 + return ((union a_union *) &d)->i;
12343 +@end smallexample
12345 +The @option{-fstrict-aliasing} option is enabled at levels
12346 +@option{-O2}, @option{-O3}, @option{-Os}.
12348 +@item -fstrict-overflow
12349 +@opindex fstrict-overflow
12350 +Allow the compiler to assume strict signed overflow rules, depending
12351 +on the language being compiled. For C (and C++) this means that
12352 +overflow when doing arithmetic with signed numbers is undefined, which
12353 +means that the compiler may assume that it will not happen. This
12354 +permits various optimizations. For example, the compiler will assume
12355 +that an expression like @code{i + 10 > i} will always be true for
12356 +signed @code{i}. This assumption is only valid if signed overflow is
12357 +undefined, as the expression is false if @code{i + 10} overflows when
12358 +using twos complement arithmetic. When this option is in effect any
12359 +attempt to determine whether an operation on signed numbers will
12360 +overflow must be written carefully to not actually involve overflow.
12362 +This option also allows the compiler to assume strict pointer
12363 +semantics: given a pointer to an object, if adding an offset to that
12364 +pointer does not produce a pointer to the same object, the addition is
12365 +undefined. This permits the compiler to conclude that @code{p + u >
12366 +p} is always true for a pointer @code{p} and unsigned integer
12367 +@code{u}. This assumption is only valid because pointer wraparound is
12368 +undefined, as the expression is false if @code{p + u} overflows using
12369 +twos complement arithmetic.
12371 +See also the @option{-fwrapv} option. Using @option{-fwrapv} means
12372 +that integer signed overflow is fully defined: it wraps. When
12373 +@option{-fwrapv} is used, there is no difference between
12374 +@option{-fstrict-overflow} and @option{-fno-strict-overflow} for
12375 +integers. With @option{-fwrapv} certain types of overflow are
12376 +permitted. For example, if the compiler gets an overflow when doing
12377 +arithmetic on constants, the overflowed value can still be used with
12378 +@option{-fwrapv}, but not otherwise.
12380 +The @option{-fstrict-overflow} option is enabled at levels
12381 +@option{-O2}, @option{-O3}, @option{-Os}.
12383 +@item -falign-functions
12384 +@itemx -falign-functions=@var{n}
12385 +@opindex falign-functions
12386 +Align the start of functions to the next power-of-two greater than
12387 +@var{n}, skipping up to @var{n} bytes. For instance,
12388 +@option{-falign-functions=32} aligns functions to the next 32-byte
12389 +boundary, but @option{-falign-functions=24} would align to the next
12390 +32-byte boundary only if this can be done by skipping 23 bytes or less.
12392 +@option{-fno-align-functions} and @option{-falign-functions=1} are
12393 +equivalent and mean that functions will not be aligned.
12395 +Some assemblers only support this flag when @var{n} is a power of two;
12396 +in that case, it is rounded up.
12398 +If @var{n} is not specified or is zero, use a machine-dependent default.
12400 +Enabled at levels @option{-O2}, @option{-O3}.
12402 +@item -falign-labels
12403 +@itemx -falign-labels=@var{n}
12404 +@opindex falign-labels
12405 +Align all branch targets to a power-of-two boundary, skipping up to
12406 +@var{n} bytes like @option{-falign-functions}. This option can easily
12407 +make code slower, because it must insert dummy operations for when the
12408 +branch target is reached in the usual flow of the code.
12410 +@option{-fno-align-labels} and @option{-falign-labels=1} are
12411 +equivalent and mean that labels will not be aligned.
12413 +If @option{-falign-loops} or @option{-falign-jumps} are applicable and
12414 +are greater than this value, then their values are used instead.
12416 +If @var{n} is not specified or is zero, use a machine-dependent default
12417 +which is very likely to be @samp{1}, meaning no alignment.
12419 +Enabled at levels @option{-O2}, @option{-O3}.
12421 +@item -falign-loops
12422 +@itemx -falign-loops=@var{n}
12423 +@opindex falign-loops
12424 +Align loops to a power-of-two boundary, skipping up to @var{n} bytes
12425 +like @option{-falign-functions}. The hope is that the loop will be
12426 +executed many times, which will make up for any execution of the dummy
12427 +operations.
12429 +@option{-fno-align-loops} and @option{-falign-loops=1} are
12430 +equivalent and mean that loops will not be aligned.
12432 +If @var{n} is not specified or is zero, use a machine-dependent default.
12434 +Enabled at levels @option{-O2}, @option{-O3}.
12436 +@item -falign-jumps
12437 +@itemx -falign-jumps=@var{n}
12438 +@opindex falign-jumps
12439 +Align branch targets to a power-of-two boundary, for branch targets
12440 +where the targets can only be reached by jumping, skipping up to @var{n}
12441 +bytes like @option{-falign-functions}. In this case, no dummy operations
12442 +need be executed.
12444 +@option{-fno-align-jumps} and @option{-falign-jumps=1} are
12445 +equivalent and mean that loops will not be aligned.
12447 +If @var{n} is not specified or is zero, use a machine-dependent default.
12449 +Enabled at levels @option{-O2}, @option{-O3}.
12451 +@item -funit-at-a-time
12452 +@opindex funit-at-a-time
12453 +This option is left for compatibility reasons. @option{-funit-at-a-time}
12454 +has no effect, while @option{-fno-unit-at-a-time} implies
12455 +@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
12457 +Enabled by default.
12459 +@item -fno-toplevel-reorder
12460 +@opindex fno-toplevel-reorder
12461 +Do not reorder top-level functions, variables, and @code{asm}
12462 +statements. Output them in the same order that they appear in the
12463 +input file. When this option is used, unreferenced static variables
12464 +will not be removed. This option is intended to support existing code
12465 +which relies on a particular ordering. For new code, it is better to
12466 +use attributes.
12468 +Enabled at level @option{-O0}. When disabled explicitly, it also imply
12469 +@option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
12470 +targets.
12472 +@item -fweb
12473 +@opindex fweb
12474 +Constructs webs as commonly used for register allocation purposes and assign
12475 +each web individual pseudo register. This allows the register allocation pass
12476 +to operate on pseudos directly, but also strengthens several other optimization
12477 +passes, such as CSE, loop optimizer and trivial dead code remover. It can,
12478 +however, make debugging impossible, since variables will no longer stay in a
12479 +``home register''.
12481 +Enabled by default with @option{-funroll-loops}.
12483 +@item -fwhole-program
12484 +@opindex fwhole-program
12485 +Assume that the current compilation unit represents the whole program being
12486 +compiled. All public functions and variables with the exception of @code{main}
12487 +and those merged by attribute @code{externally_visible} become static functions
12488 +and in effect are optimized more aggressively by interprocedural optimizers. If @command{gold} is used as the linker plugin, @code{externally_visible} attributes are automatically added to functions (not variable yet due to a current @command{gold} issue) that are accessed outside of LTO objects according to resolution file produced by @command{gold}. For other linkers that cannot generate resolution file, explicit @code{externally_visible} attributes are still necessary.
12489 +While this option is equivalent to proper use of the @code{static} keyword for
12490 +programs consisting of a single file, in combination with option
12491 +@option{-flto} this flag can be used to
12492 +compile many smaller scale programs since the functions and variables become
12493 +local for the whole combined compilation unit, not for the single source file
12494 +itself.
12496 +This option implies @option{-fwhole-file} for Fortran programs.
12498 +@item -flto[=@var{n}]
12499 +@opindex flto
12500 +This option runs the standard link-time optimizer. When invoked
12501 +with source code, it generates GIMPLE (one of GCC's internal
12502 +representations) and writes it to special ELF sections in the object
12503 +file. When the object files are linked together, all the function
12504 +bodies are read from these ELF sections and instantiated as if they
12505 +had been part of the same translation unit.
12507 +To use the link-time optimizer, @option{-flto} needs to be specified at
12508 +compile time and during the final link. For example:
12510 +@smallexample
12511 +gcc -c -O2 -flto foo.c
12512 +gcc -c -O2 -flto bar.c
12513 +gcc -o myprog -flto -O2 foo.o bar.o
12514 +@end smallexample
12516 +The first two invocations to GCC save a bytecode representation
12517 +of GIMPLE into special ELF sections inside @file{foo.o} and
12518 +@file{bar.o}. The final invocation reads the GIMPLE bytecode from
12519 +@file{foo.o} and @file{bar.o}, merges the two files into a single
12520 +internal image, and compiles the result as usual. Since both
12521 +@file{foo.o} and @file{bar.o} are merged into a single image, this
12522 +causes all the interprocedural analyses and optimizations in GCC to
12523 +work across the two files as if they were a single one. This means,
12524 +for example, that the inliner is able to inline functions in
12525 +@file{bar.o} into functions in @file{foo.o} and vice-versa.
12527 +Another (simpler) way to enable link-time optimization is:
12529 +@smallexample
12530 +gcc -o myprog -flto -O2 foo.c bar.c
12531 +@end smallexample
12533 +The above generates bytecode for @file{foo.c} and @file{bar.c},
12534 +merges them together into a single GIMPLE representation and optimizes
12535 +them as usual to produce @file{myprog}.
12537 +The only important thing to keep in mind is that to enable link-time
12538 +optimizations the @option{-flto} flag needs to be passed to both the
12539 +compile and the link commands.
12541 +To make whole program optimization effective, it is necessary to make
12542 +certain whole program assumptions. The compiler needs to know
12543 +what functions and variables can be accessed by libraries and runtime
12544 +outside of the link-time optimized unit. When supported by the linker,
12545 +the linker plugin (see @option{-fuse-linker-plugin}) passes information
12546 +to the compiler about used and externally visible symbols. When
12547 +the linker plugin is not available, @option{-fwhole-program} should be
12548 +used to allow the compiler to make these assumptions, which leads
12549 +to more aggressive optimization decisions.
12551 +Note that when a file is compiled with @option{-flto}, the generated
12552 +object file is larger than a regular object file because it
12553 +contains GIMPLE bytecodes and the usual final code. This means that
12554 +object files with LTO information can be linked as normal object
12555 +files; if @option{-flto} is not passed to the linker, no
12556 +interprocedural optimizations are applied.
12558 +Additionally, the optimization flags used to compile individual files
12559 +are not necessarily related to those used at link time. For instance,
12561 +@smallexample
12562 +gcc -c -O0 -flto foo.c
12563 +gcc -c -O0 -flto bar.c
12564 +gcc -o myprog -flto -O3 foo.o bar.o
12565 +@end smallexample
12567 +This produces individual object files with unoptimized assembler
12568 +code, but the resulting binary @file{myprog} is optimized at
12569 +@option{-O3}. If, instead, the final binary is generated without
12570 +@option{-flto}, then @file{myprog} is not optimized.
12572 +When producing the final binary with @option{-flto}, GCC only
12573 +applies link-time optimizations to those files that contain bytecode.
12574 +Therefore, you can mix and match object files and libraries with
12575 +GIMPLE bytecodes and final object code. GCC automatically selects
12576 +which files to optimize in LTO mode and which files to link without
12577 +further processing.
12579 +There are some code generation flags that GCC preserves when
12580 +generating bytecodes, as they need to be used during the final link
12581 +stage. Currently, the following options are saved into the GIMPLE
12582 +bytecode files: @option{-fPIC}, @option{-fcommon} and all the
12583 +@option{-m} target flags.
12585 +At link time, these options are read in and reapplied. Note that the
12586 +current implementation makes no attempt to recognize conflicting
12587 +values for these options. If different files have conflicting option
12588 +values (e.g., one file is compiled with @option{-fPIC} and another
12589 +isn't), the compiler simply uses the last value read from the
12590 +bytecode files. It is recommended, then, that you compile all the files
12591 +participating in the same link with the same options.
12593 +If LTO encounters objects with C linkage declared with incompatible
12594 +types in separate translation units to be linked together (undefined
12595 +behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
12596 +issued. The behavior is still undefined at runtime.
12598 +Another feature of LTO is that it is possible to apply interprocedural
12599 +optimizations on files written in different languages. This requires
12600 +support in the language front end. Currently, the C, C++ and
12601 +Fortran front ends are capable of emitting GIMPLE bytecodes, so
12602 +something like this should work:
12604 +@smallexample
12605 +gcc -c -flto foo.c
12606 +g++ -c -flto bar.cc
12607 +gfortran -c -flto baz.f90
12608 +g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
12609 +@end smallexample
12611 +Notice that the final link is done with @command{g++} to get the C++
12612 +runtime libraries and @option{-lgfortran} is added to get the Fortran
12613 +runtime libraries. In general, when mixing languages in LTO mode, you
12614 +should use the same link command options as when mixing languages in a
12615 +regular (non-LTO) compilation; all you need to add is @option{-flto} to
12616 +all the compile and link commands.
12618 +If object files containing GIMPLE bytecode are stored in a library archive, say
12619 +@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
12620 +are using a linker with plugin support. To enable this feature, use
12621 +the flag @option{-fuse-linker-plugin} at link time:
12623 +@smallexample
12624 +gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
12625 +@end smallexample
12627 +With the linker plugin enabled, the linker extracts the needed
12628 +GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
12629 +to make them part of the aggregated GIMPLE image to be optimized.
12631 +If you are not using a linker with plugin support and/or do not
12632 +enable the linker plugin, then the objects inside @file{libfoo.a}
12633 +are extracted and linked as usual, but they do not participate
12634 +in the LTO optimization process.
12636 +Link-time optimizations do not require the presence of the whole program to
12637 +operate. If the program does not require any symbols to be exported, it is
12638 +possible to combine @option{-flto} and @option{-fwhole-program} to allow
12639 +the interprocedural optimizers to use more aggressive assumptions which may
12640 +lead to improved optimization opportunities.
12641 +Use of @option{-fwhole-program} is not needed when linker plugin is
12642 +active (see @option{-fuse-linker-plugin}).
12644 +The current implementation of LTO makes no
12645 +attempt to generate bytecode that is portable between different
12646 +types of hosts. The bytecode files are versioned and there is a
12647 +strict version check, so bytecode files generated in one version of
12648 +GCC will not work with an older/newer version of GCC.
12650 +Link-time optimization does not work well with generation of debugging
12651 +information. Combining @option{-flto} with
12652 +@option{-g} is currently experimental and expected to produce wrong
12653 +results.
12655 +If you specify the optional @var{n}, the optimization and code
12656 +generation done at link time is executed in parallel using @var{n}
12657 +parallel jobs by utilizing an installed @command{make} program. The
12658 +environment variable @env{MAKE} may be used to override the program
12659 +used. The default value for @var{n} is 1.
12661 +You can also specify @option{-flto=jobserver} to use GNU make's
12662 +job server mode to determine the number of parallel jobs. This
12663 +is useful when the Makefile calling GCC is already executing in parallel.
12664 +You must prepend a @samp{+} to the command recipe in the parent Makefile
12665 +for this to work. This option likely only works if @env{MAKE} is
12666 +GNU make.
12668 +This option is disabled by default.
12670 +@item -flto-partition=@var{alg}
12671 +@opindex flto-partition
12672 +Specify the partitioning algorithm used by the link-time optimizer.
12673 +The value is either @code{1to1} to specify a partitioning mirroring
12674 +the original source files or @code{balanced} to specify partitioning
12675 +into equally sized chunks (whenever possible). Specifying @code{none}
12676 +as an algorithm disables partitioning and streaming completely. The
12677 +default value is @code{balanced}.
12679 +@item -flto-compression-level=@var{n}
12680 +This option specifies the level of compression used for intermediate
12681 +language written to LTO object files, and is only meaningful in
12682 +conjunction with LTO mode (@option{-flto}). Valid
12683 +values are 0 (no compression) to 9 (maximum compression). Values
12684 +outside this range are clamped to either 0 or 9. If the option is not
12685 +given, a default balanced compression setting is used.
12687 +@item -flto-report
12688 +Prints a report with internal details on the workings of the link-time
12689 +optimizer. The contents of this report vary from version to version.
12690 +It is meant to be useful to GCC developers when processing object
12691 +files in LTO mode (via @option{-flto}).
12693 +Disabled by default.
12695 +@item -fuse-linker-plugin
12696 +Enables the use of a linker plugin during link-time optimization. This
12697 +option relies on the linker plugin support in linker that is available in gold
12698 +or in GNU ld 2.21 or newer.
12700 +This option enables the extraction of object files with GIMPLE bytecode out
12701 +of library archives. This improves the quality of optimization by exposing
12702 +more code to the link-time optimizer. This information specifies what
12703 +symbols can be accessed externally (by non-LTO object or during dynamic
12704 +linking). Resulting code quality improvements on binaries (and shared
12705 +libraries that use hidden visibility) are similar to @code{-fwhole-program}.
12706 +See @option{-flto} for a description of the effect of this flag and how to
12707 +use it.
12709 +This option is enabled by default when LTO support in GCC is enabled
12710 +and GCC was configured for use with
12711 +a linker supporting plugins (GNU ld 2.21 or newer or gold).
12713 +@item -fcompare-elim
12714 +@opindex fcompare-elim
12715 +After register allocation and post-register allocation instruction splitting,
12716 +identify arithmetic instructions that compute processor flags similar to a
12717 +comparison operation based on that arithmetic. If possible, eliminate the
12718 +explicit comparison operation.
12720 +This pass only applies to certain targets that cannot explicitly represent
12721 +the comparison operation before register allocation is complete.
12723 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12725 +@item -fcprop-registers
12726 +@opindex fcprop-registers
12727 +After register allocation and post-register allocation instruction splitting,
12728 +we perform a copy-propagation pass to try to reduce scheduling dependencies
12729 +and occasionally eliminate the copy.
12731 +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12733 +@item -fprofile-correction
12734 +@opindex fprofile-correction
12735 +Profiles collected using an instrumented binary for multi-threaded programs may
12736 +be inconsistent due to missed counter updates. When this option is specified,
12737 +GCC will use heuristics to correct or smooth out such inconsistencies. By
12738 +default, GCC will emit an error message when an inconsistent profile is detected.
12740 +@item -fprofile-dir=@var{path}
12741 +@opindex fprofile-dir
12743 +Set the directory to search for the profile data files in to @var{path}.
12744 +This option affects only the profile data generated by
12745 +@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12746 +and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12747 +and its related options.
12748 +By default, GCC will use the current directory as @var{path}, thus the
12749 +profile data file will appear in the same directory as the object file.
12751 +@item -fprofile-generate
12752 +@itemx -fprofile-generate=@var{path}
12753 +@opindex fprofile-generate
12755 +Enable options usually used for instrumenting application to produce
12756 +profile useful for later recompilation with profile feedback based
12757 +optimization. You must use @option{-fprofile-generate} both when
12758 +compiling and when linking your program.
12760 +The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
12762 +If @var{path} is specified, GCC will look at the @var{path} to find
12763 +the profile feedback data files. See @option{-fprofile-dir}.
12765 +@item -fprofile-use
12766 +@itemx -fprofile-use=@var{path}
12767 +@opindex fprofile-use
12768 +Enable profile feedback directed optimizations, and optimizations
12769 +generally profitable only with profile feedback available.
12771 +The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
12772 +@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
12774 +By default, GCC emits an error message if the feedback profiles do not
12775 +match the source code. This error can be turned into a warning by using
12776 +@option{-Wcoverage-mismatch}. Note this may result in poorly optimized
12777 +code.
12779 +If @var{path} is specified, GCC will look at the @var{path} to find
12780 +the profile feedback data files. See @option{-fprofile-dir}.
12781 +@end table
12783 +The following options control compiler behavior regarding floating
12784 +point arithmetic. These options trade off between speed and
12785 +correctness. All must be specifically enabled.
12787 +@table @gcctabopt
12788 +@item -ffloat-store
12789 +@opindex ffloat-store
12790 +Do not store floating point variables in registers, and inhibit other
12791 +options that might change whether a floating point value is taken from a
12792 +register or memory.
12794 +@cindex floating point precision
12795 +This option prevents undesirable excess precision on machines such as
12796 +the 68000 where the floating registers (of the 68881) keep more
12797 +precision than a @code{double} is supposed to have. Similarly for the
12798 +x86 architecture. For most programs, the excess precision does only
12799 +good, but a few programs rely on the precise definition of IEEE floating
12800 +point. Use @option{-ffloat-store} for such programs, after modifying
12801 +them to store all pertinent intermediate computations into variables.
12803 +@item -fexcess-precision=@var{style}
12804 +@opindex fexcess-precision
12805 +This option allows further control over excess precision on machines
12806 +where floating-point registers have more precision than the IEEE
12807 +@code{float} and @code{double} types and the processor does not
12808 +support operations rounding to those types. By default,
12809 +@option{-fexcess-precision=fast} is in effect; this means that
12810 +operations are carried out in the precision of the registers and that
12811 +it is unpredictable when rounding to the types specified in the source
12812 +code takes place. When compiling C, if
12813 +@option{-fexcess-precision=standard} is specified then excess
12814 +precision will follow the rules specified in ISO C99; in particular,
12815 +both casts and assignments cause values to be rounded to their
12816 +semantic types (whereas @option{-ffloat-store} only affects
12817 +assignments). This option is enabled by default for C if a strict
12818 +conformance option such as @option{-std=c99} is used.
12820 +@opindex mfpmath
12821 +@option{-fexcess-precision=standard} is not implemented for languages
12822 +other than C, and has no effect if
12823 +@option{-funsafe-math-optimizations} or @option{-ffast-math} is
12824 +specified. On the x86, it also has no effect if @option{-mfpmath=sse}
12825 +or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
12826 +semantics apply without excess precision, and in the latter, rounding
12827 +is unpredictable.
12829 +@item -ffast-math
12830 +@opindex ffast-math
12831 +Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
12832 +@option{-ffinite-math-only}, @option{-fno-rounding-math},
12833 +@option{-fno-signaling-nans} and @option{-fcx-limited-range}.
12835 +This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
12837 +This option is not turned on by any @option{-O} option besides
12838 +@option{-Ofast} since it can result in incorrect output for programs
12839 +which depend on an exact implementation of IEEE or ISO rules/specifications
12840 +for math functions. It may, however, yield faster code for programs
12841 +that do not require the guarantees of these specifications.
12843 +@item -fno-math-errno
12844 +@opindex fno-math-errno
12845 +Do not set ERRNO after calling math functions that are executed
12846 +with a single instruction, e.g., sqrt. A program that relies on
12847 +IEEE exceptions for math error handling may want to use this flag
12848 +for speed while maintaining IEEE arithmetic compatibility.
12850 +This option is not turned on by any @option{-O} option since
12851 +it can result in incorrect output for programs which depend on
12852 +an exact implementation of IEEE or ISO rules/specifications for
12853 +math functions. It may, however, yield faster code for programs
12854 +that do not require the guarantees of these specifications.
12856 +The default is @option{-fmath-errno}.
12858 +On Darwin systems, the math library never sets @code{errno}. There is
12859 +therefore no reason for the compiler to consider the possibility that
12860 +it might, and @option{-fno-math-errno} is the default.
12862 +@item -funsafe-math-optimizations
12863 +@opindex funsafe-math-optimizations
12865 +Allow optimizations for floating-point arithmetic that (a) assume
12866 +that arguments and results are valid and (b) may violate IEEE or
12867 +ANSI standards. When used at link-time, it may include libraries
12868 +or startup files that change the default FPU control word or other
12869 +similar optimizations.
12871 +This option is not turned on by any @option{-O} option since
12872 +it can result in incorrect output for programs which depend on
12873 +an exact implementation of IEEE or ISO rules/specifications for
12874 +math functions. It may, however, yield faster code for programs
12875 +that do not require the guarantees of these specifications.
12876 +Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
12877 +@option{-fassociative-math} and @option{-freciprocal-math}.
12879 +The default is @option{-fno-unsafe-math-optimizations}.
12881 +@item -fassociative-math
12882 +@opindex fassociative-math
12884 +Allow re-association of operands in series of floating-point operations.
12885 +This violates the ISO C and C++ language standard by possibly changing
12886 +computation result. NOTE: re-ordering may change the sign of zero as
12887 +well as ignore NaNs and inhibit or create underflow or overflow (and
12888 +thus cannot be used on a code which relies on rounding behavior like
12889 +@code{(x + 2**52) - 2**52)}. May also reorder floating-point comparisons
12890 +and thus may not be used when ordered comparisons are required.
12891 +This option requires that both @option{-fno-signed-zeros} and
12892 +@option{-fno-trapping-math} be in effect. Moreover, it doesn't make
12893 +much sense with @option{-frounding-math}. For Fortran the option
12894 +is automatically enabled when both @option{-fno-signed-zeros} and
12895 +@option{-fno-trapping-math} are in effect.
12897 +The default is @option{-fno-associative-math}.
12899 +@item -freciprocal-math
12900 +@opindex freciprocal-math
12902 +Allow the reciprocal of a value to be used instead of dividing by
12903 +the value if this enables optimizations. For example @code{x / y}
12904 +can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
12905 +is subject to common subexpression elimination. Note that this loses
12906 +precision and increases the number of flops operating on the value.
12908 +The default is @option{-fno-reciprocal-math}.
12910 +@item -ffinite-math-only
12911 +@opindex ffinite-math-only
12912 +Allow optimizations for floating-point arithmetic that assume
12913 +that arguments and results are not NaNs or +-Infs.
12915 +This option is not turned on by any @option{-O} option since
12916 +it can result in incorrect output for programs which depend on
12917 +an exact implementation of IEEE or ISO rules/specifications for
12918 +math functions. It may, however, yield faster code for programs
12919 +that do not require the guarantees of these specifications.
12921 +The default is @option{-fno-finite-math-only}.
12923 +@item -fno-signed-zeros
12924 +@opindex fno-signed-zeros
12925 +Allow optimizations for floating point arithmetic that ignore the
12926 +signedness of zero. IEEE arithmetic specifies the behavior of
12927 +distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
12928 +of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
12929 +This option implies that the sign of a zero result isn't significant.
12931 +The default is @option{-fsigned-zeros}.
12933 +@item -fno-trapping-math
12934 +@opindex fno-trapping-math
12935 +Compile code assuming that floating-point operations cannot generate
12936 +user-visible traps. These traps include division by zero, overflow,
12937 +underflow, inexact result and invalid operation. This option requires
12938 +that @option{-fno-signaling-nans} be in effect. Setting this option may
12939 +allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
12941 +This option should never be turned on by any @option{-O} option since
12942 +it can result in incorrect output for programs which depend on
12943 +an exact implementation of IEEE or ISO rules/specifications for
12944 +math functions.
12946 +The default is @option{-ftrapping-math}.
12948 +@item -frounding-math
12949 +@opindex frounding-math
12950 +Disable transformations and optimizations that assume default floating
12951 +point rounding behavior. This is round-to-zero for all floating point
12952 +to integer conversions, and round-to-nearest for all other arithmetic
12953 +truncations. This option should be specified for programs that change
12954 +the FP rounding mode dynamically, or that may be executed with a
12955 +non-default rounding mode. This option disables constant folding of
12956 +floating point expressions at compile-time (which may be affected by
12957 +rounding mode) and arithmetic transformations that are unsafe in the
12958 +presence of sign-dependent rounding modes.
12960 +The default is @option{-fno-rounding-math}.
12962 +This option is experimental and does not currently guarantee to
12963 +disable all GCC optimizations that are affected by rounding mode.
12964 +Future versions of GCC may provide finer control of this setting
12965 +using C99's @code{FENV_ACCESS} pragma. This command line option
12966 +will be used to specify the default state for @code{FENV_ACCESS}.
12968 +@item -fsignaling-nans
12969 +@opindex fsignaling-nans
12970 +Compile code assuming that IEEE signaling NaNs may generate user-visible
12971 +traps during floating-point operations. Setting this option disables
12972 +optimizations that may change the number of exceptions visible with
12973 +signaling NaNs. This option implies @option{-ftrapping-math}.
12975 +This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
12976 +be defined.
12978 +The default is @option{-fno-signaling-nans}.
12980 +This option is experimental and does not currently guarantee to
12981 +disable all GCC optimizations that affect signaling NaN behavior.
12983 +@item -fsingle-precision-constant
12984 +@opindex fsingle-precision-constant
12985 +Treat floating point constant as single precision constant instead of
12986 +implicitly converting it to double precision constant.
12988 +@item -fcx-limited-range
12989 +@opindex fcx-limited-range
12990 +When enabled, this option states that a range reduction step is not
12991 +needed when performing complex division. Also, there is no checking
12992 +whether the result of a complex multiplication or division is @code{NaN
12993 ++ I*NaN}, with an attempt to rescue the situation in that case. The
12994 +default is @option{-fno-cx-limited-range}, but is enabled by
12995 +@option{-ffast-math}.
12997 +This option controls the default setting of the ISO C99
12998 +@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
12999 +all languages.
13001 +@item -fcx-fortran-rules
13002 +@opindex fcx-fortran-rules
13003 +Complex multiplication and division follow Fortran rules. Range
13004 +reduction is done as part of complex division, but there is no checking
13005 +whether the result of a complex multiplication or division is @code{NaN
13006 ++ I*NaN}, with an attempt to rescue the situation in that case.
13008 +The default is @option{-fno-cx-fortran-rules}.
13010 +@end table
13012 +The following options control optimizations that may improve
13013 +performance, but are not enabled by any @option{-O} options. This
13014 +section includes experimental options that may produce broken code.
13016 +@table @gcctabopt
13017 +@item -fbranch-probabilities
13018 +@opindex fbranch-probabilities
13019 +After running a program compiled with @option{-fprofile-arcs}
13020 +(@pxref{Debugging Options,, Options for Debugging Your Program or
13021 +@command{gcc}}), you can compile it a second time using
13022 +@option{-fbranch-probabilities}, to improve optimizations based on
13023 +the number of times each branch was taken. When the program
13024 +compiled with @option{-fprofile-arcs} exits it saves arc execution
13025 +counts to a file called @file{@var{sourcename}.gcda} for each source
13026 +file. The information in this data file is very dependent on the
13027 +structure of the generated code, so you must use the same source code
13028 +and the same optimization options for both compilations.
13030 +With @option{-fbranch-probabilities}, GCC puts a
13031 +@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
13032 +These can be used to improve optimization. Currently, they are only
13033 +used in one place: in @file{reorg.c}, instead of guessing which path a
13034 +branch is most likely to take, the @samp{REG_BR_PROB} values are used to
13035 +exactly determine which path is taken more often.
13037 +@item -fprofile-values
13038 +@opindex fprofile-values
13039 +If combined with @option{-fprofile-arcs}, it adds code so that some
13040 +data about values of expressions in the program is gathered.
13042 +With @option{-fbranch-probabilities}, it reads back the data gathered
13043 +from profiling values of expressions for usage in optimizations.
13045 +Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
13047 +@item -fvpt
13048 +@opindex fvpt
13049 +If combined with @option{-fprofile-arcs}, it instructs the compiler to add
13050 +a code to gather information about values of expressions.
13052 +With @option{-fbranch-probabilities}, it reads back the data gathered
13053 +and actually performs the optimizations based on them.
13054 +Currently the optimizations include specialization of division operation
13055 +using the knowledge about the value of the denominator.
13057 +@item -frename-registers
13058 +@opindex frename-registers
13059 +Attempt to avoid false dependencies in scheduled code by making use
13060 +of registers left over after register allocation. This optimization
13061 +will most benefit processors with lots of registers. Depending on the
13062 +debug information format adopted by the target, however, it can
13063 +make debugging impossible, since variables will no longer stay in
13064 +a ``home register''.
13066 +Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
13068 +@item -ftracer
13069 +@opindex ftracer
13070 +Perform tail duplication to enlarge superblock size. This transformation
13071 +simplifies the control flow of the function allowing other optimizations to do
13072 +better job.
13074 +Enabled with @option{-fprofile-use}.
13076 +@item -funroll-loops
13077 +@opindex funroll-loops
13078 +Unroll loops whose number of iterations can be determined at compile time or
13079 +upon entry to the loop. @option{-funroll-loops} implies
13080 +@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
13081 +It also turns on complete loop peeling (i.e.@: complete removal of loops with
13082 +small constant number of iterations). This option makes code larger, and may
13083 +or may not make it run faster.
13085 +Enabled with @option{-fprofile-use}.
13087 +@item -funroll-all-loops
13088 +@opindex funroll-all-loops
13089 +Unroll all loops, even if their number of iterations is uncertain when
13090 +the loop is entered. This usually makes programs run more slowly.
13091 +@option{-funroll-all-loops} implies the same options as
13092 +@option{-funroll-loops}.
13094 +@item -fpeel-loops
13095 +@opindex fpeel-loops
13096 +Peels the loops for that there is enough information that they do not
13097 +roll much (from profile feedback). It also turns on complete loop peeling
13098 +(i.e.@: complete removal of loops with small constant number of iterations).
13100 +Enabled with @option{-fprofile-use}.
13102 +@item -fmove-loop-invariants
13103 +@opindex fmove-loop-invariants
13104 +Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
13105 +at level @option{-O1}
13107 +@item -funswitch-loops
13108 +@opindex funswitch-loops
13109 +Move branches with loop invariant conditions out of the loop, with duplicates
13110 +of the loop on both branches (modified according to result of the condition).
13112 +@item -ffunction-sections
13113 +@itemx -fdata-sections
13114 +@opindex ffunction-sections
13115 +@opindex fdata-sections
13116 +Place each function or data item into its own section in the output
13117 +file if the target supports arbitrary sections. The name of the
13118 +function or the name of the data item determines the section's name
13119 +in the output file.
13121 +Use these options on systems where the linker can perform optimizations
13122 +to improve locality of reference in the instruction space. Most systems
13123 +using the ELF object format and SPARC processors running Solaris 2 have
13124 +linkers with such optimizations. AIX may have these optimizations in
13125 +the future.
13127 +Only use these options when there are significant benefits from doing
13128 +so. When you specify these options, the assembler and linker will
13129 +create larger object and executable files and will also be slower.
13130 +You will not be able to use @code{gprof} on all systems if you
13131 +specify this option and you may have problems with debugging if
13132 +you specify both this option and @option{-g}.
13134 +@item -fbranch-target-load-optimize
13135 +@opindex fbranch-target-load-optimize
13136 +Perform branch target register load optimization before prologue / epilogue
13137 +threading.
13138 +The use of target registers can typically be exposed only during reload,
13139 +thus hoisting loads out of loops and doing inter-block scheduling needs
13140 +a separate optimization pass.
13142 +@item -fbranch-target-load-optimize2
13143 +@opindex fbranch-target-load-optimize2
13144 +Perform branch target register load optimization after prologue / epilogue
13145 +threading.
13147 +@item -fbtr-bb-exclusive
13148 +@opindex fbtr-bb-exclusive
13149 +When performing branch target register load optimization, don't reuse
13150 +branch target registers in within any basic block.
13152 +@item -fstack-protector
13153 +@opindex fstack-protector
13154 +Emit extra code to check for buffer overflows, such as stack smashing
13155 +attacks. This is done by adding a guard variable to functions with
13156 +vulnerable objects. This includes functions that call alloca, and
13157 +functions with buffers larger than 8 bytes. The guards are initialized
13158 +when a function is entered and then checked when the function exits.
13159 +If a guard check fails, an error message is printed and the program exits.
13161 +@item -fstack-protector-all
13162 +@opindex fstack-protector-all
13163 +Like @option{-fstack-protector} except that all functions are protected.
13165 +@item -fsection-anchors
13166 +@opindex fsection-anchors
13167 +Try to reduce the number of symbolic address calculations by using
13168 +shared ``anchor'' symbols to address nearby objects. This transformation
13169 +can help to reduce the number of GOT entries and GOT accesses on some
13170 +targets.
13172 +For example, the implementation of the following function @code{foo}:
13174 +@smallexample
13175 +static int a, b, c;
13176 +int foo (void) @{ return a + b + c; @}
13177 +@end smallexample
13179 +would usually calculate the addresses of all three variables, but if you
13180 +compile it with @option{-fsection-anchors}, it will access the variables
13181 +from a common anchor point instead. The effect is similar to the
13182 +following pseudocode (which isn't valid C):
13184 +@smallexample
13185 +int foo (void)
13187 + register int *xr = &x;
13188 + return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
13190 +@end smallexample
13192 +Not all targets support this option.
13194 +@item --param @var{name}=@var{value}
13195 +@opindex param
13196 +In some places, GCC uses various constants to control the amount of
13197 +optimization that is done. For example, GCC will not inline functions
13198 +that contain more that a certain number of instructions. You can
13199 +control some of these constants on the command-line using the
13200 +@option{--param} option.
13202 +The names of specific parameters, and the meaning of the values, are
13203 +tied to the internals of the compiler, and are subject to change
13204 +without notice in future releases.
13206 +In each case, the @var{value} is an integer. The allowable choices for
13207 +@var{name} are given in the following table:
13209 +@table @gcctabopt
13210 +@item struct-reorg-cold-struct-ratio
13211 +The threshold ratio (as a percentage) between a structure frequency
13212 +and the frequency of the hottest structure in the program. This parameter
13213 +is used by struct-reorg optimization enabled by @option{-fipa-struct-reorg}.
13214 +We say that if the ratio of a structure frequency, calculated by profiling,
13215 +to the hottest structure frequency in the program is less than this
13216 +parameter, then structure reorganization is not applied to this structure.
13217 +The default is 10.
13219 +@item predictable-branch-outcome
13220 +When branch is predicted to be taken with probability lower than this threshold
13221 +(in percent), then it is considered well predictable. The default is 10.
13223 +@item max-crossjump-edges
13224 +The maximum number of incoming edges to consider for crossjumping.
13225 +The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
13226 +the number of edges incoming to each block. Increasing values mean
13227 +more aggressive optimization, making the compile time increase with
13228 +probably small improvement in executable size.
13230 +@item min-crossjump-insns
13231 +The minimum number of instructions which must be matched at the end
13232 +of two blocks before crossjumping will be performed on them. This
13233 +value is ignored in the case where all instructions in the block being
13234 +crossjumped from are matched. The default value is 5.
13236 +@item max-grow-copy-bb-insns
13237 +The maximum code size expansion factor when copying basic blocks
13238 +instead of jumping. The expansion is relative to a jump instruction.
13239 +The default value is 8.
13241 +@item max-goto-duplication-insns
13242 +The maximum number of instructions to duplicate to a block that jumps
13243 +to a computed goto. To avoid @math{O(N^2)} behavior in a number of
13244 +passes, GCC factors computed gotos early in the compilation process,
13245 +and unfactors them as late as possible. Only computed jumps at the
13246 +end of a basic blocks with no more than max-goto-duplication-insns are
13247 +unfactored. The default value is 8.
13249 +@item max-delay-slot-insn-search
13250 +The maximum number of instructions to consider when looking for an
13251 +instruction to fill a delay slot. If more than this arbitrary number of
13252 +instructions is searched, the time savings from filling the delay slot
13253 +will be minimal so stop searching. Increasing values mean more
13254 +aggressive optimization, making the compile time increase with probably
13255 +small improvement in executable run time.
13257 +@item max-delay-slot-live-search
13258 +When trying to fill delay slots, the maximum number of instructions to
13259 +consider when searching for a block with valid live register
13260 +information. Increasing this arbitrarily chosen value means more
13261 +aggressive optimization, increasing the compile time. This parameter
13262 +should be removed when the delay slot code is rewritten to maintain the
13263 +control-flow graph.
13265 +@item max-gcse-memory
13266 +The approximate maximum amount of memory that will be allocated in
13267 +order to perform the global common subexpression elimination
13268 +optimization. If more memory than specified is required, the
13269 +optimization will not be done.
13271 +@item max-gcse-insertion-ratio
13272 +If the ratio of expression insertions to deletions is larger than this value
13273 +for any expression, then RTL PRE will insert or remove the expression and thus
13274 +leave partially redundant computations in the instruction stream. The default value is 20.
13276 +@item max-pending-list-length
13277 +The maximum number of pending dependencies scheduling will allow
13278 +before flushing the current state and starting over. Large functions
13279 +with few branches or calls can create excessively large lists which
13280 +needlessly consume memory and resources.
13282 +@item max-inline-insns-single
13283 +Several parameters control the tree inliner used in gcc.
13284 +This number sets the maximum number of instructions (counted in GCC's
13285 +internal representation) in a single function that the tree inliner
13286 +will consider for inlining. This only affects functions declared
13287 +inline and methods implemented in a class declaration (C++).
13288 +The default value is 400.
13290 +@item max-inline-insns-auto
13291 +When you use @option{-finline-functions} (included in @option{-O3}),
13292 +a lot of functions that would otherwise not be considered for inlining
13293 +by the compiler will be investigated. To those functions, a different
13294 +(more restrictive) limit compared to functions declared inline can
13295 +be applied.
13296 +The default value is 40.
13298 +@item large-function-insns
13299 +The limit specifying really large functions. For functions larger than this
13300 +limit after inlining, inlining is constrained by
13301 +@option{--param large-function-growth}. This parameter is useful primarily
13302 +to avoid extreme compilation time caused by non-linear algorithms used by the
13303 +backend.
13304 +The default value is 2700.
13306 +@item large-function-growth
13307 +Specifies maximal growth of large function caused by inlining in percents.
13308 +The default value is 100 which limits large function growth to 2.0 times
13309 +the original size.
13311 +@item large-unit-insns
13312 +The limit specifying large translation unit. Growth caused by inlining of
13313 +units larger than this limit is limited by @option{--param inline-unit-growth}.
13314 +For small units this might be too tight (consider unit consisting of function A
13315 +that is inline and B that just calls A three time. If B is small relative to
13316 +A, the growth of unit is 300\% and yet such inlining is very sane. For very
13317 +large units consisting of small inlineable functions however the overall unit
13318 +growth limit is needed to avoid exponential explosion of code size. Thus for
13319 +smaller units, the size is increased to @option{--param large-unit-insns}
13320 +before applying @option{--param inline-unit-growth}. The default is 10000
13322 +@item inline-unit-growth
13323 +Specifies maximal overall growth of the compilation unit caused by inlining.
13324 +The default value is 30 which limits unit growth to 1.3 times the original
13325 +size.
13327 +@item ipcp-unit-growth
13328 +Specifies maximal overall growth of the compilation unit caused by
13329 +interprocedural constant propagation. The default value is 10 which limits
13330 +unit growth to 1.1 times the original size.
13332 +@item large-stack-frame
13333 +The limit specifying large stack frames. While inlining the algorithm is trying
13334 +to not grow past this limit too much. Default value is 256 bytes.
13336 +@item large-stack-frame-growth
13337 +Specifies maximal growth of large stack frames caused by inlining in percents.
13338 +The default value is 1000 which limits large stack frame growth to 11 times
13339 +the original size.
13341 +@item max-inline-insns-recursive
13342 +@itemx max-inline-insns-recursive-auto
13343 +Specifies maximum number of instructions out-of-line copy of self recursive inline
13344 +function can grow into by performing recursive inlining.
13346 +For functions declared inline @option{--param max-inline-insns-recursive} is
13347 +taken into account. For function not declared inline, recursive inlining
13348 +happens only when @option{-finline-functions} (included in @option{-O3}) is
13349 +enabled and @option{--param max-inline-insns-recursive-auto} is used. The
13350 +default value is 450.
13352 +@item max-inline-recursive-depth
13353 +@itemx max-inline-recursive-depth-auto
13354 +Specifies maximum recursion depth used by the recursive inlining.
13356 +For functions declared inline @option{--param max-inline-recursive-depth} is
13357 +taken into account. For function not declared inline, recursive inlining
13358 +happens only when @option{-finline-functions} (included in @option{-O3}) is
13359 +enabled and @option{--param max-inline-recursive-depth-auto} is used. The
13360 +default value is 8.
13362 +@item min-inline-recursive-probability
13363 +Recursive inlining is profitable only for function having deep recursion
13364 +in average and can hurt for function having little recursion depth by
13365 +increasing the prologue size or complexity of function body to other
13366 +optimizers.
13368 +When profile feedback is available (see @option{-fprofile-generate}) the actual
13369 +recursion depth can be guessed from probability that function will recurse via
13370 +given call expression. This parameter limits inlining only to call expression
13371 +whose probability exceeds given threshold (in percents). The default value is
13372 +10.
13374 +@item early-inlining-insns
13375 +Specify growth that early inliner can make. In effect it increases amount of
13376 +inlining for code having large abstraction penalty. The default value is 10.
13378 +@item max-early-inliner-iterations
13379 +@itemx max-early-inliner-iterations
13380 +Limit of iterations of early inliner. This basically bounds number of nested
13381 +indirect calls early inliner can resolve. Deeper chains are still handled by
13382 +late inlining.
13384 +@item comdat-sharing-probability
13385 +@itemx comdat-sharing-probability
13386 +Probability (in percent) that C++ inline function with comdat visibility
13387 +will be shared across multiple compilation units. The default value is 20.
13389 +@item min-vect-loop-bound
13390 +The minimum number of iterations under which a loop will not get vectorized
13391 +when @option{-ftree-vectorize} is used. The number of iterations after
13392 +vectorization needs to be greater than the value specified by this option
13393 +to allow vectorization. The default value is 0.
13395 +@item gcse-cost-distance-ratio
13396 +Scaling factor in calculation of maximum distance an expression
13397 +can be moved by GCSE optimizations. This is currently supported only in the
13398 +code hoisting pass. The bigger the ratio, the more aggressive code hoisting
13399 +will be with simple expressions, i.e., the expressions which have cost
13400 +less than @option{gcse-unrestricted-cost}. Specifying 0 will disable
13401 +hoisting of simple expressions. The default value is 10.
13403 +@item gcse-unrestricted-cost
13404 +Cost, roughly measured as the cost of a single typical machine
13405 +instruction, at which GCSE optimizations will not constrain
13406 +the distance an expression can travel. This is currently
13407 +supported only in the code hoisting pass. The lesser the cost,
13408 +the more aggressive code hoisting will be. Specifying 0 will
13409 +allow all expressions to travel unrestricted distances.
13410 +The default value is 3.
13412 +@item max-hoist-depth
13413 +The depth of search in the dominator tree for expressions to hoist.
13414 +This is used to avoid quadratic behavior in hoisting algorithm.
13415 +The value of 0 will avoid limiting the search, but may slow down compilation
13416 +of huge functions. The default value is 30.
13418 +@item max-unrolled-insns
13419 +The maximum number of instructions that a loop should have if that loop
13420 +is unrolled, and if the loop is unrolled, it determines how many times
13421 +the loop code is unrolled.
13423 +@item max-average-unrolled-insns
13424 +The maximum number of instructions biased by probabilities of their execution
13425 +that a loop should have if that loop is unrolled, and if the loop is unrolled,
13426 +it determines how many times the loop code is unrolled.
13428 +@item max-unroll-times
13429 +The maximum number of unrollings of a single loop.
13431 +@item max-peeled-insns
13432 +The maximum number of instructions that a loop should have if that loop
13433 +is peeled, and if the loop is peeled, it determines how many times
13434 +the loop code is peeled.
13436 +@item max-peel-times
13437 +The maximum number of peelings of a single loop.
13439 +@item max-completely-peeled-insns
13440 +The maximum number of insns of a completely peeled loop.
13442 +@item max-completely-peel-times
13443 +The maximum number of iterations of a loop to be suitable for complete peeling.
13445 +@item max-completely-peel-loop-nest-depth
13446 +The maximum depth of a loop nest suitable for complete peeling.
13448 +@item max-unswitch-insns
13449 +The maximum number of insns of an unswitched loop.
13451 +@item max-unswitch-level
13452 +The maximum number of branches unswitched in a single loop.
13454 +@item lim-expensive
13455 +The minimum cost of an expensive expression in the loop invariant motion.
13457 +@item iv-consider-all-candidates-bound
13458 +Bound on number of candidates for induction variables below that
13459 +all candidates are considered for each use in induction variable
13460 +optimizations. Only the most relevant candidates are considered
13461 +if there are more candidates, to avoid quadratic time complexity.
13463 +@item iv-max-considered-uses
13464 +The induction variable optimizations give up on loops that contain more
13465 +induction variable uses.
13467 +@item iv-always-prune-cand-set-bound
13468 +If number of candidates in the set is smaller than this value,
13469 +we always try to remove unnecessary ivs from the set during its
13470 +optimization when a new iv is added to the set.
13472 +@item scev-max-expr-size
13473 +Bound on size of expressions used in the scalar evolutions analyzer.
13474 +Large expressions slow the analyzer.
13476 +@item scev-max-expr-complexity
13477 +Bound on the complexity of the expressions in the scalar evolutions analyzer.
13478 +Complex expressions slow the analyzer.
13480 +@item omega-max-vars
13481 +The maximum number of variables in an Omega constraint system.
13482 +The default value is 128.
13484 +@item omega-max-geqs
13485 +The maximum number of inequalities in an Omega constraint system.
13486 +The default value is 256.
13488 +@item omega-max-eqs
13489 +The maximum number of equalities in an Omega constraint system.
13490 +The default value is 128.
13492 +@item omega-max-wild-cards
13493 +The maximum number of wildcard variables that the Omega solver will
13494 +be able to insert. The default value is 18.
13496 +@item omega-hash-table-size
13497 +The size of the hash table in the Omega solver. The default value is
13498 +550.
13500 +@item omega-max-keys
13501 +The maximal number of keys used by the Omega solver. The default
13502 +value is 500.
13504 +@item omega-eliminate-redundant-constraints
13505 +When set to 1, use expensive methods to eliminate all redundant
13506 +constraints. The default value is 0.
13508 +@item vect-max-version-for-alignment-checks
13509 +The maximum number of runtime checks that can be performed when
13510 +doing loop versioning for alignment in the vectorizer. See option
13511 +ftree-vect-loop-version for more information.
13513 +@item vect-max-version-for-alias-checks
13514 +The maximum number of runtime checks that can be performed when
13515 +doing loop versioning for alias in the vectorizer. See option
13516 +ftree-vect-loop-version for more information.
13518 +@item max-iterations-to-track
13520 +The maximum number of iterations of a loop the brute force algorithm
13521 +for analysis of # of iterations of the loop tries to evaluate.
13523 +@item hot-bb-count-fraction
13524 +Select fraction of the maximal count of repetitions of basic block in program
13525 +given basic block needs to have to be considered hot.
13527 +@item hot-bb-frequency-fraction
13528 +Select fraction of the entry block frequency of executions of basic block in
13529 +function given basic block needs to have to be considered hot
13531 +@item max-predicted-iterations
13532 +The maximum number of loop iterations we predict statically. This is useful
13533 +in cases where function contain single loop with known bound and other loop
13534 +with unknown. We predict the known number of iterations correctly, while
13535 +the unknown number of iterations average to roughly 10. This means that the
13536 +loop without bounds would appear artificially cold relative to the other one.
13538 +@item align-threshold
13540 +Select fraction of the maximal frequency of executions of basic block in
13541 +function given basic block will get aligned.
13543 +@item align-loop-iterations
13545 +A loop expected to iterate at lest the selected number of iterations will get
13546 +aligned.
13548 +@item tracer-dynamic-coverage
13549 +@itemx tracer-dynamic-coverage-feedback
13551 +This value is used to limit superblock formation once the given percentage of
13552 +executed instructions is covered. This limits unnecessary code size
13553 +expansion.
13555 +The @option{tracer-dynamic-coverage-feedback} is used only when profile
13556 +feedback is available. The real profiles (as opposed to statically estimated
13557 +ones) are much less balanced allowing the threshold to be larger value.
13559 +@item tracer-max-code-growth
13560 +Stop tail duplication once code growth has reached given percentage. This is
13561 +rather hokey argument, as most of the duplicates will be eliminated later in
13562 +cross jumping, so it may be set to much higher values than is the desired code
13563 +growth.
13565 +@item tracer-min-branch-ratio
13567 +Stop reverse growth when the reverse probability of best edge is less than this
13568 +threshold (in percent).
13570 +@item tracer-min-branch-ratio
13571 +@itemx tracer-min-branch-ratio-feedback
13573 +Stop forward growth if the best edge do have probability lower than this
13574 +threshold.
13576 +Similarly to @option{tracer-dynamic-coverage} two values are present, one for
13577 +compilation for profile feedback and one for compilation without. The value
13578 +for compilation with profile feedback needs to be more conservative (higher) in
13579 +order to make tracer effective.
13581 +@item max-cse-path-length
13583 +Maximum number of basic blocks on path that cse considers. The default is 10.
13585 +@item max-cse-insns
13586 +The maximum instructions CSE process before flushing. The default is 1000.
13588 +@item ggc-min-expand
13590 +GCC uses a garbage collector to manage its own memory allocation. This
13591 +parameter specifies the minimum percentage by which the garbage
13592 +collector's heap should be allowed to expand between collections.
13593 +Tuning this may improve compilation speed; it has no effect on code
13594 +generation.
13596 +The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
13597 +RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
13598 +the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
13599 +GCC is not able to calculate RAM on a particular platform, the lower
13600 +bound of 30% is used. Setting this parameter and
13601 +@option{ggc-min-heapsize} to zero causes a full collection to occur at
13602 +every opportunity. This is extremely slow, but can be useful for
13603 +debugging.
13605 +@item ggc-min-heapsize
13607 +Minimum size of the garbage collector's heap before it begins bothering
13608 +to collect garbage. The first collection occurs after the heap expands
13609 +by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
13610 +tuning this may improve compilation speed, and has no effect on code
13611 +generation.
13613 +The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
13614 +tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
13615 +with a lower bound of 4096 (four megabytes) and an upper bound of
13616 +131072 (128 megabytes). If GCC is not able to calculate RAM on a
13617 +particular platform, the lower bound is used. Setting this parameter
13618 +very large effectively disables garbage collection. Setting this
13619 +parameter and @option{ggc-min-expand} to zero causes a full collection
13620 +to occur at every opportunity.
13622 +@item max-reload-search-insns
13623 +The maximum number of instruction reload should look backward for equivalent
13624 +register. Increasing values mean more aggressive optimization, making the
13625 +compile time increase with probably slightly better performance. The default
13626 +value is 100.
13628 +@item max-cselib-memory-locations
13629 +The maximum number of memory locations cselib should take into account.
13630 +Increasing values mean more aggressive optimization, making the compile time
13631 +increase with probably slightly better performance. The default value is 500.
13633 +@item reorder-blocks-duplicate
13634 +@itemx reorder-blocks-duplicate-feedback
13636 +Used by basic block reordering pass to decide whether to use unconditional
13637 +branch or duplicate the code on its destination. Code is duplicated when its
13638 +estimated size is smaller than this value multiplied by the estimated size of
13639 +unconditional jump in the hot spots of the program.
13641 +The @option{reorder-block-duplicate-feedback} is used only when profile
13642 +feedback is available and may be set to higher values than
13643 +@option{reorder-block-duplicate} since information about the hot spots is more
13644 +accurate.
13646 +@item max-sched-ready-insns
13647 +The maximum number of instructions ready to be issued the scheduler should
13648 +consider at any given time during the first scheduling pass. Increasing
13649 +values mean more thorough searches, making the compilation time increase
13650 +with probably little benefit. The default value is 100.
13652 +@item max-sched-region-blocks
13653 +The maximum number of blocks in a region to be considered for
13654 +interblock scheduling. The default value is 10.
13656 +@item max-pipeline-region-blocks
13657 +The maximum number of blocks in a region to be considered for
13658 +pipelining in the selective scheduler. The default value is 15.
13660 +@item max-sched-region-insns
13661 +The maximum number of insns in a region to be considered for
13662 +interblock scheduling. The default value is 100.
13664 +@item max-pipeline-region-insns
13665 +The maximum number of insns in a region to be considered for
13666 +pipelining in the selective scheduler. The default value is 200.
13668 +@item min-spec-prob
13669 +The minimum probability (in percents) of reaching a source block
13670 +for interblock speculative scheduling. The default value is 40.
13672 +@item max-sched-extend-regions-iters
13673 +The maximum number of iterations through CFG to extend regions.
13674 +0 - disable region extension,
13675 +N - do at most N iterations.
13676 +The default value is 0.
13678 +@item max-sched-insn-conflict-delay
13679 +The maximum conflict delay for an insn to be considered for speculative motion.
13680 +The default value is 3.
13682 +@item sched-spec-prob-cutoff
13683 +The minimal probability of speculation success (in percents), so that
13684 +speculative insn will be scheduled.
13685 +The default value is 40.
13687 +@item sched-mem-true-dep-cost
13688 +Minimal distance (in CPU cycles) between store and load targeting same
13689 +memory locations. The default value is 1.
13691 +@item selsched-max-lookahead
13692 +The maximum size of the lookahead window of selective scheduling. It is a
13693 +depth of search for available instructions.
13694 +The default value is 50.
13696 +@item selsched-max-sched-times
13697 +The maximum number of times that an instruction will be scheduled during
13698 +selective scheduling. This is the limit on the number of iterations
13699 +through which the instruction may be pipelined. The default value is 2.
13701 +@item selsched-max-insns-to-rename
13702 +The maximum number of best instructions in the ready list that are considered
13703 +for renaming in the selective scheduler. The default value is 2.
13705 +@item max-last-value-rtl
13706 +The maximum size measured as number of RTLs that can be recorded in an expression
13707 +in combiner for a pseudo register as last known value of that register. The default
13708 +is 10000.
13710 +@item integer-share-limit
13711 +Small integer constants can use a shared data structure, reducing the
13712 +compiler's memory usage and increasing its speed. This sets the maximum
13713 +value of a shared integer constant. The default value is 256.
13715 +@item min-virtual-mappings
13716 +Specifies the minimum number of virtual mappings in the incremental
13717 +SSA updater that should be registered to trigger the virtual mappings
13718 +heuristic defined by virtual-mappings-ratio. The default value is
13719 +100.
13721 +@item virtual-mappings-ratio
13722 +If the number of virtual mappings is virtual-mappings-ratio bigger
13723 +than the number of virtual symbols to be updated, then the incremental
13724 +SSA updater switches to a full update for those symbols. The default
13725 +ratio is 3.
13727 +@item ssp-buffer-size
13728 +The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
13729 +protection when @option{-fstack-protection} is used.
13731 +@item max-jump-thread-duplication-stmts
13732 +Maximum number of statements allowed in a block that needs to be
13733 +duplicated when threading jumps.
13735 +@item max-fields-for-field-sensitive
13736 +Maximum number of fields in a structure we will treat in
13737 +a field sensitive manner during pointer analysis. The default is zero
13738 +for -O0, and -O1 and 100 for -Os, -O2, and -O3.
13740 +@item prefetch-latency
13741 +Estimate on average number of instructions that are executed before
13742 +prefetch finishes. The distance we prefetch ahead is proportional
13743 +to this constant. Increasing this number may also lead to less
13744 +streams being prefetched (see @option{simultaneous-prefetches}).
13746 +@item simultaneous-prefetches
13747 +Maximum number of prefetches that can run at the same time.
13749 +@item l1-cache-line-size
13750 +The size of cache line in L1 cache, in bytes.
13752 +@item l1-cache-size
13753 +The size of L1 cache, in kilobytes.
13755 +@item l2-cache-size
13756 +The size of L2 cache, in kilobytes.
13758 +@item min-insn-to-prefetch-ratio
13759 +The minimum ratio between the number of instructions and the
13760 +number of prefetches to enable prefetching in a loop.
13762 +@item prefetch-min-insn-to-mem-ratio
13763 +The minimum ratio between the number of instructions and the
13764 +number of memory references to enable prefetching in a loop.
13766 +@item use-canonical-types
13767 +Whether the compiler should use the ``canonical'' type system. By
13768 +default, this should always be 1, which uses a more efficient internal
13769 +mechanism for comparing types in C++ and Objective-C++. However, if
13770 +bugs in the canonical type system are causing compilation failures,
13771 +set this value to 0 to disable canonical types.
13773 +@item switch-conversion-max-branch-ratio
13774 +Switch initialization conversion will refuse to create arrays that are
13775 +bigger than @option{switch-conversion-max-branch-ratio} times the number of
13776 +branches in the switch.
13778 +@item max-partial-antic-length
13779 +Maximum length of the partial antic set computed during the tree
13780 +partial redundancy elimination optimization (@option{-ftree-pre}) when
13781 +optimizing at @option{-O3} and above. For some sorts of source code
13782 +the enhanced partial redundancy elimination optimization can run away,
13783 +consuming all of the memory available on the host machine. This
13784 +parameter sets a limit on the length of the sets that are computed,
13785 +which prevents the runaway behavior. Setting a value of 0 for
13786 +this parameter will allow an unlimited set length.
13788 +@item sccvn-max-scc-size
13789 +Maximum size of a strongly connected component (SCC) during SCCVN
13790 +processing. If this limit is hit, SCCVN processing for the whole
13791 +function will not be done and optimizations depending on it will
13792 +be disabled. The default maximum SCC size is 10000.
13794 +@item ira-max-loops-num
13795 +IRA uses a regional register allocation by default. If a function
13796 +contains loops more than number given by the parameter, only at most
13797 +given number of the most frequently executed loops will form regions
13798 +for the regional register allocation. The default value of the
13799 +parameter is 100.
13801 +@item ira-max-conflict-table-size
13802 +Although IRA uses a sophisticated algorithm of compression conflict
13803 +table, the table can be still big for huge functions. If the conflict
13804 +table for a function could be more than size in MB given by the
13805 +parameter, the conflict table is not built and faster, simpler, and
13806 +lower quality register allocation algorithm will be used. The
13807 +algorithm do not use pseudo-register conflicts. The default value of
13808 +the parameter is 2000.
13810 +@item ira-loop-reserved-regs
13811 +IRA can be used to evaluate more accurate register pressure in loops
13812 +for decision to move loop invariants (see @option{-O3}). The number
13813 +of available registers reserved for some other purposes is described
13814 +by this parameter. The default value of the parameter is 2 which is
13815 +minimal number of registers needed for execution of typical
13816 +instruction. This value is the best found from numerous experiments.
13818 +@item loop-invariant-max-bbs-in-loop
13819 +Loop invariant motion can be very expensive, both in compile time and
13820 +in amount of needed compile time memory, with very large loops. Loops
13821 +with more basic blocks than this parameter won't have loop invariant
13822 +motion optimization performed on them. The default value of the
13823 +parameter is 1000 for -O1 and 10000 for -O2 and above.
13825 +@item max-vartrack-size
13826 +Sets a maximum number of hash table slots to use during variable
13827 +tracking dataflow analysis of any function. If this limit is exceeded
13828 +with variable tracking at assignments enabled, analysis for that
13829 +function is retried without it, after removing all debug insns from
13830 +the function. If the limit is exceeded even without debug insns, var
13831 +tracking analysis is completely disabled for the function. Setting
13832 +the parameter to zero makes it unlimited.
13834 +@item min-nondebug-insn-uid
13835 +Use uids starting at this parameter for nondebug insns. The range below
13836 +the parameter is reserved exclusively for debug insns created by
13837 +@option{-fvar-tracking-assignments}, but debug insns may get
13838 +(non-overlapping) uids above it if the reserved range is exhausted.
13840 +@item ipa-sra-ptr-growth-factor
13841 +IPA-SRA will replace a pointer to an aggregate with one or more new
13842 +parameters only when their cumulative size is less or equal to
13843 +@option{ipa-sra-ptr-growth-factor} times the size of the original
13844 +pointer parameter.
13846 +@item graphite-max-nb-scop-params
13847 +To avoid exponential effects in the Graphite loop transforms, the
13848 +number of parameters in a Static Control Part (SCoP) is bounded. The
13849 +default value is 10 parameters. A variable whose value is unknown at
13850 +compile time and defined outside a SCoP is a parameter of the SCoP.
13852 +@item graphite-max-bbs-per-function
13853 +To avoid exponential effects in the detection of SCoPs, the size of
13854 +the functions analyzed by Graphite is bounded. The default value is
13855 +100 basic blocks.
13857 +@item loop-block-tile-size
13858 +Loop blocking or strip mining transforms, enabled with
13859 +@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
13860 +loop in the loop nest by a given number of iterations. The strip
13861 +length can be changed using the @option{loop-block-tile-size}
13862 +parameter. The default value is 51 iterations.
13864 +@item devirt-type-list-size
13865 +IPA-CP attempts to track all possible types passed to a function's
13866 +parameter in order to perform devirtualization.
13867 +@option{devirt-type-list-size} is the maximum number of types it
13868 +stores per a single formal parameter of a function.
13870 +@item lto-partitions
13871 +Specify desired number of partitions produced during WHOPR compilation.
13872 +The number of partitions should exceed the number of CPUs used for compilation.
13873 +The default value is 32.
13875 +@item lto-minpartition
13876 +Size of minimal partition for WHOPR (in estimated instructions).
13877 +This prevents expenses of splitting very small programs into too many
13878 +partitions.
13880 +@item cxx-max-namespaces-for-diagnostic-help
13881 +The maximum number of namespaces to consult for suggestions when C++
13882 +name lookup fails for an identifier. The default is 1000.
13884 +@end table
13885 +@end table
13887 +@node Preprocessor Options
13888 +@section Options Controlling the Preprocessor
13889 +@cindex preprocessor options
13890 +@cindex options, preprocessor
13892 +These options control the C preprocessor, which is run on each C source
13893 +file before actual compilation.
13895 +If you use the @option{-E} option, nothing is done except preprocessing.
13896 +Some of these options make sense only together with @option{-E} because
13897 +they cause the preprocessor output to be unsuitable for actual
13898 +compilation.
13900 +@table @gcctabopt
13901 +@item -Wp,@var{option}
13902 +@opindex Wp
13903 +You can use @option{-Wp,@var{option}} to bypass the compiler driver
13904 +and pass @var{option} directly through to the preprocessor. If
13905 +@var{option} contains commas, it is split into multiple options at the
13906 +commas. However, many options are modified, translated or interpreted
13907 +by the compiler driver before being passed to the preprocessor, and
13908 +@option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13909 +interface is undocumented and subject to change, so whenever possible
13910 +you should avoid using @option{-Wp} and let the driver handle the
13911 +options instead.
13913 +@item -Xpreprocessor @var{option}
13914 +@opindex Xpreprocessor
13915 +Pass @var{option} as an option to the preprocessor. You can use this to
13916 +supply system-specific preprocessor options which GCC does not know how to
13917 +recognize.
13919 +If you want to pass an option that takes an argument, you must use
13920 +@option{-Xpreprocessor} twice, once for the option and once for the argument.
13921 +@end table
13923 +@include cppopts.texi
13925 +@node Assembler Options
13926 +@section Passing Options to the Assembler
13928 +@c prevent bad page break with this line
13929 +You can pass options to the assembler.
13931 +@table @gcctabopt
13932 +@item -Wa,@var{option}
13933 +@opindex Wa
13934 +Pass @var{option} as an option to the assembler. If @var{option}
13935 +contains commas, it is split into multiple options at the commas.
13937 +@item -Xassembler @var{option}
13938 +@opindex Xassembler
13939 +Pass @var{option} as an option to the assembler. You can use this to
13940 +supply system-specific assembler options which GCC does not know how to
13941 +recognize.
13943 +If you want to pass an option that takes an argument, you must use
13944 +@option{-Xassembler} twice, once for the option and once for the argument.
13946 +@end table
13948 +@node Link Options
13949 +@section Options for Linking
13950 +@cindex link options
13951 +@cindex options, linking
13953 +These options come into play when the compiler links object files into
13954 +an executable output file. They are meaningless if the compiler is
13955 +not doing a link step.
13957 +@table @gcctabopt
13958 +@cindex file names
13959 +@item @var{object-file-name}
13960 +A file name that does not end in a special recognized suffix is
13961 +considered to name an object file or library. (Object files are
13962 +distinguished from libraries by the linker according to the file
13963 +contents.) If linking is done, these object files are used as input
13964 +to the linker.
13966 +@item -c
13967 +@itemx -S
13968 +@itemx -E
13969 +@opindex c
13970 +@opindex S
13971 +@opindex E
13972 +If any of these options is used, then the linker is not run, and
13973 +object file names should not be used as arguments. @xref{Overall
13974 +Options}.
13976 +@cindex Libraries
13977 +@item -l@var{library}
13978 +@itemx -l @var{library}
13979 +@opindex l
13980 +Search the library named @var{library} when linking. (The second
13981 +alternative with the library as a separate argument is only for
13982 +POSIX compliance and is not recommended.)
13984 +It makes a difference where in the command you write this option; the
13985 +linker searches and processes libraries and object files in the order they
13986 +are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13987 +after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13988 +to functions in @samp{z}, those functions may not be loaded.
13990 +The linker searches a standard list of directories for the library,
13991 +which is actually a file named @file{lib@var{library}.a}. The linker
13992 +then uses this file as if it had been specified precisely by name.
13994 +The directories searched include several standard system directories
13995 +plus any that you specify with @option{-L}.
13997 +Normally the files found this way are library files---archive files
13998 +whose members are object files. The linker handles an archive file by
13999 +scanning through it for members which define symbols that have so far
14000 +been referenced but not defined. But if the file that is found is an
14001 +ordinary object file, it is linked in the usual fashion. The only
14002 +difference between using an @option{-l} option and specifying a file name
14003 +is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
14004 +and searches several directories.
14006 +@item -lobjc
14007 +@opindex lobjc
14008 +You need this special case of the @option{-l} option in order to
14009 +link an Objective-C or Objective-C++ program.
14011 +@item -nostartfiles
14012 +@opindex nostartfiles
14013 +Do not use the standard system startup files when linking.
14014 +The standard system libraries are used normally, unless @option{-nostdlib}
14015 +or @option{-nodefaultlibs} is used.
14017 +@item -nodefaultlibs
14018 +@opindex nodefaultlibs
14019 +Do not use the standard system libraries when linking.
14020 +Only the libraries you specify will be passed to the linker, options
14021 +specifying linkage of the system libraries, such as @code{-static-libgcc}
14022 +or @code{-shared-libgcc}, will be ignored.
14023 +The standard startup files are used normally, unless @option{-nostartfiles}
14024 +is used. The compiler may generate calls to @code{memcmp},
14025 +@code{memset}, @code{memcpy} and @code{memmove}.
14026 +These entries are usually resolved by entries in
14027 +libc. These entry points should be supplied through some other
14028 +mechanism when this option is specified.
14030 +@item -nostdlib
14031 +@opindex nostdlib
14032 +Do not use the standard system startup files or libraries when linking.
14033 +No startup files and only the libraries you specify will be passed to
14034 +the linker, options specifying linkage of the system libraries, such as
14035 +@code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
14036 +The compiler may generate calls to @code{memcmp}, @code{memset},
14037 +@code{memcpy} and @code{memmove}.
14038 +These entries are usually resolved by entries in
14039 +libc. These entry points should be supplied through some other
14040 +mechanism when this option is specified.
14042 +@cindex @option{-lgcc}, use with @option{-nostdlib}
14043 +@cindex @option{-nostdlib} and unresolved references
14044 +@cindex unresolved references and @option{-nostdlib}
14045 +@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14046 +@cindex @option{-nodefaultlibs} and unresolved references
14047 +@cindex unresolved references and @option{-nodefaultlibs}
14048 +One of the standard libraries bypassed by @option{-nostdlib} and
14049 +@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14050 +that GCC uses to overcome shortcomings of particular machines, or special
14051 +needs for some languages.
14052 +(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14053 +Collection (GCC) Internals},
14054 +for more discussion of @file{libgcc.a}.)
14055 +In most cases, you need @file{libgcc.a} even when you want to avoid
14056 +other standard libraries. In other words, when you specify @option{-nostdlib}
14057 +or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14058 +This ensures that you have no unresolved references to internal GCC
14059 +library subroutines. (For example, @samp{__main}, used to ensure C++
14060 +constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
14061 +GNU Compiler Collection (GCC) Internals}.)
14063 +@item -pie
14064 +@opindex pie
14065 +Produce a position independent executable on targets which support it.
14066 +For predictable results, you must also specify the same set of options
14067 +that were used to generate code (@option{-fpie}, @option{-fPIE},
14068 +or model suboptions) when you specify this option.
14070 +@item -rdynamic
14071 +@opindex rdynamic
14072 +Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14073 +that support it. This instructs the linker to add all symbols, not
14074 +only used ones, to the dynamic symbol table. This option is needed
14075 +for some uses of @code{dlopen} or to allow obtaining backtraces
14076 +from within a program.
14078 +@item -s
14079 +@opindex s
14080 +Remove all symbol table and relocation information from the executable.
14082 +@item -static
14083 +@opindex static
14084 +On systems that support dynamic linking, this prevents linking with the shared
14085 +libraries. On other systems, this option has no effect.
14087 +@item -shared
14088 +@opindex shared
14089 +Produce a shared object which can then be linked with other objects to
14090 +form an executable. Not all systems support this option. For predictable
14091 +results, you must also specify the same set of options that were used to
14092 +generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
14093 +when you specify this option.@footnote{On some systems, @samp{gcc -shared}
14094 +needs to build supplementary stub code for constructors to work. On
14095 +multi-libbed systems, @samp{gcc -shared} must select the correct support
14096 +libraries to link against. Failing to supply the correct flags may lead
14097 +to subtle defects. Supplying them in cases where they are not necessary
14098 +is innocuous.}
14100 +@item -shared-libgcc
14101 +@itemx -static-libgcc
14102 +@opindex shared-libgcc
14103 +@opindex static-libgcc
14104 +On systems that provide @file{libgcc} as a shared library, these options
14105 +force the use of either the shared or static version respectively.
14106 +If no shared version of @file{libgcc} was built when the compiler was
14107 +configured, these options have no effect.
14109 +There are several situations in which an application should use the
14110 +shared @file{libgcc} instead of the static version. The most common
14111 +of these is when the application wishes to throw and catch exceptions
14112 +across different shared libraries. In that case, each of the libraries
14113 +as well as the application itself should use the shared @file{libgcc}.
14115 +Therefore, the G++ and GCJ drivers automatically add
14116 +@option{-shared-libgcc} whenever you build a shared library or a main
14117 +executable, because C++ and Java programs typically use exceptions, so
14118 +this is the right thing to do.
14120 +If, instead, you use the GCC driver to create shared libraries, you may
14121 +find that they will not always be linked with the shared @file{libgcc}.
14122 +If GCC finds, at its configuration time, that you have a non-GNU linker
14123 +or a GNU linker that does not support option @option{--eh-frame-hdr},
14124 +it will link the shared version of @file{libgcc} into shared libraries
14125 +by default. Otherwise, it will take advantage of the linker and optimize
14126 +away the linking with the shared version of @file{libgcc}, linking with
14127 +the static version of libgcc by default. This allows exceptions to
14128 +propagate through such shared libraries, without incurring relocation
14129 +costs at library load time.
14131 +However, if a library or main executable is supposed to throw or catch
14132 +exceptions, you must link it using the G++ or GCJ driver, as appropriate
14133 +for the languages used in the program, or using the option
14134 +@option{-shared-libgcc}, such that it is linked with the shared
14135 +@file{libgcc}.
14137 +@item -static-libstdc++
14138 +When the @command{g++} program is used to link a C++ program, it will
14139 +normally automatically link against @option{libstdc++}. If
14140 +@file{libstdc++} is available as a shared library, and the
14141 +@option{-static} option is not used, then this will link against the
14142 +shared version of @file{libstdc++}. That is normally fine. However, it
14143 +is sometimes useful to freeze the version of @file{libstdc++} used by
14144 +the program without going all the way to a fully static link. The
14145 +@option{-static-libstdc++} option directs the @command{g++} driver to
14146 +link @file{libstdc++} statically, without necessarily linking other
14147 +libraries statically.
14149 +@item -symbolic
14150 +@opindex symbolic
14151 +Bind references to global symbols when building a shared object. Warn
14152 +about any unresolved references (unless overridden by the link editor
14153 +option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
14154 +this option.
14156 +@item -T @var{script}
14157 +@opindex T
14158 +@cindex linker script
14159 +Use @var{script} as the linker script. This option is supported by most
14160 +systems using the GNU linker. On some targets, such as bare-board
14161 +targets without an operating system, the @option{-T} option may be required
14162 +when linking to avoid references to undefined symbols.
14164 +@item -Xlinker @var{option}
14165 +@opindex Xlinker
14166 +Pass @var{option} as an option to the linker. You can use this to
14167 +supply system-specific linker options which GCC does not know how to
14168 +recognize.
14170 +If you want to pass an option that takes a separate argument, you must use
14171 +@option{-Xlinker} twice, once for the option and once for the argument.
14172 +For example, to pass @option{-assert definitions}, you must write
14173 +@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
14174 +@option{-Xlinker "-assert definitions"}, because this passes the entire
14175 +string as a single argument, which is not what the linker expects.
14177 +When using the GNU linker, it is usually more convenient to pass
14178 +arguments to linker options using the @option{@var{option}=@var{value}}
14179 +syntax than as separate arguments. For example, you can specify
14180 +@samp{-Xlinker -Map=output.map} rather than
14181 +@samp{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
14182 +this syntax for command-line options.
14184 +@item -Wl,@var{option}
14185 +@opindex Wl
14186 +Pass @var{option} as an option to the linker. If @var{option} contains
14187 +commas, it is split into multiple options at the commas. You can use this
14188 +syntax to pass an argument to the option.
14189 +For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
14190 +linker. When using the GNU linker, you can also get the same effect with
14191 +@samp{-Wl,-Map=output.map}.
14193 +@item -u @var{symbol}
14194 +@opindex u
14195 +Pretend the symbol @var{symbol} is undefined, to force linking of
14196 +library modules to define it. You can use @option{-u} multiple times with
14197 +different symbols to force loading of additional library modules.
14198 +@end table
14200 +@node Directory Options
14201 +@section Options for Directory Search
14202 +@cindex directory options
14203 +@cindex options, directory search
14204 +@cindex search path
14206 +These options specify directories to search for header files, for
14207 +libraries and for parts of the compiler:
14209 +@table @gcctabopt
14210 +@item -I@var{dir}
14211 +@opindex I
14212 +Add the directory @var{dir} to the head of the list of directories to be
14213 +searched for header files. This can be used to override a system header
14214 +file, substituting your own version, since these directories are
14215 +searched before the system header file directories. However, you should
14216 +not use this option to add directories that contain vendor-supplied
14217 +system header files (use @option{-isystem} for that). If you use more than
14218 +one @option{-I} option, the directories are scanned in left-to-right
14219 +order; the standard system directories come after.
14221 +If a standard system include directory, or a directory specified with
14222 +@option{-isystem}, is also specified with @option{-I}, the @option{-I}
14223 +option will be ignored. The directory will still be searched but as a
14224 +system directory at its normal position in the system include chain.
14225 +This is to ensure that GCC's procedure to fix buggy system headers and
14226 +the ordering for the include_next directive are not inadvertently changed.
14227 +If you really need to change the search order for system directories,
14228 +use the @option{-nostdinc} and/or @option{-isystem} options.
14230 +@item -iplugindir=@var{dir}
14231 +Set the directory to search for plugins which are passed
14232 +by @option{-fplugin=@var{name}} instead of
14233 +@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
14234 +to be used by the user, but only passed by the driver.
14236 +@item -iquote@var{dir}
14237 +@opindex iquote
14238 +Add the directory @var{dir} to the head of the list of directories to
14239 +be searched for header files only for the case of @samp{#include
14240 +"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
14241 +otherwise just like @option{-I}.
14243 +@item -L@var{dir}
14244 +@opindex L
14245 +Add directory @var{dir} to the list of directories to be searched
14246 +for @option{-l}.
14248 +@item -B@var{prefix}
14249 +@opindex B
14250 +This option specifies where to find the executables, libraries,
14251 +include files, and data files of the compiler itself.
14253 +The compiler driver program runs one or more of the subprograms
14254 +@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
14255 +@var{prefix} as a prefix for each program it tries to run, both with and
14256 +without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
14258 +For each subprogram to be run, the compiler driver first tries the
14259 +@option{-B} prefix, if any. If that name is not found, or if @option{-B}
14260 +was not specified, the driver tries two standard prefixes, which are
14261 +@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
14262 +those results in a file name that is found, the unmodified program
14263 +name is searched for using the directories specified in your
14264 +@env{PATH} environment variable.
14266 +The compiler will check to see if the path provided by the @option{-B}
14267 +refers to a directory, and if necessary it will add a directory
14268 +separator character at the end of the path.
14270 +@option{-B} prefixes that effectively specify directory names also apply
14271 +to libraries in the linker, because the compiler translates these
14272 +options into @option{-L} options for the linker. They also apply to
14273 +includes files in the preprocessor, because the compiler translates these
14274 +options into @option{-isystem} options for the preprocessor. In this case,
14275 +the compiler appends @samp{include} to the prefix.
14277 +The run-time support file @file{libgcc.a} can also be searched for using
14278 +the @option{-B} prefix, if needed. If it is not found there, the two
14279 +standard prefixes above are tried, and that is all. The file is left
14280 +out of the link if it is not found by those means.
14282 +Another way to specify a prefix much like the @option{-B} prefix is to use
14283 +the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
14284 +Variables}.
14286 +As a special kludge, if the path provided by @option{-B} is
14287 +@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
14288 +9, then it will be replaced by @file{[dir/]include}. This is to help
14289 +with boot-strapping the compiler.
14291 +@item -specs=@var{file}
14292 +@opindex specs
14293 +Process @var{file} after the compiler reads in the standard @file{specs}
14294 +file, in order to override the defaults that the @file{gcc} driver
14295 +program uses when determining what switches to pass to @file{cc1},
14296 +@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
14297 +@option{-specs=@var{file}} can be specified on the command line, and they
14298 +are processed in order, from left to right.
14300 +@item --sysroot=@var{dir}
14301 +@opindex sysroot
14302 +Use @var{dir} as the logical root directory for headers and libraries.
14303 +For example, if the compiler would normally search for headers in
14304 +@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
14305 +search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
14307 +If you use both this option and the @option{-isysroot} option, then
14308 +the @option{--sysroot} option will apply to libraries, but the
14309 +@option{-isysroot} option will apply to header files.
14311 +The GNU linker (beginning with version 2.16) has the necessary support
14312 +for this option. If your linker does not support this option, the
14313 +header file aspect of @option{--sysroot} will still work, but the
14314 +library aspect will not.
14316 +@item -I-
14317 +@opindex I-
14318 +This option has been deprecated. Please use @option{-iquote} instead for
14319 +@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
14320 +Any directories you specify with @option{-I} options before the @option{-I-}
14321 +option are searched only for the case of @samp{#include "@var{file}"};
14322 +they are not searched for @samp{#include <@var{file}>}.
14324 +If additional directories are specified with @option{-I} options after
14325 +the @option{-I-}, these directories are searched for all @samp{#include}
14326 +directives. (Ordinarily @emph{all} @option{-I} directories are used
14327 +this way.)
14329 +In addition, the @option{-I-} option inhibits the use of the current
14330 +directory (where the current input file came from) as the first search
14331 +directory for @samp{#include "@var{file}"}. There is no way to
14332 +override this effect of @option{-I-}. With @option{-I.} you can specify
14333 +searching the directory which was current when the compiler was
14334 +invoked. That is not exactly the same as what the preprocessor does
14335 +by default, but it is often satisfactory.
14337 +@option{-I-} does not inhibit the use of the standard system directories
14338 +for header files. Thus, @option{-I-} and @option{-nostdinc} are
14339 +independent.
14340 +@end table
14342 +@c man end
14344 +@node Spec Files
14345 +@section Specifying subprocesses and the switches to pass to them
14346 +@cindex Spec Files
14348 +@command{gcc} is a driver program. It performs its job by invoking a
14349 +sequence of other programs to do the work of compiling, assembling and
14350 +linking. GCC interprets its command-line parameters and uses these to
14351 +deduce which programs it should invoke, and which command-line options
14352 +it ought to place on their command lines. This behavior is controlled
14353 +by @dfn{spec strings}. In most cases there is one spec string for each
14354 +program that GCC can invoke, but a few programs have multiple spec
14355 +strings to control their behavior. The spec strings built into GCC can
14356 +be overridden by using the @option{-specs=} command-line switch to specify
14357 +a spec file.
14359 +@dfn{Spec files} are plaintext files that are used to construct spec
14360 +strings. They consist of a sequence of directives separated by blank
14361 +lines. The type of directive is determined by the first non-whitespace
14362 +character on the line and it can be one of the following:
14364 +@table @code
14365 +@item %@var{command}
14366 +Issues a @var{command} to the spec file processor. The commands that can
14367 +appear here are:
14369 +@table @code
14370 +@item %include <@var{file}>
14371 +@cindex @code{%include}
14372 +Search for @var{file} and insert its text at the current point in the
14373 +specs file.
14375 +@item %include_noerr <@var{file}>
14376 +@cindex @code{%include_noerr}
14377 +Just like @samp{%include}, but do not generate an error message if the include
14378 +file cannot be found.
14380 +@item %rename @var{old_name} @var{new_name}
14381 +@cindex @code{%rename}
14382 +Rename the spec string @var{old_name} to @var{new_name}.
14384 +@end table
14386 +@item *[@var{spec_name}]:
14387 +This tells the compiler to create, override or delete the named spec
14388 +string. All lines after this directive up to the next directive or
14389 +blank line are considered to be the text for the spec string. If this
14390 +results in an empty string then the spec will be deleted. (Or, if the
14391 +spec did not exist, then nothing will happened.) Otherwise, if the spec
14392 +does not currently exist a new spec will be created. If the spec does
14393 +exist then its contents will be overridden by the text of this
14394 +directive, unless the first character of that text is the @samp{+}
14395 +character, in which case the text will be appended to the spec.
14397 +@item [@var{suffix}]:
14398 +Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
14399 +and up to the next directive or blank line are considered to make up the
14400 +spec string for the indicated suffix. When the compiler encounters an
14401 +input file with the named suffix, it will processes the spec string in
14402 +order to work out how to compile that file. For example:
14404 +@smallexample
14405 +.ZZ:
14406 +z-compile -input %i
14407 +@end smallexample
14409 +This says that any input file whose name ends in @samp{.ZZ} should be
14410 +passed to the program @samp{z-compile}, which should be invoked with the
14411 +command-line switch @option{-input} and with the result of performing the
14412 +@samp{%i} substitution. (See below.)
14414 +As an alternative to providing a spec string, the text that follows a
14415 +suffix directive can be one of the following:
14417 +@table @code
14418 +@item @@@var{language}
14419 +This says that the suffix is an alias for a known @var{language}. This is
14420 +similar to using the @option{-x} command-line switch to GCC to specify a
14421 +language explicitly. For example:
14423 +@smallexample
14424 +.ZZ:
14425 +@@c++
14426 +@end smallexample
14428 +Says that .ZZ files are, in fact, C++ source files.
14430 +@item #@var{name}
14431 +This causes an error messages saying:
14433 +@smallexample
14434 +@var{name} compiler not installed on this system.
14435 +@end smallexample
14436 +@end table
14438 +GCC already has an extensive list of suffixes built into it.
14439 +This directive will add an entry to the end of the list of suffixes, but
14440 +since the list is searched from the end backwards, it is effectively
14441 +possible to override earlier entries using this technique.
14443 +@end table
14445 +GCC has the following spec strings built into it. Spec files can
14446 +override these strings or create their own. Note that individual
14447 +targets can also add their own spec strings to this list.
14449 +@smallexample
14450 +asm Options to pass to the assembler
14451 +asm_final Options to pass to the assembler post-processor
14452 +cpp Options to pass to the C preprocessor
14453 +cc1 Options to pass to the C compiler
14454 +cc1plus Options to pass to the C++ compiler
14455 +endfile Object files to include at the end of the link
14456 +link Options to pass to the linker
14457 +lib Libraries to include on the command line to the linker
14458 +libgcc Decides which GCC support library to pass to the linker
14459 +linker Sets the name of the linker
14460 +predefines Defines to be passed to the C preprocessor
14461 +signed_char Defines to pass to CPP to say whether @code{char} is signed
14462 + by default
14463 +startfile Object files to include at the start of the link
14464 +@end smallexample
14466 +Here is a small example of a spec file:
14468 +@smallexample
14469 +%rename lib old_lib
14471 +*lib:
14472 +--start-group -lgcc -lc -leval1 --end-group %(old_lib)
14473 +@end smallexample
14475 +This example renames the spec called @samp{lib} to @samp{old_lib} and
14476 +then overrides the previous definition of @samp{lib} with a new one.
14477 +The new definition adds in some extra command-line options before
14478 +including the text of the old definition.
14480 +@dfn{Spec strings} are a list of command-line options to be passed to their
14481 +corresponding program. In addition, the spec strings can contain
14482 +@samp{%}-prefixed sequences to substitute variable text or to
14483 +conditionally insert text into the command line. Using these constructs
14484 +it is possible to generate quite complex command lines.
14486 +Here is a table of all defined @samp{%}-sequences for spec
14487 +strings. Note that spaces are not generated automatically around the
14488 +results of expanding these sequences. Therefore you can concatenate them
14489 +together or combine them with constant text in a single argument.
14491 +@table @code
14492 +@item %%
14493 +Substitute one @samp{%} into the program name or argument.
14495 +@item %i
14496 +Substitute the name of the input file being processed.
14498 +@item %b
14499 +Substitute the basename of the input file being processed.
14500 +This is the substring up to (and not including) the last period
14501 +and not including the directory.
14503 +@item %B
14504 +This is the same as @samp{%b}, but include the file suffix (text after
14505 +the last period).
14507 +@item %d
14508 +Marks the argument containing or following the @samp{%d} as a
14509 +temporary file name, so that that file will be deleted if GCC exits
14510 +successfully. Unlike @samp{%g}, this contributes no text to the
14511 +argument.
14513 +@item %g@var{suffix}
14514 +Substitute a file name that has suffix @var{suffix} and is chosen
14515 +once per compilation, and mark the argument in the same way as
14516 +@samp{%d}. To reduce exposure to denial-of-service attacks, the file
14517 +name is now chosen in a way that is hard to predict even when previously
14518 +chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
14519 +might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
14520 +the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
14521 +treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
14522 +was simply substituted with a file name chosen once per compilation,
14523 +without regard to any appended suffix (which was therefore treated
14524 +just like ordinary text), making such attacks more likely to succeed.
14526 +@item %u@var{suffix}
14527 +Like @samp{%g}, but generates a new temporary file name even if
14528 +@samp{%u@var{suffix}} was already seen.
14530 +@item %U@var{suffix}
14531 +Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
14532 +new one if there is no such last file name. In the absence of any
14533 +@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
14534 +the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
14535 +would involve the generation of two distinct file names, one
14536 +for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
14537 +simply substituted with a file name chosen for the previous @samp{%u},
14538 +without regard to any appended suffix.
14540 +@item %j@var{suffix}
14541 +Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
14542 +writable, and if save-temps is off; otherwise, substitute the name
14543 +of a temporary file, just like @samp{%u}. This temporary file is not
14544 +meant for communication between processes, but rather as a junk
14545 +disposal mechanism.
14547 +@item %|@var{suffix}
14548 +@itemx %m@var{suffix}
14549 +Like @samp{%g}, except if @option{-pipe} is in effect. In that case
14550 +@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
14551 +all. These are the two most common ways to instruct a program that it
14552 +should read from standard input or write to standard output. If you
14553 +need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
14554 +construct: see for example @file{f/lang-specs.h}.
14556 +@item %.@var{SUFFIX}
14557 +Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
14558 +when it is subsequently output with @samp{%*}. @var{SUFFIX} is
14559 +terminated by the next space or %.
14561 +@item %w
14562 +Marks the argument containing or following the @samp{%w} as the
14563 +designated output file of this compilation. This puts the argument
14564 +into the sequence of arguments that @samp{%o} will substitute later.
14566 +@item %o
14567 +Substitutes the names of all the output files, with spaces
14568 +automatically placed around them. You should write spaces
14569 +around the @samp{%o} as well or the results are undefined.
14570 +@samp{%o} is for use in the specs for running the linker.
14571 +Input files whose names have no recognized suffix are not compiled
14572 +at all, but they are included among the output files, so they will
14573 +be linked.
14575 +@item %O
14576 +Substitutes the suffix for object files. Note that this is
14577 +handled specially when it immediately follows @samp{%g, %u, or %U},
14578 +because of the need for those to form complete file names. The
14579 +handling is such that @samp{%O} is treated exactly as if it had already
14580 +been substituted, except that @samp{%g, %u, and %U} do not currently
14581 +support additional @var{suffix} characters following @samp{%O} as they would
14582 +following, for example, @samp{.o}.
14584 +@item %p
14585 +Substitutes the standard macro predefinitions for the
14586 +current target machine. Use this when running @code{cpp}.
14588 +@item %P
14589 +Like @samp{%p}, but puts @samp{__} before and after the name of each
14590 +predefined macro, except for macros that start with @samp{__} or with
14591 +@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
14592 +C@.
14594 +@item %I
14595 +Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
14596 +@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
14597 +@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
14598 +and @option{-imultilib} as necessary.
14600 +@item %s
14601 +Current argument is the name of a library or startup file of some sort.
14602 +Search for that file in a standard list of directories and substitute
14603 +the full name found. The current working directory is included in the
14604 +list of directories scanned.
14606 +@item %T
14607 +Current argument is the name of a linker script. Search for that file
14608 +in the current list of directories to scan for libraries. If the file
14609 +is located insert a @option{--script} option into the command line
14610 +followed by the full path name found. If the file is not found then
14611 +generate an error message. Note: the current working directory is not
14612 +searched.
14614 +@item %e@var{str}
14615 +Print @var{str} as an error message. @var{str} is terminated by a newline.
14616 +Use this when inconsistent options are detected.
14618 +@item %(@var{name})
14619 +Substitute the contents of spec string @var{name} at this point.
14621 +@item %[@var{name}]
14622 +Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
14624 +@item %x@{@var{option}@}
14625 +Accumulate an option for @samp{%X}.
14627 +@item %X
14628 +Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
14629 +spec string.
14631 +@item %Y
14632 +Output the accumulated assembler options specified by @option{-Wa}.
14634 +@item %Z
14635 +Output the accumulated preprocessor options specified by @option{-Wp}.
14637 +@item %a
14638 +Process the @code{asm} spec. This is used to compute the
14639 +switches to be passed to the assembler.
14641 +@item %A
14642 +Process the @code{asm_final} spec. This is a spec string for
14643 +passing switches to an assembler post-processor, if such a program is
14644 +needed.
14646 +@item %l
14647 +Process the @code{link} spec. This is the spec for computing the
14648 +command line passed to the linker. Typically it will make use of the
14649 +@samp{%L %G %S %D and %E} sequences.
14651 +@item %D
14652 +Dump out a @option{-L} option for each directory that GCC believes might
14653 +contain startup files. If the target supports multilibs then the
14654 +current multilib directory will be prepended to each of these paths.
14656 +@item %L
14657 +Process the @code{lib} spec. This is a spec string for deciding which
14658 +libraries should be included on the command line to the linker.
14660 +@item %G
14661 +Process the @code{libgcc} spec. This is a spec string for deciding
14662 +which GCC support library should be included on the command line to the linker.
14664 +@item %S
14665 +Process the @code{startfile} spec. This is a spec for deciding which
14666 +object files should be the first ones passed to the linker. Typically
14667 +this might be a file named @file{crt0.o}.
14669 +@item %E
14670 +Process the @code{endfile} spec. This is a spec string that specifies
14671 +the last object files that will be passed to the linker.
14673 +@item %C
14674 +Process the @code{cpp} spec. This is used to construct the arguments
14675 +to be passed to the C preprocessor.
14677 +@item %1
14678 +Process the @code{cc1} spec. This is used to construct the options to be
14679 +passed to the actual C compiler (@samp{cc1}).
14681 +@item %2
14682 +Process the @code{cc1plus} spec. This is used to construct the options to be
14683 +passed to the actual C++ compiler (@samp{cc1plus}).
14685 +@item %*
14686 +Substitute the variable part of a matched option. See below.
14687 +Note that each comma in the substituted string is replaced by
14688 +a single space.
14690 +@item %<@code{S}
14691 +Remove all occurrences of @code{-S} from the command line. Note---this
14692 +command is position dependent. @samp{%} commands in the spec string
14693 +before this one will see @code{-S}, @samp{%} commands in the spec string
14694 +after this one will not.
14696 +@item %:@var{function}(@var{args})
14697 +Call the named function @var{function}, passing it @var{args}.
14698 +@var{args} is first processed as a nested spec string, then split
14699 +into an argument vector in the usual fashion. The function returns
14700 +a string which is processed as if it had appeared literally as part
14701 +of the current spec.
14703 +The following built-in spec functions are provided:
14705 +@table @code
14706 +@item @code{getenv}
14707 +The @code{getenv} spec function takes two arguments: an environment
14708 +variable name and a string. If the environment variable is not
14709 +defined, a fatal error is issued. Otherwise, the return value is the
14710 +value of the environment variable concatenated with the string. For
14711 +example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
14713 +@smallexample
14714 +%:getenv(TOPDIR /include)
14715 +@end smallexample
14717 +expands to @file{/path/to/top/include}.
14719 +@item @code{if-exists}
14720 +The @code{if-exists} spec function takes one argument, an absolute
14721 +pathname to a file. If the file exists, @code{if-exists} returns the
14722 +pathname. Here is a small example of its usage:
14724 +@smallexample
14725 +*startfile:
14726 +crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
14727 +@end smallexample
14729 +@item @code{if-exists-else}
14730 +The @code{if-exists-else} spec function is similar to the @code{if-exists}
14731 +spec function, except that it takes two arguments. The first argument is
14732 +an absolute pathname to a file. If the file exists, @code{if-exists-else}
14733 +returns the pathname. If it does not exist, it returns the second argument.
14734 +This way, @code{if-exists-else} can be used to select one file or another,
14735 +based on the existence of the first. Here is a small example of its usage:
14737 +@smallexample
14738 +*startfile:
14739 +crt0%O%s %:if-exists(crti%O%s) \
14740 +%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
14741 +@end smallexample
14743 +@item @code{replace-outfile}
14744 +The @code{replace-outfile} spec function takes two arguments. It looks for the
14745 +first argument in the outfiles array and replaces it with the second argument. Here
14746 +is a small example of its usage:
14748 +@smallexample
14749 +%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
14750 +@end smallexample
14752 +@item @code{remove-outfile}
14753 +The @code{remove-outfile} spec function takes one argument. It looks for the
14754 +first argument in the outfiles array and removes it. Here is a small example
14755 +its usage:
14757 +@smallexample
14758 +%:remove-outfile(-lm)
14759 +@end smallexample
14761 +@item @code{pass-through-libs}
14762 +The @code{pass-through-libs} spec function takes any number of arguments. It
14763 +finds any @option{-l} options and any non-options ending in ".a" (which it
14764 +assumes are the names of linker input library archive files) and returns a
14765 +result containing all the found arguments each prepended by
14766 +@option{-plugin-opt=-pass-through=} and joined by spaces. This list is
14767 +intended to be passed to the LTO linker plugin.
14769 +@smallexample
14770 +%:pass-through-libs(%G %L %G)
14771 +@end smallexample
14773 +@item @code{print-asm-header}
14774 +The @code{print-asm-header} function takes no arguments and simply
14775 +prints a banner like:
14777 +@smallexample
14778 +Assembler options
14779 +=================
14781 +Use "-Wa,OPTION" to pass "OPTION" to the assembler.
14782 +@end smallexample
14784 +It is used to separate compiler options from assembler options
14785 +in the @option{--target-help} output.
14786 +@end table
14788 +@item %@{@code{S}@}
14789 +Substitutes the @code{-S} switch, if that switch was given to GCC@.
14790 +If that switch was not specified, this substitutes nothing. Note that
14791 +the leading dash is omitted when specifying this option, and it is
14792 +automatically inserted if the substitution is performed. Thus the spec
14793 +string @samp{%@{foo@}} would match the command-line option @option{-foo}
14794 +and would output the command line option @option{-foo}.
14796 +@item %W@{@code{S}@}
14797 +Like %@{@code{S}@} but mark last argument supplied within as a file to be
14798 +deleted on failure.
14800 +@item %@{@code{S}*@}
14801 +Substitutes all the switches specified to GCC whose names start
14802 +with @code{-S}, but which also take an argument. This is used for
14803 +switches like @option{-o}, @option{-D}, @option{-I}, etc.
14804 +GCC considers @option{-o foo} as being
14805 +one switch whose names starts with @samp{o}. %@{o*@} would substitute this
14806 +text, including the space. Thus two arguments would be generated.
14808 +@item %@{@code{S}*&@code{T}*@}
14809 +Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
14810 +(the order of @code{S} and @code{T} in the spec is not significant).
14811 +There can be any number of ampersand-separated variables; for each the
14812 +wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
14814 +@item %@{@code{S}:@code{X}@}
14815 +Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
14817 +@item %@{!@code{S}:@code{X}@}
14818 +Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
14820 +@item %@{@code{S}*:@code{X}@}
14821 +Substitutes @code{X} if one or more switches whose names start with
14822 +@code{-S} are specified to GCC@. Normally @code{X} is substituted only
14823 +once, no matter how many such switches appeared. However, if @code{%*}
14824 +appears somewhere in @code{X}, then @code{X} will be substituted once
14825 +for each matching switch, with the @code{%*} replaced by the part of
14826 +that switch that matched the @code{*}.
14828 +@item %@{.@code{S}:@code{X}@}
14829 +Substitutes @code{X}, if processing a file with suffix @code{S}.
14831 +@item %@{!.@code{S}:@code{X}@}
14832 +Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
14834 +@item %@{,@code{S}:@code{X}@}
14835 +Substitutes @code{X}, if processing a file for language @code{S}.
14837 +@item %@{!,@code{S}:@code{X}@}
14838 +Substitutes @code{X}, if not processing a file for language @code{S}.
14840 +@item %@{@code{S}|@code{P}:@code{X}@}
14841 +Substitutes @code{X} if either @code{-S} or @code{-P} was given to
14842 +GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
14843 +@code{*} sequences as well, although they have a stronger binding than
14844 +the @samp{|}. If @code{%*} appears in @code{X}, all of the
14845 +alternatives must be starred, and only the first matching alternative
14846 +is substituted.
14848 +For example, a spec string like this:
14850 +@smallexample
14851 +%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
14852 +@end smallexample
14854 +will output the following command-line options from the following input
14855 +command-line options:
14857 +@smallexample
14858 +fred.c -foo -baz
14859 +jim.d -bar -boggle
14860 +-d fred.c -foo -baz -boggle
14861 +-d jim.d -bar -baz -boggle
14862 +@end smallexample
14864 +@item %@{S:X; T:Y; :D@}
14866 +If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
14867 +given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
14868 +be as many clauses as you need. This may be combined with @code{.},
14869 +@code{,}, @code{!}, @code{|}, and @code{*} as needed.
14872 +@end table
14874 +The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
14875 +construct may contain other nested @samp{%} constructs or spaces, or
14876 +even newlines. They are processed as usual, as described above.
14877 +Trailing white space in @code{X} is ignored. White space may also
14878 +appear anywhere on the left side of the colon in these constructs,
14879 +except between @code{.} or @code{*} and the corresponding word.
14881 +The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
14882 +handled specifically in these constructs. If another value of
14883 +@option{-O} or the negated form of a @option{-f}, @option{-m}, or
14884 +@option{-W} switch is found later in the command line, the earlier
14885 +switch value is ignored, except with @{@code{S}*@} where @code{S} is
14886 +just one letter, which passes all matching options.
14888 +The character @samp{|} at the beginning of the predicate text is used to
14889 +indicate that a command should be piped to the following command, but
14890 +only if @option{-pipe} is specified.
14892 +It is built into GCC which switches take arguments and which do not.
14893 +(You might think it would be useful to generalize this to allow each
14894 +compiler's spec to say which switches take arguments. But this cannot
14895 +be done in a consistent fashion. GCC cannot even decide which input
14896 +files have been specified without knowing which switches take arguments,
14897 +and it must know which input files to compile in order to tell which
14898 +compilers to run).
14900 +GCC also knows implicitly that arguments starting in @option{-l} are to be
14901 +treated as compiler output files, and passed to the linker in their
14902 +proper position among the other output files.
14904 +@c man begin OPTIONS
14906 +@node Target Options
14907 +@section Specifying Target Machine and Compiler Version
14908 +@cindex target options
14909 +@cindex cross compiling
14910 +@cindex specifying machine version
14911 +@cindex specifying compiler version and target machine
14912 +@cindex compiler version, specifying
14913 +@cindex target machine, specifying
14915 +The usual way to run GCC is to run the executable called @command{gcc}, or
14916 +@command{@var{machine}-gcc} when cross-compiling, or
14917 +@command{@var{machine}-gcc-@var{version}} to run a version other than the
14918 +one that was installed last.
14920 +@node Submodel Options
14921 +@section Hardware Models and Configurations
14922 +@cindex submodel options
14923 +@cindex specifying hardware config
14924 +@cindex hardware models and configurations, specifying
14925 +@cindex machine dependent options
14927 +Each target machine types can have its own
14928 +special options, starting with @samp{-m}, to choose among various
14929 +hardware models or configurations---for example, 68010 vs 68020,
14930 +floating coprocessor or none. A single installed version of the
14931 +compiler can compile for any model or configuration, according to the
14932 +options specified.
14934 +Some configurations of the compiler also support additional special
14935 +options, usually for compatibility with other compilers on the same
14936 +platform.
14938 +@c This list is ordered alphanumerically by subsection name.
14939 +@c It should be the same order and spelling as these options are listed
14940 +@c in Machine Dependent Options
14942 +@menu
14943 +* ARC Options::
14944 +* ARM Options::
14945 +* AVR Options::
14946 +* Blackfin Options::
14947 +* CRIS Options::
14948 +* CRX Options::
14949 +* Darwin Options::
14950 +* DEC Alpha Options::
14951 +* DEC Alpha/VMS Options::
14952 +* FR30 Options::
14953 +* FRV Options::
14954 +* GNU/Linux Options::
14955 +* H8/300 Options::
14956 +* HPPA Options::
14957 +* i386 and x86-64 Options::
14958 +* i386 and x86-64 Windows Options::
14959 +* IA-64 Options::
14960 +* IA-64/VMS Options::
14961 +* LM32 Options::
14962 +* M32C Options::
14963 +* M32R/D Options::
14964 +* M680x0 Options::
14965 +* M68hc1x Options::
14966 +* MCore Options::
14967 +* MeP Options::
14968 +* MicroBlaze Options::
14969 +* MIPS Options::
14970 +* MMIX Options::
14971 +* MN10300 Options::
14972 +* PDP-11 Options::
14973 +* picoChip Options::
14974 +* PowerPC Options::
14975 +* RS/6000 and PowerPC Options::
14976 +* RX Options::
14977 +* S/390 and zSeries Options::
14978 +* Score Options::
14979 +* SH Options::
14980 +* Solaris 2 Options::
14981 +* SPARC Options::
14982 +* SPU Options::
14983 +* System V Options::
14984 +* V850 Options::
14985 +* VAX Options::
14986 +* VxWorks Options::
14987 +* x86-64 Options::
14988 +* Xstormy16 Options::
14989 +* Xtensa Options::
14990 +* zSeries Options::
14991 +@end menu
14993 +@node ARC Options
14994 +@subsection ARC Options
14995 +@cindex ARC Options
14997 +These options are defined for ARC implementations:
14999 +@table @gcctabopt
15000 +@item -EL
15001 +@opindex EL
15002 +Compile code for little endian mode. This is the default.
15004 +@item -EB
15005 +@opindex EB
15006 +Compile code for big endian mode.
15008 +@item -mmangle-cpu
15009 +@opindex mmangle-cpu
15010 +Prepend the name of the CPU to all public symbol names.
15011 +In multiple-processor systems, there are many ARC variants with different
15012 +instruction and register set characteristics. This flag prevents code
15013 +compiled for one CPU to be linked with code compiled for another.
15014 +No facility exists for handling variants that are ``almost identical''.
15015 +This is an all or nothing option.
15017 +@item -mcpu=@var{cpu}
15018 +@opindex mcpu
15019 +Compile code for ARC variant @var{cpu}.
15020 +Which variants are supported depend on the configuration.
15021 +All variants support @option{-mcpu=base}, this is the default.
15023 +@item -mtext=@var{text-section}
15024 +@itemx -mdata=@var{data-section}
15025 +@itemx -mrodata=@var{readonly-data-section}
15026 +@opindex mtext
15027 +@opindex mdata
15028 +@opindex mrodata
15029 +Put functions, data, and readonly data in @var{text-section},
15030 +@var{data-section}, and @var{readonly-data-section} respectively
15031 +by default. This can be overridden with the @code{section} attribute.
15032 +@xref{Variable Attributes}.
15034 +@end table
15036 +@node ARM Options
15037 +@subsection ARM Options
15038 +@cindex ARM options
15040 +These @samp{-m} options are defined for Advanced RISC Machines (ARM)
15041 +architectures:
15043 +@table @gcctabopt
15044 +@item -mabi=@var{name}
15045 +@opindex mabi
15046 +Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15047 +@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15049 +@item -mapcs-frame
15050 +@opindex mapcs-frame
15051 +Generate a stack frame that is compliant with the ARM Procedure Call
15052 +Standard for all functions, even if this is not strictly necessary for
15053 +correct execution of the code. Specifying @option{-fomit-frame-pointer}
15054 +with this option will cause the stack frames not to be generated for
15055 +leaf functions. The default is @option{-mno-apcs-frame}.
15057 +@item -mapcs
15058 +@opindex mapcs
15059 +This is a synonym for @option{-mapcs-frame}.
15061 +@ignore
15062 +@c not currently implemented
15063 +@item -mapcs-stack-check
15064 +@opindex mapcs-stack-check
15065 +Generate code to check the amount of stack space available upon entry to
15066 +every function (that actually uses some stack space). If there is
15067 +insufficient space available then either the function
15068 +@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
15069 +called, depending upon the amount of stack space required. The run time
15070 +system is required to provide these functions. The default is
15071 +@option{-mno-apcs-stack-check}, since this produces smaller code.
15073 +@c not currently implemented
15074 +@item -mapcs-float
15075 +@opindex mapcs-float
15076 +Pass floating point arguments using the float point registers. This is
15077 +one of the variants of the APCS@. This option is recommended if the
15078 +target hardware has a floating point unit or if a lot of floating point
15079 +arithmetic is going to be performed by the code. The default is
15080 +@option{-mno-apcs-float}, since integer only code is slightly increased in
15081 +size if @option{-mapcs-float} is used.
15083 +@c not currently implemented
15084 +@item -mapcs-reentrant
15085 +@opindex mapcs-reentrant
15086 +Generate reentrant, position independent code. The default is
15087 +@option{-mno-apcs-reentrant}.
15088 +@end ignore
15090 +@item -mthumb-interwork
15091 +@opindex mthumb-interwork
15092 +Generate code which supports calling between the ARM and Thumb
15093 +instruction sets. Without this option the two instruction sets cannot
15094 +be reliably used inside one program. The default is
15095 +@option{-mno-thumb-interwork}, since slightly larger code is generated
15096 +when @option{-mthumb-interwork} is specified.
15098 +@item -mno-sched-prolog
15099 +@opindex mno-sched-prolog
15100 +Prevent the reordering of instructions in the function prolog, or the
15101 +merging of those instruction with the instructions in the function's
15102 +body. This means that all functions will start with a recognizable set
15103 +of instructions (or in fact one of a choice from a small set of
15104 +different function prologues), and this information can be used to
15105 +locate the start if functions inside an executable piece of code. The
15106 +default is @option{-msched-prolog}.
15108 +@item -mfloat-abi=@var{name}
15109 +@opindex mfloat-abi
15110 +Specifies which floating-point ABI to use. Permissible values
15111 +are: @samp{soft}, @samp{softfp} and @samp{hard}.
15113 +Specifying @samp{soft} causes GCC to generate output containing
15114 +library calls for floating-point operations.
15115 +@samp{softfp} allows the generation of code using hardware floating-point
15116 +instructions, but still uses the soft-float calling conventions.
15117 +@samp{hard} allows generation of floating-point instructions
15118 +and uses FPU-specific calling conventions.
15120 +The default depends on the specific target configuration. Note that
15121 +the hard-float and soft-float ABIs are not link-compatible; you must
15122 +compile your entire program with the same ABI, and link with a
15123 +compatible set of libraries.
15125 +@item -mhard-float
15126 +@opindex mhard-float
15127 +Equivalent to @option{-mfloat-abi=hard}.
15129 +@item -msoft-float
15130 +@opindex msoft-float
15131 +Equivalent to @option{-mfloat-abi=soft}.
15133 +@item -mlittle-endian
15134 +@opindex mlittle-endian
15135 +Generate code for a processor running in little-endian mode. This is
15136 +the default for all standard configurations.
15138 +@item -mbig-endian
15139 +@opindex mbig-endian
15140 +Generate code for a processor running in big-endian mode; the default is
15141 +to compile code for a little-endian processor.
15143 +@item -mwords-little-endian
15144 +@opindex mwords-little-endian
15145 +This option only applies when generating code for big-endian processors.
15146 +Generate code for a little-endian word order but a big-endian byte
15147 +order. That is, a byte order of the form @samp{32107654}. Note: this
15148 +option should only be used if you require compatibility with code for
15149 +big-endian ARM processors generated by versions of the compiler prior to
15150 +2.8.
15152 +@item -mcpu=@var{name}
15153 +@opindex mcpu
15154 +This specifies the name of the target ARM processor. GCC uses this name
15155 +to determine what kind of instructions it can emit when generating
15156 +assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
15157 +@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
15158 +@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
15159 +@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
15160 +@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
15161 +@samp{arm720},
15162 +@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
15163 +@samp{arm710t}, @samp{arm720t}, @samp{arm740t},
15164 +@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
15165 +@samp{strongarm1110},
15166 +@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
15167 +@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
15168 +@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
15169 +@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
15170 +@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
15171 +@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
15172 +@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
15173 +@samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a15},
15174 +@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
15175 +@samp{cortex-m1},
15176 +@samp{cortex-m0},
15177 +@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
15179 +@item -mtune=@var{name}
15180 +@opindex mtune
15181 +This option is very similar to the @option{-mcpu=} option, except that
15182 +instead of specifying the actual target processor type, and hence
15183 +restricting which instructions can be used, it specifies that GCC should
15184 +tune the performance of the code as if the target were of the type
15185 +specified in this option, but still choosing the instructions that it
15186 +will generate based on the CPU specified by a @option{-mcpu=} option.
15187 +For some ARM implementations better performance can be obtained by using
15188 +this option.
15190 +@item -march=@var{name}
15191 +@opindex march
15192 +This specifies the name of the target ARM architecture. GCC uses this
15193 +name to determine what kind of instructions it can emit when generating
15194 +assembly code. This option can be used in conjunction with or instead
15195 +of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
15196 +@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
15197 +@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
15198 +@samp{armv6}, @samp{armv6j},
15199 +@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
15200 +@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
15201 +@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
15203 +@item -mfpu=@var{name}
15204 +@itemx -mfpe=@var{number}
15205 +@itemx -mfp=@var{number}
15206 +@opindex mfpu
15207 +@opindex mfpe
15208 +@opindex mfp
15209 +This specifies what floating point hardware (or hardware emulation) is
15210 +available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
15211 +@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
15212 +@samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
15213 +@samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
15214 +@samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
15215 +@option{-mfp} and @option{-mfpe} are synonyms for
15216 +@option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
15217 +of GCC@.
15219 +If @option{-msoft-float} is specified this specifies the format of
15220 +floating point values.
15222 +If the selected floating-point hardware includes the NEON extension
15223 +(e.g. @option{-mfpu}=@samp{neon}), note that floating-point
15224 +operations will not be used by GCC's auto-vectorization pass unless
15225 +@option{-funsafe-math-optimizations} is also specified. This is
15226 +because NEON hardware does not fully implement the IEEE 754 standard for
15227 +floating-point arithmetic (in particular denormal values are treated as
15228 +zero), so the use of NEON instructions may lead to a loss of precision.
15230 +@item -mfp16-format=@var{name}
15231 +@opindex mfp16-format
15232 +Specify the format of the @code{__fp16} half-precision floating-point type.
15233 +Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15234 +the default is @samp{none}, in which case the @code{__fp16} type is not
15235 +defined. @xref{Half-Precision}, for more information.
15237 +@item -mstructure-size-boundary=@var{n}
15238 +@opindex mstructure-size-boundary
15239 +The size of all structures and unions will be rounded up to a multiple
15240 +of the number of bits set by this option. Permissible values are 8, 32
15241 +and 64. The default value varies for different toolchains. For the COFF
15242 +targeted toolchain the default value is 8. A value of 64 is only allowed
15243 +if the underlying ABI supports it.
15245 +Specifying the larger number can produce faster, more efficient code, but
15246 +can also increase the size of the program. Different values are potentially
15247 +incompatible. Code compiled with one value cannot necessarily expect to
15248 +work with code or libraries compiled with another value, if they exchange
15249 +information using structures or unions.
15251 +@item -mabort-on-noreturn
15252 +@opindex mabort-on-noreturn
15253 +Generate a call to the function @code{abort} at the end of a
15254 +@code{noreturn} function. It will be executed if the function tries to
15255 +return.
15257 +@item -mlong-calls
15258 +@itemx -mno-long-calls
15259 +@opindex mlong-calls
15260 +@opindex mno-long-calls
15261 +Tells the compiler to perform function calls by first loading the
15262 +address of the function into a register and then performing a subroutine
15263 +call on this register. This switch is needed if the target function
15264 +will lie outside of the 64 megabyte addressing range of the offset based
15265 +version of subroutine call instruction.
15267 +Even if this switch is enabled, not all function calls will be turned
15268 +into long calls. The heuristic is that static functions, functions
15269 +which have the @samp{short-call} attribute, functions that are inside
15270 +the scope of a @samp{#pragma no_long_calls} directive and functions whose
15271 +definitions have already been compiled within the current compilation
15272 +unit, will not be turned into long calls. The exception to this rule is
15273 +that weak function definitions, functions with the @samp{long-call}
15274 +attribute or the @samp{section} attribute, and functions that are within
15275 +the scope of a @samp{#pragma long_calls} directive, will always be
15276 +turned into long calls.
15278 +This feature is not enabled by default. Specifying
15279 +@option{-mno-long-calls} will restore the default behavior, as will
15280 +placing the function calls within the scope of a @samp{#pragma
15281 +long_calls_off} directive. Note these switches have no effect on how
15282 +the compiler generates code to handle function calls via function
15283 +pointers.
15285 +@item -msingle-pic-base
15286 +@opindex msingle-pic-base
15287 +Treat the register used for PIC addressing as read-only, rather than
15288 +loading it in the prologue for each function. The run-time system is
15289 +responsible for initializing this register with an appropriate value
15290 +before execution begins.
15292 +@item -mpic-register=@var{reg}
15293 +@opindex mpic-register
15294 +Specify the register to be used for PIC addressing. The default is R10
15295 +unless stack-checking is enabled, when R9 is used.
15297 +@item -mcirrus-fix-invalid-insns
15298 +@opindex mcirrus-fix-invalid-insns
15299 +@opindex mno-cirrus-fix-invalid-insns
15300 +Insert NOPs into the instruction stream to in order to work around
15301 +problems with invalid Maverick instruction combinations. This option
15302 +is only valid if the @option{-mcpu=ep9312} option has been used to
15303 +enable generation of instructions for the Cirrus Maverick floating
15304 +point co-processor. This option is not enabled by default, since the
15305 +problem is only present in older Maverick implementations. The default
15306 +can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
15307 +switch.
15309 +@item -mpoke-function-name
15310 +@opindex mpoke-function-name
15311 +Write the name of each function into the text section, directly
15312 +preceding the function prologue. The generated code is similar to this:
15314 +@smallexample
15315 + t0
15316 + .ascii "arm_poke_function_name", 0
15317 + .align
15318 + t1
15319 + .word 0xff000000 + (t1 - t0)
15320 + arm_poke_function_name
15321 + mov ip, sp
15322 + stmfd sp!, @{fp, ip, lr, pc@}
15323 + sub fp, ip, #4
15324 +@end smallexample
15326 +When performing a stack backtrace, code can inspect the value of
15327 +@code{pc} stored at @code{fp + 0}. If the trace function then looks at
15328 +location @code{pc - 12} and the top 8 bits are set, then we know that
15329 +there is a function name embedded immediately preceding this location
15330 +and has length @code{((pc[-3]) & 0xff000000)}.
15332 +@item -mthumb
15333 +@opindex mthumb
15334 +Generate code for the Thumb instruction set. The default is to
15335 +use the 32-bit ARM instruction set.
15336 +This option automatically enables either 16-bit Thumb-1 or
15337 +mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
15338 +and @option{-march=@var{name}} options. This option is not passed to the
15339 +assembler. If you want to force assembler files to be interpreted as Thumb code,
15340 +either add a @samp{.thumb} directive to the source or pass the @option{-mthumb}
15341 +option directly to the assembler by prefixing it with @option{-Wa}.
15343 +@item -mtpcs-frame
15344 +@opindex mtpcs-frame
15345 +Generate a stack frame that is compliant with the Thumb Procedure Call
15346 +Standard for all non-leaf functions. (A leaf function is one that does
15347 +not call any other functions.) The default is @option{-mno-tpcs-frame}.
15349 +@item -mtpcs-leaf-frame
15350 +@opindex mtpcs-leaf-frame
15351 +Generate a stack frame that is compliant with the Thumb Procedure Call
15352 +Standard for all leaf functions. (A leaf function is one that does
15353 +not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15355 +@item -mcallee-super-interworking
15356 +@opindex mcallee-super-interworking
15357 +Gives all externally visible functions in the file being compiled an ARM
15358 +instruction set header which switches to Thumb mode before executing the
15359 +rest of the function. This allows these functions to be called from
15360 +non-interworking code. This option is not valid in AAPCS configurations
15361 +because interworking is enabled by default.
15363 +@item -mcaller-super-interworking
15364 +@opindex mcaller-super-interworking
15365 +Allows calls via function pointers (including virtual functions) to
15366 +execute correctly regardless of whether the target code has been
15367 +compiled for interworking or not. There is a small overhead in the cost
15368 +of executing a function pointer if this option is enabled. This option
15369 +is not valid in AAPCS configurations because interworking is enabled
15370 +by default.
15372 +@item -mtp=@var{name}
15373 +@opindex mtp
15374 +Specify the access model for the thread local storage pointer. The valid
15375 +models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
15376 +@option{cp15}, which fetches the thread pointer from @code{cp15} directly
15377 +(supported in the arm6k architecture), and @option{auto}, which uses the
15378 +best available method for the selected processor. The default setting is
15379 +@option{auto}.
15381 +@item -mword-relocations
15382 +@opindex mword-relocations
15383 +Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
15384 +This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15385 +loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15386 +is specified.
15388 +@item -mfix-cortex-m3-ldrd
15389 +@opindex mfix-cortex-m3-ldrd
15390 +Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15391 +with overlapping destination and base registers are used. This option avoids
15392 +generating these instructions. This option is enabled by default when
15393 +@option{-mcpu=cortex-m3} is specified.
15395 +@end table
15397 +@node AVR Options
15398 +@subsection AVR Options
15399 +@cindex AVR Options
15401 +These options are defined for AVR implementations:
15403 +@table @gcctabopt
15404 +@item -mmcu=@var{mcu}
15405 +@opindex mmcu
15406 +Specify ATMEL AVR instruction set or MCU type.
15408 +Instruction set avr1 is for the minimal AVR core, not supported by the C
15409 +compiler, only for assembler programs (MCU types: at90s1200, attiny10,
15410 +attiny11, attiny12, attiny15, attiny28).
15412 +Instruction set avr2 (default) is for the classic AVR core with up to
15413 +8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
15414 +at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
15415 +at90c8534, at90s8535).
15417 +Instruction set avr3 is for the classic AVR core with up to 128K program
15418 +memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
15420 +Instruction set avr4 is for the enhanced AVR core with up to 8K program
15421 +memory space (MCU types: atmega8, atmega83, atmega85).
15423 +Instruction set avr5 is for the enhanced AVR core with up to 128K program
15424 +memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
15425 +atmega64, atmega128, at43usb355, at94k).
15427 +@item -mno-interrupts
15428 +@opindex mno-interrupts
15429 +Generated code is not compatible with hardware interrupts.
15430 +Code size will be smaller.
15432 +@item -mcall-prologues
15433 +@opindex mcall-prologues
15434 +Functions prologues/epilogues expanded as call to appropriate
15435 +subroutines. Code size will be smaller.
15437 +@item -mtiny-stack
15438 +@opindex mtiny-stack
15439 +Change only the low 8 bits of the stack pointer.
15441 +@item -mint8
15442 +@opindex mint8
15443 +Assume int to be 8 bit integer. This affects the sizes of all types: A
15444 +char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
15445 +and long long will be 4 bytes. Please note that this option does not
15446 +comply to the C standards, but it will provide you with smaller code
15447 +size.
15448 +@end table
15450 +@subsubsection @code{EIND} and Devices with more than 128k Bytes of Flash
15452 +Pointers in the implementation are 16 bits wide.
15453 +The address of a function or label is represented as word address so
15454 +that indirect jumps and calls can address any code address in the
15455 +range of 64k words.
15457 +In order to faciliate indirect jump on devices with more than 128k
15458 +bytes of program memory space, there is a special function register called
15459 +@code{EIND} that serves as most significant part of the target address
15460 +when @code{EICALL} or @code{EIJMP} instructions are used.
15462 +Indirect jumps and calls on these devices are handled as follows and
15463 +are subject to some limitations:
15465 +@itemize @bullet
15467 +@item
15468 +The compiler never sets @code{EIND}.
15470 +@item
15471 +The startup code from libgcc never sets @code{EIND}.
15472 +Notice that startup code is a blend of code from libgcc and avr-libc.
15473 +For the impact of avr-libc on @code{EIND}, see the
15474 +@w{@uref{http://nongnu.org/avr-libc/user-manual,avr-libc user manual}}.
15476 +@item
15477 +The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
15478 +instructions or might read @code{EIND} directly.
15480 +@item
15481 +The compiler assumes that @code{EIND} never changes during the startup
15482 +code or run of the application. In particular, @code{EIND} is not
15483 +saved/restored in function or interrupt service routine
15484 +prologue/epilogue.
15486 +@item
15487 +It is legitimate for user-specific startup code to set up @code{EIND}
15488 +early, for example by means of initialization code located in
15489 +section @code{.init3}, and thus prior to general startup code that
15490 +initializes RAM and calls constructors.
15492 +@item
15493 +For indirect calls to functions and computed goto, the linker will
15494 +generate @emph{stubs}. Stubs are jump pads sometimes also called
15495 +@emph{trampolines}. Thus, the indirect call/jump will jump to such a stub.
15496 +The stub contains a direct jump to the desired address.
15498 +@item
15499 +Stubs will be generated automatically by the linker if
15500 +the following two conditions are met:
15501 +@itemize @minus
15503 +@item The address of a label is taken by means of the @code{gs} modifier
15504 +(short for @emph{generate stubs}) like so:
15505 +@example
15506 +LDI r24, lo8(gs(@var{func}))
15507 +LDI r25, hi8(gs(@var{func}))
15508 +@end example
15509 +@item The final location of that label is in a code segment
15510 +@emph{outside} the segment where the stubs are located.
15511 +@end itemize
15513 +@item
15514 +The compiler will emit such @code{gs} modifiers for code labels in the
15515 +following situations:
15516 +@itemize @minus
15517 +@item Taking address of a function or code label.
15518 +@item Computed goto.
15519 +@item If prologue-save function is used, see @option{-mcall-prologues}
15520 +command line option.
15521 +@item Switch/case dispatch tables. If you do not want such dispatch
15522 +tables you can specify the @option{-fno-jump-tables} command line option.
15523 +@item C and C++ constructors/destructors called during startup/shutdown.
15524 +@item If the tools hit a @code{gs()} modifier explained above.
15525 +@end itemize
15527 +@item
15528 +The default linker script is arranged for code with @code{EIND = 0}.
15529 +If code is supposed to work for a setup with @code{EIND != 0}, a custom
15530 +linker script has to be used in order to place the sections whose
15531 +name start with @code{.trampolines} into the segment where @code{EIND}
15532 +points to.
15534 +@item
15535 +Jumping to non-symbolic addresses like so is @emph{not} supported:
15537 +@example
15538 +int main (void)
15540 + /* Call function at word address 0x2 */
15541 + return ((int(*)(void)) 0x2)();
15543 +@end example
15545 +Instead, a stub has to be set up:
15547 +@example
15548 +int main (void)
15550 + extern int func_4 (void);
15552 + /* Call function at byte address 0x4 */
15553 + return func_4();
15555 +@end example
15557 +and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
15558 +Alternatively, @code{func_4} can be defined in the linker script.
15559 +@end itemize
15561 +@node Blackfin Options
15562 +@subsection Blackfin Options
15563 +@cindex Blackfin Options
15565 +@table @gcctabopt
15566 +@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15567 +@opindex mcpu=
15568 +Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15569 +can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15570 +@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15571 +@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15572 +@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15573 +@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15574 +@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15575 +@samp{bf561}.
15576 +The optional @var{sirevision} specifies the silicon revision of the target
15577 +Blackfin processor. Any workarounds available for the targeted silicon revision
15578 +will be enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15579 +If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15580 +will be enabled. The @code{__SILICON_REVISION__} macro is defined to two
15581 +hexadecimal digits representing the major and minor numbers in the silicon
15582 +revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15583 +is not defined. If @var{sirevision} is @samp{any}, the
15584 +@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15585 +If this optional @var{sirevision} is not used, GCC assumes the latest known
15586 +silicon revision of the targeted Blackfin processor.
15588 +Support for @samp{bf561} is incomplete. For @samp{bf561},
15589 +Only the processor macro is defined.
15590 +Without this option, @samp{bf532} is used as the processor by default.
15591 +The corresponding predefined processor macros for @var{cpu} is to
15592 +be defined. And for @samp{bfin-elf} toolchain, this causes the hardware BSP
15593 +provided by libgloss to be linked in if @option{-msim} is not given.
15595 +@item -msim
15596 +@opindex msim
15597 +Specifies that the program will be run on the simulator. This causes
15598 +the simulator BSP provided by libgloss to be linked in. This option
15599 +has effect only for @samp{bfin-elf} toolchain.
15600 +Certain other options, such as @option{-mid-shared-library} and
15601 +@option{-mfdpic}, imply @option{-msim}.
15603 +@item -momit-leaf-frame-pointer
15604 +@opindex momit-leaf-frame-pointer
15605 +Don't keep the frame pointer in a register for leaf functions. This
15606 +avoids the instructions to save, set up and restore frame pointers and
15607 +makes an extra register available in leaf functions. The option
15608 +@option{-fomit-frame-pointer} removes the frame pointer for all functions
15609 +which might make debugging harder.
15611 +@item -mspecld-anomaly
15612 +@opindex mspecld-anomaly
15613 +When enabled, the compiler will ensure that the generated code does not
15614 +contain speculative loads after jump instructions. If this option is used,
15615 +@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15617 +@item -mno-specld-anomaly
15618 +@opindex mno-specld-anomaly
15619 +Don't generate extra code to prevent speculative loads from occurring.
15621 +@item -mcsync-anomaly
15622 +@opindex mcsync-anomaly
15623 +When enabled, the compiler will ensure that the generated code does not
15624 +contain CSYNC or SSYNC instructions too soon after conditional branches.
15625 +If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15627 +@item -mno-csync-anomaly
15628 +@opindex mno-csync-anomaly
15629 +Don't generate extra code to prevent CSYNC or SSYNC instructions from
15630 +occurring too soon after a conditional branch.
15632 +@item -mlow-64k
15633 +@opindex mlow-64k
15634 +When enabled, the compiler is free to take advantage of the knowledge that
15635 +the entire program fits into the low 64k of memory.
15637 +@item -mno-low-64k
15638 +@opindex mno-low-64k
15639 +Assume that the program is arbitrarily large. This is the default.
15641 +@item -mstack-check-l1
15642 +@opindex mstack-check-l1
15643 +Do stack checking using information placed into L1 scratchpad memory by the
15644 +uClinux kernel.
15646 +@item -mid-shared-library
15647 +@opindex mid-shared-library
15648 +Generate code that supports shared libraries via the library ID method.
15649 +This allows for execute in place and shared libraries in an environment
15650 +without virtual memory management. This option implies @option{-fPIC}.
15651 +With a @samp{bfin-elf} target, this option implies @option{-msim}.
15653 +@item -mno-id-shared-library
15654 +@opindex mno-id-shared-library
15655 +Generate code that doesn't assume ID based shared libraries are being used.
15656 +This is the default.
15658 +@item -mleaf-id-shared-library
15659 +@opindex mleaf-id-shared-library
15660 +Generate code that supports shared libraries via the library ID method,
15661 +but assumes that this library or executable won't link against any other
15662 +ID shared libraries. That allows the compiler to use faster code for jumps
15663 +and calls.
15665 +@item -mno-leaf-id-shared-library
15666 +@opindex mno-leaf-id-shared-library
15667 +Do not assume that the code being compiled won't link against any ID shared
15668 +libraries. Slower code will be generated for jump and call insns.
15670 +@item -mshared-library-id=n
15671 +@opindex mshared-library-id
15672 +Specified the identification number of the ID based shared library being
15673 +compiled. Specifying a value of 0 will generate more compact code, specifying
15674 +other values will force the allocation of that number to the current
15675 +library but is no more space or time efficient than omitting this option.
15677 +@item -msep-data
15678 +@opindex msep-data
15679 +Generate code that allows the data segment to be located in a different
15680 +area of memory from the text segment. This allows for execute in place in
15681 +an environment without virtual memory management by eliminating relocations
15682 +against the text section.
15684 +@item -mno-sep-data
15685 +@opindex mno-sep-data
15686 +Generate code that assumes that the data segment follows the text segment.
15687 +This is the default.
15689 +@item -mlong-calls
15690 +@itemx -mno-long-calls
15691 +@opindex mlong-calls
15692 +@opindex mno-long-calls
15693 +Tells the compiler to perform function calls by first loading the
15694 +address of the function into a register and then performing a subroutine
15695 +call on this register. This switch is needed if the target function
15696 +will lie outside of the 24 bit addressing range of the offset based
15697 +version of subroutine call instruction.
15699 +This feature is not enabled by default. Specifying
15700 +@option{-mno-long-calls} will restore the default behavior. Note these
15701 +switches have no effect on how the compiler generates code to handle
15702 +function calls via function pointers.
15704 +@item -mfast-fp
15705 +@opindex mfast-fp
15706 +Link with the fast floating-point library. This library relaxes some of
15707 +the IEEE floating-point standard's rules for checking inputs against
15708 +Not-a-Number (NAN), in the interest of performance.
15710 +@item -minline-plt
15711 +@opindex minline-plt
15712 +Enable inlining of PLT entries in function calls to functions that are
15713 +not known to bind locally. It has no effect without @option{-mfdpic}.
15715 +@item -mmulticore
15716 +@opindex mmulticore
15717 +Build standalone application for multicore Blackfin processor. Proper
15718 +start files and link scripts will be used to support multicore.
15719 +This option defines @code{__BFIN_MULTICORE}. It can only be used with
15720 +@option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
15721 +@option{-mcorea} or @option{-mcoreb}. If it's used without
15722 +@option{-mcorea} or @option{-mcoreb}, single application/dual core
15723 +programming model is used. In this model, the main function of Core B
15724 +should be named as coreb_main. If it's used with @option{-mcorea} or
15725 +@option{-mcoreb}, one application per core programming model is used.
15726 +If this option is not used, single core application programming
15727 +model is used.
15729 +@item -mcorea
15730 +@opindex mcorea
15731 +Build standalone application for Core A of BF561 when using
15732 +one application per core programming model. Proper start files
15733 +and link scripts will be used to support Core A. This option
15734 +defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
15736 +@item -mcoreb
15737 +@opindex mcoreb
15738 +Build standalone application for Core B of BF561 when using
15739 +one application per core programming model. Proper start files
15740 +and link scripts will be used to support Core B. This option
15741 +defines @code{__BFIN_COREB}. When this option is used, coreb_main
15742 +should be used instead of main. It must be used with
15743 +@option{-mmulticore}.
15745 +@item -msdram
15746 +@opindex msdram
15747 +Build standalone application for SDRAM. Proper start files and
15748 +link scripts will be used to put the application into SDRAM.
15749 +Loader should initialize SDRAM before loading the application
15750 +into SDRAM. This option defines @code{__BFIN_SDRAM}.
15752 +@item -micplb
15753 +@opindex micplb
15754 +Assume that ICPLBs are enabled at runtime. This has an effect on certain
15755 +anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15756 +are enabled; for standalone applications the default is off.
15757 +@end table
15759 +@node CRIS Options
15760 +@subsection CRIS Options
15761 +@cindex CRIS Options
15763 +These options are defined specifically for the CRIS ports.
15765 +@table @gcctabopt
15766 +@item -march=@var{architecture-type}
15767 +@itemx -mcpu=@var{architecture-type}
15768 +@opindex march
15769 +@opindex mcpu
15770 +Generate code for the specified architecture. The choices for
15771 +@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15772 +respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15773 +Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15774 +@samp{v10}.
15776 +@item -mtune=@var{architecture-type}
15777 +@opindex mtune
15778 +Tune to @var{architecture-type} everything applicable about the generated
15779 +code, except for the ABI and the set of available instructions. The
15780 +choices for @var{architecture-type} are the same as for
15781 +@option{-march=@var{architecture-type}}.
15783 +@item -mmax-stack-frame=@var{n}
15784 +@opindex mmax-stack-frame
15785 +Warn when the stack frame of a function exceeds @var{n} bytes.
15787 +@item -metrax4
15788 +@itemx -metrax100
15789 +@opindex metrax4
15790 +@opindex metrax100
15791 +The options @option{-metrax4} and @option{-metrax100} are synonyms for
15792 +@option{-march=v3} and @option{-march=v8} respectively.
15794 +@item -mmul-bug-workaround
15795 +@itemx -mno-mul-bug-workaround
15796 +@opindex mmul-bug-workaround
15797 +@opindex mno-mul-bug-workaround
15798 +Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15799 +models where it applies. This option is active by default.
15801 +@item -mpdebug
15802 +@opindex mpdebug
15803 +Enable CRIS-specific verbose debug-related information in the assembly
15804 +code. This option also has the effect to turn off the @samp{#NO_APP}
15805 +formatted-code indicator to the assembler at the beginning of the
15806 +assembly file.
15808 +@item -mcc-init
15809 +@opindex mcc-init
15810 +Do not use condition-code results from previous instruction; always emit
15811 +compare and test instructions before use of condition codes.
15813 +@item -mno-side-effects
15814 +@opindex mno-side-effects
15815 +Do not emit instructions with side-effects in addressing modes other than
15816 +post-increment.
15818 +@item -mstack-align
15819 +@itemx -mno-stack-align
15820 +@itemx -mdata-align
15821 +@itemx -mno-data-align
15822 +@itemx -mconst-align
15823 +@itemx -mno-const-align
15824 +@opindex mstack-align
15825 +@opindex mno-stack-align
15826 +@opindex mdata-align
15827 +@opindex mno-data-align
15828 +@opindex mconst-align
15829 +@opindex mno-const-align
15830 +These options (no-options) arranges (eliminate arrangements) for the
15831 +stack-frame, individual data and constants to be aligned for the maximum
15832 +single data access size for the chosen CPU model. The default is to
15833 +arrange for 32-bit alignment. ABI details such as structure layout are
15834 +not affected by these options.
15836 +@item -m32-bit
15837 +@itemx -m16-bit
15838 +@itemx -m8-bit
15839 +@opindex m32-bit
15840 +@opindex m16-bit
15841 +@opindex m8-bit
15842 +Similar to the stack- data- and const-align options above, these options
15843 +arrange for stack-frame, writable data and constants to all be 32-bit,
15844 +16-bit or 8-bit aligned. The default is 32-bit alignment.
15846 +@item -mno-prologue-epilogue
15847 +@itemx -mprologue-epilogue
15848 +@opindex mno-prologue-epilogue
15849 +@opindex mprologue-epilogue
15850 +With @option{-mno-prologue-epilogue}, the normal function prologue and
15851 +epilogue that sets up the stack-frame are omitted and no return
15852 +instructions or return sequences are generated in the code. Use this
15853 +option only together with visual inspection of the compiled code: no
15854 +warnings or errors are generated when call-saved registers must be saved,
15855 +or storage for local variable needs to be allocated.
15857 +@item -mno-gotplt
15858 +@itemx -mgotplt
15859 +@opindex mno-gotplt
15860 +@opindex mgotplt
15861 +With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15862 +instruction sequences that load addresses for functions from the PLT part
15863 +of the GOT rather than (traditional on other architectures) calls to the
15864 +PLT@. The default is @option{-mgotplt}.
15866 +@item -melf
15867 +@opindex melf
15868 +Legacy no-op option only recognized with the cris-axis-elf and
15869 +cris-axis-linux-gnu targets.
15871 +@item -mlinux
15872 +@opindex mlinux
15873 +Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15875 +@item -sim
15876 +@opindex sim
15877 +This option, recognized for the cris-axis-elf arranges
15878 +to link with input-output functions from a simulator library. Code,
15879 +initialized data and zero-initialized data are allocated consecutively.
15881 +@item -sim2
15882 +@opindex sim2
15883 +Like @option{-sim}, but pass linker options to locate initialized data at
15884 +0x40000000 and zero-initialized data at 0x80000000.
15885 +@end table
15887 +@node CRX Options
15888 +@subsection CRX Options
15889 +@cindex CRX Options
15891 +These options are defined specifically for the CRX ports.
15893 +@table @gcctabopt
15895 +@item -mmac
15896 +@opindex mmac
15897 +Enable the use of multiply-accumulate instructions. Disabled by default.
15899 +@item -mpush-args
15900 +@opindex mpush-args
15901 +Push instructions will be used to pass outgoing arguments when functions
15902 +are called. Enabled by default.
15903 +@end table
15905 +@node Darwin Options
15906 +@subsection Darwin Options
15907 +@cindex Darwin options
15909 +These options are defined for all architectures running the Darwin operating
15910 +system.
15912 +FSF GCC on Darwin does not create ``fat'' object files; it will create
15913 +an object file for the single architecture that it was built to
15914 +target. Apple's GCC on Darwin does create ``fat'' files if multiple
15915 +@option{-arch} options are used; it does so by running the compiler or
15916 +linker multiple times and joining the results together with
15917 +@file{lipo}.
15919 +The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15920 +@samp{i686}) is determined by the flags that specify the ISA
15921 +that GCC is targetting, like @option{-mcpu} or @option{-march}. The
15922 +@option{-force_cpusubtype_ALL} option can be used to override this.
15924 +The Darwin tools vary in their behavior when presented with an ISA
15925 +mismatch. The assembler, @file{as}, will only permit instructions to
15926 +be used that are valid for the subtype of the file it is generating,
15927 +so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15928 +The linker for shared libraries, @file{/usr/bin/libtool}, will fail
15929 +and print an error if asked to create a shared library with a less
15930 +restrictive subtype than its input files (for instance, trying to put
15931 +a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15932 +for executables, @file{ld}, will quietly give the executable the most
15933 +restrictive subtype of any of its input files.
15935 +@table @gcctabopt
15936 +@item -F@var{dir}
15937 +@opindex F
15938 +Add the framework directory @var{dir} to the head of the list of
15939 +directories to be searched for header files. These directories are
15940 +interleaved with those specified by @option{-I} options and are
15941 +scanned in a left-to-right order.
15943 +A framework directory is a directory with frameworks in it. A
15944 +framework is a directory with a @samp{"Headers"} and/or
15945 +@samp{"PrivateHeaders"} directory contained directly in it that ends
15946 +in @samp{".framework"}. The name of a framework is the name of this
15947 +directory excluding the @samp{".framework"}. Headers associated with
15948 +the framework are found in one of those two directories, with
15949 +@samp{"Headers"} being searched first. A subframework is a framework
15950 +directory that is in a framework's @samp{"Frameworks"} directory.
15951 +Includes of subframework headers can only appear in a header of a
15952 +framework that contains the subframework, or in a sibling subframework
15953 +header. Two subframeworks are siblings if they occur in the same
15954 +framework. A subframework should not have the same name as a
15955 +framework, a warning will be issued if this is violated. Currently a
15956 +subframework cannot have subframeworks, in the future, the mechanism
15957 +may be extended to support this. The standard frameworks can be found
15958 +in @samp{"/System/Library/Frameworks"} and
15959 +@samp{"/Library/Frameworks"}. An example include looks like
15960 +@code{#include <Framework/header.h>}, where @samp{Framework} denotes
15961 +the name of the framework and header.h is found in the
15962 +@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
15964 +@item -iframework@var{dir}
15965 +@opindex iframework
15966 +Like @option{-F} except the directory is a treated as a system
15967 +directory. The main difference between this @option{-iframework} and
15968 +@option{-F} is that with @option{-iframework} the compiler does not
15969 +warn about constructs contained within header files found via
15970 +@var{dir}. This option is valid only for the C family of languages.
15972 +@item -gused
15973 +@opindex gused
15974 +Emit debugging information for symbols that are used. For STABS
15975 +debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15976 +This is by default ON@.
15978 +@item -gfull
15979 +@opindex gfull
15980 +Emit debugging information for all symbols and types.
15982 +@item -mmacosx-version-min=@var{version}
15983 +The earliest version of MacOS X that this executable will run on
15984 +is @var{version}. Typical values of @var{version} include @code{10.1},
15985 +@code{10.2}, and @code{10.3.9}.
15987 +If the compiler was built to use the system's headers by default,
15988 +then the default for this option is the system version on which the
15989 +compiler is running, otherwise the default is to make choices which
15990 +are compatible with as many systems and code bases as possible.
15992 +@item -mkernel
15993 +@opindex mkernel
15994 +Enable kernel development mode. The @option{-mkernel} option sets
15995 +@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
15996 +@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15997 +@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15998 +applicable. This mode also sets @option{-mno-altivec},
15999 +@option{-msoft-float}, @option{-fno-builtin} and
16000 +@option{-mlong-branch} for PowerPC targets.
16002 +@item -mone-byte-bool
16003 +@opindex mone-byte-bool
16004 +Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
16005 +By default @samp{sizeof(bool)} is @samp{4} when compiling for
16006 +Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
16007 +option has no effect on x86.
16009 +@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
16010 +to generate code that is not binary compatible with code generated
16011 +without that switch. Using this switch may require recompiling all
16012 +other modules in a program, including system libraries. Use this
16013 +switch to conform to a non-default data model.
16015 +@item -mfix-and-continue
16016 +@itemx -ffix-and-continue
16017 +@itemx -findirect-data
16018 +@opindex mfix-and-continue
16019 +@opindex ffix-and-continue
16020 +@opindex findirect-data
16021 +Generate code suitable for fast turn around development. Needed to
16022 +enable gdb to dynamically load @code{.o} files into already running
16023 +programs. @option{-findirect-data} and @option{-ffix-and-continue}
16024 +are provided for backwards compatibility.
16026 +@item -all_load
16027 +@opindex all_load
16028 +Loads all members of static archive libraries.
16029 +See man ld(1) for more information.
16031 +@item -arch_errors_fatal
16032 +@opindex arch_errors_fatal
16033 +Cause the errors having to do with files that have the wrong architecture
16034 +to be fatal.
16036 +@item -bind_at_load
16037 +@opindex bind_at_load
16038 +Causes the output file to be marked such that the dynamic linker will
16039 +bind all undefined references when the file is loaded or launched.
16041 +@item -bundle
16042 +@opindex bundle
16043 +Produce a Mach-o bundle format file.
16044 +See man ld(1) for more information.
16046 +@item -bundle_loader @var{executable}
16047 +@opindex bundle_loader
16048 +This option specifies the @var{executable} that will be loading the build
16049 +output file being linked. See man ld(1) for more information.
16051 +@item -dynamiclib
16052 +@opindex dynamiclib
16053 +When passed this option, GCC will produce a dynamic library instead of
16054 +an executable when linking, using the Darwin @file{libtool} command.
16056 +@item -force_cpusubtype_ALL
16057 +@opindex force_cpusubtype_ALL
16058 +This causes GCC's output file to have the @var{ALL} subtype, instead of
16059 +one controlled by the @option{-mcpu} or @option{-march} option.
16061 +@item -allowable_client @var{client_name}
16062 +@itemx -client_name
16063 +@itemx -compatibility_version
16064 +@itemx -current_version
16065 +@itemx -dead_strip
16066 +@itemx -dependency-file
16067 +@itemx -dylib_file
16068 +@itemx -dylinker_install_name
16069 +@itemx -dynamic
16070 +@itemx -exported_symbols_list
16071 +@itemx -filelist
16072 +@need 800
16073 +@itemx -flat_namespace
16074 +@itemx -force_flat_namespace
16075 +@itemx -headerpad_max_install_names
16076 +@itemx -image_base
16077 +@itemx -init
16078 +@itemx -install_name
16079 +@itemx -keep_private_externs
16080 +@itemx -multi_module
16081 +@itemx -multiply_defined
16082 +@itemx -multiply_defined_unused
16083 +@need 800
16084 +@itemx -noall_load
16085 +@itemx -no_dead_strip_inits_and_terms
16086 +@itemx -nofixprebinding
16087 +@itemx -nomultidefs
16088 +@itemx -noprebind
16089 +@itemx -noseglinkedit
16090 +@itemx -pagezero_size
16091 +@itemx -prebind
16092 +@itemx -prebind_all_twolevel_modules
16093 +@itemx -private_bundle
16094 +@need 800
16095 +@itemx -read_only_relocs
16096 +@itemx -sectalign
16097 +@itemx -sectobjectsymbols
16098 +@itemx -whyload
16099 +@itemx -seg1addr
16100 +@itemx -sectcreate
16101 +@itemx -sectobjectsymbols
16102 +@itemx -sectorder
16103 +@itemx -segaddr
16104 +@itemx -segs_read_only_addr
16105 +@need 800
16106 +@itemx -segs_read_write_addr
16107 +@itemx -seg_addr_table
16108 +@itemx -seg_addr_table_filename
16109 +@itemx -seglinkedit
16110 +@itemx -segprot
16111 +@itemx -segs_read_only_addr
16112 +@itemx -segs_read_write_addr
16113 +@itemx -single_module
16114 +@itemx -static
16115 +@itemx -sub_library
16116 +@need 800
16117 +@itemx -sub_umbrella
16118 +@itemx -twolevel_namespace
16119 +@itemx -umbrella
16120 +@itemx -undefined
16121 +@itemx -unexported_symbols_list
16122 +@itemx -weak_reference_mismatches
16123 +@itemx -whatsloaded
16124 +@opindex allowable_client
16125 +@opindex client_name
16126 +@opindex compatibility_version
16127 +@opindex current_version
16128 +@opindex dead_strip
16129 +@opindex dependency-file
16130 +@opindex dylib_file
16131 +@opindex dylinker_install_name
16132 +@opindex dynamic
16133 +@opindex exported_symbols_list
16134 +@opindex filelist
16135 +@opindex flat_namespace
16136 +@opindex force_flat_namespace
16137 +@opindex headerpad_max_install_names
16138 +@opindex image_base
16139 +@opindex init
16140 +@opindex install_name
16141 +@opindex keep_private_externs
16142 +@opindex multi_module
16143 +@opindex multiply_defined
16144 +@opindex multiply_defined_unused
16145 +@opindex noall_load
16146 +@opindex no_dead_strip_inits_and_terms
16147 +@opindex nofixprebinding
16148 +@opindex nomultidefs
16149 +@opindex noprebind
16150 +@opindex noseglinkedit
16151 +@opindex pagezero_size
16152 +@opindex prebind
16153 +@opindex prebind_all_twolevel_modules
16154 +@opindex private_bundle
16155 +@opindex read_only_relocs
16156 +@opindex sectalign
16157 +@opindex sectobjectsymbols
16158 +@opindex whyload
16159 +@opindex seg1addr
16160 +@opindex sectcreate
16161 +@opindex sectobjectsymbols
16162 +@opindex sectorder
16163 +@opindex segaddr
16164 +@opindex segs_read_only_addr
16165 +@opindex segs_read_write_addr
16166 +@opindex seg_addr_table
16167 +@opindex seg_addr_table_filename
16168 +@opindex seglinkedit
16169 +@opindex segprot
16170 +@opindex segs_read_only_addr
16171 +@opindex segs_read_write_addr
16172 +@opindex single_module
16173 +@opindex static
16174 +@opindex sub_library
16175 +@opindex sub_umbrella
16176 +@opindex twolevel_namespace
16177 +@opindex umbrella
16178 +@opindex undefined
16179 +@opindex unexported_symbols_list
16180 +@opindex weak_reference_mismatches
16181 +@opindex whatsloaded
16182 +These options are passed to the Darwin linker. The Darwin linker man page
16183 +describes them in detail.
16184 +@end table
16186 +@node DEC Alpha Options
16187 +@subsection DEC Alpha Options
16189 +These @samp{-m} options are defined for the DEC Alpha implementations:
16191 +@table @gcctabopt
16192 +@item -mno-soft-float
16193 +@itemx -msoft-float
16194 +@opindex mno-soft-float
16195 +@opindex msoft-float
16196 +Use (do not use) the hardware floating-point instructions for
16197 +floating-point operations. When @option{-msoft-float} is specified,
16198 +functions in @file{libgcc.a} will be used to perform floating-point
16199 +operations. Unless they are replaced by routines that emulate the
16200 +floating-point operations, or compiled in such a way as to call such
16201 +emulations routines, these routines will issue floating-point
16202 +operations. If you are compiling for an Alpha without floating-point
16203 +operations, you must ensure that the library is built so as not to call
16204 +them.
16206 +Note that Alpha implementations without floating-point operations are
16207 +required to have floating-point registers.
16209 +@item -mfp-reg
16210 +@itemx -mno-fp-regs
16211 +@opindex mfp-reg
16212 +@opindex mno-fp-regs
16213 +Generate code that uses (does not use) the floating-point register set.
16214 +@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
16215 +register set is not used, floating point operands are passed in integer
16216 +registers as if they were integers and floating-point results are passed
16217 +in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
16218 +so any function with a floating-point argument or return value called by code
16219 +compiled with @option{-mno-fp-regs} must also be compiled with that
16220 +option.
16222 +A typical use of this option is building a kernel that does not use,
16223 +and hence need not save and restore, any floating-point registers.
16225 +@item -mieee
16226 +@opindex mieee
16227 +The Alpha architecture implements floating-point hardware optimized for
16228 +maximum performance. It is mostly compliant with the IEEE floating
16229 +point standard. However, for full compliance, software assistance is
16230 +required. This option generates code fully IEEE compliant code
16231 +@emph{except} that the @var{inexact-flag} is not maintained (see below).
16232 +If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
16233 +defined during compilation. The resulting code is less efficient but is
16234 +able to correctly support denormalized numbers and exceptional IEEE
16235 +values such as not-a-number and plus/minus infinity. Other Alpha
16236 +compilers call this option @option{-ieee_with_no_inexact}.
16238 +@item -mieee-with-inexact
16239 +@opindex mieee-with-inexact
16240 +This is like @option{-mieee} except the generated code also maintains
16241 +the IEEE @var{inexact-flag}. Turning on this option causes the
16242 +generated code to implement fully-compliant IEEE math. In addition to
16243 +@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
16244 +macro. On some Alpha implementations the resulting code may execute
16245 +significantly slower than the code generated by default. Since there is
16246 +very little code that depends on the @var{inexact-flag}, you should
16247 +normally not specify this option. Other Alpha compilers call this
16248 +option @option{-ieee_with_inexact}.
16250 +@item -mfp-trap-mode=@var{trap-mode}
16251 +@opindex mfp-trap-mode
16252 +This option controls what floating-point related traps are enabled.
16253 +Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
16254 +The trap mode can be set to one of four values:
16256 +@table @samp
16257 +@item n
16258 +This is the default (normal) setting. The only traps that are enabled
16259 +are the ones that cannot be disabled in software (e.g., division by zero
16260 +trap).
16262 +@item u
16263 +In addition to the traps enabled by @samp{n}, underflow traps are enabled
16264 +as well.
16266 +@item su
16267 +Like @samp{u}, but the instructions are marked to be safe for software
16268 +completion (see Alpha architecture manual for details).
16270 +@item sui
16271 +Like @samp{su}, but inexact traps are enabled as well.
16272 +@end table
16274 +@item -mfp-rounding-mode=@var{rounding-mode}
16275 +@opindex mfp-rounding-mode
16276 +Selects the IEEE rounding mode. Other Alpha compilers call this option
16277 +@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
16278 +of:
16280 +@table @samp
16281 +@item n
16282 +Normal IEEE rounding mode. Floating point numbers are rounded towards
16283 +the nearest machine number or towards the even machine number in case
16284 +of a tie.
16286 +@item m
16287 +Round towards minus infinity.
16289 +@item c
16290 +Chopped rounding mode. Floating point numbers are rounded towards zero.
16292 +@item d
16293 +Dynamic rounding mode. A field in the floating point control register
16294 +(@var{fpcr}, see Alpha architecture reference manual) controls the
16295 +rounding mode in effect. The C library initializes this register for
16296 +rounding towards plus infinity. Thus, unless your program modifies the
16297 +@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16298 +@end table
16300 +@item -mtrap-precision=@var{trap-precision}
16301 +@opindex mtrap-precision
16302 +In the Alpha architecture, floating point traps are imprecise. This
16303 +means without software assistance it is impossible to recover from a
16304 +floating trap and program execution normally needs to be terminated.
16305 +GCC can generate code that can assist operating system trap handlers
16306 +in determining the exact location that caused a floating point trap.
16307 +Depending on the requirements of an application, different levels of
16308 +precisions can be selected:
16310 +@table @samp
16311 +@item p
16312 +Program precision. This option is the default and means a trap handler
16313 +can only identify which program caused a floating point exception.
16315 +@item f
16316 +Function precision. The trap handler can determine the function that
16317 +caused a floating point exception.
16319 +@item i
16320 +Instruction precision. The trap handler can determine the exact
16321 +instruction that caused a floating point exception.
16322 +@end table
16324 +Other Alpha compilers provide the equivalent options called
16325 +@option{-scope_safe} and @option{-resumption_safe}.
16327 +@item -mieee-conformant
16328 +@opindex mieee-conformant
16329 +This option marks the generated code as IEEE conformant. You must not
16330 +use this option unless you also specify @option{-mtrap-precision=i} and either
16331 +@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16332 +is to emit the line @samp{.eflag 48} in the function prologue of the
16333 +generated assembly file. Under DEC Unix, this has the effect that
16334 +IEEE-conformant math library routines will be linked in.
16336 +@item -mbuild-constants
16337 +@opindex mbuild-constants
16338 +Normally GCC examines a 32- or 64-bit integer constant to
16339 +see if it can construct it from smaller constants in two or three
16340 +instructions. If it cannot, it will output the constant as a literal and
16341 +generate code to load it from the data segment at runtime.
16343 +Use this option to require GCC to construct @emph{all} integer constants
16344 +using code, even if it takes more instructions (the maximum is six).
16346 +You would typically use this option to build a shared library dynamic
16347 +loader. Itself a shared library, it must relocate itself in memory
16348 +before it can find the variables and constants in its own data segment.
16350 +@item -malpha-as
16351 +@itemx -mgas
16352 +@opindex malpha-as
16353 +@opindex mgas
16354 +Select whether to generate code to be assembled by the vendor-supplied
16355 +assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
16357 +@item -mbwx
16358 +@itemx -mno-bwx
16359 +@itemx -mcix
16360 +@itemx -mno-cix
16361 +@itemx -mfix
16362 +@itemx -mno-fix
16363 +@itemx -mmax
16364 +@itemx -mno-max
16365 +@opindex mbwx
16366 +@opindex mno-bwx
16367 +@opindex mcix
16368 +@opindex mno-cix
16369 +@opindex mfix
16370 +@opindex mno-fix
16371 +@opindex mmax
16372 +@opindex mno-max
16373 +Indicate whether GCC should generate code to use the optional BWX,
16374 +CIX, FIX and MAX instruction sets. The default is to use the instruction
16375 +sets supported by the CPU type specified via @option{-mcpu=} option or that
16376 +of the CPU on which GCC was built if none was specified.
16378 +@item -mfloat-vax
16379 +@itemx -mfloat-ieee
16380 +@opindex mfloat-vax
16381 +@opindex mfloat-ieee
16382 +Generate code that uses (does not use) VAX F and G floating point
16383 +arithmetic instead of IEEE single and double precision.
16385 +@item -mexplicit-relocs
16386 +@itemx -mno-explicit-relocs
16387 +@opindex mexplicit-relocs
16388 +@opindex mno-explicit-relocs
16389 +Older Alpha assemblers provided no way to generate symbol relocations
16390 +except via assembler macros. Use of these macros does not allow
16391 +optimal instruction scheduling. GNU binutils as of version 2.12
16392 +supports a new syntax that allows the compiler to explicitly mark
16393 +which relocations should apply to which instructions. This option
16394 +is mostly useful for debugging, as GCC detects the capabilities of
16395 +the assembler when it is built and sets the default accordingly.
16397 +@item -msmall-data
16398 +@itemx -mlarge-data
16399 +@opindex msmall-data
16400 +@opindex mlarge-data
16401 +When @option{-mexplicit-relocs} is in effect, static data is
16402 +accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16403 +is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16404 +(the @code{.sdata} and @code{.sbss} sections) and are accessed via
16405 +16-bit relocations off of the @code{$gp} register. This limits the
16406 +size of the small data area to 64KB, but allows the variables to be
16407 +directly accessed via a single instruction.
16409 +The default is @option{-mlarge-data}. With this option the data area
16410 +is limited to just below 2GB@. Programs that require more than 2GB of
16411 +data must use @code{malloc} or @code{mmap} to allocate the data in the
16412 +heap instead of in the program's data segment.
16414 +When generating code for shared libraries, @option{-fpic} implies
16415 +@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16417 +@item -msmall-text
16418 +@itemx -mlarge-text
16419 +@opindex msmall-text
16420 +@opindex mlarge-text
16421 +When @option{-msmall-text} is used, the compiler assumes that the
16422 +code of the entire program (or shared library) fits in 4MB, and is
16423 +thus reachable with a branch instruction. When @option{-msmall-data}
16424 +is used, the compiler can assume that all local symbols share the
16425 +same @code{$gp} value, and thus reduce the number of instructions
16426 +required for a function call from 4 to 1.
16428 +The default is @option{-mlarge-text}.
16430 +@item -mcpu=@var{cpu_type}
16431 +@opindex mcpu
16432 +Set the instruction set and instruction scheduling parameters for
16433 +machine type @var{cpu_type}. You can specify either the @samp{EV}
16434 +style name or the corresponding chip number. GCC supports scheduling
16435 +parameters for the EV4, EV5 and EV6 family of processors and will
16436 +choose the default values for the instruction set from the processor
16437 +you specify. If you do not specify a processor type, GCC will default
16438 +to the processor on which the compiler was built.
16440 +Supported values for @var{cpu_type} are
16442 +@table @samp
16443 +@item ev4
16444 +@itemx ev45
16445 +@itemx 21064
16446 +Schedules as an EV4 and has no instruction set extensions.
16448 +@item ev5
16449 +@itemx 21164
16450 +Schedules as an EV5 and has no instruction set extensions.
16452 +@item ev56
16453 +@itemx 21164a
16454 +Schedules as an EV5 and supports the BWX extension.
16456 +@item pca56
16457 +@itemx 21164pc
16458 +@itemx 21164PC
16459 +Schedules as an EV5 and supports the BWX and MAX extensions.
16461 +@item ev6
16462 +@itemx 21264
16463 +Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16465 +@item ev67
16466 +@itemx 21264a
16467 +Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16468 +@end table
16470 +Native Linux/GNU toolchains also support the value @samp{native},
16471 +which selects the best architecture option for the host processor.
16472 +@option{-mcpu=native} has no effect if GCC does not recognize
16473 +the processor.
16475 +@item -mtune=@var{cpu_type}
16476 +@opindex mtune
16477 +Set only the instruction scheduling parameters for machine type
16478 +@var{cpu_type}. The instruction set is not changed.
16480 +Native Linux/GNU toolchains also support the value @samp{native},
16481 +which selects the best architecture option for the host processor.
16482 +@option{-mtune=native} has no effect if GCC does not recognize
16483 +the processor.
16485 +@item -mmemory-latency=@var{time}
16486 +@opindex mmemory-latency
16487 +Sets the latency the scheduler should assume for typical memory
16488 +references as seen by the application. This number is highly
16489 +dependent on the memory access patterns used by the application
16490 +and the size of the external cache on the machine.
16492 +Valid options for @var{time} are
16494 +@table @samp
16495 +@item @var{number}
16496 +A decimal number representing clock cycles.
16498 +@item L1
16499 +@itemx L2
16500 +@itemx L3
16501 +@itemx main
16502 +The compiler contains estimates of the number of clock cycles for
16503 +``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16504 +(also called Dcache, Scache, and Bcache), as well as to main memory.
16505 +Note that L3 is only valid for EV5.
16507 +@end table
16508 +@end table
16510 +@node DEC Alpha/VMS Options
16511 +@subsection DEC Alpha/VMS Options
16513 +These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
16515 +@table @gcctabopt
16516 +@item -mvms-return-codes
16517 +@opindex mvms-return-codes
16518 +Return VMS condition codes from main. The default is to return POSIX
16519 +style condition (e.g.@: error) codes.
16521 +@item -mdebug-main=@var{prefix}
16522 +@opindex mdebug-main=@var{prefix}
16523 +Flag the first routine whose name starts with @var{prefix} as the main
16524 +routine for the debugger.
16526 +@item -mmalloc64
16527 +@opindex mmalloc64
16528 +Default to 64bit memory allocation routines.
16529 +@end table
16531 +@node FR30 Options
16532 +@subsection FR30 Options
16533 +@cindex FR30 Options
16535 +These options are defined specifically for the FR30 port.
16537 +@table @gcctabopt
16539 +@item -msmall-model
16540 +@opindex msmall-model
16541 +Use the small address space model. This can produce smaller code, but
16542 +it does assume that all symbolic values and addresses will fit into a
16543 +20-bit range.
16545 +@item -mno-lsim
16546 +@opindex mno-lsim
16547 +Assume that run-time support has been provided and so there is no need
16548 +to include the simulator library (@file{libsim.a}) on the linker
16549 +command line.
16551 +@end table
16553 +@node FRV Options
16554 +@subsection FRV Options
16555 +@cindex FRV Options
16557 +@table @gcctabopt
16558 +@item -mgpr-32
16559 +@opindex mgpr-32
16561 +Only use the first 32 general purpose registers.
16563 +@item -mgpr-64
16564 +@opindex mgpr-64
16566 +Use all 64 general purpose registers.
16568 +@item -mfpr-32
16569 +@opindex mfpr-32
16571 +Use only the first 32 floating point registers.
16573 +@item -mfpr-64
16574 +@opindex mfpr-64
16576 +Use all 64 floating point registers
16578 +@item -mhard-float
16579 +@opindex mhard-float
16581 +Use hardware instructions for floating point operations.
16583 +@item -msoft-float
16584 +@opindex msoft-float
16586 +Use library routines for floating point operations.
16588 +@item -malloc-cc
16589 +@opindex malloc-cc
16591 +Dynamically allocate condition code registers.
16593 +@item -mfixed-cc
16594 +@opindex mfixed-cc
16596 +Do not try to dynamically allocate condition code registers, only
16597 +use @code{icc0} and @code{fcc0}.
16599 +@item -mdword
16600 +@opindex mdword
16602 +Change ABI to use double word insns.
16604 +@item -mno-dword
16605 +@opindex mno-dword
16607 +Do not use double word instructions.
16609 +@item -mdouble
16610 +@opindex mdouble
16612 +Use floating point double instructions.
16614 +@item -mno-double
16615 +@opindex mno-double
16617 +Do not use floating point double instructions.
16619 +@item -mmedia
16620 +@opindex mmedia
16622 +Use media instructions.
16624 +@item -mno-media
16625 +@opindex mno-media
16627 +Do not use media instructions.
16629 +@item -mmuladd
16630 +@opindex mmuladd
16632 +Use multiply and add/subtract instructions.
16634 +@item -mno-muladd
16635 +@opindex mno-muladd
16637 +Do not use multiply and add/subtract instructions.
16639 +@item -mfdpic
16640 +@opindex mfdpic
16642 +Select the FDPIC ABI, that uses function descriptors to represent
16643 +pointers to functions. Without any PIC/PIE-related options, it
16644 +implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16645 +assumes GOT entries and small data are within a 12-bit range from the
16646 +GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16647 +are computed with 32 bits.
16648 +With a @samp{bfin-elf} target, this option implies @option{-msim}.
16650 +@item -minline-plt
16651 +@opindex minline-plt
16653 +Enable inlining of PLT entries in function calls to functions that are
16654 +not known to bind locally. It has no effect without @option{-mfdpic}.
16655 +It's enabled by default if optimizing for speed and compiling for
16656 +shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16657 +optimization option such as @option{-O3} or above is present in the
16658 +command line.
16660 +@item -mTLS
16661 +@opindex mTLS
16663 +Assume a large TLS segment when generating thread-local code.
16665 +@item -mtls
16666 +@opindex mtls
16668 +Do not assume a large TLS segment when generating thread-local code.
16670 +@item -mgprel-ro
16671 +@opindex mgprel-ro
16673 +Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16674 +that is known to be in read-only sections. It's enabled by default,
16675 +except for @option{-fpic} or @option{-fpie}: even though it may help
16676 +make the global offset table smaller, it trades 1 instruction for 4.
16677 +With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16678 +one of which may be shared by multiple symbols, and it avoids the need
16679 +for a GOT entry for the referenced symbol, so it's more likely to be a
16680 +win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16682 +@item -multilib-library-pic
16683 +@opindex multilib-library-pic
16685 +Link with the (library, not FD) pic libraries. It's implied by
16686 +@option{-mlibrary-pic}, as well as by @option{-fPIC} and
16687 +@option{-fpic} without @option{-mfdpic}. You should never have to use
16688 +it explicitly.
16690 +@item -mlinked-fp
16691 +@opindex mlinked-fp
16693 +Follow the EABI requirement of always creating a frame pointer whenever
16694 +a stack frame is allocated. This option is enabled by default and can
16695 +be disabled with @option{-mno-linked-fp}.
16697 +@item -mlong-calls
16698 +@opindex mlong-calls
16700 +Use indirect addressing to call functions outside the current
16701 +compilation unit. This allows the functions to be placed anywhere
16702 +within the 32-bit address space.
16704 +@item -malign-labels
16705 +@opindex malign-labels
16707 +Try to align labels to an 8-byte boundary by inserting nops into the
16708 +previous packet. This option only has an effect when VLIW packing
16709 +is enabled. It doesn't create new packets; it merely adds nops to
16710 +existing ones.
16712 +@item -mlibrary-pic
16713 +@opindex mlibrary-pic
16715 +Generate position-independent EABI code.
16717 +@item -macc-4
16718 +@opindex macc-4
16720 +Use only the first four media accumulator registers.
16722 +@item -macc-8
16723 +@opindex macc-8
16725 +Use all eight media accumulator registers.
16727 +@item -mpack
16728 +@opindex mpack
16730 +Pack VLIW instructions.
16732 +@item -mno-pack
16733 +@opindex mno-pack
16735 +Do not pack VLIW instructions.
16737 +@item -mno-eflags
16738 +@opindex mno-eflags
16740 +Do not mark ABI switches in e_flags.
16742 +@item -mcond-move
16743 +@opindex mcond-move
16745 +Enable the use of conditional-move instructions (default).
16747 +This switch is mainly for debugging the compiler and will likely be removed
16748 +in a future version.
16750 +@item -mno-cond-move
16751 +@opindex mno-cond-move
16753 +Disable the use of conditional-move instructions.
16755 +This switch is mainly for debugging the compiler and will likely be removed
16756 +in a future version.
16758 +@item -mscc
16759 +@opindex mscc
16761 +Enable the use of conditional set instructions (default).
16763 +This switch is mainly for debugging the compiler and will likely be removed
16764 +in a future version.
16766 +@item -mno-scc
16767 +@opindex mno-scc
16769 +Disable the use of conditional set instructions.
16771 +This switch is mainly for debugging the compiler and will likely be removed
16772 +in a future version.
16774 +@item -mcond-exec
16775 +@opindex mcond-exec
16777 +Enable the use of conditional execution (default).
16779 +This switch is mainly for debugging the compiler and will likely be removed
16780 +in a future version.
16782 +@item -mno-cond-exec
16783 +@opindex mno-cond-exec
16785 +Disable the use of conditional execution.
16787 +This switch is mainly for debugging the compiler and will likely be removed
16788 +in a future version.
16790 +@item -mvliw-branch
16791 +@opindex mvliw-branch
16793 +Run a pass to pack branches into VLIW instructions (default).
16795 +This switch is mainly for debugging the compiler and will likely be removed
16796 +in a future version.
16798 +@item -mno-vliw-branch
16799 +@opindex mno-vliw-branch
16801 +Do not run a pass to pack branches into VLIW instructions.
16803 +This switch is mainly for debugging the compiler and will likely be removed
16804 +in a future version.
16806 +@item -mmulti-cond-exec
16807 +@opindex mmulti-cond-exec
16809 +Enable optimization of @code{&&} and @code{||} in conditional execution
16810 +(default).
16812 +This switch is mainly for debugging the compiler and will likely be removed
16813 +in a future version.
16815 +@item -mno-multi-cond-exec
16816 +@opindex mno-multi-cond-exec
16818 +Disable optimization of @code{&&} and @code{||} in conditional execution.
16820 +This switch is mainly for debugging the compiler and will likely be removed
16821 +in a future version.
16823 +@item -mnested-cond-exec
16824 +@opindex mnested-cond-exec
16826 +Enable nested conditional execution optimizations (default).
16828 +This switch is mainly for debugging the compiler and will likely be removed
16829 +in a future version.
16831 +@item -mno-nested-cond-exec
16832 +@opindex mno-nested-cond-exec
16834 +Disable nested conditional execution optimizations.
16836 +This switch is mainly for debugging the compiler and will likely be removed
16837 +in a future version.
16839 +@item -moptimize-membar
16840 +@opindex moptimize-membar
16842 +This switch removes redundant @code{membar} instructions from the
16843 +compiler generated code. It is enabled by default.
16845 +@item -mno-optimize-membar
16846 +@opindex mno-optimize-membar
16848 +This switch disables the automatic removal of redundant @code{membar}
16849 +instructions from the generated code.
16851 +@item -mtomcat-stats
16852 +@opindex mtomcat-stats
16854 +Cause gas to print out tomcat statistics.
16856 +@item -mcpu=@var{cpu}
16857 +@opindex mcpu
16859 +Select the processor type for which to generate code. Possible values are
16860 +@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16861 +@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16863 +@end table
16865 +@node GNU/Linux Options
16866 +@subsection GNU/Linux Options
16868 +These @samp{-m} options are defined for GNU/Linux targets:
16870 +@table @gcctabopt
16871 +@item -mglibc
16872 +@opindex mglibc
16873 +Use the GNU C library. This is the default except
16874 +on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
16876 +@item -muclibc
16877 +@opindex muclibc
16878 +Use uClibc C library. This is the default on
16879 +@samp{*-*-linux-*uclibc*} targets.
16881 +@item -mbionic
16882 +@opindex mbionic
16883 +Use Bionic C library. This is the default on
16884 +@samp{*-*-linux-*android*} targets.
16886 +@item -mandroid
16887 +@opindex mandroid
16888 +Compile code compatible with Android platform. This is the default on
16889 +@samp{*-*-linux-*android*} targets.
16891 +When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16892 +@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16893 +this option makes the GCC driver pass Android-specific options to the linker.
16894 +Finally, this option causes the preprocessor macro @code{__ANDROID__}
16895 +to be defined.
16897 +@item -tno-android-cc
16898 +@opindex tno-android-cc
16899 +Disable compilation effects of @option{-mandroid}, i.e., do not enable
16900 +@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16901 +@option{-fno-rtti} by default.
16903 +@item -tno-android-ld
16904 +@opindex tno-android-ld
16905 +Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16906 +linking options to the linker.
16908 +@end table
16910 +@node H8/300 Options
16911 +@subsection H8/300 Options
16913 +These @samp{-m} options are defined for the H8/300 implementations:
16915 +@table @gcctabopt
16916 +@item -mrelax
16917 +@opindex mrelax
16918 +Shorten some address references at link time, when possible; uses the
16919 +linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16920 +ld, Using ld}, for a fuller description.
16922 +@item -mh
16923 +@opindex mh
16924 +Generate code for the H8/300H@.
16926 +@item -ms
16927 +@opindex ms
16928 +Generate code for the H8S@.
16930 +@item -mn
16931 +@opindex mn
16932 +Generate code for the H8S and H8/300H in the normal mode. This switch
16933 +must be used either with @option{-mh} or @option{-ms}.
16935 +@item -ms2600
16936 +@opindex ms2600
16937 +Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16939 +@item -mint32
16940 +@opindex mint32
16941 +Make @code{int} data 32 bits by default.
16943 +@item -malign-300
16944 +@opindex malign-300
16945 +On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16946 +The default for the H8/300H and H8S is to align longs and floats on 4
16947 +byte boundaries.
16948 +@option{-malign-300} causes them to be aligned on 2 byte boundaries.
16949 +This option has no effect on the H8/300.
16950 +@end table
16952 +@node HPPA Options
16953 +@subsection HPPA Options
16954 +@cindex HPPA Options
16956 +These @samp{-m} options are defined for the HPPA family of computers:
16958 +@table @gcctabopt
16959 +@item -march=@var{architecture-type}
16960 +@opindex march
16961 +Generate code for the specified architecture. The choices for
16962 +@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16963 +1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16964 +@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16965 +architecture option for your machine. Code compiled for lower numbered
16966 +architectures will run on higher numbered architectures, but not the
16967 +other way around.
16969 +@item -mpa-risc-1-0
16970 +@itemx -mpa-risc-1-1
16971 +@itemx -mpa-risc-2-0
16972 +@opindex mpa-risc-1-0
16973 +@opindex mpa-risc-1-1
16974 +@opindex mpa-risc-2-0
16975 +Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16977 +@item -mbig-switch
16978 +@opindex mbig-switch
16979 +Generate code suitable for big switch tables. Use this option only if
16980 +the assembler/linker complain about out of range branches within a switch
16981 +table.
16983 +@item -mjump-in-delay
16984 +@opindex mjump-in-delay
16985 +Fill delay slots of function calls with unconditional jump instructions
16986 +by modifying the return pointer for the function call to be the target
16987 +of the conditional jump.
16989 +@item -mdisable-fpregs
16990 +@opindex mdisable-fpregs
16991 +Prevent floating point registers from being used in any manner. This is
16992 +necessary for compiling kernels which perform lazy context switching of
16993 +floating point registers. If you use this option and attempt to perform
16994 +floating point operations, the compiler will abort.
16996 +@item -mdisable-indexing
16997 +@opindex mdisable-indexing
16998 +Prevent the compiler from using indexing address modes. This avoids some
16999 +rather obscure problems when compiling MIG generated code under MACH@.
17001 +@item -mno-space-regs
17002 +@opindex mno-space-regs
17003 +Generate code that assumes the target has no space registers. This allows
17004 +GCC to generate faster indirect calls and use unscaled index address modes.
17006 +Such code is suitable for level 0 PA systems and kernels.
17008 +@item -mfast-indirect-calls
17009 +@opindex mfast-indirect-calls
17010 +Generate code that assumes calls never cross space boundaries. This
17011 +allows GCC to emit code which performs faster indirect calls.
17013 +This option will not work in the presence of shared libraries or nested
17014 +functions.
17016 +@item -mfixed-range=@var{register-range}
17017 +@opindex mfixed-range
17018 +Generate code treating the given register range as fixed registers.
17019 +A fixed register is one that the register allocator can not use. This is
17020 +useful when compiling kernel code. A register range is specified as
17021 +two registers separated by a dash. Multiple register ranges can be
17022 +specified separated by a comma.
17024 +@item -mlong-load-store
17025 +@opindex mlong-load-store
17026 +Generate 3-instruction load and store sequences as sometimes required by
17027 +the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
17028 +the HP compilers.
17030 +@item -mportable-runtime
17031 +@opindex mportable-runtime
17032 +Use the portable calling conventions proposed by HP for ELF systems.
17034 +@item -mgas
17035 +@opindex mgas
17036 +Enable the use of assembler directives only GAS understands.
17038 +@item -mschedule=@var{cpu-type}
17039 +@opindex mschedule
17040 +Schedule code according to the constraints for the machine type
17041 +@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
17042 +@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
17043 +to @file{/usr/lib/sched.models} on an HP-UX system to determine the
17044 +proper scheduling option for your machine. The default scheduling is
17045 +@samp{8000}.
17047 +@item -mlinker-opt
17048 +@opindex mlinker-opt
17049 +Enable the optimization pass in the HP-UX linker. Note this makes symbolic
17050 +debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
17051 +linkers in which they give bogus error messages when linking some programs.
17053 +@item -msoft-float
17054 +@opindex msoft-float
17055 +Generate output containing library calls for floating point.
17056 +@strong{Warning:} the requisite libraries are not available for all HPPA
17057 +targets. Normally the facilities of the machine's usual C compiler are
17058 +used, but this cannot be done directly in cross-compilation. You must make
17059 +your own arrangements to provide suitable library functions for
17060 +cross-compilation.
17062 +@option{-msoft-float} changes the calling convention in the output file;
17063 +therefore, it is only useful if you compile @emph{all} of a program with
17064 +this option. In particular, you need to compile @file{libgcc.a}, the
17065 +library that comes with GCC, with @option{-msoft-float} in order for
17066 +this to work.
17068 +@item -msio
17069 +@opindex msio
17070 +Generate the predefine, @code{_SIO}, for server IO@. The default is
17071 +@option{-mwsio}. This generates the predefines, @code{__hp9000s700},
17072 +@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
17073 +options are available under HP-UX and HI-UX@.
17075 +@item -mgnu-ld
17076 +@opindex mgnu-ld
17077 +Use GNU ld specific options. This passes @option{-shared} to ld when
17078 +building a shared library. It is the default when GCC is configured,
17079 +explicitly or implicitly, with the GNU linker. This option does not
17080 +have any affect on which ld is called, it only changes what parameters
17081 +are passed to that ld. The ld that is called is determined by the
17082 +@option{--with-ld} configure option, GCC's program search path, and
17083 +finally by the user's @env{PATH}. The linker used by GCC can be printed
17084 +using @samp{which `gcc -print-prog-name=ld`}. This option is only available
17085 +on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17087 +@item -mhp-ld
17088 +@opindex mhp-ld
17089 +Use HP ld specific options. This passes @option{-b} to ld when building
17090 +a shared library and passes @option{+Accept TypeMismatch} to ld on all
17091 +links. It is the default when GCC is configured, explicitly or
17092 +implicitly, with the HP linker. This option does not have any affect on
17093 +which ld is called, it only changes what parameters are passed to that
17094 +ld. The ld that is called is determined by the @option{--with-ld}
17095 +configure option, GCC's program search path, and finally by the user's
17096 +@env{PATH}. The linker used by GCC can be printed using @samp{which
17097 +`gcc -print-prog-name=ld`}. This option is only available on the 64 bit
17098 +HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17100 +@item -mlong-calls
17101 +@opindex mno-long-calls
17102 +Generate code that uses long call sequences. This ensures that a call
17103 +is always able to reach linker generated stubs. The default is to generate
17104 +long calls only when the distance from the call site to the beginning
17105 +of the function or translation unit, as the case may be, exceeds a
17106 +predefined limit set by the branch type being used. The limits for
17107 +normal calls are 7,600,000 and 240,000 bytes, respectively for the
17108 +PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
17109 +240,000 bytes.
17111 +Distances are measured from the beginning of functions when using the
17112 +@option{-ffunction-sections} option, or when using the @option{-mgas}
17113 +and @option{-mno-portable-runtime} options together under HP-UX with
17114 +the SOM linker.
17116 +It is normally not desirable to use this option as it will degrade
17117 +performance. However, it may be useful in large applications,
17118 +particularly when partial linking is used to build the application.
17120 +The types of long calls used depends on the capabilities of the
17121 +assembler and linker, and the type of code being generated. The
17122 +impact on systems that support long absolute calls, and long pic
17123 +symbol-difference or pc-relative calls should be relatively small.
17124 +However, an indirect call is used on 32-bit ELF systems in pic code
17125 +and it is quite long.
17127 +@item -munix=@var{unix-std}
17128 +@opindex march
17129 +Generate compiler predefines and select a startfile for the specified
17130 +UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
17131 +and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
17132 +is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
17133 +11.11 and later. The default values are @samp{93} for HP-UX 10.00,
17134 +@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
17135 +and later.
17137 +@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
17138 +@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
17139 +and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
17140 +@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
17141 +@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
17142 +@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
17144 +It is @emph{important} to note that this option changes the interfaces
17145 +for various library routines. It also affects the operational behavior
17146 +of the C library. Thus, @emph{extreme} care is needed in using this
17147 +option.
17149 +Library code that is intended to operate with more than one UNIX
17150 +standard must test, set and restore the variable @var{__xpg4_extended_mask}
17151 +as appropriate. Most GNU software doesn't provide this capability.
17153 +@item -nolibdld
17154 +@opindex nolibdld
17155 +Suppress the generation of link options to search libdld.sl when the
17156 +@option{-static} option is specified on HP-UX 10 and later.
17158 +@item -static
17159 +@opindex static
17160 +The HP-UX implementation of setlocale in libc has a dependency on
17161 +libdld.sl. There isn't an archive version of libdld.sl. Thus,
17162 +when the @option{-static} option is specified, special link options
17163 +are needed to resolve this dependency.
17165 +On HP-UX 10 and later, the GCC driver adds the necessary options to
17166 +link with libdld.sl when the @option{-static} option is specified.
17167 +This causes the resulting binary to be dynamic. On the 64-bit port,
17168 +the linkers generate dynamic binaries by default in any case. The
17169 +@option{-nolibdld} option can be used to prevent the GCC driver from
17170 +adding these link options.
17172 +@item -threads
17173 +@opindex threads
17174 +Add support for multithreading with the @dfn{dce thread} library
17175 +under HP-UX@. This option sets flags for both the preprocessor and
17176 +linker.
17177 +@end table
17179 +@node i386 and x86-64 Options
17180 +@subsection Intel 386 and AMD x86-64 Options
17181 +@cindex i386 Options
17182 +@cindex x86-64 Options
17183 +@cindex Intel 386 Options
17184 +@cindex AMD x86-64 Options
17186 +These @samp{-m} options are defined for the i386 and x86-64 family of
17187 +computers:
17189 +@table @gcctabopt
17190 +@item -mtune=@var{cpu-type}
17191 +@opindex mtune
17192 +Tune to @var{cpu-type} everything applicable about the generated code, except
17193 +for the ABI and the set of available instructions. The choices for
17194 +@var{cpu-type} are:
17195 +@table @emph
17196 +@item generic
17197 +Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
17198 +If you know the CPU on which your code will run, then you should use
17199 +the corresponding @option{-mtune} option instead of
17200 +@option{-mtune=generic}. But, if you do not know exactly what CPU users
17201 +of your application will have, then you should use this option.
17203 +As new processors are deployed in the marketplace, the behavior of this
17204 +option will change. Therefore, if you upgrade to a newer version of
17205 +GCC, the code generated option will change to reflect the processors
17206 +that were most common when that version of GCC was released.
17208 +There is no @option{-march=generic} option because @option{-march}
17209 +indicates the instruction set the compiler can use, and there is no
17210 +generic instruction set applicable to all processors. In contrast,
17211 +@option{-mtune} indicates the processor (or, in this case, collection of
17212 +processors) for which the code is optimized.
17213 +@item native
17214 +This selects the CPU to tune for at compilation time by determining
17215 +the processor type of the compiling machine. Using @option{-mtune=native}
17216 +will produce code optimized for the local machine under the constraints
17217 +of the selected instruction set. Using @option{-march=native} will
17218 +enable all instruction subsets supported by the local machine (hence
17219 +the result might not run on different machines).
17220 +@item i386
17221 +Original Intel's i386 CPU@.
17222 +@item i486
17223 +Intel's i486 CPU@. (No scheduling is implemented for this chip.)
17224 +@item i586, pentium
17225 +Intel Pentium CPU with no MMX support.
17226 +@item pentium-mmx
17227 +Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
17228 +@item pentiumpro
17229 +Intel PentiumPro CPU@.
17230 +@item i686
17231 +Same as @code{generic}, but when used as @code{march} option, PentiumPro
17232 +instruction set will be used, so the code will run on all i686 family chips.
17233 +@item pentium2
17234 +Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
17235 +@item pentium3, pentium3m
17236 +Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
17237 +support.
17238 +@item pentium-m
17239 +Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
17240 +support. Used by Centrino notebooks.
17241 +@item pentium4, pentium4m
17242 +Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
17243 +@item prescott
17244 +Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
17245 +set support.
17246 +@item nocona
17247 +Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
17248 +SSE2 and SSE3 instruction set support.
17249 +@item core2
17250 +Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
17251 +instruction set support.
17252 +@item corei7
17253 +Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
17254 +and SSE4.2 instruction set support.
17255 +@item corei7-avx
17256 +Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
17257 +SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support.
17258 +@item core-avx-i
17259 +Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
17260 +SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction
17261 +set support.
17262 +@item atom
17263 +Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
17264 +instruction set support.
17265 +@item k6
17266 +AMD K6 CPU with MMX instruction set support.
17267 +@item k6-2, k6-3
17268 +Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
17269 +@item athlon, athlon-tbird
17270 +AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
17271 +support.
17272 +@item athlon-4, athlon-xp, athlon-mp
17273 +Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
17274 +instruction set support.
17275 +@item k8, opteron, athlon64, athlon-fx
17276 +AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
17277 +MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit instruction set extensions.)
17278 +@item k8-sse3, opteron-sse3, athlon64-sse3
17279 +Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
17280 +@item amdfam10, barcelona
17281 +AMD Family 10h core based CPUs with x86-64 instruction set support. (This
17282 +supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
17283 +instruction set extensions.)
17284 +@item winchip-c6
17285 +IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
17286 +set support.
17287 +@item winchip2
17288 +IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
17289 +instruction set support.
17290 +@item c3
17291 +Via C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
17292 +implemented for this chip.)
17293 +@item c3-2
17294 +Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
17295 +implemented for this chip.)
17296 +@item geode
17297 +Embedded AMD CPU with MMX and 3DNow!@: instruction set support.
17298 +@end table
17300 +While picking a specific @var{cpu-type} will schedule things appropriately
17301 +for that particular chip, the compiler will not generate any code that
17302 +does not run on the i386 without the @option{-march=@var{cpu-type}} option
17303 +being used.
17305 +@item -march=@var{cpu-type}
17306 +@opindex march
17307 +Generate instructions for the machine type @var{cpu-type}. The choices
17308 +for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
17309 +specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
17311 +@item -mcpu=@var{cpu-type}
17312 +@opindex mcpu
17313 +A deprecated synonym for @option{-mtune}.
17315 +@item -mfpmath=@var{unit}
17316 +@opindex mfpmath
17317 +Generate floating point arithmetics for selected unit @var{unit}. The choices
17318 +for @var{unit} are:
17320 +@table @samp
17321 +@item 387
17322 +Use the standard 387 floating point coprocessor present majority of chips and
17323 +emulated otherwise. Code compiled with this option will run almost everywhere.
17324 +The temporary results are computed in 80bit precision instead of precision
17325 +specified by the type resulting in slightly different results compared to most
17326 +of other chips. See @option{-ffloat-store} for more detailed description.
17328 +This is the default choice for i386 compiler.
17330 +@item sse
17331 +Use scalar floating point instructions present in the SSE instruction set.
17332 +This instruction set is supported by Pentium3 and newer chips, in the AMD line
17333 +by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
17334 +instruction set supports only single precision arithmetics, thus the double and
17335 +extended precision arithmetics is still done using 387. Later version, present
17336 +only in Pentium4 and the future AMD x86-64 chips supports double precision
17337 +arithmetics too.
17339 +For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
17340 +or @option{-msse2} switches to enable SSE extensions and make this option
17341 +effective. For the x86-64 compiler, these extensions are enabled by default.
17343 +The resulting code should be considerably faster in the majority of cases and avoid
17344 +the numerical instability problems of 387 code, but may break some existing
17345 +code that expects temporaries to be 80bit.
17347 +This is the default choice for the x86-64 compiler.
17349 +@item sse,387
17350 +@itemx sse+387
17351 +@itemx both
17352 +Attempt to utilize both instruction sets at once. This effectively double the
17353 +amount of available registers and on chips with separate execution units for
17354 +387 and SSE the execution resources too. Use this option with care, as it is
17355 +still experimental, because the GCC register allocator does not model separate
17356 +functional units well resulting in instable performance.
17357 +@end table
17359 +@item -masm=@var{dialect}
17360 +@opindex masm=@var{dialect}
17361 +Output asm instructions using selected @var{dialect}. Supported
17362 +choices are @samp{intel} or @samp{att} (the default one). Darwin does
17363 +not support @samp{intel}.
17365 +@item -mieee-fp
17366 +@itemx -mno-ieee-fp
17367 +@opindex mieee-fp
17368 +@opindex mno-ieee-fp
17369 +Control whether or not the compiler uses IEEE floating point
17370 +comparisons. These handle correctly the case where the result of a
17371 +comparison is unordered.
17373 +@item -msoft-float
17374 +@opindex msoft-float
17375 +Generate output containing library calls for floating point.
17376 +@strong{Warning:} the requisite libraries are not part of GCC@.
17377 +Normally the facilities of the machine's usual C compiler are used, but
17378 +this can't be done directly in cross-compilation. You must make your
17379 +own arrangements to provide suitable library functions for
17380 +cross-compilation.
17382 +On machines where a function returns floating point results in the 80387
17383 +register stack, some floating point opcodes may be emitted even if
17384 +@option{-msoft-float} is used.
17386 +@item -mno-fp-ret-in-387
17387 +@opindex mno-fp-ret-in-387
17388 +Do not use the FPU registers for return values of functions.
17390 +The usual calling convention has functions return values of types
17391 +@code{float} and @code{double} in an FPU register, even if there
17392 +is no FPU@. The idea is that the operating system should emulate
17393 +an FPU@.
17395 +The option @option{-mno-fp-ret-in-387} causes such values to be returned
17396 +in ordinary CPU registers instead.
17398 +@item -mno-fancy-math-387
17399 +@opindex mno-fancy-math-387
17400 +Some 387 emulators do not support the @code{sin}, @code{cos} and
17401 +@code{sqrt} instructions for the 387. Specify this option to avoid
17402 +generating those instructions. This option is the default on FreeBSD,
17403 +OpenBSD and NetBSD@. This option is overridden when @option{-march}
17404 +indicates that the target CPU will always have an FPU and so the
17405 +instruction will not need emulation. As of revision 2.6.1, these
17406 +instructions are not generated unless you also use the
17407 +@option{-funsafe-math-optimizations} switch.
17409 +@item -malign-double
17410 +@itemx -mno-align-double
17411 +@opindex malign-double
17412 +@opindex mno-align-double
17413 +Control whether GCC aligns @code{double}, @code{long double}, and
17414 +@code{long long} variables on a two word boundary or a one word
17415 +boundary. Aligning @code{double} variables on a two word boundary will
17416 +produce code that runs somewhat faster on a @samp{Pentium} at the
17417 +expense of more memory.
17419 +On x86-64, @option{-malign-double} is enabled by default.
17421 +@strong{Warning:} if you use the @option{-malign-double} switch,
17422 +structures containing the above types will be aligned differently than
17423 +the published application binary interface specifications for the 386
17424 +and will not be binary compatible with structures in code compiled
17425 +without that switch.
17427 +@item -m96bit-long-double
17428 +@itemx -m128bit-long-double
17429 +@opindex m96bit-long-double
17430 +@opindex m128bit-long-double
17431 +These switches control the size of @code{long double} type. The i386
17432 +application binary interface specifies the size to be 96 bits,
17433 +so @option{-m96bit-long-double} is the default in 32 bit mode.
17435 +Modern architectures (Pentium and newer) would prefer @code{long double}
17436 +to be aligned to an 8 or 16 byte boundary. In arrays or structures
17437 +conforming to the ABI, this would not be possible. So specifying a
17438 +@option{-m128bit-long-double} will align @code{long double}
17439 +to a 16 byte boundary by padding the @code{long double} with an additional
17440 +32 bit zero.
17442 +In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
17443 +its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
17445 +Notice that neither of these options enable any extra precision over the x87
17446 +standard of 80 bits for a @code{long double}.
17448 +@strong{Warning:} if you override the default value for your target ABI, the
17449 +structures and arrays containing @code{long double} variables will change
17450 +their size as well as function calling convention for function taking
17451 +@code{long double} will be modified. Hence they will not be binary
17452 +compatible with arrays or structures in code compiled without that switch.
17454 +@item -mlarge-data-threshold=@var{number}
17455 +@opindex mlarge-data-threshold=@var{number}
17456 +When @option{-mcmodel=medium} is specified, the data greater than
17457 +@var{threshold} are placed in large data section. This value must be the
17458 +same across all object linked into the binary and defaults to 65535.
17460 +@item -mrtd
17461 +@opindex mrtd
17462 +Use a different function-calling convention, in which functions that
17463 +take a fixed number of arguments return with the @code{ret} @var{num}
17464 +instruction, which pops their arguments while returning. This saves one
17465 +instruction in the caller since there is no need to pop the arguments
17466 +there.
17468 +You can specify that an individual function is called with this calling
17469 +sequence with the function attribute @samp{stdcall}. You can also
17470 +override the @option{-mrtd} option by using the function attribute
17471 +@samp{cdecl}. @xref{Function Attributes}.
17473 +@strong{Warning:} this calling convention is incompatible with the one
17474 +normally used on Unix, so you cannot use it if you need to call
17475 +libraries compiled with the Unix compiler.
17477 +Also, you must provide function prototypes for all functions that
17478 +take variable numbers of arguments (including @code{printf});
17479 +otherwise incorrect code will be generated for calls to those
17480 +functions.
17482 +In addition, seriously incorrect code will result if you call a
17483 +function with too many arguments. (Normally, extra arguments are
17484 +harmlessly ignored.)
17486 +@item -mregparm=@var{num}
17487 +@opindex mregparm
17488 +Control how many registers are used to pass integer arguments. By
17489 +default, no registers are used to pass arguments, and at most 3
17490 +registers can be used. You can control this behavior for a specific
17491 +function by using the function attribute @samp{regparm}.
17492 +@xref{Function Attributes}.
17494 +@strong{Warning:} if you use this switch, and
17495 +@var{num} is nonzero, then you must build all modules with the same
17496 +value, including any libraries. This includes the system libraries and
17497 +startup modules.
17499 +@item -msseregparm
17500 +@opindex msseregparm
17501 +Use SSE register passing conventions for float and double arguments
17502 +and return values. You can control this behavior for a specific
17503 +function by using the function attribute @samp{sseregparm}.
17504 +@xref{Function Attributes}.
17506 +@strong{Warning:} if you use this switch then you must build all
17507 +modules with the same value, including any libraries. This includes
17508 +the system libraries and startup modules.
17510 +@item -mvect8-ret-in-mem
17511 +@opindex mvect8-ret-in-mem
17512 +Return 8-byte vectors in memory instead of MMX registers. This is the
17513 +default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
17514 +Studio compilers until version 12. Later compiler versions (starting
17515 +with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
17516 +is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
17517 +you need to remain compatible with existing code produced by those
17518 +previous compiler versions or older versions of GCC.
17520 +@item -mpc32
17521 +@itemx -mpc64
17522 +@itemx -mpc80
17523 +@opindex mpc32
17524 +@opindex mpc64
17525 +@opindex mpc80
17527 +Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
17528 +is specified, the significands of results of floating-point operations are
17529 +rounded to 24 bits (single precision); @option{-mpc64} rounds the
17530 +significands of results of floating-point operations to 53 bits (double
17531 +precision) and @option{-mpc80} rounds the significands of results of
17532 +floating-point operations to 64 bits (extended double precision), which is
17533 +the default. When this option is used, floating-point operations in higher
17534 +precisions are not available to the programmer without setting the FPU
17535 +control word explicitly.
17537 +Setting the rounding of floating-point operations to less than the default
17538 +80 bits can speed some programs by 2% or more. Note that some mathematical
17539 +libraries assume that extended precision (80 bit) floating-point operations
17540 +are enabled by default; routines in such libraries could suffer significant
17541 +loss of accuracy, typically through so-called "catastrophic cancellation",
17542 +when this option is used to set the precision to less than extended precision.
17544 +@item -mstackrealign
17545 +@opindex mstackrealign
17546 +Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
17547 +option will generate an alternate prologue and epilogue that realigns the
17548 +runtime stack if necessary. This supports mixing legacy codes that keep
17549 +a 4-byte aligned stack with modern codes that keep a 16-byte stack for
17550 +SSE compatibility. See also the attribute @code{force_align_arg_pointer},
17551 +applicable to individual functions.
17553 +@item -mpreferred-stack-boundary=@var{num}
17554 +@opindex mpreferred-stack-boundary
17555 +Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
17556 +byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
17557 +the default is 4 (16 bytes or 128 bits).
17559 +@item -mincoming-stack-boundary=@var{num}
17560 +@opindex mincoming-stack-boundary
17561 +Assume the incoming stack is aligned to a 2 raised to @var{num} byte
17562 +boundary. If @option{-mincoming-stack-boundary} is not specified,
17563 +the one specified by @option{-mpreferred-stack-boundary} will be used.
17565 +On Pentium and PentiumPro, @code{double} and @code{long double} values
17566 +should be aligned to an 8 byte boundary (see @option{-malign-double}) or
17567 +suffer significant run time performance penalties. On Pentium III, the
17568 +Streaming SIMD Extension (SSE) data type @code{__m128} may not work
17569 +properly if it is not 16 byte aligned.
17571 +To ensure proper alignment of this values on the stack, the stack boundary
17572 +must be as aligned as that required by any value stored on the stack.
17573 +Further, every function must be generated such that it keeps the stack
17574 +aligned. Thus calling a function compiled with a higher preferred
17575 +stack boundary from a function compiled with a lower preferred stack
17576 +boundary will most likely misalign the stack. It is recommended that
17577 +libraries that use callbacks always use the default setting.
17579 +This extra alignment does consume extra stack space, and generally
17580 +increases code size. Code that is sensitive to stack space usage, such
17581 +as embedded systems and operating system kernels, may want to reduce the
17582 +preferred alignment to @option{-mpreferred-stack-boundary=2}.
17584 +@item -mmmx
17585 +@itemx -mno-mmx
17586 +@itemx -msse
17587 +@itemx -mno-sse
17588 +@itemx -msse2
17589 +@itemx -mno-sse2
17590 +@itemx -msse3
17591 +@itemx -mno-sse3
17592 +@itemx -mssse3
17593 +@itemx -mno-ssse3
17594 +@itemx -msse4.1
17595 +@need 800
17596 +@itemx -mno-sse4.1
17597 +@itemx -msse4.2
17598 +@itemx -mno-sse4.2
17599 +@itemx -msse4
17600 +@itemx -mno-sse4
17601 +@itemx -mavx
17602 +@itemx -mno-avx
17603 +@itemx -maes
17604 +@itemx -mno-aes
17605 +@itemx -mpclmul
17606 +@need 800
17607 +@itemx -mno-pclmul
17608 +@itemx -mfsgsbase
17609 +@itemx -mno-fsgsbase
17610 +@itemx -mrdrnd
17611 +@itemx -mno-rdrnd
17612 +@itemx -mf16c
17613 +@itemx -mno-f16c
17614 +@itemx -msse4a
17615 +@itemx -mno-sse4a
17616 +@itemx -mfma4
17617 +@need 800
17618 +@itemx -mno-fma4
17619 +@itemx -mxop
17620 +@itemx -mno-xop
17621 +@itemx -mlwp
17622 +@itemx -mno-lwp
17623 +@itemx -m3dnow
17624 +@itemx -mno-3dnow
17625 +@itemx -mpopcnt
17626 +@itemx -mno-popcnt
17627 +@itemx -mabm
17628 +@itemx -mno-abm
17629 +@itemx -mbmi
17630 +@itemx -mno-bmi
17631 +@itemx -mtbm
17632 +@itemx -mno-tbm
17633 +@opindex mmmx
17634 +@opindex mno-mmx
17635 +@opindex msse
17636 +@opindex mno-sse
17637 +@opindex m3dnow
17638 +@opindex mno-3dnow
17639 +These switches enable or disable the use of instructions in the MMX,
17640 +SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, FSGSBASE, RDRND,
17641 +F16C, SSE4A, FMA4, XOP, LWP, ABM, BMI, or 3DNow!@: extended instruction sets.
17642 +These extensions are also available as built-in functions: see
17643 +@ref{X86 Built-in Functions}, for details of the functions enabled and
17644 +disabled by these switches.
17646 +To have SSE/SSE2 instructions generated automatically from floating-point
17647 +code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
17649 +GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
17650 +generates new AVX instructions or AVX equivalence for all SSEx instructions
17651 +when needed.
17653 +These options will enable GCC to use these extended instructions in
17654 +generated code, even without @option{-mfpmath=sse}. Applications which
17655 +perform runtime CPU detection must compile separate files for each
17656 +supported architecture, using the appropriate flags. In particular,
17657 +the file containing the CPU detection code should be compiled without
17658 +these options.
17660 +@item -mfused-madd
17661 +@itemx -mno-fused-madd
17662 +@opindex mfused-madd
17663 +@opindex mno-fused-madd
17664 +Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17665 +instructions. The default is to use these instructions.
17667 +@item -mcld
17668 +@opindex mcld
17669 +This option instructs GCC to emit a @code{cld} instruction in the prologue
17670 +of functions that use string instructions. String instructions depend on
17671 +the DF flag to select between autoincrement or autodecrement mode. While the
17672 +ABI specifies the DF flag to be cleared on function entry, some operating
17673 +systems violate this specification by not clearing the DF flag in their
17674 +exception dispatchers. The exception handler can be invoked with the DF flag
17675 +set which leads to wrong direction mode, when string instructions are used.
17676 +This option can be enabled by default on 32-bit x86 targets by configuring
17677 +GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
17678 +instructions can be suppressed with the @option{-mno-cld} compiler option
17679 +in this case.
17681 +@item -mvzeroupper
17682 +@opindex mvzeroupper
17683 +This option instructs GCC to emit a @code{vzeroupper} instruction
17684 +before a transfer of control flow out of the function to minimize
17685 +AVX to SSE transition penalty as well as remove unnecessary zeroupper
17686 +intrinsics.
17688 +@item -mprefer-avx128
17689 +@opindex mprefer-avx128
17690 +This option instructs GCC to use 128-bit AVX instructions instead of
17691 +256-bit AVX instructions in the auto-vectorizer.
17693 +@item -mcx16
17694 +@opindex mcx16
17695 +This option will enable GCC to use CMPXCHG16B instruction in generated code.
17696 +CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
17697 +data types. This is useful for high resolution counters that could be updated
17698 +by multiple processors (or cores). This instruction is generated as part of
17699 +atomic built-in functions: see @ref{Atomic Builtins} for details.
17701 +@item -msahf
17702 +@opindex msahf
17703 +This option will enable GCC to use SAHF instruction in generated 64-bit code.
17704 +Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
17705 +by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
17706 +SAHF are load and store instructions, respectively, for certain status flags.
17707 +In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
17708 +or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
17710 +@item -mmovbe
17711 +@opindex mmovbe
17712 +This option will enable GCC to use movbe instruction to implement
17713 +@code{__builtin_bswap32} and @code{__builtin_bswap64}.
17715 +@item -mcrc32
17716 +@opindex mcrc32
17717 +This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
17718 +@code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
17719 +@code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
17721 +@item -mrecip
17722 +@opindex mrecip
17723 +This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
17724 +vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
17725 +to increase precision instead of DIVSS and SQRTSS (and their vectorized
17726 +variants) for single precision floating point arguments. These instructions
17727 +are generated only when @option{-funsafe-math-optimizations} is enabled
17728 +together with @option{-finite-math-only} and @option{-fno-trapping-math}.
17729 +Note that while the throughput of the sequence is higher than the throughput
17730 +of the non-reciprocal instruction, the precision of the sequence can be
17731 +decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
17733 +Note that GCC implements 1.0f/sqrtf(x) in terms of RSQRTSS (or RSQRTPS)
17734 +already with @option{-ffast-math} (or the above option combination), and
17735 +doesn't need @option{-mrecip}.
17737 +@item -mveclibabi=@var{type}
17738 +@opindex mveclibabi
17739 +Specifies the ABI type to use for vectorizing intrinsics using an
17740 +external library. Supported types are @code{svml} for the Intel short
17741 +vector math library and @code{acml} for the AMD math core library style
17742 +of interfacing. GCC will currently emit calls to @code{vmldExp2},
17743 +@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
17744 +@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
17745 +@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
17746 +@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
17747 +@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
17748 +@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
17749 +@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
17750 +@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
17751 +@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
17752 +function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
17753 +@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
17754 +@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
17755 +@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
17756 +@code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
17757 +when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
17758 +@option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
17759 +compatible library will have to be specified at link time.
17761 +@item -mabi=@var{name}
17762 +@opindex mabi
17763 +Generate code for the specified calling convention. Permissible values
17764 +are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
17765 +@samp{ms} for the Microsoft ABI. The default is to use the Microsoft
17766 +ABI when targeting Windows. On all other systems, the default is the
17767 +SYSV ABI. You can control this behavior for a specific function by
17768 +using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
17769 +@xref{Function Attributes}.
17771 +@item -mpush-args
17772 +@itemx -mno-push-args
17773 +@opindex mpush-args
17774 +@opindex mno-push-args
17775 +Use PUSH operations to store outgoing parameters. This method is shorter
17776 +and usually equally fast as method using SUB/MOV operations and is enabled
17777 +by default. In some cases disabling it may improve performance because of
17778 +improved scheduling and reduced dependencies.
17780 +@item -maccumulate-outgoing-args
17781 +@opindex maccumulate-outgoing-args
17782 +If enabled, the maximum amount of space required for outgoing arguments will be
17783 +computed in the function prologue. This is faster on most modern CPUs
17784 +because of reduced dependencies, improved scheduling and reduced stack usage
17785 +when preferred stack boundary is not equal to 2. The drawback is a notable
17786 +increase in code size. This switch implies @option{-mno-push-args}.
17788 +@item -mthreads
17789 +@opindex mthreads
17790 +Support thread-safe exception handling on @samp{Mingw32}. Code that relies
17791 +on thread-safe exception handling must compile and link all code with the
17792 +@option{-mthreads} option. When compiling, @option{-mthreads} defines
17793 +@option{-D_MT}; when linking, it links in a special thread helper library
17794 +@option{-lmingwthrd} which cleans up per thread exception handling data.
17796 +@item -mno-align-stringops
17797 +@opindex mno-align-stringops
17798 +Do not align destination of inlined string operations. This switch reduces
17799 +code size and improves performance in case the destination is already aligned,
17800 +but GCC doesn't know about it.
17802 +@item -minline-all-stringops
17803 +@opindex minline-all-stringops
17804 +By default GCC inlines string operations only when destination is known to be
17805 +aligned at least to 4 byte boundary. This enables more inlining, increase code
17806 +size, but may improve performance of code that depends on fast memcpy, strlen
17807 +and memset for short lengths.
17809 +@item -minline-stringops-dynamically
17810 +@opindex minline-stringops-dynamically
17811 +For string operation of unknown size, inline runtime checks so for small
17812 +blocks inline code is used, while for large blocks library call is used.
17814 +@item -mstringop-strategy=@var{alg}
17815 +@opindex mstringop-strategy=@var{alg}
17816 +Overwrite internal decision heuristic about particular algorithm to inline
17817 +string operation with. The allowed values are @code{rep_byte},
17818 +@code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
17819 +of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
17820 +expanding inline loop, @code{libcall} for always expanding library call.
17822 +@item -momit-leaf-frame-pointer
17823 +@opindex momit-leaf-frame-pointer
17824 +Don't keep the frame pointer in a register for leaf functions. This
17825 +avoids the instructions to save, set up and restore frame pointers and
17826 +makes an extra register available in leaf functions. The option
17827 +@option{-fomit-frame-pointer} removes the frame pointer for all functions
17828 +which might make debugging harder.
17830 +@item -mtls-direct-seg-refs
17831 +@itemx -mno-tls-direct-seg-refs
17832 +@opindex mtls-direct-seg-refs
17833 +Controls whether TLS variables may be accessed with offsets from the
17834 +TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
17835 +or whether the thread base pointer must be added. Whether or not this
17836 +is legal depends on the operating system, and whether it maps the
17837 +segment to cover the entire TLS area.
17839 +For systems that use GNU libc, the default is on.
17841 +@item -msse2avx
17842 +@itemx -mno-sse2avx
17843 +@opindex msse2avx
17844 +Specify that the assembler should encode SSE instructions with VEX
17845 +prefix. The option @option{-mavx} turns this on by default.
17847 +@item -mfentry
17848 +@itemx -mno-fentry
17849 +@opindex mfentry
17850 +If profiling is active @option{-pg} put the profiling
17851 +counter call before prologue.
17852 +Note: On x86 architectures the attribute @code{ms_hook_prologue}
17853 +isn't possible at the moment for @option{-mfentry} and @option{-pg}.
17855 +@item -m8bit-idiv
17856 +@itemx -mno-8bit-idiv
17857 +@opindex 8bit-idiv
17858 +On some processors, like Intel Atom, 8bit unsigned integer divide is
17859 +much faster than 32bit/64bit integer divide. This option will generate a
17860 +runt-time check. If both dividend and divisor are within range of 0
17861 +to 255, 8bit unsigned integer divide will be used instead of
17862 +32bit/64bit integer divide.
17864 +@item -mavx256-split-unaligned-load
17865 +@item -mavx256-split-unaligned-store
17866 +@opindex avx256-split-unaligned-load
17867 +@opindex avx256-split-unaligned-store
17868 +Split 32-byte AVX unaligned load and store.
17870 +@end table
17872 +These @samp{-m} switches are supported in addition to the above
17873 +on AMD x86-64 processors in 64-bit environments.
17875 +@table @gcctabopt
17876 +@item -m32
17877 +@itemx -m64
17878 +@opindex m32
17879 +@opindex m64
17880 +Generate code for a 32-bit or 64-bit environment.
17881 +The 32-bit environment sets int, long and pointer to 32 bits and
17882 +generates code that runs on any i386 system.
17883 +The 64-bit environment sets int to 32 bits and long and pointer
17884 +to 64 bits and generates code for AMD's x86-64 architecture. For
17885 +darwin only the -m64 option turns off the @option{-fno-pic} and
17886 +@option{-mdynamic-no-pic} options.
17888 +@item -mno-red-zone
17889 +@opindex mno-red-zone
17890 +Do not use a so called red zone for x86-64 code. The red zone is mandated
17891 +by the x86-64 ABI, it is a 128-byte area beyond the location of the
17892 +stack pointer that will not be modified by signal or interrupt handlers
17893 +and therefore can be used for temporary data without adjusting the stack
17894 +pointer. The flag @option{-mno-red-zone} disables this red zone.
17896 +@item -mcmodel=small
17897 +@opindex mcmodel=small
17898 +Generate code for the small code model: the program and its symbols must
17899 +be linked in the lower 2 GB of the address space. Pointers are 64 bits.
17900 +Programs can be statically or dynamically linked. This is the default
17901 +code model.
17903 +@item -mcmodel=kernel
17904 +@opindex mcmodel=kernel
17905 +Generate code for the kernel code model. The kernel runs in the
17906 +negative 2 GB of the address space.
17907 +This model has to be used for Linux kernel code.
17909 +@item -mcmodel=medium
17910 +@opindex mcmodel=medium
17911 +Generate code for the medium model: The program is linked in the lower 2
17912 +GB of the address space. Small symbols are also placed there. Symbols
17913 +with sizes larger than @option{-mlarge-data-threshold} are put into
17914 +large data or bss sections and can be located above 2GB. Programs can
17915 +be statically or dynamically linked.
17917 +@item -mcmodel=large
17918 +@opindex mcmodel=large
17919 +Generate code for the large model: This model makes no assumptions
17920 +about addresses and sizes of sections.
17921 +@end table
17923 +@node i386 and x86-64 Windows Options
17924 +@subsection i386 and x86-64 Windows Options
17925 +@cindex i386 and x86-64 Windows Options
17927 +These additional options are available for Windows targets:
17929 +@table @gcctabopt
17930 +@item -mconsole
17931 +@opindex mconsole
17932 +This option is available for Cygwin and MinGW targets. It
17933 +specifies that a console application is to be generated, by
17934 +instructing the linker to set the PE header subsystem type
17935 +required for console applications.
17936 +This is the default behavior for Cygwin and MinGW targets.
17938 +@item -mdll
17939 +@opindex mdll
17940 +This option is available for Cygwin and MinGW targets. It
17941 +specifies that a DLL - a dynamic link library - is to be
17942 +generated, enabling the selection of the required runtime
17943 +startup object and entry point.
17945 +@item -mnop-fun-dllimport
17946 +@opindex mnop-fun-dllimport
17947 +This option is available for Cygwin and MinGW targets. It
17948 +specifies that the dllimport attribute should be ignored.
17950 +@item -mthread
17951 +@opindex mthread
17952 +This option is available for MinGW targets. It specifies
17953 +that MinGW-specific thread support is to be used.
17955 +@item -municode
17956 +@opindex municode
17957 +This option is available for mingw-w64 targets. It specifies
17958 +that the UNICODE macro is getting pre-defined and that the
17959 +unicode capable runtime startup code is chosen.
17961 +@item -mwin32
17962 +@opindex mwin32
17963 +This option is available for Cygwin and MinGW targets. It
17964 +specifies that the typical Windows pre-defined macros are to
17965 +be set in the pre-processor, but does not influence the choice
17966 +of runtime library/startup code.
17968 +@item -mwindows
17969 +@opindex mwindows
17970 +This option is available for Cygwin and MinGW targets. It
17971 +specifies that a GUI application is to be generated by
17972 +instructing the linker to set the PE header subsystem type
17973 +appropriately.
17975 +@item -fno-set-stack-executable
17976 +@opindex fno-set-stack-executable
17977 +This option is available for MinGW targets. It specifies that
17978 +the executable flag for stack used by nested functions isn't
17979 +set. This is necessary for binaries running in kernel mode of
17980 +Windows, as there the user32 API, which is used to set executable
17981 +privileges, isn't available.
17983 +@item -mpe-aligned-commons
17984 +@opindex mpe-aligned-commons
17985 +This option is available for Cygwin and MinGW targets. It
17986 +specifies that the GNU extension to the PE file format that
17987 +permits the correct alignment of COMMON variables should be
17988 +used when generating code. It will be enabled by default if
17989 +GCC detects that the target assembler found during configuration
17990 +supports the feature.
17991 +@end table
17993 +See also under @ref{i386 and x86-64 Options} for standard options.
17995 +@node IA-64 Options
17996 +@subsection IA-64 Options
17997 +@cindex IA-64 Options
17999 +These are the @samp{-m} options defined for the Intel IA-64 architecture.
18001 +@table @gcctabopt
18002 +@item -mbig-endian
18003 +@opindex mbig-endian
18004 +Generate code for a big endian target. This is the default for HP-UX@.
18006 +@item -mlittle-endian
18007 +@opindex mlittle-endian
18008 +Generate code for a little endian target. This is the default for AIX5
18009 +and GNU/Linux.
18011 +@item -mgnu-as
18012 +@itemx -mno-gnu-as
18013 +@opindex mgnu-as
18014 +@opindex mno-gnu-as
18015 +Generate (or don't) code for the GNU assembler. This is the default.
18016 +@c Also, this is the default if the configure option @option{--with-gnu-as}
18017 +@c is used.
18019 +@item -mgnu-ld
18020 +@itemx -mno-gnu-ld
18021 +@opindex mgnu-ld
18022 +@opindex mno-gnu-ld
18023 +Generate (or don't) code for the GNU linker. This is the default.
18024 +@c Also, this is the default if the configure option @option{--with-gnu-ld}
18025 +@c is used.
18027 +@item -mno-pic
18028 +@opindex mno-pic
18029 +Generate code that does not use a global pointer register. The result
18030 +is not position independent code, and violates the IA-64 ABI@.
18032 +@item -mvolatile-asm-stop
18033 +@itemx -mno-volatile-asm-stop
18034 +@opindex mvolatile-asm-stop
18035 +@opindex mno-volatile-asm-stop
18036 +Generate (or don't) a stop bit immediately before and after volatile asm
18037 +statements.
18039 +@item -mregister-names
18040 +@itemx -mno-register-names
18041 +@opindex mregister-names
18042 +@opindex mno-register-names
18043 +Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18044 +the stacked registers. This may make assembler output more readable.
18046 +@item -mno-sdata
18047 +@itemx -msdata
18048 +@opindex mno-sdata
18049 +@opindex msdata
18050 +Disable (or enable) optimizations that use the small data section. This may
18051 +be useful for working around optimizer bugs.
18053 +@item -mconstant-gp
18054 +@opindex mconstant-gp
18055 +Generate code that uses a single constant global pointer value. This is
18056 +useful when compiling kernel code.
18058 +@item -mauto-pic
18059 +@opindex mauto-pic
18060 +Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18061 +This is useful when compiling firmware code.
18063 +@item -minline-float-divide-min-latency
18064 +@opindex minline-float-divide-min-latency
18065 +Generate code for inline divides of floating point values
18066 +using the minimum latency algorithm.
18068 +@item -minline-float-divide-max-throughput
18069 +@opindex minline-float-divide-max-throughput
18070 +Generate code for inline divides of floating point values
18071 +using the maximum throughput algorithm.
18073 +@item -mno-inline-float-divide
18074 +@opindex mno-inline-float-divide
18075 +Do not generate inline code for divides of floating point values.
18077 +@item -minline-int-divide-min-latency
18078 +@opindex minline-int-divide-min-latency
18079 +Generate code for inline divides of integer values
18080 +using the minimum latency algorithm.
18082 +@item -minline-int-divide-max-throughput
18083 +@opindex minline-int-divide-max-throughput
18084 +Generate code for inline divides of integer values
18085 +using the maximum throughput algorithm.
18087 +@item -mno-inline-int-divide
18088 +@opindex mno-inline-int-divide
18089 +Do not generate inline code for divides of integer values.
18091 +@item -minline-sqrt-min-latency
18092 +@opindex minline-sqrt-min-latency
18093 +Generate code for inline square roots
18094 +using the minimum latency algorithm.
18096 +@item -minline-sqrt-max-throughput
18097 +@opindex minline-sqrt-max-throughput
18098 +Generate code for inline square roots
18099 +using the maximum throughput algorithm.
18101 +@item -mno-inline-sqrt
18102 +@opindex mno-inline-sqrt
18103 +Do not generate inline code for sqrt.
18105 +@item -mfused-madd
18106 +@itemx -mno-fused-madd
18107 +@opindex mfused-madd
18108 +@opindex mno-fused-madd
18109 +Do (don't) generate code that uses the fused multiply/add or multiply/subtract
18110 +instructions. The default is to use these instructions.
18112 +@item -mno-dwarf2-asm
18113 +@itemx -mdwarf2-asm
18114 +@opindex mno-dwarf2-asm
18115 +@opindex mdwarf2-asm
18116 +Don't (or do) generate assembler code for the DWARF2 line number debugging
18117 +info. This may be useful when not using the GNU assembler.
18119 +@item -mearly-stop-bits
18120 +@itemx -mno-early-stop-bits
18121 +@opindex mearly-stop-bits
18122 +@opindex mno-early-stop-bits
18123 +Allow stop bits to be placed earlier than immediately preceding the
18124 +instruction that triggered the stop bit. This can improve instruction
18125 +scheduling, but does not always do so.
18127 +@item -mfixed-range=@var{register-range}
18128 +@opindex mfixed-range
18129 +Generate code treating the given register range as fixed registers.
18130 +A fixed register is one that the register allocator can not use. This is
18131 +useful when compiling kernel code. A register range is specified as
18132 +two registers separated by a dash. Multiple register ranges can be
18133 +specified separated by a comma.
18135 +@item -mtls-size=@var{tls-size}
18136 +@opindex mtls-size
18137 +Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
18138 +64.
18140 +@item -mtune=@var{cpu-type}
18141 +@opindex mtune
18142 +Tune the instruction scheduling for a particular CPU, Valid values are
18143 +itanium, itanium1, merced, itanium2, and mckinley.
18145 +@item -milp32
18146 +@itemx -mlp64
18147 +@opindex milp32
18148 +@opindex mlp64
18149 +Generate code for a 32-bit or 64-bit environment.
18150 +The 32-bit environment sets int, long and pointer to 32 bits.
18151 +The 64-bit environment sets int to 32 bits and long and pointer
18152 +to 64 bits. These are HP-UX specific flags.
18154 +@item -mno-sched-br-data-spec
18155 +@itemx -msched-br-data-spec
18156 +@opindex mno-sched-br-data-spec
18157 +@opindex msched-br-data-spec
18158 +(Dis/En)able data speculative scheduling before reload.
18159 +This will result in generation of the ld.a instructions and
18160 +the corresponding check instructions (ld.c / chk.a).
18161 +The default is 'disable'.
18163 +@item -msched-ar-data-spec
18164 +@itemx -mno-sched-ar-data-spec
18165 +@opindex msched-ar-data-spec
18166 +@opindex mno-sched-ar-data-spec
18167 +(En/Dis)able data speculative scheduling after reload.
18168 +This will result in generation of the ld.a instructions and
18169 +the corresponding check instructions (ld.c / chk.a).
18170 +The default is 'enable'.
18172 +@item -mno-sched-control-spec
18173 +@itemx -msched-control-spec
18174 +@opindex mno-sched-control-spec
18175 +@opindex msched-control-spec
18176 +(Dis/En)able control speculative scheduling. This feature is
18177 +available only during region scheduling (i.e.@: before reload).
18178 +This will result in generation of the ld.s instructions and
18179 +the corresponding check instructions chk.s .
18180 +The default is 'disable'.
18182 +@item -msched-br-in-data-spec
18183 +@itemx -mno-sched-br-in-data-spec
18184 +@opindex msched-br-in-data-spec
18185 +@opindex mno-sched-br-in-data-spec
18186 +(En/Dis)able speculative scheduling of the instructions that
18187 +are dependent on the data speculative loads before reload.
18188 +This is effective only with @option{-msched-br-data-spec} enabled.
18189 +The default is 'enable'.
18191 +@item -msched-ar-in-data-spec
18192 +@itemx -mno-sched-ar-in-data-spec
18193 +@opindex msched-ar-in-data-spec
18194 +@opindex mno-sched-ar-in-data-spec
18195 +(En/Dis)able speculative scheduling of the instructions that
18196 +are dependent on the data speculative loads after reload.
18197 +This is effective only with @option{-msched-ar-data-spec} enabled.
18198 +The default is 'enable'.
18200 +@item -msched-in-control-spec
18201 +@itemx -mno-sched-in-control-spec
18202 +@opindex msched-in-control-spec
18203 +@opindex mno-sched-in-control-spec
18204 +(En/Dis)able speculative scheduling of the instructions that
18205 +are dependent on the control speculative loads.
18206 +This is effective only with @option{-msched-control-spec} enabled.
18207 +The default is 'enable'.
18209 +@item -mno-sched-prefer-non-data-spec-insns
18210 +@itemx -msched-prefer-non-data-spec-insns
18211 +@opindex mno-sched-prefer-non-data-spec-insns
18212 +@opindex msched-prefer-non-data-spec-insns
18213 +If enabled, data speculative instructions will be chosen for schedule
18214 +only if there are no other choices at the moment. This will make
18215 +the use of the data speculation much more conservative.
18216 +The default is 'disable'.
18218 +@item -mno-sched-prefer-non-control-spec-insns
18219 +@itemx -msched-prefer-non-control-spec-insns
18220 +@opindex mno-sched-prefer-non-control-spec-insns
18221 +@opindex msched-prefer-non-control-spec-insns
18222 +If enabled, control speculative instructions will be chosen for schedule
18223 +only if there are no other choices at the moment. This will make
18224 +the use of the control speculation much more conservative.
18225 +The default is 'disable'.
18227 +@item -mno-sched-count-spec-in-critical-path
18228 +@itemx -msched-count-spec-in-critical-path
18229 +@opindex mno-sched-count-spec-in-critical-path
18230 +@opindex msched-count-spec-in-critical-path
18231 +If enabled, speculative dependencies will be considered during
18232 +computation of the instructions priorities. This will make the use of the
18233 +speculation a bit more conservative.
18234 +The default is 'disable'.
18236 +@item -msched-spec-ldc
18237 +@opindex msched-spec-ldc
18238 +Use a simple data speculation check. This option is on by default.
18240 +@item -msched-control-spec-ldc
18241 +@opindex msched-spec-ldc
18242 +Use a simple check for control speculation. This option is on by default.
18244 +@item -msched-stop-bits-after-every-cycle
18245 +@opindex msched-stop-bits-after-every-cycle
18246 +Place a stop bit after every cycle when scheduling. This option is on
18247 +by default.
18249 +@item -msched-fp-mem-deps-zero-cost
18250 +@opindex msched-fp-mem-deps-zero-cost
18251 +Assume that floating-point stores and loads are not likely to cause a conflict
18252 +when placed into the same instruction group. This option is disabled by
18253 +default.
18255 +@item -msel-sched-dont-check-control-spec
18256 +@opindex msel-sched-dont-check-control-spec
18257 +Generate checks for control speculation in selective scheduling.
18258 +This flag is disabled by default.
18260 +@item -msched-max-memory-insns=@var{max-insns}
18261 +@opindex msched-max-memory-insns
18262 +Limit on the number of memory insns per instruction group, giving lower
18263 +priority to subsequent memory insns attempting to schedule in the same
18264 +instruction group. Frequently useful to prevent cache bank conflicts.
18265 +The default value is 1.
18267 +@item -msched-max-memory-insns-hard-limit
18268 +@opindex msched-max-memory-insns-hard-limit
18269 +Disallow more than `msched-max-memory-insns' in instruction group.
18270 +Otherwise, limit is `soft' meaning that we would prefer non-memory operations
18271 +when limit is reached but may still schedule memory operations.
18273 +@end table
18275 +@node IA-64/VMS Options
18276 +@subsection IA-64/VMS Options
18278 +These @samp{-m} options are defined for the IA-64/VMS implementations:
18280 +@table @gcctabopt
18281 +@item -mvms-return-codes
18282 +@opindex mvms-return-codes
18283 +Return VMS condition codes from main. The default is to return POSIX
18284 +style condition (e.g.@ error) codes.
18286 +@item -mdebug-main=@var{prefix}
18287 +@opindex mdebug-main=@var{prefix}
18288 +Flag the first routine whose name starts with @var{prefix} as the main
18289 +routine for the debugger.
18291 +@item -mmalloc64
18292 +@opindex mmalloc64
18293 +Default to 64bit memory allocation routines.
18294 +@end table
18296 +@node LM32 Options
18297 +@subsection LM32 Options
18298 +@cindex LM32 options
18300 +These @option{-m} options are defined for the Lattice Mico32 architecture:
18302 +@table @gcctabopt
18303 +@item -mbarrel-shift-enabled
18304 +@opindex mbarrel-shift-enabled
18305 +Enable barrel-shift instructions.
18307 +@item -mdivide-enabled
18308 +@opindex mdivide-enabled
18309 +Enable divide and modulus instructions.
18311 +@item -mmultiply-enabled
18312 +@opindex multiply-enabled
18313 +Enable multiply instructions.
18315 +@item -msign-extend-enabled
18316 +@opindex msign-extend-enabled
18317 +Enable sign extend instructions.
18319 +@item -muser-enabled
18320 +@opindex muser-enabled
18321 +Enable user-defined instructions.
18323 +@end table
18325 +@node M32C Options
18326 +@subsection M32C Options
18327 +@cindex M32C options
18329 +@table @gcctabopt
18330 +@item -mcpu=@var{name}
18331 +@opindex mcpu=
18332 +Select the CPU for which code is generated. @var{name} may be one of
18333 +@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
18334 +/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
18335 +the M32C/80 series.
18337 +@item -msim
18338 +@opindex msim
18339 +Specifies that the program will be run on the simulator. This causes
18340 +an alternate runtime library to be linked in which supports, for
18341 +example, file I/O@. You must not use this option when generating
18342 +programs that will run on real hardware; you must provide your own
18343 +runtime library for whatever I/O functions are needed.
18345 +@item -memregs=@var{number}
18346 +@opindex memregs=
18347 +Specifies the number of memory-based pseudo-registers GCC will use
18348 +during code generation. These pseudo-registers will be used like real
18349 +registers, so there is a tradeoff between GCC's ability to fit the
18350 +code into available registers, and the performance penalty of using
18351 +memory instead of registers. Note that all modules in a program must
18352 +be compiled with the same value for this option. Because of that, you
18353 +must not use this option with the default runtime libraries gcc
18354 +builds.
18356 +@end table
18358 +@node M32R/D Options
18359 +@subsection M32R/D Options
18360 +@cindex M32R/D options
18362 +These @option{-m} options are defined for Renesas M32R/D architectures:
18364 +@table @gcctabopt
18365 +@item -m32r2
18366 +@opindex m32r2
18367 +Generate code for the M32R/2@.
18369 +@item -m32rx
18370 +@opindex m32rx
18371 +Generate code for the M32R/X@.
18373 +@item -m32r
18374 +@opindex m32r
18375 +Generate code for the M32R@. This is the default.
18377 +@item -mmodel=small
18378 +@opindex mmodel=small
18379 +Assume all objects live in the lower 16MB of memory (so that their addresses
18380 +can be loaded with the @code{ld24} instruction), and assume all subroutines
18381 +are reachable with the @code{bl} instruction.
18382 +This is the default.
18384 +The addressability of a particular object can be set with the
18385 +@code{model} attribute.
18387 +@item -mmodel=medium
18388 +@opindex mmodel=medium
18389 +Assume objects may be anywhere in the 32-bit address space (the compiler
18390 +will generate @code{seth/add3} instructions to load their addresses), and
18391 +assume all subroutines are reachable with the @code{bl} instruction.
18393 +@item -mmodel=large
18394 +@opindex mmodel=large
18395 +Assume objects may be anywhere in the 32-bit address space (the compiler
18396 +will generate @code{seth/add3} instructions to load their addresses), and
18397 +assume subroutines may not be reachable with the @code{bl} instruction
18398 +(the compiler will generate the much slower @code{seth/add3/jl}
18399 +instruction sequence).
18401 +@item -msdata=none
18402 +@opindex msdata=none
18403 +Disable use of the small data area. Variables will be put into
18404 +one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
18405 +@code{section} attribute has been specified).
18406 +This is the default.
18408 +The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
18409 +Objects may be explicitly put in the small data area with the
18410 +@code{section} attribute using one of these sections.
18412 +@item -msdata=sdata
18413 +@opindex msdata=sdata
18414 +Put small global and static data in the small data area, but do not
18415 +generate special code to reference them.
18417 +@item -msdata=use
18418 +@opindex msdata=use
18419 +Put small global and static data in the small data area, and generate
18420 +special instructions to reference them.
18422 +@item -G @var{num}
18423 +@opindex G
18424 +@cindex smaller data references
18425 +Put global and static objects less than or equal to @var{num} bytes
18426 +into the small data or bss sections instead of the normal data or bss
18427 +sections. The default value of @var{num} is 8.
18428 +The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
18429 +for this option to have any effect.
18431 +All modules should be compiled with the same @option{-G @var{num}} value.
18432 +Compiling with different values of @var{num} may or may not work; if it
18433 +doesn't the linker will give an error message---incorrect code will not be
18434 +generated.
18436 +@item -mdebug
18437 +@opindex mdebug
18438 +Makes the M32R specific code in the compiler display some statistics
18439 +that might help in debugging programs.
18441 +@item -malign-loops
18442 +@opindex malign-loops
18443 +Align all loops to a 32-byte boundary.
18445 +@item -mno-align-loops
18446 +@opindex mno-align-loops
18447 +Do not enforce a 32-byte alignment for loops. This is the default.
18449 +@item -missue-rate=@var{number}
18450 +@opindex missue-rate=@var{number}
18451 +Issue @var{number} instructions per cycle. @var{number} can only be 1
18452 +or 2.
18454 +@item -mbranch-cost=@var{number}
18455 +@opindex mbranch-cost=@var{number}
18456 +@var{number} can only be 1 or 2. If it is 1 then branches will be
18457 +preferred over conditional code, if it is 2, then the opposite will
18458 +apply.
18460 +@item -mflush-trap=@var{number}
18461 +@opindex mflush-trap=@var{number}
18462 +Specifies the trap number to use to flush the cache. The default is
18463 +12. Valid numbers are between 0 and 15 inclusive.
18465 +@item -mno-flush-trap
18466 +@opindex mno-flush-trap
18467 +Specifies that the cache cannot be flushed by using a trap.
18469 +@item -mflush-func=@var{name}
18470 +@opindex mflush-func=@var{name}
18471 +Specifies the name of the operating system function to call to flush
18472 +the cache. The default is @emph{_flush_cache}, but a function call
18473 +will only be used if a trap is not available.
18475 +@item -mno-flush-func
18476 +@opindex mno-flush-func
18477 +Indicates that there is no OS function for flushing the cache.
18479 +@end table
18481 +@node M680x0 Options
18482 +@subsection M680x0 Options
18483 +@cindex M680x0 options
18485 +These are the @samp{-m} options defined for M680x0 and ColdFire processors.
18486 +The default settings depend on which architecture was selected when
18487 +the compiler was configured; the defaults for the most common choices
18488 +are given below.
18490 +@table @gcctabopt
18491 +@item -march=@var{arch}
18492 +@opindex march
18493 +Generate code for a specific M680x0 or ColdFire instruction set
18494 +architecture. Permissible values of @var{arch} for M680x0
18495 +architectures are: @samp{68000}, @samp{68010}, @samp{68020},
18496 +@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
18497 +architectures are selected according to Freescale's ISA classification
18498 +and the permissible values are: @samp{isaa}, @samp{isaaplus},
18499 +@samp{isab} and @samp{isac}.
18501 +gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
18502 +code for a ColdFire target. The @var{arch} in this macro is one of the
18503 +@option{-march} arguments given above.
18505 +When used together, @option{-march} and @option{-mtune} select code
18506 +that runs on a family of similar processors but that is optimized
18507 +for a particular microarchitecture.
18509 +@item -mcpu=@var{cpu}
18510 +@opindex mcpu
18511 +Generate code for a specific M680x0 or ColdFire processor.
18512 +The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
18513 +@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
18514 +and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
18515 +below, which also classifies the CPUs into families:
18517 +@multitable @columnfractions 0.20 0.80
18518 +@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
18519 +@item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
18520 +@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
18521 +@item @samp{5206e} @tab @samp{5206e}
18522 +@item @samp{5208} @tab @samp{5207} @samp{5208}
18523 +@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
18524 +@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
18525 +@item @samp{5216} @tab @samp{5214} @samp{5216}
18526 +@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
18527 +@item @samp{5225} @tab @samp{5224} @samp{5225}
18528 +@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
18529 +@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
18530 +@item @samp{5249} @tab @samp{5249}
18531 +@item @samp{5250} @tab @samp{5250}
18532 +@item @samp{5271} @tab @samp{5270} @samp{5271}
18533 +@item @samp{5272} @tab @samp{5272}
18534 +@item @samp{5275} @tab @samp{5274} @samp{5275}
18535 +@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
18536 +@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
18537 +@item @samp{5307} @tab @samp{5307}
18538 +@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
18539 +@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
18540 +@item @samp{5407} @tab @samp{5407}
18541 +@item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485}
18542 +@end multitable
18544 +@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
18545 +@var{arch} is compatible with @var{cpu}. Other combinations of
18546 +@option{-mcpu} and @option{-march} are rejected.
18548 +gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
18549 +@var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
18550 +where the value of @var{family} is given by the table above.
18552 +@item -mtune=@var{tune}
18553 +@opindex mtune
18554 +Tune the code for a particular microarchitecture, within the
18555 +constraints set by @option{-march} and @option{-mcpu}.
18556 +The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
18557 +@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
18558 +and @samp{cpu32}. The ColdFire microarchitectures
18559 +are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
18561 +You can also use @option{-mtune=68020-40} for code that needs
18562 +to run relatively well on 68020, 68030 and 68040 targets.
18563 +@option{-mtune=68020-60} is similar but includes 68060 targets
18564 +as well. These two options select the same tuning decisions as
18565 +@option{-m68020-40} and @option{-m68020-60} respectively.
18567 +gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
18568 +when tuning for 680x0 architecture @var{arch}. It also defines
18569 +@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
18570 +option is used. If gcc is tuning for a range of architectures,
18571 +as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
18572 +it defines the macros for every architecture in the range.
18574 +gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
18575 +ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
18576 +of the arguments given above.
18578 +@item -m68000
18579 +@itemx -mc68000
18580 +@opindex m68000
18581 +@opindex mc68000
18582 +Generate output for a 68000. This is the default
18583 +when the compiler is configured for 68000-based systems.
18584 +It is equivalent to @option{-march=68000}.
18586 +Use this option for microcontrollers with a 68000 or EC000 core,
18587 +including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18589 +@item -m68010
18590 +@opindex m68010
18591 +Generate output for a 68010. This is the default
18592 +when the compiler is configured for 68010-based systems.
18593 +It is equivalent to @option{-march=68010}.
18595 +@item -m68020
18596 +@itemx -mc68020
18597 +@opindex m68020
18598 +@opindex mc68020
18599 +Generate output for a 68020. This is the default
18600 +when the compiler is configured for 68020-based systems.
18601 +It is equivalent to @option{-march=68020}.
18603 +@item -m68030
18604 +@opindex m68030
18605 +Generate output for a 68030. This is the default when the compiler is
18606 +configured for 68030-based systems. It is equivalent to
18607 +@option{-march=68030}.
18609 +@item -m68040
18610 +@opindex m68040
18611 +Generate output for a 68040. This is the default when the compiler is
18612 +configured for 68040-based systems. It is equivalent to
18613 +@option{-march=68040}.
18615 +This option inhibits the use of 68881/68882 instructions that have to be
18616 +emulated by software on the 68040. Use this option if your 68040 does not
18617 +have code to emulate those instructions.
18619 +@item -m68060
18620 +@opindex m68060
18621 +Generate output for a 68060. This is the default when the compiler is
18622 +configured for 68060-based systems. It is equivalent to
18623 +@option{-march=68060}.
18625 +This option inhibits the use of 68020 and 68881/68882 instructions that
18626 +have to be emulated by software on the 68060. Use this option if your 68060
18627 +does not have code to emulate those instructions.
18629 +@item -mcpu32
18630 +@opindex mcpu32
18631 +Generate output for a CPU32. This is the default
18632 +when the compiler is configured for CPU32-based systems.
18633 +It is equivalent to @option{-march=cpu32}.
18635 +Use this option for microcontrollers with a
18636 +CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18637 +68336, 68340, 68341, 68349 and 68360.
18639 +@item -m5200
18640 +@opindex m5200
18641 +Generate output for a 520X ColdFire CPU@. This is the default
18642 +when the compiler is configured for 520X-based systems.
18643 +It is equivalent to @option{-mcpu=5206}, and is now deprecated
18644 +in favor of that option.
18646 +Use this option for microcontroller with a 5200 core, including
18647 +the MCF5202, MCF5203, MCF5204 and MCF5206.
18649 +@item -m5206e
18650 +@opindex m5206e
18651 +Generate output for a 5206e ColdFire CPU@. The option is now
18652 +deprecated in favor of the equivalent @option{-mcpu=5206e}.
18654 +@item -m528x
18655 +@opindex m528x
18656 +Generate output for a member of the ColdFire 528X family.
18657 +The option is now deprecated in favor of the equivalent
18658 +@option{-mcpu=528x}.
18660 +@item -m5307
18661 +@opindex m5307
18662 +Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18663 +in favor of the equivalent @option{-mcpu=5307}.
18665 +@item -m5407
18666 +@opindex m5407
18667 +Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18668 +in favor of the equivalent @option{-mcpu=5407}.
18670 +@item -mcfv4e
18671 +@opindex mcfv4e
18672 +Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18673 +This includes use of hardware floating point instructions.
18674 +The option is equivalent to @option{-mcpu=547x}, and is now
18675 +deprecated in favor of that option.
18677 +@item -m68020-40
18678 +@opindex m68020-40
18679 +Generate output for a 68040, without using any of the new instructions.
18680 +This results in code which can run relatively efficiently on either a
18681 +68020/68881 or a 68030 or a 68040. The generated code does use the
18682 +68881 instructions that are emulated on the 68040.
18684 +The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18686 +@item -m68020-60
18687 +@opindex m68020-60
18688 +Generate output for a 68060, without using any of the new instructions.
18689 +This results in code which can run relatively efficiently on either a
18690 +68020/68881 or a 68030 or a 68040. The generated code does use the
18691 +68881 instructions that are emulated on the 68060.
18693 +The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18695 +@item -mhard-float
18696 +@itemx -m68881
18697 +@opindex mhard-float
18698 +@opindex m68881
18699 +Generate floating-point instructions. This is the default for 68020
18700 +and above, and for ColdFire devices that have an FPU@. It defines the
18701 +macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
18702 +on ColdFire targets.
18704 +@item -msoft-float
18705 +@opindex msoft-float
18706 +Do not generate floating-point instructions; use library calls instead.
18707 +This is the default for 68000, 68010, and 68832 targets. It is also
18708 +the default for ColdFire devices that have no FPU.
18710 +@item -mdiv
18711 +@itemx -mno-div
18712 +@opindex mdiv
18713 +@opindex mno-div
18714 +Generate (do not generate) ColdFire hardware divide and remainder
18715 +instructions. If @option{-march} is used without @option{-mcpu},
18716 +the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18717 +architectures. Otherwise, the default is taken from the target CPU
18718 +(either the default CPU, or the one specified by @option{-mcpu}). For
18719 +example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18720 +@option{-mcpu=5206e}.
18722 +gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
18724 +@item -mshort
18725 +@opindex mshort
18726 +Consider type @code{int} to be 16 bits wide, like @code{short int}.
18727 +Additionally, parameters passed on the stack are also aligned to a
18728 +16-bit boundary even on targets whose API mandates promotion to 32-bit.
18730 +@item -mno-short
18731 +@opindex mno-short
18732 +Do not consider type @code{int} to be 16 bits wide. This is the default.
18734 +@item -mnobitfield
18735 +@itemx -mno-bitfield
18736 +@opindex mnobitfield
18737 +@opindex mno-bitfield
18738 +Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
18739 +and @option{-m5200} options imply @w{@option{-mnobitfield}}.
18741 +@item -mbitfield
18742 +@opindex mbitfield
18743 +Do use the bit-field instructions. The @option{-m68020} option implies
18744 +@option{-mbitfield}. This is the default if you use a configuration
18745 +designed for a 68020.
18747 +@item -mrtd
18748 +@opindex mrtd
18749 +Use a different function-calling convention, in which functions
18750 +that take a fixed number of arguments return with the @code{rtd}
18751 +instruction, which pops their arguments while returning. This
18752 +saves one instruction in the caller since there is no need to pop
18753 +the arguments there.
18755 +This calling convention is incompatible with the one normally
18756 +used on Unix, so you cannot use it if you need to call libraries
18757 +compiled with the Unix compiler.
18759 +Also, you must provide function prototypes for all functions that
18760 +take variable numbers of arguments (including @code{printf});
18761 +otherwise incorrect code will be generated for calls to those
18762 +functions.
18764 +In addition, seriously incorrect code will result if you call a
18765 +function with too many arguments. (Normally, extra arguments are
18766 +harmlessly ignored.)
18768 +The @code{rtd} instruction is supported by the 68010, 68020, 68030,
18769 +68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18771 +@item -mno-rtd
18772 +@opindex mno-rtd
18773 +Do not use the calling conventions selected by @option{-mrtd}.
18774 +This is the default.
18776 +@item -malign-int
18777 +@itemx -mno-align-int
18778 +@opindex malign-int
18779 +@opindex mno-align-int
18780 +Control whether GCC aligns @code{int}, @code{long}, @code{long long},
18781 +@code{float}, @code{double}, and @code{long double} variables on a 32-bit
18782 +boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
18783 +Aligning variables on 32-bit boundaries produces code that runs somewhat
18784 +faster on processors with 32-bit busses at the expense of more memory.
18786 +@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
18787 +align structures containing the above types differently than
18788 +most published application binary interface specifications for the m68k.
18790 +@item -mpcrel
18791 +@opindex mpcrel
18792 +Use the pc-relative addressing mode of the 68000 directly, instead of
18793 +using a global offset table. At present, this option implies @option{-fpic},
18794 +allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
18795 +not presently supported with @option{-mpcrel}, though this could be supported for
18796 +68020 and higher processors.
18798 +@item -mno-strict-align
18799 +@itemx -mstrict-align
18800 +@opindex mno-strict-align
18801 +@opindex mstrict-align
18802 +Do not (do) assume that unaligned memory references will be handled by
18803 +the system.
18805 +@item -msep-data
18806 +Generate code that allows the data segment to be located in a different
18807 +area of memory from the text segment. This allows for execute in place in
18808 +an environment without virtual memory management. This option implies
18809 +@option{-fPIC}.
18811 +@item -mno-sep-data
18812 +Generate code that assumes that the data segment follows the text segment.
18813 +This is the default.
18815 +@item -mid-shared-library
18816 +Generate code that supports shared libraries via the library ID method.
18817 +This allows for execute in place and shared libraries in an environment
18818 +without virtual memory management. This option implies @option{-fPIC}.
18820 +@item -mno-id-shared-library
18821 +Generate code that doesn't assume ID based shared libraries are being used.
18822 +This is the default.
18824 +@item -mshared-library-id=n
18825 +Specified the identification number of the ID based shared library being
18826 +compiled. Specifying a value of 0 will generate more compact code, specifying
18827 +other values will force the allocation of that number to the current
18828 +library but is no more space or time efficient than omitting this option.
18830 +@item -mxgot
18831 +@itemx -mno-xgot
18832 +@opindex mxgot
18833 +@opindex mno-xgot
18834 +When generating position-independent code for ColdFire, generate code
18835 +that works if the GOT has more than 8192 entries. This code is
18836 +larger and slower than code generated without this option. On M680x0
18837 +processors, this option is not needed; @option{-fPIC} suffices.
18839 +GCC normally uses a single instruction to load values from the GOT@.
18840 +While this is relatively efficient, it only works if the GOT
18841 +is smaller than about 64k. Anything larger causes the linker
18842 +to report an error such as:
18844 +@cindex relocation truncated to fit (ColdFire)
18845 +@smallexample
18846 +relocation truncated to fit: R_68K_GOT16O foobar
18847 +@end smallexample
18849 +If this happens, you should recompile your code with @option{-mxgot}.
18850 +It should then work with very large GOTs. However, code generated with
18851 +@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
18852 +the value of a global symbol.
18854 +Note that some linkers, including newer versions of the GNU linker,
18855 +can create multiple GOTs and sort GOT entries. If you have such a linker,
18856 +you should only need to use @option{-mxgot} when compiling a single
18857 +object file that accesses more than 8192 GOT entries. Very few do.
18859 +These options have no effect unless GCC is generating
18860 +position-independent code.
18862 +@end table
18864 +@node M68hc1x Options
18865 +@subsection M68hc1x Options
18866 +@cindex M68hc1x options
18868 +These are the @samp{-m} options defined for the 68hc11 and 68hc12
18869 +microcontrollers. The default values for these options depends on
18870 +which style of microcontroller was selected when the compiler was configured;
18871 +the defaults for the most common choices are given below.
18873 +@table @gcctabopt
18874 +@item -m6811
18875 +@itemx -m68hc11
18876 +@opindex m6811
18877 +@opindex m68hc11
18878 +Generate output for a 68HC11. This is the default
18879 +when the compiler is configured for 68HC11-based systems.
18881 +@item -m6812
18882 +@itemx -m68hc12
18883 +@opindex m6812
18884 +@opindex m68hc12
18885 +Generate output for a 68HC12. This is the default
18886 +when the compiler is configured for 68HC12-based systems.
18888 +@item -m68S12
18889 +@itemx -m68hcs12
18890 +@opindex m68S12
18891 +@opindex m68hcs12
18892 +Generate output for a 68HCS12.
18894 +@item -mauto-incdec
18895 +@opindex mauto-incdec
18896 +Enable the use of 68HC12 pre and post auto-increment and auto-decrement
18897 +addressing modes.
18899 +@item -minmax
18900 +@itemx -mnominmax
18901 +@opindex minmax
18902 +@opindex mnominmax
18903 +Enable the use of 68HC12 min and max instructions.
18905 +@item -mlong-calls
18906 +@itemx -mno-long-calls
18907 +@opindex mlong-calls
18908 +@opindex mno-long-calls
18909 +Treat all calls as being far away (near). If calls are assumed to be
18910 +far away, the compiler will use the @code{call} instruction to
18911 +call a function and the @code{rtc} instruction for returning.
18913 +@item -mshort
18914 +@opindex mshort
18915 +Consider type @code{int} to be 16 bits wide, like @code{short int}.
18917 +@item -msoft-reg-count=@var{count}
18918 +@opindex msoft-reg-count
18919 +Specify the number of pseudo-soft registers which are used for the
18920 +code generation. The maximum number is 32. Using more pseudo-soft
18921 +register may or may not result in better code depending on the program.
18922 +The default is 4 for 68HC11 and 2 for 68HC12.
18924 +@end table
18926 +@node MCore Options
18927 +@subsection MCore Options
18928 +@cindex MCore options
18930 +These are the @samp{-m} options defined for the Motorola M*Core
18931 +processors.
18933 +@table @gcctabopt
18935 +@item -mhardlit
18936 +@itemx -mno-hardlit
18937 +@opindex mhardlit
18938 +@opindex mno-hardlit
18939 +Inline constants into the code stream if it can be done in two
18940 +instructions or less.
18942 +@item -mdiv
18943 +@itemx -mno-div
18944 +@opindex mdiv
18945 +@opindex mno-div
18946 +Use the divide instruction. (Enabled by default).
18948 +@item -mrelax-immediate
18949 +@itemx -mno-relax-immediate
18950 +@opindex mrelax-immediate
18951 +@opindex mno-relax-immediate
18952 +Allow arbitrary sized immediates in bit operations.
18954 +@item -mwide-bitfields
18955 +@itemx -mno-wide-bitfields
18956 +@opindex mwide-bitfields
18957 +@opindex mno-wide-bitfields
18958 +Always treat bit-fields as int-sized.
18960 +@item -m4byte-functions
18961 +@itemx -mno-4byte-functions
18962 +@opindex m4byte-functions
18963 +@opindex mno-4byte-functions
18964 +Force all functions to be aligned to a four byte boundary.
18966 +@item -mcallgraph-data
18967 +@itemx -mno-callgraph-data
18968 +@opindex mcallgraph-data
18969 +@opindex mno-callgraph-data
18970 +Emit callgraph information.
18972 +@item -mslow-bytes
18973 +@itemx -mno-slow-bytes
18974 +@opindex mslow-bytes
18975 +@opindex mno-slow-bytes
18976 +Prefer word access when reading byte quantities.
18978 +@item -mlittle-endian
18979 +@itemx -mbig-endian
18980 +@opindex mlittle-endian
18981 +@opindex mbig-endian
18982 +Generate code for a little endian target.
18984 +@item -m210
18985 +@itemx -m340
18986 +@opindex m210
18987 +@opindex m340
18988 +Generate code for the 210 processor.
18990 +@item -mno-lsim
18991 +@opindex mno-lsim
18992 +Assume that run-time support has been provided and so omit the
18993 +simulator library (@file{libsim.a)} from the linker command line.
18995 +@item -mstack-increment=@var{size}
18996 +@opindex mstack-increment
18997 +Set the maximum amount for a single stack increment operation. Large
18998 +values can increase the speed of programs which contain functions
18999 +that need a large amount of stack space, but they can also trigger a
19000 +segmentation fault if the stack is extended too much. The default
19001 +value is 0x1000.
19003 +@end table
19005 +@node MeP Options
19006 +@subsection MeP Options
19007 +@cindex MeP options
19009 +@table @gcctabopt
19011 +@item -mabsdiff
19012 +@opindex mabsdiff
19013 +Enables the @code{abs} instruction, which is the absolute difference
19014 +between two registers.
19016 +@item -mall-opts
19017 +@opindex mall-opts
19018 +Enables all the optional instructions - average, multiply, divide, bit
19019 +operations, leading zero, absolute difference, min/max, clip, and
19020 +saturation.
19023 +@item -maverage
19024 +@opindex maverage
19025 +Enables the @code{ave} instruction, which computes the average of two
19026 +registers.
19028 +@item -mbased=@var{n}
19029 +@opindex mbased=
19030 +Variables of size @var{n} bytes or smaller will be placed in the
19031 +@code{.based} section by default. Based variables use the @code{$tp}
19032 +register as a base register, and there is a 128 byte limit to the
19033 +@code{.based} section.
19035 +@item -mbitops
19036 +@opindex mbitops
19037 +Enables the bit operation instructions - bit test (@code{btstm}), set
19038 +(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19039 +test-and-set (@code{tas}).
19041 +@item -mc=@var{name}
19042 +@opindex mc=
19043 +Selects which section constant data will be placed in. @var{name} may
19044 +be @code{tiny}, @code{near}, or @code{far}.
19046 +@item -mclip
19047 +@opindex mclip
19048 +Enables the @code{clip} instruction. Note that @code{-mclip} is not
19049 +useful unless you also provide @code{-mminmax}.
19051 +@item -mconfig=@var{name}
19052 +@opindex mconfig=
19053 +Selects one of the build-in core configurations. Each MeP chip has
19054 +one or more modules in it; each module has a core CPU and a variety of
19055 +coprocessors, optional instructions, and peripherals. The
19056 +@code{MeP-Integrator} tool, not part of GCC, provides these
19057 +configurations through this option; using this option is the same as
19058 +using all the corresponding command line options. The default
19059 +configuration is @code{default}.
19061 +@item -mcop
19062 +@opindex mcop
19063 +Enables the coprocessor instructions. By default, this is a 32-bit
19064 +coprocessor. Note that the coprocessor is normally enabled via the
19065 +@code{-mconfig=} option.
19067 +@item -mcop32
19068 +@opindex mcop32
19069 +Enables the 32-bit coprocessor's instructions.
19071 +@item -mcop64
19072 +@opindex mcop64
19073 +Enables the 64-bit coprocessor's instructions.
19075 +@item -mivc2
19076 +@opindex mivc2
19077 +Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19079 +@item -mdc
19080 +@opindex mdc
19081 +Causes constant variables to be placed in the @code{.near} section.
19083 +@item -mdiv
19084 +@opindex mdiv
19085 +Enables the @code{div} and @code{divu} instructions.
19087 +@item -meb
19088 +@opindex meb
19089 +Generate big-endian code.
19091 +@item -mel
19092 +@opindex mel
19093 +Generate little-endian code.
19095 +@item -mio-volatile
19096 +@opindex mio-volatile
19097 +Tells the compiler that any variable marked with the @code{io}
19098 +attribute is to be considered volatile.
19100 +@item -ml
19101 +@opindex ml
19102 +Causes variables to be assigned to the @code{.far} section by default.
19104 +@item -mleadz
19105 +@opindex mleadz
19106 +Enables the @code{leadz} (leading zero) instruction.
19108 +@item -mm
19109 +@opindex mm
19110 +Causes variables to be assigned to the @code{.near} section by default.
19112 +@item -mminmax
19113 +@opindex mminmax
19114 +Enables the @code{min} and @code{max} instructions.
19116 +@item -mmult
19117 +@opindex mmult
19118 +Enables the multiplication and multiply-accumulate instructions.
19120 +@item -mno-opts
19121 +@opindex mno-opts
19122 +Disables all the optional instructions enabled by @code{-mall-opts}.
19124 +@item -mrepeat
19125 +@opindex mrepeat
19126 +Enables the @code{repeat} and @code{erepeat} instructions, used for
19127 +low-overhead looping.
19129 +@item -ms
19130 +@opindex ms
19131 +Causes all variables to default to the @code{.tiny} section. Note
19132 +that there is a 65536 byte limit to this section. Accesses to these
19133 +variables use the @code{%gp} base register.
19135 +@item -msatur
19136 +@opindex msatur
19137 +Enables the saturation instructions. Note that the compiler does not
19138 +currently generate these itself, but this option is included for
19139 +compatibility with other tools, like @code{as}.
19141 +@item -msdram
19142 +@opindex msdram
19143 +Link the SDRAM-based runtime instead of the default ROM-based runtime.
19145 +@item -msim
19146 +@opindex msim
19147 +Link the simulator runtime libraries.
19149 +@item -msimnovec
19150 +@opindex msimnovec
19151 +Link the simulator runtime libraries, excluding built-in support
19152 +for reset and exception vectors and tables.
19154 +@item -mtf
19155 +@opindex mtf
19156 +Causes all functions to default to the @code{.far} section. Without
19157 +this option, functions default to the @code{.near} section.
19159 +@item -mtiny=@var{n}
19160 +@opindex mtiny=
19161 +Variables that are @var{n} bytes or smaller will be allocated to the
19162 +@code{.tiny} section. These variables use the @code{$gp} base
19163 +register. The default for this option is 4, but note that there's a
19164 +65536 byte limit to the @code{.tiny} section.
19166 +@end table
19168 +@node MicroBlaze Options
19169 +@subsection MicroBlaze Options
19170 +@cindex MicroBlaze Options
19172 +@table @gcctabopt
19174 +@item -msoft-float
19175 +@opindex msoft-float
19176 +Use software emulation for floating point (default).
19178 +@item -mhard-float
19179 +@opindex mhard-float
19180 +Use hardware floating point instructions.
19182 +@item -mmemcpy
19183 +@opindex mmemcpy
19184 +Do not optimize block moves, use @code{memcpy}.
19186 +@item -mno-clearbss
19187 +@opindex mno-clearbss
19188 +This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
19190 +@item -mcpu=@var{cpu-type}
19191 +@opindex mcpu=
19192 +Use features of and schedule code for given CPU.
19193 +Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
19194 +where @var{X} is a major version, @var{YY} is the minor version, and
19195 +@var{Z} is compatibility code. Example values are @samp{v3.00.a},
19196 +@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
19198 +@item -mxl-soft-mul
19199 +@opindex mxl-soft-mul
19200 +Use software multiply emulation (default).
19202 +@item -mxl-soft-div
19203 +@opindex mxl-soft-div
19204 +Use software emulation for divides (default).
19206 +@item -mxl-barrel-shift
19207 +@opindex mxl-barrel-shift
19208 +Use the hardware barrel shifter.
19210 +@item -mxl-pattern-compare
19211 +@opindex mxl-pattern-compare
19212 +Use pattern compare instructions.
19214 +@item -msmall-divides
19215 +@opindex msmall-divides
19216 +Use table lookup optimization for small signed integer divisions.
19218 +@item -mxl-stack-check
19219 +@opindex mxl-stack-check
19220 +This option is deprecated. Use -fstack-check instead.
19222 +@item -mxl-gp-opt
19223 +@opindex mxl-gp-opt
19224 +Use GP relative sdata/sbss sections.
19226 +@item -mxl-multiply-high
19227 +@opindex mxl-multiply-high
19228 +Use multiply high instructions for high part of 32x32 multiply.
19230 +@item -mxl-float-convert
19231 +@opindex mxl-float-convert
19232 +Use hardware floating point conversion instructions.
19234 +@item -mxl-float-sqrt
19235 +@opindex mxl-float-sqrt
19236 +Use hardware floating point square root instruction.
19238 +@item -mxl-mode-@var{app-model}
19239 +Select application model @var{app-model}. Valid models are
19240 +@table @samp
19241 +@item executable
19242 +normal executable (default), uses startup code @file{crt0.o}.
19244 +@item xmdstub
19245 +for use with Xilinx Microprocessor Debugger (XMD) based
19246 +software intrusive debug agent called xmdstub. This uses startup file
19247 +@file{crt1.o} and sets the start address of the program to be 0x800.
19249 +@item bootstrap
19250 +for applications that are loaded using a bootloader.
19251 +This model uses startup file @file{crt2.o} which does not contain a processor
19252 +reset vector handler. This is suitable for transferring control on a
19253 +processor reset to the bootloader rather than the application.
19255 +@item novectors
19256 +for applications that do not require any of the
19257 +MicroBlaze vectors. This option may be useful for applications running
19258 +within a monitoring application. This model uses @file{crt3.o} as a startup file.
19259 +@end table
19261 +Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
19262 +@option{-mxl-mode-@var{app-model}}.
19264 +@end table
19266 +@node MIPS Options
19267 +@subsection MIPS Options
19268 +@cindex MIPS options
19270 +@table @gcctabopt
19272 +@item -EB
19273 +@opindex EB
19274 +Generate big-endian code.
19276 +@item -EL
19277 +@opindex EL
19278 +Generate little-endian code. This is the default for @samp{mips*el-*-*}
19279 +configurations.
19281 +@item -march=@var{arch}
19282 +@opindex march
19283 +Generate code that will run on @var{arch}, which can be the name of a
19284 +generic MIPS ISA, or the name of a particular processor.
19285 +The ISA names are:
19286 +@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
19287 +@samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
19288 +The processor names are:
19289 +@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
19290 +@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
19291 +@samp{5kc}, @samp{5kf},
19292 +@samp{20kc},
19293 +@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
19294 +@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
19295 +@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
19296 +@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
19297 +@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
19298 +@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
19299 +@samp{m4k},
19300 +@samp{octeon},
19301 +@samp{orion},
19302 +@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
19303 +@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
19304 +@samp{rm7000}, @samp{rm9000},
19305 +@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
19306 +@samp{sb1},
19307 +@samp{sr71000},
19308 +@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
19309 +@samp{vr5000}, @samp{vr5400}, @samp{vr5500}
19310 +and @samp{xlr}.
19311 +The special value @samp{from-abi} selects the
19312 +most compatible architecture for the selected ABI (that is,
19313 +@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
19315 +Native Linux/GNU toolchains also support the value @samp{native},
19316 +which selects the best architecture option for the host processor.
19317 +@option{-march=native} has no effect if GCC does not recognize
19318 +the processor.
19320 +In processor names, a final @samp{000} can be abbreviated as @samp{k}
19321 +(for example, @samp{-march=r2k}). Prefixes are optional, and
19322 +@samp{vr} may be written @samp{r}.
19324 +Names of the form @samp{@var{n}f2_1} refer to processors with
19325 +FPUs clocked at half the rate of the core, names of the form
19326 +@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
19327 +rate as the core, and names of the form @samp{@var{n}f3_2} refer to
19328 +processors with FPUs clocked a ratio of 3:2 with respect to the core.
19329 +For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
19330 +for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
19331 +accepted as synonyms for @samp{@var{n}f1_1}.
19333 +GCC defines two macros based on the value of this option. The first
19334 +is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
19335 +a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
19336 +where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
19337 +For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
19338 +to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
19340 +Note that the @samp{_MIPS_ARCH} macro uses the processor names given
19341 +above. In other words, it will have the full prefix and will not
19342 +abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
19343 +the macro names the resolved architecture (either @samp{"mips1"} or
19344 +@samp{"mips3"}). It names the default architecture when no
19345 +@option{-march} option is given.
19347 +@item -mtune=@var{arch}
19348 +@opindex mtune
19349 +Optimize for @var{arch}. Among other things, this option controls
19350 +the way instructions are scheduled, and the perceived cost of arithmetic
19351 +operations. The list of @var{arch} values is the same as for
19352 +@option{-march}.
19354 +When this option is not used, GCC will optimize for the processor
19355 +specified by @option{-march}. By using @option{-march} and
19356 +@option{-mtune} together, it is possible to generate code that will
19357 +run on a family of processors, but optimize the code for one
19358 +particular member of that family.
19360 +@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
19361 +@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
19362 +@samp{-march} ones described above.
19364 +@item -mips1
19365 +@opindex mips1
19366 +Equivalent to @samp{-march=mips1}.
19368 +@item -mips2
19369 +@opindex mips2
19370 +Equivalent to @samp{-march=mips2}.
19372 +@item -mips3
19373 +@opindex mips3
19374 +Equivalent to @samp{-march=mips3}.
19376 +@item -mips4
19377 +@opindex mips4
19378 +Equivalent to @samp{-march=mips4}.
19380 +@item -mips32
19381 +@opindex mips32
19382 +Equivalent to @samp{-march=mips32}.
19384 +@item -mips32r2
19385 +@opindex mips32r2
19386 +Equivalent to @samp{-march=mips32r2}.
19388 +@item -mips64
19389 +@opindex mips64
19390 +Equivalent to @samp{-march=mips64}.
19392 +@item -mips64r2
19393 +@opindex mips64r2
19394 +Equivalent to @samp{-march=mips64r2}.
19396 +@item -mips16
19397 +@itemx -mno-mips16
19398 +@opindex mips16
19399 +@opindex mno-mips16
19400 +Generate (do not generate) MIPS16 code. If GCC is targetting a
19401 +MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
19403 +MIPS16 code generation can also be controlled on a per-function basis
19404 +by means of @code{mips16} and @code{nomips16} attributes.
19405 +@xref{Function Attributes}, for more information.
19407 +@item -mflip-mips16
19408 +@opindex mflip-mips16
19409 +Generate MIPS16 code on alternating functions. This option is provided
19410 +for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
19411 +not intended for ordinary use in compiling user code.
19413 +@item -minterlink-mips16
19414 +@itemx -mno-interlink-mips16
19415 +@opindex minterlink-mips16
19416 +@opindex mno-interlink-mips16
19417 +Require (do not require) that non-MIPS16 code be link-compatible with
19418 +MIPS16 code.
19420 +For example, non-MIPS16 code cannot jump directly to MIPS16 code;
19421 +it must either use a call or an indirect jump. @option{-minterlink-mips16}
19422 +therefore disables direct jumps unless GCC knows that the target of the
19423 +jump is not MIPS16.
19425 +@item -mabi=32
19426 +@itemx -mabi=o64
19427 +@itemx -mabi=n32
19428 +@itemx -mabi=64
19429 +@itemx -mabi=eabi
19430 +@opindex mabi=32
19431 +@opindex mabi=o64
19432 +@opindex mabi=n32
19433 +@opindex mabi=64
19434 +@opindex mabi=eabi
19435 +Generate code for the given ABI@.
19437 +Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19438 +generates 64-bit code when you select a 64-bit architecture, but you
19439 +can use @option{-mgp32} to get 32-bit code instead.
19441 +For information about the O64 ABI, see
19442 +@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
19444 +GCC supports a variant of the o32 ABI in which floating-point registers
19445 +are 64 rather than 32 bits wide. You can select this combination with
19446 +@option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
19447 +and @samp{mfhc1} instructions and is therefore only supported for
19448 +MIPS32R2 processors.
19450 +The register assignments for arguments and return values remain the
19451 +same, but each scalar value is passed in a single 64-bit register
19452 +rather than a pair of 32-bit registers. For example, scalar
19453 +floating-point values are returned in @samp{$f0} only, not a
19454 +@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
19455 +remains the same, but all 64 bits are saved.
19457 +@item -mabicalls
19458 +@itemx -mno-abicalls
19459 +@opindex mabicalls
19460 +@opindex mno-abicalls
19461 +Generate (do not generate) code that is suitable for SVR4-style
19462 +dynamic objects. @option{-mabicalls} is the default for SVR4-based
19463 +systems.
19465 +@item -mshared
19466 +@itemx -mno-shared
19467 +Generate (do not generate) code that is fully position-independent,
19468 +and that can therefore be linked into shared libraries. This option
19469 +only affects @option{-mabicalls}.
19471 +All @option{-mabicalls} code has traditionally been position-independent,
19472 +regardless of options like @option{-fPIC} and @option{-fpic}. However,
19473 +as an extension, the GNU toolchain allows executables to use absolute
19474 +accesses for locally-binding symbols. It can also use shorter GP
19475 +initialization sequences and generate direct calls to locally-defined
19476 +functions. This mode is selected by @option{-mno-shared}.
19478 +@option{-mno-shared} depends on binutils 2.16 or higher and generates
19479 +objects that can only be linked by the GNU linker. However, the option
19480 +does not affect the ABI of the final executable; it only affects the ABI
19481 +of relocatable objects. Using @option{-mno-shared} will generally make
19482 +executables both smaller and quicker.
19484 +@option{-mshared} is the default.
19486 +@item -mplt
19487 +@itemx -mno-plt
19488 +@opindex mplt
19489 +@opindex mno-plt
19490 +Assume (do not assume) that the static and dynamic linkers
19491 +support PLTs and copy relocations. This option only affects
19492 +@samp{-mno-shared -mabicalls}. For the n64 ABI, this option
19493 +has no effect without @samp{-msym32}.
19495 +You can make @option{-mplt} the default by configuring
19496 +GCC with @option{--with-mips-plt}. The default is
19497 +@option{-mno-plt} otherwise.
19499 +@item -mxgot
19500 +@itemx -mno-xgot
19501 +@opindex mxgot
19502 +@opindex mno-xgot
19503 +Lift (do not lift) the usual restrictions on the size of the global
19504 +offset table.
19506 +GCC normally uses a single instruction to load values from the GOT@.
19507 +While this is relatively efficient, it will only work if the GOT
19508 +is smaller than about 64k. Anything larger will cause the linker
19509 +to report an error such as:
19511 +@cindex relocation truncated to fit (MIPS)
19512 +@smallexample
19513 +relocation truncated to fit: R_MIPS_GOT16 foobar
19514 +@end smallexample
19516 +If this happens, you should recompile your code with @option{-mxgot}.
19517 +It should then work with very large GOTs, although it will also be
19518 +less efficient, since it will take three instructions to fetch the
19519 +value of a global symbol.
19521 +Note that some linkers can create multiple GOTs. If you have such a
19522 +linker, you should only need to use @option{-mxgot} when a single object
19523 +file accesses more than 64k's worth of GOT entries. Very few do.
19525 +These options have no effect unless GCC is generating position
19526 +independent code.
19528 +@item -mgp32
19529 +@opindex mgp32
19530 +Assume that general-purpose registers are 32 bits wide.
19532 +@item -mgp64
19533 +@opindex mgp64
19534 +Assume that general-purpose registers are 64 bits wide.
19536 +@item -mfp32
19537 +@opindex mfp32
19538 +Assume that floating-point registers are 32 bits wide.
19540 +@item -mfp64
19541 +@opindex mfp64
19542 +Assume that floating-point registers are 64 bits wide.
19544 +@item -mhard-float
19545 +@opindex mhard-float
19546 +Use floating-point coprocessor instructions.
19548 +@item -msoft-float
19549 +@opindex msoft-float
19550 +Do not use floating-point coprocessor instructions. Implement
19551 +floating-point calculations using library calls instead.
19553 +@item -msingle-float
19554 +@opindex msingle-float
19555 +Assume that the floating-point coprocessor only supports single-precision
19556 +operations.
19558 +@item -mdouble-float
19559 +@opindex mdouble-float
19560 +Assume that the floating-point coprocessor supports double-precision
19561 +operations. This is the default.
19563 +@item -mllsc
19564 +@itemx -mno-llsc
19565 +@opindex mllsc
19566 +@opindex mno-llsc
19567 +Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19568 +implement atomic memory built-in functions. When neither option is
19569 +specified, GCC will use the instructions if the target architecture
19570 +supports them.
19572 +@option{-mllsc} is useful if the runtime environment can emulate the
19573 +instructions and @option{-mno-llsc} can be useful when compiling for
19574 +nonstandard ISAs. You can make either option the default by
19575 +configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19576 +respectively. @option{--with-llsc} is the default for some
19577 +configurations; see the installation documentation for details.
19579 +@item -mdsp
19580 +@itemx -mno-dsp
19581 +@opindex mdsp
19582 +@opindex mno-dsp
19583 +Use (do not use) revision 1 of the MIPS DSP ASE@.
19584 +@xref{MIPS DSP Built-in Functions}. This option defines the
19585 +preprocessor macro @samp{__mips_dsp}. It also defines
19586 +@samp{__mips_dsp_rev} to 1.
19588 +@item -mdspr2
19589 +@itemx -mno-dspr2
19590 +@opindex mdspr2
19591 +@opindex mno-dspr2
19592 +Use (do not use) revision 2 of the MIPS DSP ASE@.
19593 +@xref{MIPS DSP Built-in Functions}. This option defines the
19594 +preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
19595 +It also defines @samp{__mips_dsp_rev} to 2.
19597 +@item -msmartmips
19598 +@itemx -mno-smartmips
19599 +@opindex msmartmips
19600 +@opindex mno-smartmips
19601 +Use (do not use) the MIPS SmartMIPS ASE.
19603 +@item -mpaired-single
19604 +@itemx -mno-paired-single
19605 +@opindex mpaired-single
19606 +@opindex mno-paired-single
19607 +Use (do not use) paired-single floating-point instructions.
19608 +@xref{MIPS Paired-Single Support}. This option requires
19609 +hardware floating-point support to be enabled.
19611 +@item -mdmx
19612 +@itemx -mno-mdmx
19613 +@opindex mdmx
19614 +@opindex mno-mdmx
19615 +Use (do not use) MIPS Digital Media Extension instructions.
19616 +This option can only be used when generating 64-bit code and requires
19617 +hardware floating-point support to be enabled.
19619 +@item -mips3d
19620 +@itemx -mno-mips3d
19621 +@opindex mips3d
19622 +@opindex mno-mips3d
19623 +Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19624 +The option @option{-mips3d} implies @option{-mpaired-single}.
19626 +@item -mmt
19627 +@itemx -mno-mt
19628 +@opindex mmt
19629 +@opindex mno-mt
19630 +Use (do not use) MT Multithreading instructions.
19632 +@item -mlong64
19633 +@opindex mlong64
19634 +Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
19635 +an explanation of the default and the way that the pointer size is
19636 +determined.
19638 +@item -mlong32
19639 +@opindex mlong32
19640 +Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
19642 +The default size of @code{int}s, @code{long}s and pointers depends on
19643 +the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
19644 +uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
19645 +32-bit @code{long}s. Pointers are the same size as @code{long}s,
19646 +or the same size as integer registers, whichever is smaller.
19648 +@item -msym32
19649 +@itemx -mno-sym32
19650 +@opindex msym32
19651 +@opindex mno-sym32
19652 +Assume (do not assume) that all symbols have 32-bit values, regardless
19653 +of the selected ABI@. This option is useful in combination with
19654 +@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
19655 +to generate shorter and faster references to symbolic addresses.
19657 +@item -G @var{num}
19658 +@opindex G
19659 +Put definitions of externally-visible data in a small data section
19660 +if that data is no bigger than @var{num} bytes. GCC can then access
19661 +the data more efficiently; see @option{-mgpopt} for details.
19663 +The default @option{-G} option depends on the configuration.
19665 +@item -mlocal-sdata
19666 +@itemx -mno-local-sdata
19667 +@opindex mlocal-sdata
19668 +@opindex mno-local-sdata
19669 +Extend (do not extend) the @option{-G} behavior to local data too,
19670 +such as to static variables in C@. @option{-mlocal-sdata} is the
19671 +default for all configurations.
19673 +If the linker complains that an application is using too much small data,
19674 +you might want to try rebuilding the less performance-critical parts with
19675 +@option{-mno-local-sdata}. You might also want to build large
19676 +libraries with @option{-mno-local-sdata}, so that the libraries leave
19677 +more room for the main program.
19679 +@item -mextern-sdata
19680 +@itemx -mno-extern-sdata
19681 +@opindex mextern-sdata
19682 +@opindex mno-extern-sdata
19683 +Assume (do not assume) that externally-defined data will be in
19684 +a small data section if that data is within the @option{-G} limit.
19685 +@option{-mextern-sdata} is the default for all configurations.
19687 +If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
19688 +@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
19689 +that is no bigger than @var{num} bytes, you must make sure that @var{Var}
19690 +is placed in a small data section. If @var{Var} is defined by another
19691 +module, you must either compile that module with a high-enough
19692 +@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
19693 +definition. If @var{Var} is common, you must link the application
19694 +with a high-enough @option{-G} setting.
19696 +The easiest way of satisfying these restrictions is to compile
19697 +and link every module with the same @option{-G} option. However,
19698 +you may wish to build a library that supports several different
19699 +small data limits. You can do this by compiling the library with
19700 +the highest supported @option{-G} setting and additionally using
19701 +@option{-mno-extern-sdata} to stop the library from making assumptions
19702 +about externally-defined data.
19704 +@item -mgpopt
19705 +@itemx -mno-gpopt
19706 +@opindex mgpopt
19707 +@opindex mno-gpopt
19708 +Use (do not use) GP-relative accesses for symbols that are known to be
19709 +in a small data section; see @option{-G}, @option{-mlocal-sdata} and
19710 +@option{-mextern-sdata}. @option{-mgpopt} is the default for all
19711 +configurations.
19713 +@option{-mno-gpopt} is useful for cases where the @code{$gp} register
19714 +might not hold the value of @code{_gp}. For example, if the code is
19715 +part of a library that might be used in a boot monitor, programs that
19716 +call boot monitor routines will pass an unknown value in @code{$gp}.
19717 +(In such situations, the boot monitor itself would usually be compiled
19718 +with @option{-G0}.)
19720 +@option{-mno-gpopt} implies @option{-mno-local-sdata} and
19721 +@option{-mno-extern-sdata}.
19723 +@item -membedded-data
19724 +@itemx -mno-embedded-data
19725 +@opindex membedded-data
19726 +@opindex mno-embedded-data
19727 +Allocate variables to the read-only data section first if possible, then
19728 +next in the small data section if possible, otherwise in data. This gives
19729 +slightly slower code than the default, but reduces the amount of RAM required
19730 +when executing, and thus may be preferred for some embedded systems.
19732 +@item -muninit-const-in-rodata
19733 +@itemx -mno-uninit-const-in-rodata
19734 +@opindex muninit-const-in-rodata
19735 +@opindex mno-uninit-const-in-rodata
19736 +Put uninitialized @code{const} variables in the read-only data section.
19737 +This option is only meaningful in conjunction with @option{-membedded-data}.
19739 +@item -mcode-readable=@var{setting}
19740 +@opindex mcode-readable
19741 +Specify whether GCC may generate code that reads from executable sections.
19742 +There are three possible settings:
19744 +@table @gcctabopt
19745 +@item -mcode-readable=yes
19746 +Instructions may freely access executable sections. This is the
19747 +default setting.
19749 +@item -mcode-readable=pcrel
19750 +MIPS16 PC-relative load instructions can access executable sections,
19751 +but other instructions must not do so. This option is useful on 4KSc
19752 +and 4KSd processors when the code TLBs have the Read Inhibit bit set.
19753 +It is also useful on processors that can be configured to have a dual
19754 +instruction/data SRAM interface and that, like the M4K, automatically
19755 +redirect PC-relative loads to the instruction RAM.
19757 +@item -mcode-readable=no
19758 +Instructions must not access executable sections. This option can be
19759 +useful on targets that are configured to have a dual instruction/data
19760 +SRAM interface but that (unlike the M4K) do not automatically redirect
19761 +PC-relative loads to the instruction RAM.
19762 +@end table
19764 +@item -msplit-addresses
19765 +@itemx -mno-split-addresses
19766 +@opindex msplit-addresses
19767 +@opindex mno-split-addresses
19768 +Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
19769 +relocation operators. This option has been superseded by
19770 +@option{-mexplicit-relocs} but is retained for backwards compatibility.
19772 +@item -mexplicit-relocs
19773 +@itemx -mno-explicit-relocs
19774 +@opindex mexplicit-relocs
19775 +@opindex mno-explicit-relocs
19776 +Use (do not use) assembler relocation operators when dealing with symbolic
19777 +addresses. The alternative, selected by @option{-mno-explicit-relocs},
19778 +is to use assembler macros instead.
19780 +@option{-mexplicit-relocs} is the default if GCC was configured
19781 +to use an assembler that supports relocation operators.
19783 +@item -mcheck-zero-division
19784 +@itemx -mno-check-zero-division
19785 +@opindex mcheck-zero-division
19786 +@opindex mno-check-zero-division
19787 +Trap (do not trap) on integer division by zero.
19789 +The default is @option{-mcheck-zero-division}.
19791 +@item -mdivide-traps
19792 +@itemx -mdivide-breaks
19793 +@opindex mdivide-traps
19794 +@opindex mdivide-breaks
19795 +MIPS systems check for division by zero by generating either a
19796 +conditional trap or a break instruction. Using traps results in
19797 +smaller code, but is only supported on MIPS II and later. Also, some
19798 +versions of the Linux kernel have a bug that prevents trap from
19799 +generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
19800 +allow conditional traps on architectures that support them and
19801 +@option{-mdivide-breaks} to force the use of breaks.
19803 +The default is usually @option{-mdivide-traps}, but this can be
19804 +overridden at configure time using @option{--with-divide=breaks}.
19805 +Divide-by-zero checks can be completely disabled using
19806 +@option{-mno-check-zero-division}.
19808 +@item -mmemcpy
19809 +@itemx -mno-memcpy
19810 +@opindex mmemcpy
19811 +@opindex mno-memcpy
19812 +Force (do not force) the use of @code{memcpy()} for non-trivial block
19813 +moves. The default is @option{-mno-memcpy}, which allows GCC to inline
19814 +most constant-sized copies.
19816 +@item -mlong-calls
19817 +@itemx -mno-long-calls
19818 +@opindex mlong-calls
19819 +@opindex mno-long-calls
19820 +Disable (do not disable) use of the @code{jal} instruction. Calling
19821 +functions using @code{jal} is more efficient but requires the caller
19822 +and callee to be in the same 256 megabyte segment.
19824 +This option has no effect on abicalls code. The default is
19825 +@option{-mno-long-calls}.
19827 +@item -mmad
19828 +@itemx -mno-mad
19829 +@opindex mmad
19830 +@opindex mno-mad
19831 +Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
19832 +instructions, as provided by the R4650 ISA@.
19834 +@item -mfused-madd
19835 +@itemx -mno-fused-madd
19836 +@opindex mfused-madd
19837 +@opindex mno-fused-madd
19838 +Enable (disable) use of the floating point multiply-accumulate
19839 +instructions, when they are available. The default is
19840 +@option{-mfused-madd}.
19842 +When multiply-accumulate instructions are used, the intermediate
19843 +product is calculated to infinite precision and is not subject to
19844 +the FCSR Flush to Zero bit. This may be undesirable in some
19845 +circumstances.
19847 +@item -nocpp
19848 +@opindex nocpp
19849 +Tell the MIPS assembler to not run its preprocessor over user
19850 +assembler files (with a @samp{.s} suffix) when assembling them.
19852 +@item -mfix-r4000
19853 +@itemx -mno-fix-r4000
19854 +@opindex mfix-r4000
19855 +@opindex mno-fix-r4000
19856 +Work around certain R4000 CPU errata:
19857 +@itemize @minus
19858 +@item
19859 +A double-word or a variable shift may give an incorrect result if executed
19860 +immediately after starting an integer division.
19861 +@item
19862 +A double-word or a variable shift may give an incorrect result if executed
19863 +while an integer multiplication is in progress.
19864 +@item
19865 +An integer division may give an incorrect result if started in a delay slot
19866 +of a taken branch or a jump.
19867 +@end itemize
19869 +@item -mfix-r4400
19870 +@itemx -mno-fix-r4400
19871 +@opindex mfix-r4400
19872 +@opindex mno-fix-r4400
19873 +Work around certain R4400 CPU errata:
19874 +@itemize @minus
19875 +@item
19876 +A double-word or a variable shift may give an incorrect result if executed
19877 +immediately after starting an integer division.
19878 +@end itemize
19880 +@item -mfix-r10000
19881 +@itemx -mno-fix-r10000
19882 +@opindex mfix-r10000
19883 +@opindex mno-fix-r10000
19884 +Work around certain R10000 errata:
19885 +@itemize @minus
19886 +@item
19887 +@code{ll}/@code{sc} sequences may not behave atomically on revisions
19888 +prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19889 +@end itemize
19891 +This option can only be used if the target architecture supports
19892 +branch-likely instructions. @option{-mfix-r10000} is the default when
19893 +@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
19894 +otherwise.
19896 +@item -mfix-vr4120
19897 +@itemx -mno-fix-vr4120
19898 +@opindex mfix-vr4120
19899 +Work around certain VR4120 errata:
19900 +@itemize @minus
19901 +@item
19902 +@code{dmultu} does not always produce the correct result.
19903 +@item
19904 +@code{div} and @code{ddiv} do not always produce the correct result if one
19905 +of the operands is negative.
19906 +@end itemize
19907 +The workarounds for the division errata rely on special functions in
19908 +@file{libgcc.a}. At present, these functions are only provided by
19909 +the @code{mips64vr*-elf} configurations.
19911 +Other VR4120 errata require a nop to be inserted between certain pairs of
19912 +instructions. These errata are handled by the assembler, not by GCC itself.
19914 +@item -mfix-vr4130
19915 +@opindex mfix-vr4130
19916 +Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
19917 +workarounds are implemented by the assembler rather than by GCC,
19918 +although GCC will avoid using @code{mflo} and @code{mfhi} if the
19919 +VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
19920 +instructions are available instead.
19922 +@item -mfix-sb1
19923 +@itemx -mno-fix-sb1
19924 +@opindex mfix-sb1
19925 +Work around certain SB-1 CPU core errata.
19926 +(This flag currently works around the SB-1 revision 2
19927 +``F1'' and ``F2'' floating point errata.)
19929 +@item -mr10k-cache-barrier=@var{setting}
19930 +@opindex mr10k-cache-barrier
19931 +Specify whether GCC should insert cache barriers to avoid the
19932 +side-effects of speculation on R10K processors.
19934 +In common with many processors, the R10K tries to predict the outcome
19935 +of a conditional branch and speculatively executes instructions from
19936 +the ``taken'' branch. It later aborts these instructions if the
19937 +predicted outcome was wrong. However, on the R10K, even aborted
19938 +instructions can have side effects.
19940 +This problem only affects kernel stores and, depending on the system,
19941 +kernel loads. As an example, a speculatively-executed store may load
19942 +the target memory into cache and mark the cache line as dirty, even if
19943 +the store itself is later aborted. If a DMA operation writes to the
19944 +same area of memory before the ``dirty'' line is flushed, the cached
19945 +data will overwrite the DMA-ed data. See the R10K processor manual
19946 +for a full description, including other potential problems.
19948 +One workaround is to insert cache barrier instructions before every memory
19949 +access that might be speculatively executed and that might have side
19950 +effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
19951 +controls GCC's implementation of this workaround. It assumes that
19952 +aborted accesses to any byte in the following regions will not have
19953 +side effects:
19955 +@enumerate
19956 +@item
19957 +the memory occupied by the current function's stack frame;
19959 +@item
19960 +the memory occupied by an incoming stack argument;
19962 +@item
19963 +the memory occupied by an object with a link-time-constant address.
19964 +@end enumerate
19966 +It is the kernel's responsibility to ensure that speculative
19967 +accesses to these regions are indeed safe.
19969 +If the input program contains a function declaration such as:
19971 +@smallexample
19972 +void foo (void);
19973 +@end smallexample
19975 +then the implementation of @code{foo} must allow @code{j foo} and
19976 +@code{jal foo} to be executed speculatively. GCC honors this
19977 +restriction for functions it compiles itself. It expects non-GCC
19978 +functions (such as hand-written assembly code) to do the same.
19980 +The option has three forms:
19982 +@table @gcctabopt
19983 +@item -mr10k-cache-barrier=load-store
19984 +Insert a cache barrier before a load or store that might be
19985 +speculatively executed and that might have side effects even
19986 +if aborted.
19988 +@item -mr10k-cache-barrier=store
19989 +Insert a cache barrier before a store that might be speculatively
19990 +executed and that might have side effects even if aborted.
19992 +@item -mr10k-cache-barrier=none
19993 +Disable the insertion of cache barriers. This is the default setting.
19994 +@end table
19996 +@item -mflush-func=@var{func}
19997 +@itemx -mno-flush-func
19998 +@opindex mflush-func
19999 +Specifies the function to call to flush the I and D caches, or to not
20000 +call any such function. If called, the function must take the same
20001 +arguments as the common @code{_flush_func()}, that is, the address of the
20002 +memory range for which the cache is being flushed, the size of the
20003 +memory range, and the number 3 (to flush both caches). The default
20004 +depends on the target GCC was configured for, but commonly is either
20005 +@samp{_flush_func} or @samp{__cpu_flush}.
20007 +@item mbranch-cost=@var{num}
20008 +@opindex mbranch-cost
20009 +Set the cost of branches to roughly @var{num} ``simple'' instructions.
20010 +This cost is only a heuristic and is not guaranteed to produce
20011 +consistent results across releases. A zero cost redundantly selects
20012 +the default, which is based on the @option{-mtune} setting.
20014 +@item -mbranch-likely
20015 +@itemx -mno-branch-likely
20016 +@opindex mbranch-likely
20017 +@opindex mno-branch-likely
20018 +Enable or disable use of Branch Likely instructions, regardless of the
20019 +default for the selected architecture. By default, Branch Likely
20020 +instructions may be generated if they are supported by the selected
20021 +architecture. An exception is for the MIPS32 and MIPS64 architectures
20022 +and processors which implement those architectures; for those, Branch
20023 +Likely instructions will not be generated by default because the MIPS32
20024 +and MIPS64 architectures specifically deprecate their use.
20026 +@item -mfp-exceptions
20027 +@itemx -mno-fp-exceptions
20028 +@opindex mfp-exceptions
20029 +Specifies whether FP exceptions are enabled. This affects how we schedule
20030 +FP instructions for some processors. The default is that FP exceptions are
20031 +enabled.
20033 +For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
20034 +64-bit code, then we can use both FP pipes. Otherwise, we can only use one
20035 +FP pipe.
20037 +@item -mvr4130-align
20038 +@itemx -mno-vr4130-align
20039 +@opindex mvr4130-align
20040 +The VR4130 pipeline is two-way superscalar, but can only issue two
20041 +instructions together if the first one is 8-byte aligned. When this
20042 +option is enabled, GCC will align pairs of instructions that it
20043 +thinks should execute in parallel.
20045 +This option only has an effect when optimizing for the VR4130.
20046 +It normally makes code faster, but at the expense of making it bigger.
20047 +It is enabled by default at optimization level @option{-O3}.
20049 +@item -msynci
20050 +@itemx -mno-synci
20051 +@opindex msynci
20052 +Enable (disable) generation of @code{synci} instructions on
20053 +architectures that support it. The @code{synci} instructions (if
20054 +enabled) will be generated when @code{__builtin___clear_cache()} is
20055 +compiled.
20057 +This option defaults to @code{-mno-synci}, but the default can be
20058 +overridden by configuring with @code{--with-synci}.
20060 +When compiling code for single processor systems, it is generally safe
20061 +to use @code{synci}. However, on many multi-core (SMP) systems, it
20062 +will not invalidate the instruction caches on all cores and may lead
20063 +to undefined behavior.
20065 +@item -mrelax-pic-calls
20066 +@itemx -mno-relax-pic-calls
20067 +@opindex mrelax-pic-calls
20068 +Try to turn PIC calls that are normally dispatched via register
20069 +@code{$25} into direct calls. This is only possible if the linker can
20070 +resolve the destination at link-time and if the destination is within
20071 +range for a direct call.
20073 +@option{-mrelax-pic-calls} is the default if GCC was configured to use
20074 +an assembler and a linker that supports the @code{.reloc} assembly
20075 +directive and @code{-mexplicit-relocs} is in effect. With
20076 +@code{-mno-explicit-relocs}, this optimization can be performed by the
20077 +assembler and the linker alone without help from the compiler.
20079 +@item -mmcount-ra-address
20080 +@itemx -mno-mcount-ra-address
20081 +@opindex mmcount-ra-address
20082 +@opindex mno-mcount-ra-address
20083 +Emit (do not emit) code that allows @code{_mcount} to modify the
20084 +calling function's return address. When enabled, this option extends
20085 +the usual @code{_mcount} interface with a new @var{ra-address}
20086 +parameter, which has type @code{intptr_t *} and is passed in register
20087 +@code{$12}. @code{_mcount} can then modify the return address by
20088 +doing both of the following:
20089 +@itemize
20090 +@item
20091 +Returning the new address in register @code{$31}.
20092 +@item
20093 +Storing the new address in @code{*@var{ra-address}},
20094 +if @var{ra-address} is nonnull.
20095 +@end itemize
20097 +The default is @option{-mno-mcount-ra-address}.
20099 +@end table
20101 +@node MMIX Options
20102 +@subsection MMIX Options
20103 +@cindex MMIX Options
20105 +These options are defined for the MMIX:
20107 +@table @gcctabopt
20108 +@item -mlibfuncs
20109 +@itemx -mno-libfuncs
20110 +@opindex mlibfuncs
20111 +@opindex mno-libfuncs
20112 +Specify that intrinsic library functions are being compiled, passing all
20113 +values in registers, no matter the size.
20115 +@item -mepsilon
20116 +@itemx -mno-epsilon
20117 +@opindex mepsilon
20118 +@opindex mno-epsilon
20119 +Generate floating-point comparison instructions that compare with respect
20120 +to the @code{rE} epsilon register.
20122 +@item -mabi=mmixware
20123 +@itemx -mabi=gnu
20124 +@opindex mabi=mmixware
20125 +@opindex mabi=gnu
20126 +Generate code that passes function parameters and return values that (in
20127 +the called function) are seen as registers @code{$0} and up, as opposed to
20128 +the GNU ABI which uses global registers @code{$231} and up.
20130 +@item -mzero-extend
20131 +@itemx -mno-zero-extend
20132 +@opindex mzero-extend
20133 +@opindex mno-zero-extend
20134 +When reading data from memory in sizes shorter than 64 bits, use (do not
20135 +use) zero-extending load instructions by default, rather than
20136 +sign-extending ones.
20138 +@item -mknuthdiv
20139 +@itemx -mno-knuthdiv
20140 +@opindex mknuthdiv
20141 +@opindex mno-knuthdiv
20142 +Make the result of a division yielding a remainder have the same sign as
20143 +the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
20144 +remainder follows the sign of the dividend. Both methods are
20145 +arithmetically valid, the latter being almost exclusively used.
20147 +@item -mtoplevel-symbols
20148 +@itemx -mno-toplevel-symbols
20149 +@opindex mtoplevel-symbols
20150 +@opindex mno-toplevel-symbols
20151 +Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
20152 +code can be used with the @code{PREFIX} assembly directive.
20154 +@item -melf
20155 +@opindex melf
20156 +Generate an executable in the ELF format, rather than the default
20157 +@samp{mmo} format used by the @command{mmix} simulator.
20159 +@item -mbranch-predict
20160 +@itemx -mno-branch-predict
20161 +@opindex mbranch-predict
20162 +@opindex mno-branch-predict
20163 +Use (do not use) the probable-branch instructions, when static branch
20164 +prediction indicates a probable branch.
20166 +@item -mbase-addresses
20167 +@itemx -mno-base-addresses
20168 +@opindex mbase-addresses
20169 +@opindex mno-base-addresses
20170 +Generate (do not generate) code that uses @emph{base addresses}. Using a
20171 +base address automatically generates a request (handled by the assembler
20172 +and the linker) for a constant to be set up in a global register. The
20173 +register is used for one or more base address requests within the range 0
20174 +to 255 from the value held in the register. The generally leads to short
20175 +and fast code, but the number of different data items that can be
20176 +addressed is limited. This means that a program that uses lots of static
20177 +data may require @option{-mno-base-addresses}.
20179 +@item -msingle-exit
20180 +@itemx -mno-single-exit
20181 +@opindex msingle-exit
20182 +@opindex mno-single-exit
20183 +Force (do not force) generated code to have a single exit point in each
20184 +function.
20185 +@end table
20187 +@node MN10300 Options
20188 +@subsection MN10300 Options
20189 +@cindex MN10300 options
20191 +These @option{-m} options are defined for Matsushita MN10300 architectures:
20193 +@table @gcctabopt
20194 +@item -mmult-bug
20195 +@opindex mmult-bug
20196 +Generate code to avoid bugs in the multiply instructions for the MN10300
20197 +processors. This is the default.
20199 +@item -mno-mult-bug
20200 +@opindex mno-mult-bug
20201 +Do not generate code to avoid bugs in the multiply instructions for the
20202 +MN10300 processors.
20204 +@item -mam33
20205 +@opindex mam33
20206 +Generate code which uses features specific to the AM33 processor.
20208 +@item -mno-am33
20209 +@opindex mno-am33
20210 +Do not generate code which uses features specific to the AM33 processor. This
20211 +is the default.
20213 +@item -mam33-2
20214 +@opindex mam33-2
20215 +Generate code which uses features specific to the AM33/2.0 processor.
20217 +@item -mam34
20218 +@opindex mam34
20219 +Generate code which uses features specific to the AM34 processor.
20221 +@item -mtune=@var{cpu-type}
20222 +@opindex mtune
20223 +Use the timing characteristics of the indicated CPU type when
20224 +scheduling instructions. This does not change the targeted processor
20225 +type. The CPU type must be one of @samp{mn10300}, @samp{am33},
20226 +@samp{am33-2} or @samp{am34}.
20228 +@item -mreturn-pointer-on-d0
20229 +@opindex mreturn-pointer-on-d0
20230 +When generating a function which returns a pointer, return the pointer
20231 +in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
20232 +only in a0, and attempts to call such functions without a prototype
20233 +would result in errors. Note that this option is on by default; use
20234 +@option{-mno-return-pointer-on-d0} to disable it.
20236 +@item -mno-crt0
20237 +@opindex mno-crt0
20238 +Do not link in the C run-time initialization object file.
20240 +@item -mrelax
20241 +@opindex mrelax
20242 +Indicate to the linker that it should perform a relaxation optimization pass
20243 +to shorten branches, calls and absolute memory addresses. This option only
20244 +has an effect when used on the command line for the final link step.
20246 +This option makes symbolic debugging impossible.
20248 +@item -mliw
20249 +@opindex mliw
20250 +Allow the compiler to generate @emph{Long Instruction Word}
20251 +instructions if the target is the @samp{AM33} or later. This is the
20252 +default. This option defines the preprocessor macro @samp{__LIW__}.
20254 +@item -mnoliw
20255 +@opindex mnoliw
20256 +Do not allow the compiler to generate @emph{Long Instruction Word}
20257 +instructions. This option defines the preprocessor macro
20258 +@samp{__NO_LIW__}.
20260 +@end table
20262 +@node PDP-11 Options
20263 +@subsection PDP-11 Options
20264 +@cindex PDP-11 Options
20266 +These options are defined for the PDP-11:
20268 +@table @gcctabopt
20269 +@item -mfpu
20270 +@opindex mfpu
20271 +Use hardware FPP floating point. This is the default. (FIS floating
20272 +point on the PDP-11/40 is not supported.)
20274 +@item -msoft-float
20275 +@opindex msoft-float
20276 +Do not use hardware floating point.
20278 +@item -mac0
20279 +@opindex mac0
20280 +Return floating-point results in ac0 (fr0 in Unix assembler syntax).
20282 +@item -mno-ac0
20283 +@opindex mno-ac0
20284 +Return floating-point results in memory. This is the default.
20286 +@item -m40
20287 +@opindex m40
20288 +Generate code for a PDP-11/40.
20290 +@item -m45
20291 +@opindex m45
20292 +Generate code for a PDP-11/45. This is the default.
20294 +@item -m10
20295 +@opindex m10
20296 +Generate code for a PDP-11/10.
20298 +@item -mbcopy-builtin
20299 +@opindex mbcopy-builtin
20300 +Use inline @code{movmemhi} patterns for copying memory. This is the
20301 +default.
20303 +@item -mbcopy
20304 +@opindex mbcopy
20305 +Do not use inline @code{movmemhi} patterns for copying memory.
20307 +@item -mint16
20308 +@itemx -mno-int32
20309 +@opindex mint16
20310 +@opindex mno-int32
20311 +Use 16-bit @code{int}. This is the default.
20313 +@item -mint32
20314 +@itemx -mno-int16
20315 +@opindex mint32
20316 +@opindex mno-int16
20317 +Use 32-bit @code{int}.
20319 +@item -mfloat64
20320 +@itemx -mno-float32
20321 +@opindex mfloat64
20322 +@opindex mno-float32
20323 +Use 64-bit @code{float}. This is the default.
20325 +@item -mfloat32
20326 +@itemx -mno-float64
20327 +@opindex mfloat32
20328 +@opindex mno-float64
20329 +Use 32-bit @code{float}.
20331 +@item -mabshi
20332 +@opindex mabshi
20333 +Use @code{abshi2} pattern. This is the default.
20335 +@item -mno-abshi
20336 +@opindex mno-abshi
20337 +Do not use @code{abshi2} pattern.
20339 +@item -mbranch-expensive
20340 +@opindex mbranch-expensive
20341 +Pretend that branches are expensive. This is for experimenting with
20342 +code generation only.
20344 +@item -mbranch-cheap
20345 +@opindex mbranch-cheap
20346 +Do not pretend that branches are expensive. This is the default.
20348 +@item -munix-asm
20349 +@opindex munix-asm
20350 +Use Unix assembler syntax. This is the default when configured for
20351 +@samp{pdp11-*-bsd}.
20353 +@item -mdec-asm
20354 +@opindex mdec-asm
20355 +Use DEC assembler syntax. This is the default when configured for any
20356 +PDP-11 target other than @samp{pdp11-*-bsd}.
20357 +@end table
20359 +@node picoChip Options
20360 +@subsection picoChip Options
20361 +@cindex picoChip options
20363 +These @samp{-m} options are defined for picoChip implementations:
20365 +@table @gcctabopt
20367 +@item -mae=@var{ae_type}
20368 +@opindex mcpu
20369 +Set the instruction set, register set, and instruction scheduling
20370 +parameters for array element type @var{ae_type}. Supported values
20371 +for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20373 +@option{-mae=ANY} selects a completely generic AE type. Code
20374 +generated with this option will run on any of the other AE types. The
20375 +code will not be as efficient as it would be if compiled for a specific
20376 +AE type, and some types of operation (e.g., multiplication) will not
20377 +work properly on all types of AE.
20379 +@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20380 +for compiled code, and is the default.
20382 +@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20383 +option may suffer from poor performance of byte (char) manipulation,
20384 +since the DSP AE does not provide hardware support for byte load/stores.
20386 +@item -msymbol-as-address
20387 +Enable the compiler to directly use a symbol name as an address in a
20388 +load/store instruction, without first loading it into a
20389 +register. Typically, the use of this option will generate larger
20390 +programs, which run faster than when the option isn't used. However, the
20391 +results vary from program to program, so it is left as a user option,
20392 +rather than being permanently enabled.
20394 +@item -mno-inefficient-warnings
20395 +Disables warnings about the generation of inefficient code. These
20396 +warnings can be generated, for example, when compiling code which
20397 +performs byte-level memory operations on the MAC AE type. The MAC AE has
20398 +no hardware support for byte-level memory operations, so all byte
20399 +load/stores must be synthesized from word load/store operations. This is
20400 +inefficient and a warning will be generated indicating to the programmer
20401 +that they should rewrite the code to avoid byte operations, or to target
20402 +an AE type which has the necessary hardware support. This option enables
20403 +the warning to be turned off.
20405 +@end table
20407 +@node PowerPC Options
20408 +@subsection PowerPC Options
20409 +@cindex PowerPC options
20411 +These are listed under @xref{RS/6000 and PowerPC Options}.
20413 +@node RS/6000 and PowerPC Options
20414 +@subsection IBM RS/6000 and PowerPC Options
20415 +@cindex RS/6000 and PowerPC Options
20416 +@cindex IBM RS/6000 and PowerPC Options
20418 +These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20419 +@table @gcctabopt
20420 +@item -mpower
20421 +@itemx -mno-power
20422 +@itemx -mpower2
20423 +@itemx -mno-power2
20424 +@itemx -mpowerpc
20425 +@itemx -mno-powerpc
20426 +@itemx -mpowerpc-gpopt
20427 +@itemx -mno-powerpc-gpopt
20428 +@itemx -mpowerpc-gfxopt
20429 +@itemx -mno-powerpc-gfxopt
20430 +@need 800
20431 +@itemx -mpowerpc64
20432 +@itemx -mno-powerpc64
20433 +@itemx -mmfcrf
20434 +@itemx -mno-mfcrf
20435 +@itemx -mpopcntb
20436 +@itemx -mno-popcntb
20437 +@itemx -mpopcntd
20438 +@itemx -mno-popcntd
20439 +@itemx -mfprnd
20440 +@itemx -mno-fprnd
20441 +@need 800
20442 +@itemx -mcmpb
20443 +@itemx -mno-cmpb
20444 +@itemx -mmfpgpr
20445 +@itemx -mno-mfpgpr
20446 +@itemx -mhard-dfp
20447 +@itemx -mno-hard-dfp
20448 +@opindex mpower
20449 +@opindex mno-power
20450 +@opindex mpower2
20451 +@opindex mno-power2
20452 +@opindex mpowerpc
20453 +@opindex mno-powerpc
20454 +@opindex mpowerpc-gpopt
20455 +@opindex mno-powerpc-gpopt
20456 +@opindex mpowerpc-gfxopt
20457 +@opindex mno-powerpc-gfxopt
20458 +@opindex mpowerpc64
20459 +@opindex mno-powerpc64
20460 +@opindex mmfcrf
20461 +@opindex mno-mfcrf
20462 +@opindex mpopcntb
20463 +@opindex mno-popcntb
20464 +@opindex mpopcntd
20465 +@opindex mno-popcntd
20466 +@opindex mfprnd
20467 +@opindex mno-fprnd
20468 +@opindex mcmpb
20469 +@opindex mno-cmpb
20470 +@opindex mmfpgpr
20471 +@opindex mno-mfpgpr
20472 +@opindex mhard-dfp
20473 +@opindex mno-hard-dfp
20474 +GCC supports two related instruction set architectures for the
20475 +RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
20476 +instructions supported by the @samp{rios} chip set used in the original
20477 +RS/6000 systems and the @dfn{PowerPC} instruction set is the
20478 +architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
20479 +the IBM 4xx, 6xx, and follow-on microprocessors.
20481 +Neither architecture is a subset of the other. However there is a
20482 +large common subset of instructions supported by both. An MQ
20483 +register is included in processors supporting the POWER architecture.
20485 +You use these options to specify which instructions are available on the
20486 +processor you are using. The default value of these options is
20487 +determined when configuring GCC@. Specifying the
20488 +@option{-mcpu=@var{cpu_type}} overrides the specification of these
20489 +options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20490 +rather than the options listed above.
20492 +The @option{-mpower} option allows GCC to generate instructions that
20493 +are found only in the POWER architecture and to use the MQ register.
20494 +Specifying @option{-mpower2} implies @option{-power} and also allows GCC
20495 +to generate instructions that are present in the POWER2 architecture but
20496 +not the original POWER architecture.
20498 +The @option{-mpowerpc} option allows GCC to generate instructions that
20499 +are found only in the 32-bit subset of the PowerPC architecture.
20500 +Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
20501 +GCC to use the optional PowerPC architecture instructions in the
20502 +General Purpose group, including floating-point square root. Specifying
20503 +@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
20504 +use the optional PowerPC architecture instructions in the Graphics
20505 +group, including floating-point select.
20507 +The @option{-mmfcrf} option allows GCC to generate the move from
20508 +condition register field instruction implemented on the POWER4
20509 +processor and other processors that support the PowerPC V2.01
20510 +architecture.
20511 +The @option{-mpopcntb} option allows GCC to generate the popcount and
20512 +double precision FP reciprocal estimate instruction implemented on the
20513 +POWER5 processor and other processors that support the PowerPC V2.02
20514 +architecture.
20515 +The @option{-mpopcntd} option allows GCC to generate the popcount
20516 +instruction implemented on the POWER7 processor and other processors
20517 +that support the PowerPC V2.06 architecture.
20518 +The @option{-mfprnd} option allows GCC to generate the FP round to
20519 +integer instructions implemented on the POWER5+ processor and other
20520 +processors that support the PowerPC V2.03 architecture.
20521 +The @option{-mcmpb} option allows GCC to generate the compare bytes
20522 +instruction implemented on the POWER6 processor and other processors
20523 +that support the PowerPC V2.05 architecture.
20524 +The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20525 +general purpose register instructions implemented on the POWER6X
20526 +processor and other processors that support the extended PowerPC V2.05
20527 +architecture.
20528 +The @option{-mhard-dfp} option allows GCC to generate the decimal floating
20529 +point instructions implemented on some POWER processors.
20531 +The @option{-mpowerpc64} option allows GCC to generate the additional
20532 +64-bit instructions that are found in the full PowerPC64 architecture
20533 +and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20534 +@option{-mno-powerpc64}.
20536 +If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
20537 +will use only the instructions in the common subset of both
20538 +architectures plus some special AIX common-mode calls, and will not use
20539 +the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
20540 +permits GCC to use any instruction from either architecture and to
20541 +allow use of the MQ register; specify this for the Motorola MPC601.
20543 +@item -mnew-mnemonics
20544 +@itemx -mold-mnemonics
20545 +@opindex mnew-mnemonics
20546 +@opindex mold-mnemonics
20547 +Select which mnemonics to use in the generated assembler code. With
20548 +@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
20549 +the PowerPC architecture. With @option{-mold-mnemonics} it uses the
20550 +assembler mnemonics defined for the POWER architecture. Instructions
20551 +defined in only one architecture have only one mnemonic; GCC uses that
20552 +mnemonic irrespective of which of these options is specified.
20554 +GCC defaults to the mnemonics appropriate for the architecture in
20555 +use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
20556 +value of these option. Unless you are building a cross-compiler, you
20557 +should normally not specify either @option{-mnew-mnemonics} or
20558 +@option{-mold-mnemonics}, but should instead accept the default.
20560 +@item -mcpu=@var{cpu_type}
20561 +@opindex mcpu
20562 +Set architecture type, register usage, choice of mnemonics, and
20563 +instruction scheduling parameters for machine type @var{cpu_type}.
20564 +Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20565 +@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20566 +@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20567 +@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20568 +@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20569 +@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20570 +@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
20571 +@samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
20572 +@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
20573 +@samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
20574 +@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
20576 +@option{-mcpu=common} selects a completely generic processor. Code
20577 +generated under this option will run on any POWER or PowerPC processor.
20578 +GCC will use only the instructions in the common subset of both
20579 +architectures, and will not use the MQ register. GCC assumes a generic
20580 +processor model for scheduling purposes.
20582 +@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
20583 +@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
20584 +PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
20585 +types, with an appropriate, generic processor model assumed for
20586 +scheduling purposes.
20588 +The other options specify a specific processor. Code generated under
20589 +those options will run best on that processor, and may not run at all on
20590 +others.
20592 +The @option{-mcpu} options automatically enable or disable the
20593 +following options:
20595 +@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20596 +-mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 @gol
20597 +-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20598 +-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
20600 +The particular options set for any particular CPU will vary between
20601 +compiler versions, depending on what setting seems to produce optimal
20602 +code for that CPU; it doesn't necessarily reflect the actual hardware's
20603 +capabilities. If you wish to set an individual option to a particular
20604 +value, you may specify it after the @option{-mcpu} option, like
20605 +@samp{-mcpu=970 -mno-altivec}.
20607 +On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20608 +not enabled or disabled by the @option{-mcpu} option at present because
20609 +AIX does not have full support for these options. You may still
20610 +enable or disable them individually if you're sure it'll work in your
20611 +environment.
20613 +@item -mtune=@var{cpu_type}
20614 +@opindex mtune
20615 +Set the instruction scheduling parameters for machine type
20616 +@var{cpu_type}, but do not set the architecture type, register usage, or
20617 +choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
20618 +values for @var{cpu_type} are used for @option{-mtune} as for
20619 +@option{-mcpu}. If both are specified, the code generated will use the
20620 +architecture, registers, and mnemonics set by @option{-mcpu}, but the
20621 +scheduling parameters set by @option{-mtune}.
20623 +@item -mcmodel=small
20624 +@opindex mcmodel=small
20625 +Generate PowerPC64 code for the small model: The TOC is limited to
20626 +64k.
20628 +@item -mcmodel=medium
20629 +@opindex mcmodel=medium
20630 +Generate PowerPC64 code for the medium model: The TOC and other static
20631 +data may be up to a total of 4G in size.
20633 +@item -mcmodel=large
20634 +@opindex mcmodel=large
20635 +Generate PowerPC64 code for the large model: The TOC may be up to 4G
20636 +in size. Other data and code is only limited by the 64-bit address
20637 +space.
20639 +@item -maltivec
20640 +@itemx -mno-altivec
20641 +@opindex maltivec
20642 +@opindex mno-altivec
20643 +Generate code that uses (does not use) AltiVec instructions, and also
20644 +enable the use of built-in functions that allow more direct access to
20645 +the AltiVec instruction set. You may also need to set
20646 +@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20647 +enhancements.
20649 +@item -mvrsave
20650 +@itemx -mno-vrsave
20651 +@opindex mvrsave
20652 +@opindex mno-vrsave
20653 +Generate VRSAVE instructions when generating AltiVec code.
20655 +@item -mgen-cell-microcode
20656 +@opindex mgen-cell-microcode
20657 +Generate Cell microcode instructions
20659 +@item -mwarn-cell-microcode
20660 +@opindex mwarn-cell-microcode
20661 +Warning when a Cell microcode instruction is going to emitted. An example
20662 +of a Cell microcode instruction is a variable shift.
20664 +@item -msecure-plt
20665 +@opindex msecure-plt
20666 +Generate code that allows ld and ld.so to build executables and shared
20667 +libraries with non-exec .plt and .got sections. This is a PowerPC
20668 +32-bit SYSV ABI option.
20670 +@item -mbss-plt
20671 +@opindex mbss-plt
20672 +Generate code that uses a BSS .plt section that ld.so fills in, and
20673 +requires .plt and .got sections that are both writable and executable.
20674 +This is a PowerPC 32-bit SYSV ABI option.
20676 +@item -misel
20677 +@itemx -mno-isel
20678 +@opindex misel
20679 +@opindex mno-isel
20680 +This switch enables or disables the generation of ISEL instructions.
20682 +@item -misel=@var{yes/no}
20683 +This switch has been deprecated. Use @option{-misel} and
20684 +@option{-mno-isel} instead.
20686 +@item -mspe
20687 +@itemx -mno-spe
20688 +@opindex mspe
20689 +@opindex mno-spe
20690 +This switch enables or disables the generation of SPE simd
20691 +instructions.
20693 +@item -mpaired
20694 +@itemx -mno-paired
20695 +@opindex mpaired
20696 +@opindex mno-paired
20697 +This switch enables or disables the generation of PAIRED simd
20698 +instructions.
20700 +@item -mspe=@var{yes/no}
20701 +This option has been deprecated. Use @option{-mspe} and
20702 +@option{-mno-spe} instead.
20704 +@item -mvsx
20705 +@itemx -mno-vsx
20706 +@opindex mvsx
20707 +@opindex mno-vsx
20708 +Generate code that uses (does not use) vector/scalar (VSX)
20709 +instructions, and also enable the use of built-in functions that allow
20710 +more direct access to the VSX instruction set.
20712 +@item -mfloat-gprs=@var{yes/single/double/no}
20713 +@itemx -mfloat-gprs
20714 +@opindex mfloat-gprs
20715 +This switch enables or disables the generation of floating point
20716 +operations on the general purpose registers for architectures that
20717 +support it.
20719 +The argument @var{yes} or @var{single} enables the use of
20720 +single-precision floating point operations.
20722 +The argument @var{double} enables the use of single and
20723 +double-precision floating point operations.
20725 +The argument @var{no} disables floating point operations on the
20726 +general purpose registers.
20728 +This option is currently only available on the MPC854x.
20730 +@item -m32
20731 +@itemx -m64
20732 +@opindex m32
20733 +@opindex m64
20734 +Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20735 +targets (including GNU/Linux). The 32-bit environment sets int, long
20736 +and pointer to 32 bits and generates code that runs on any PowerPC
20737 +variant. The 64-bit environment sets int to 32 bits and long and
20738 +pointer to 64 bits, and generates code for PowerPC64, as for
20739 +@option{-mpowerpc64}.
20741 +@item -mfull-toc
20742 +@itemx -mno-fp-in-toc
20743 +@itemx -mno-sum-in-toc
20744 +@itemx -mminimal-toc
20745 +@opindex mfull-toc
20746 +@opindex mno-fp-in-toc
20747 +@opindex mno-sum-in-toc
20748 +@opindex mminimal-toc
20749 +Modify generation of the TOC (Table Of Contents), which is created for
20750 +every executable file. The @option{-mfull-toc} option is selected by
20751 +default. In that case, GCC will allocate at least one TOC entry for
20752 +each unique non-automatic variable reference in your program. GCC
20753 +will also place floating-point constants in the TOC@. However, only
20754 +16,384 entries are available in the TOC@.
20756 +If you receive a linker error message that saying you have overflowed
20757 +the available TOC space, you can reduce the amount of TOC space used
20758 +with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20759 +@option{-mno-fp-in-toc} prevents GCC from putting floating-point
20760 +constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20761 +generate code to calculate the sum of an address and a constant at
20762 +run-time instead of putting that sum into the TOC@. You may specify one
20763 +or both of these options. Each causes GCC to produce very slightly
20764 +slower and larger code at the expense of conserving TOC space.
20766 +If you still run out of space in the TOC even when you specify both of
20767 +these options, specify @option{-mminimal-toc} instead. This option causes
20768 +GCC to make only one TOC entry for every file. When you specify this
20769 +option, GCC will produce code that is slower and larger but which
20770 +uses extremely little TOC space. You may wish to use this option
20771 +only on files that contain less frequently executed code.
20773 +@item -maix64
20774 +@itemx -maix32
20775 +@opindex maix64
20776 +@opindex maix32
20777 +Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20778 +@code{long} type, and the infrastructure needed to support them.
20779 +Specifying @option{-maix64} implies @option{-mpowerpc64} and
20780 +@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
20781 +implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20783 +@item -mxl-compat
20784 +@itemx -mno-xl-compat
20785 +@opindex mxl-compat
20786 +@opindex mno-xl-compat
20787 +Produce code that conforms more closely to IBM XL compiler semantics
20788 +when using AIX-compatible ABI@. Pass floating-point arguments to
20789 +prototyped functions beyond the register save area (RSA) on the stack
20790 +in addition to argument FPRs. Do not assume that most significant
20791 +double in 128-bit long double value is properly rounded when comparing
20792 +values and converting to double. Use XL symbol names for long double
20793 +support routines.
20795 +The AIX calling convention was extended but not initially documented to
20796 +handle an obscure K&R C case of calling a function that takes the
20797 +address of its arguments with fewer arguments than declared. IBM XL
20798 +compilers access floating point arguments which do not fit in the
20799 +RSA from the stack when a subroutine is compiled without
20800 +optimization. Because always storing floating-point arguments on the
20801 +stack is inefficient and rarely needed, this option is not enabled by
20802 +default and only is necessary when calling subroutines compiled by IBM
20803 +XL compilers without optimization.
20805 +@item -mpe
20806 +@opindex mpe
20807 +Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20808 +application written to use message passing with special startup code to
20809 +enable the application to run. The system must have PE installed in the
20810 +standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20811 +must be overridden with the @option{-specs=} option to specify the
20812 +appropriate directory location. The Parallel Environment does not
20813 +support threads, so the @option{-mpe} option and the @option{-pthread}
20814 +option are incompatible.
20816 +@item -malign-natural
20817 +@itemx -malign-power
20818 +@opindex malign-natural
20819 +@opindex malign-power
20820 +On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20821 +@option{-malign-natural} overrides the ABI-defined alignment of larger
20822 +types, such as floating-point doubles, on their natural size-based boundary.
20823 +The option @option{-malign-power} instructs GCC to follow the ABI-specified
20824 +alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20826 +On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20827 +is not supported.
20829 +@item -msoft-float
20830 +@itemx -mhard-float
20831 +@opindex msoft-float
20832 +@opindex mhard-float
20833 +Generate code that does not use (uses) the floating-point register set.
20834 +Software floating point emulation is provided if you use the
20835 +@option{-msoft-float} option, and pass the option to GCC when linking.
20837 +@item -msingle-float
20838 +@itemx -mdouble-float
20839 +@opindex msingle-float
20840 +@opindex mdouble-float
20841 +Generate code for single or double-precision floating point operations.
20842 +@option{-mdouble-float} implies @option{-msingle-float}.
20844 +@item -msimple-fpu
20845 +@opindex msimple-fpu
20846 +Do not generate sqrt and div instructions for hardware floating point unit.
20848 +@item -mfpu
20849 +@opindex mfpu
20850 +Specify type of floating point unit. Valid values are @var{sp_lite}
20851 +(equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
20852 +to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
20853 +and @var{dp_full} (equivalent to -mdouble-float).
20855 +@item -mxilinx-fpu
20856 +@opindex mxilinx-fpu
20857 +Perform optimizations for floating point unit on Xilinx PPC 405/440.
20859 +@item -mmultiple
20860 +@itemx -mno-multiple
20861 +@opindex mmultiple
20862 +@opindex mno-multiple
20863 +Generate code that uses (does not use) the load multiple word
20864 +instructions and the store multiple word instructions. These
20865 +instructions are generated by default on POWER systems, and not
20866 +generated on PowerPC systems. Do not use @option{-mmultiple} on little
20867 +endian PowerPC systems, since those instructions do not work when the
20868 +processor is in little endian mode. The exceptions are PPC740 and
20869 +PPC750 which permit the instructions usage in little endian mode.
20871 +@item -mstring
20872 +@itemx -mno-string
20873 +@opindex mstring
20874 +@opindex mno-string
20875 +Generate code that uses (does not use) the load string instructions
20876 +and the store string word instructions to save multiple registers and
20877 +do small block moves. These instructions are generated by default on
20878 +POWER systems, and not generated on PowerPC systems. Do not use
20879 +@option{-mstring} on little endian PowerPC systems, since those
20880 +instructions do not work when the processor is in little endian mode.
20881 +The exceptions are PPC740 and PPC750 which permit the instructions
20882 +usage in little endian mode.
20884 +@item -mupdate
20885 +@itemx -mno-update
20886 +@opindex mupdate
20887 +@opindex mno-update
20888 +Generate code that uses (does not use) the load or store instructions
20889 +that update the base register to the address of the calculated memory
20890 +location. These instructions are generated by default. If you use
20891 +@option{-mno-update}, there is a small window between the time that the
20892 +stack pointer is updated and the address of the previous frame is
20893 +stored, which means code that walks the stack frame across interrupts or
20894 +signals may get corrupted data.
20896 +@item -mavoid-indexed-addresses
20897 +@itemx -mno-avoid-indexed-addresses
20898 +@opindex mavoid-indexed-addresses
20899 +@opindex mno-avoid-indexed-addresses
20900 +Generate code that tries to avoid (not avoid) the use of indexed load
20901 +or store instructions. These instructions can incur a performance
20902 +penalty on Power6 processors in certain situations, such as when
20903 +stepping through large arrays that cross a 16M boundary. This option
20904 +is enabled by default when targetting Power6 and disabled otherwise.
20906 +@item -mfused-madd
20907 +@itemx -mno-fused-madd
20908 +@opindex mfused-madd
20909 +@opindex mno-fused-madd
20910 +Generate code that uses (does not use) the floating point multiply and
20911 +accumulate instructions. These instructions are generated by default
20912 +if hardware floating point is used. The machine dependent
20913 +@option{-mfused-madd} option is now mapped to the machine independent
20914 +@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20915 +mapped to @option{-ffp-contract=off}.
20917 +@item -mmulhw
20918 +@itemx -mno-mulhw
20919 +@opindex mmulhw
20920 +@opindex mno-mulhw
20921 +Generate code that uses (does not use) the half-word multiply and
20922 +multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20923 +These instructions are generated by default when targetting those
20924 +processors.
20926 +@item -mdlmzb
20927 +@itemx -mno-dlmzb
20928 +@opindex mdlmzb
20929 +@opindex mno-dlmzb
20930 +Generate code that uses (does not use) the string-search @samp{dlmzb}
20931 +instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20932 +generated by default when targetting those processors.
20934 +@item -mno-bit-align
20935 +@itemx -mbit-align
20936 +@opindex mno-bit-align
20937 +@opindex mbit-align
20938 +On System V.4 and embedded PowerPC systems do not (do) force structures
20939 +and unions that contain bit-fields to be aligned to the base type of the
20940 +bit-field.
20942 +For example, by default a structure containing nothing but 8
20943 +@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
20944 +boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
20945 +the structure would be aligned to a 1 byte boundary and be one byte in
20946 +size.
20948 +@item -mno-strict-align
20949 +@itemx -mstrict-align
20950 +@opindex mno-strict-align
20951 +@opindex mstrict-align
20952 +On System V.4 and embedded PowerPC systems do not (do) assume that
20953 +unaligned memory references will be handled by the system.
20955 +@item -mrelocatable
20956 +@itemx -mno-relocatable
20957 +@opindex mrelocatable
20958 +@opindex mno-relocatable
20959 +Generate code that allows (does not allow) a static executable to be
20960 +relocated to a different address at runtime. A simple embedded
20961 +PowerPC system loader should relocate the entire contents of
20962 +@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20963 +a table of 32-bit addresses generated by this option. For this to
20964 +work, all objects linked together must be compiled with
20965 +@option{-mrelocatable} or @option{-mrelocatable-lib}.
20966 +@option{-mrelocatable} code aligns the stack to an 8 byte boundary.
20968 +@item -mrelocatable-lib
20969 +@itemx -mno-relocatable-lib
20970 +@opindex mrelocatable-lib
20971 +@opindex mno-relocatable-lib
20972 +Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20973 +@code{.fixup} section to allow static executables to be relocated at
20974 +runtime, but @option{-mrelocatable-lib} does not use the smaller stack
20975 +alignment of @option{-mrelocatable}. Objects compiled with
20976 +@option{-mrelocatable-lib} may be linked with objects compiled with
20977 +any combination of the @option{-mrelocatable} options.
20979 +@item -mno-toc
20980 +@itemx -mtoc
20981 +@opindex mno-toc
20982 +@opindex mtoc
20983 +On System V.4 and embedded PowerPC systems do not (do) assume that
20984 +register 2 contains a pointer to a global area pointing to the addresses
20985 +used in the program.
20987 +@item -mlittle
20988 +@itemx -mlittle-endian
20989 +@opindex mlittle
20990 +@opindex mlittle-endian
20991 +On System V.4 and embedded PowerPC systems compile code for the
20992 +processor in little endian mode. The @option{-mlittle-endian} option is
20993 +the same as @option{-mlittle}.
20995 +@item -mbig
20996 +@itemx -mbig-endian
20997 +@opindex mbig
20998 +@opindex mbig-endian
20999 +On System V.4 and embedded PowerPC systems compile code for the
21000 +processor in big endian mode. The @option{-mbig-endian} option is
21001 +the same as @option{-mbig}.
21003 +@item -mdynamic-no-pic
21004 +@opindex mdynamic-no-pic
21005 +On Darwin and Mac OS X systems, compile code so that it is not
21006 +relocatable, but that its external references are relocatable. The
21007 +resulting code is suitable for applications, but not shared
21008 +libraries.
21010 +@item -msingle-pic-base
21011 +@opindex msingle-pic-base
21012 +Treat the register used for PIC addressing as read-only, rather than
21013 +loading it in the prologue for each function. The run-time system is
21014 +responsible for initializing this register with an appropriate value
21015 +before execution begins.
21017 +@item -mprioritize-restricted-insns=@var{priority}
21018 +@opindex mprioritize-restricted-insns
21019 +This option controls the priority that is assigned to
21020 +dispatch-slot restricted instructions during the second scheduling
21021 +pass. The argument @var{priority} takes the value @var{0/1/2} to assign
21022 +@var{no/highest/second-highest} priority to dispatch slot restricted
21023 +instructions.
21025 +@item -msched-costly-dep=@var{dependence_type}
21026 +@opindex msched-costly-dep
21027 +This option controls which dependences are considered costly
21028 +by the target during instruction scheduling. The argument
21029 +@var{dependence_type} takes one of the following values:
21030 +@var{no}: no dependence is costly,
21031 +@var{all}: all dependences are costly,
21032 +@var{true_store_to_load}: a true dependence from store to load is costly,
21033 +@var{store_to_load}: any dependence from store to load is costly,
21034 +@var{number}: any dependence which latency >= @var{number} is costly.
21036 +@item -minsert-sched-nops=@var{scheme}
21037 +@opindex minsert-sched-nops
21038 +This option controls which nop insertion scheme will be used during
21039 +the second scheduling pass. The argument @var{scheme} takes one of the
21040 +following values:
21041 +@var{no}: Don't insert nops.
21042 +@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
21043 +according to the scheduler's grouping.
21044 +@var{regroup_exact}: Insert nops to force costly dependent insns into
21045 +separate groups. Insert exactly as many nops as needed to force an insn
21046 +to a new group, according to the estimated processor grouping.
21047 +@var{number}: Insert nops to force costly dependent insns into
21048 +separate groups. Insert @var{number} nops to force an insn to a new group.
21050 +@item -mcall-sysv
21051 +@opindex mcall-sysv
21052 +On System V.4 and embedded PowerPC systems compile code using calling
21053 +conventions that adheres to the March 1995 draft of the System V
21054 +Application Binary Interface, PowerPC processor supplement. This is the
21055 +default unless you configured GCC using @samp{powerpc-*-eabiaix}.
21057 +@item -mcall-sysv-eabi
21058 +@itemx -mcall-eabi
21059 +@opindex mcall-sysv-eabi
21060 +@opindex mcall-eabi
21061 +Specify both @option{-mcall-sysv} and @option{-meabi} options.
21063 +@item -mcall-sysv-noeabi
21064 +@opindex mcall-sysv-noeabi
21065 +Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
21067 +@item -mcall-aixdesc
21068 +@opindex m
21069 +On System V.4 and embedded PowerPC systems compile code for the AIX
21070 +operating system.
21072 +@item -mcall-linux
21073 +@opindex mcall-linux
21074 +On System V.4 and embedded PowerPC systems compile code for the
21075 +Linux-based GNU system.
21077 +@item -mcall-gnu
21078 +@opindex mcall-gnu
21079 +On System V.4 and embedded PowerPC systems compile code for the
21080 +Hurd-based GNU system.
21082 +@item -mcall-freebsd
21083 +@opindex mcall-freebsd
21084 +On System V.4 and embedded PowerPC systems compile code for the
21085 +FreeBSD operating system.
21087 +@item -mcall-netbsd
21088 +@opindex mcall-netbsd
21089 +On System V.4 and embedded PowerPC systems compile code for the
21090 +NetBSD operating system.
21092 +@item -mcall-openbsd
21093 +@opindex mcall-netbsd
21094 +On System V.4 and embedded PowerPC systems compile code for the
21095 +OpenBSD operating system.
21097 +@item -maix-struct-return
21098 +@opindex maix-struct-return
21099 +Return all structures in memory (as specified by the AIX ABI)@.
21101 +@item -msvr4-struct-return
21102 +@opindex msvr4-struct-return
21103 +Return structures smaller than 8 bytes in registers (as specified by the
21104 +SVR4 ABI)@.
21106 +@item -mabi=@var{abi-type}
21107 +@opindex mabi
21108 +Extend the current ABI with a particular extension, or remove such extension.
21109 +Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
21110 +@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
21112 +@item -mabi=spe
21113 +@opindex mabi=spe
21114 +Extend the current ABI with SPE ABI extensions. This does not change
21115 +the default ABI, instead it adds the SPE ABI extensions to the current
21116 +ABI@.
21118 +@item -mabi=no-spe
21119 +@opindex mabi=no-spe
21120 +Disable Booke SPE ABI extensions for the current ABI@.
21122 +@item -mabi=ibmlongdouble
21123 +@opindex mabi=ibmlongdouble
21124 +Change the current ABI to use IBM extended precision long double.
21125 +This is a PowerPC 32-bit SYSV ABI option.
21127 +@item -mabi=ieeelongdouble
21128 +@opindex mabi=ieeelongdouble
21129 +Change the current ABI to use IEEE extended precision long double.
21130 +This is a PowerPC 32-bit Linux ABI option.
21132 +@item -mprototype
21133 +@itemx -mno-prototype
21134 +@opindex mprototype
21135 +@opindex mno-prototype
21136 +On System V.4 and embedded PowerPC systems assume that all calls to
21137 +variable argument functions are properly prototyped. Otherwise, the
21138 +compiler must insert an instruction before every non prototyped call to
21139 +set or clear bit 6 of the condition code register (@var{CR}) to
21140 +indicate whether floating point values were passed in the floating point
21141 +registers in case the function takes a variable arguments. With
21142 +@option{-mprototype}, only calls to prototyped variable argument functions
21143 +will set or clear the bit.
21145 +@item -msim
21146 +@opindex msim
21147 +On embedded PowerPC systems, assume that the startup module is called
21148 +@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21149 +@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21150 +configurations.
21152 +@item -mmvme
21153 +@opindex mmvme
21154 +On embedded PowerPC systems, assume that the startup module is called
21155 +@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21156 +@file{libc.a}.
21158 +@item -mads
21159 +@opindex mads
21160 +On embedded PowerPC systems, assume that the startup module is called
21161 +@file{crt0.o} and the standard C libraries are @file{libads.a} and
21162 +@file{libc.a}.
21164 +@item -myellowknife
21165 +@opindex myellowknife
21166 +On embedded PowerPC systems, assume that the startup module is called
21167 +@file{crt0.o} and the standard C libraries are @file{libyk.a} and
21168 +@file{libc.a}.
21170 +@item -mvxworks
21171 +@opindex mvxworks
21172 +On System V.4 and embedded PowerPC systems, specify that you are
21173 +compiling for a VxWorks system.
21175 +@item -memb
21176 +@opindex memb
21177 +On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
21178 +header to indicate that @samp{eabi} extended relocations are used.
21180 +@item -meabi
21181 +@itemx -mno-eabi
21182 +@opindex meabi
21183 +@opindex mno-eabi
21184 +On System V.4 and embedded PowerPC systems do (do not) adhere to the
21185 +Embedded Applications Binary Interface (eabi) which is a set of
21186 +modifications to the System V.4 specifications. Selecting @option{-meabi}
21187 +means that the stack is aligned to an 8 byte boundary, a function
21188 +@code{__eabi} is called to from @code{main} to set up the eabi
21189 +environment, and the @option{-msdata} option can use both @code{r2} and
21190 +@code{r13} to point to two separate small data areas. Selecting
21191 +@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
21192 +do not call an initialization function from @code{main}, and the
21193 +@option{-msdata} option will only use @code{r13} to point to a single
21194 +small data area. The @option{-meabi} option is on by default if you
21195 +configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21197 +@item -msdata=eabi
21198 +@opindex msdata=eabi
21199 +On System V.4 and embedded PowerPC systems, put small initialized
21200 +@code{const} global and static data in the @samp{.sdata2} section, which
21201 +is pointed to by register @code{r2}. Put small initialized
21202 +non-@code{const} global and static data in the @samp{.sdata} section,
21203 +which is pointed to by register @code{r13}. Put small uninitialized
21204 +global and static data in the @samp{.sbss} section, which is adjacent to
21205 +the @samp{.sdata} section. The @option{-msdata=eabi} option is
21206 +incompatible with the @option{-mrelocatable} option. The
21207 +@option{-msdata=eabi} option also sets the @option{-memb} option.
21209 +@item -msdata=sysv
21210 +@opindex msdata=sysv
21211 +On System V.4 and embedded PowerPC systems, put small global and static
21212 +data in the @samp{.sdata} section, which is pointed to by register
21213 +@code{r13}. Put small uninitialized global and static data in the
21214 +@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
21215 +The @option{-msdata=sysv} option is incompatible with the
21216 +@option{-mrelocatable} option.
21218 +@item -msdata=default
21219 +@itemx -msdata
21220 +@opindex msdata=default
21221 +@opindex msdata
21222 +On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21223 +compile code the same as @option{-msdata=eabi}, otherwise compile code the
21224 +same as @option{-msdata=sysv}.
21226 +@item -msdata=data
21227 +@opindex msdata=data
21228 +On System V.4 and embedded PowerPC systems, put small global
21229 +data in the @samp{.sdata} section. Put small uninitialized global
21230 +data in the @samp{.sbss} section. Do not use register @code{r13}
21231 +to address small data however. This is the default behavior unless
21232 +other @option{-msdata} options are used.
21234 +@item -msdata=none
21235 +@itemx -mno-sdata
21236 +@opindex msdata=none
21237 +@opindex mno-sdata
21238 +On embedded PowerPC systems, put all initialized global and static data
21239 +in the @samp{.data} section, and all uninitialized data in the
21240 +@samp{.bss} section.
21242 +@item -mblock-move-inline-limit=@var{num}
21243 +@opindex mblock-move-inline-limit
21244 +Inline all block moves (such as calls to @code{memcpy} or structure
21245 +copies) less than or equal to @var{num} bytes. The minimum value for
21246 +@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21247 +targets. The default value is target-specific.
21249 +@item -G @var{num}
21250 +@opindex G
21251 +@cindex smaller data references (PowerPC)
21252 +@cindex .sdata/.sdata2 references (PowerPC)
21253 +On embedded PowerPC systems, put global and static items less than or
21254 +equal to @var{num} bytes into the small data or bss sections instead of
21255 +the normal data or bss section. By default, @var{num} is 8. The
21256 +@option{-G @var{num}} switch is also passed to the linker.
21257 +All modules should be compiled with the same @option{-G @var{num}} value.
21259 +@item -mregnames
21260 +@itemx -mno-regnames
21261 +@opindex mregnames
21262 +@opindex mno-regnames
21263 +On System V.4 and embedded PowerPC systems do (do not) emit register
21264 +names in the assembly language output using symbolic forms.
21266 +@item -mlongcall
21267 +@itemx -mno-longcall
21268 +@opindex mlongcall
21269 +@opindex mno-longcall
21270 +By default assume that all calls are far away so that a longer more
21271 +expensive calling sequence is required. This is required for calls
21272 +further than 32 megabytes (33,554,432 bytes) from the current location.
21273 +A short call will be generated if the compiler knows
21274 +the call cannot be that far away. This setting can be overridden by
21275 +the @code{shortcall} function attribute, or by @code{#pragma
21276 +longcall(0)}.
21278 +Some linkers are capable of detecting out-of-range calls and generating
21279 +glue code on the fly. On these systems, long calls are unnecessary and
21280 +generate slower code. As of this writing, the AIX linker can do this,
21281 +as can the GNU linker for PowerPC/64. It is planned to add this feature
21282 +to the GNU linker for 32-bit PowerPC systems as well.
21284 +On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
21285 +callee, L42'', plus a ``branch island'' (glue code). The two target
21286 +addresses represent the callee and the ``branch island''. The
21287 +Darwin/PPC linker will prefer the first address and generate a ``bl
21288 +callee'' if the PPC ``bl'' instruction will reach the callee directly;
21289 +otherwise, the linker will generate ``bl L42'' to call the ``branch
21290 +island''. The ``branch island'' is appended to the body of the
21291 +calling function; it computes the full 32-bit address of the callee
21292 +and jumps to it.
21294 +On Mach-O (Darwin) systems, this option directs the compiler emit to
21295 +the glue for every direct call, and the Darwin linker decides whether
21296 +to use or discard it.
21298 +In the future, we may cause GCC to ignore all longcall specifications
21299 +when the linker is known to generate glue.
21301 +@item -mtls-markers
21302 +@itemx -mno-tls-markers
21303 +@opindex mtls-markers
21304 +@opindex mno-tls-markers
21305 +Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21306 +specifying the function argument. The relocation allows ld to
21307 +reliably associate function call with argument setup instructions for
21308 +TLS optimization, which in turn allows gcc to better schedule the
21309 +sequence.
21311 +@item -pthread
21312 +@opindex pthread
21313 +Adds support for multithreading with the @dfn{pthreads} library.
21314 +This option sets flags for both the preprocessor and linker.
21316 +@item -mrecip
21317 +@itemx -mno-recip
21318 +@opindex mrecip
21319 +This option will enable GCC to use the reciprocal estimate and
21320 +reciprocal square root estimate instructions with additional
21321 +Newton-Raphson steps to increase precision instead of doing a divide or
21322 +square root and divide for floating point arguments. You should use
21323 +the @option{-ffast-math} option when using @option{-mrecip} (or at
21324 +least @option{-funsafe-math-optimizations},
21325 +@option{-finite-math-only}, @option{-freciprocal-math} and
21326 +@option{-fno-trapping-math}). Note that while the throughput of the
21327 +sequence is generally higher than the throughput of the non-reciprocal
21328 +instruction, the precision of the sequence can be decreased by up to 2
21329 +ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square
21330 +roots.
21332 +@item -mrecip=@var{opt}
21333 +@opindex mrecip=opt
21334 +This option allows to control which reciprocal estimate instructions
21335 +may be used. @var{opt} is a comma separated list of options, that may
21336 +be preceded by a @code{!} to invert the option:
21337 +@code{all}: enable all estimate instructions,
21338 +@code{default}: enable the default instructions, equivalent to @option{-mrecip},
21339 +@code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
21340 +@code{div}: enable the reciprocal approximation instructions for both single and double precision;
21341 +@code{divf}: enable the single precision reciprocal approximation instructions;
21342 +@code{divd}: enable the double precision reciprocal approximation instructions;
21343 +@code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
21344 +@code{rsqrtf}: enable the single precision reciprocal square root approximation instructions;
21345 +@code{rsqrtd}: enable the double precision reciprocal square root approximation instructions;
21347 +So for example, @option{-mrecip=all,!rsqrtd} would enable the
21348 +all of the reciprocal estimate instructions, except for the
21349 +@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21350 +which handle the double precision reciprocal square root calculations.
21352 +@item -mrecip-precision
21353 +@itemx -mno-recip-precision
21354 +@opindex mrecip-precision
21355 +Assume (do not assume) that the reciprocal estimate instructions
21356 +provide higher precision estimates than is mandated by the powerpc
21357 +ABI. Selecting @option{-mcpu=power6} or @option{-mcpu=power7}
21358 +automatically selects @option{-mrecip-precision}. The double
21359 +precision square root estimate instructions are not generated by
21360 +default on low precision machines, since they do not provide an
21361 +estimate that converges after three steps.
21363 +@item -mveclibabi=@var{type}
21364 +@opindex mveclibabi
21365 +Specifies the ABI type to use for vectorizing intrinsics using an
21366 +external library. The only type supported at present is @code{mass},
21367 +which specifies to use IBM's Mathematical Acceleration Subsystem
21368 +(MASS) libraries for vectorizing intrinsics using external libraries.
21369 +GCC will currently emit calls to @code{acosd2}, @code{acosf4},
21370 +@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21371 +@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21372 +@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21373 +@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21374 +@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21375 +@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21376 +@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21377 +@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21378 +@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21379 +@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21380 +@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21381 +@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21382 +@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21383 +for power7. Both @option{-ftree-vectorize} and
21384 +@option{-funsafe-math-optimizations} have to be enabled. The MASS
21385 +libraries will have to be specified at link time.
21387 +@item -mfriz
21388 +@itemx -mno-friz
21389 +@opindex mfriz
21390 +Generate (do not generate) the @code{friz} instruction when the
21391 +@option{-funsafe-math-optimizations} option is used to optimize
21392 +rounding a floating point value to 64-bit integer and back to floating
21393 +point. The @code{friz} instruction does not return the same value if
21394 +the floating point number is too large to fit in an integer.
21395 +@end table
21397 +@node RX Options
21398 +@subsection RX Options
21399 +@cindex RX Options
21401 +These command line options are defined for RX targets:
21403 +@table @gcctabopt
21404 +@item -m64bit-doubles
21405 +@itemx -m32bit-doubles
21406 +@opindex m64bit-doubles
21407 +@opindex m32bit-doubles
21408 +Make the @code{double} data type be 64-bits (@option{-m64bit-doubles})
21409 +or 32-bits (@option{-m32bit-doubles}) in size. The default is
21410 +@option{-m32bit-doubles}. @emph{Note} RX floating point hardware only
21411 +works on 32-bit values, which is why the default is
21412 +@option{-m32bit-doubles}.
21414 +@item -fpu
21415 +@itemx -nofpu
21416 +@opindex fpu
21417 +@opindex nofpu
21418 +Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21419 +floating point hardware. The default is enabled for the @var{RX600}
21420 +series and disabled for the @var{RX200} series.
21422 +Floating point instructions will only be generated for 32-bit floating
21423 +point values however, so if the @option{-m64bit-doubles} option is in
21424 +use then the FPU hardware will not be used for doubles.
21426 +@emph{Note} If the @option{-fpu} option is enabled then
21427 +@option{-funsafe-math-optimizations} is also enabled automatically.
21428 +This is because the RX FPU instructions are themselves unsafe.
21430 +@item -mcpu=@var{name}
21431 +@opindex -mcpu
21432 +Selects the type of RX CPU to be targeted. Currently three types are
21433 +supported, the generic @var{RX600} and @var{RX200} series hardware and
21434 +the specific @var{RX610} CPU. The default is @var{RX600}.
21436 +The only difference between @var{RX600} and @var{RX610} is that the
21437 +@var{RX610} does not support the @code{MVTIPL} instruction.
21439 +The @var{RX200} series does not have a hardware floating point unit
21440 +and so @option{-nofpu} is enabled by default when this type is
21441 +selected.
21443 +@item -mbig-endian-data
21444 +@itemx -mlittle-endian-data
21445 +@opindex mbig-endian-data
21446 +@opindex mlittle-endian-data
21447 +Store data (but not code) in the big-endian format. The default is
21448 +@option{-mlittle-endian-data}, i.e.@: to store data in the little endian
21449 +format.
21451 +@item -msmall-data-limit=@var{N}
21452 +@opindex msmall-data-limit
21453 +Specifies the maximum size in bytes of global and static variables
21454 +which can be placed into the small data area. Using the small data
21455 +area can lead to smaller and faster code, but the size of area is
21456 +limited and it is up to the programmer to ensure that the area does
21457 +not overflow. Also when the small data area is used one of the RX's
21458 +registers (@code{r13}) is reserved for use pointing to this area, so
21459 +it is no longer available for use by the compiler. This could result
21460 +in slower and/or larger code if variables which once could have been
21461 +held in @code{r13} are now pushed onto the stack.
21463 +Note, common variables (variables which have not been initialised) and
21464 +constants are not placed into the small data area as they are assigned
21465 +to other sections in the output executable.
21467 +The default value is zero, which disables this feature. Note, this
21468 +feature is not enabled by default with higher optimization levels
21469 +(@option{-O2} etc) because of the potentially detrimental effects of
21470 +reserving register @code{r13}. It is up to the programmer to
21471 +experiment and discover whether this feature is of benefit to their
21472 +program.
21474 +@item -msim
21475 +@itemx -mno-sim
21476 +@opindex msim
21477 +@opindex mno-sim
21478 +Use the simulator runtime. The default is to use the libgloss board
21479 +specific runtime.
21481 +@item -mas100-syntax
21482 +@itemx -mno-as100-syntax
21483 +@opindex mas100-syntax
21484 +@opindex mno-as100-syntax
21485 +When generating assembler output use a syntax that is compatible with
21486 +Renesas's AS100 assembler. This syntax can also be handled by the GAS
21487 +assembler but it has some restrictions so generating it is not the
21488 +default option.
21490 +@item -mmax-constant-size=@var{N}
21491 +@opindex mmax-constant-size
21492 +Specifies the maximum size, in bytes, of a constant that can be used as
21493 +an operand in a RX instruction. Although the RX instruction set does
21494 +allow constants of up to 4 bytes in length to be used in instructions,
21495 +a longer value equates to a longer instruction. Thus in some
21496 +circumstances it can be beneficial to restrict the size of constants
21497 +that are used in instructions. Constants that are too big are instead
21498 +placed into a constant pool and referenced via register indirection.
21500 +The value @var{N} can be between 0 and 4. A value of 0 (the default)
21501 +or 4 means that constants of any size are allowed.
21503 +@item -mrelax
21504 +@opindex mrelax
21505 +Enable linker relaxation. Linker relaxation is a process whereby the
21506 +linker will attempt to reduce the size of a program by finding shorter
21507 +versions of various instructions. Disabled by default.
21509 +@item -mint-register=@var{N}
21510 +@opindex mint-register
21511 +Specify the number of registers to reserve for fast interrupt handler
21512 +functions. The value @var{N} can be between 0 and 4. A value of 1
21513 +means that register @code{r13} will be reserved for the exclusive use
21514 +of fast interrupt handlers. A value of 2 reserves @code{r13} and
21515 +@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21516 +@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21517 +A value of 0, the default, does not reserve any registers.
21519 +@item -msave-acc-in-interrupts
21520 +@opindex msave-acc-in-interrupts
21521 +Specifies that interrupt handler functions should preserve the
21522 +accumulator register. This is only necessary if normal code might use
21523 +the accumulator register, for example because it performs 64-bit
21524 +multiplications. The default is to ignore the accumulator as this
21525 +makes the interrupt handlers faster.
21527 +@end table
21529 +@emph{Note:} The generic GCC command line @option{-ffixed-@var{reg}}
21530 +has special significance to the RX port when used with the
21531 +@code{interrupt} function attribute. This attribute indicates a
21532 +function intended to process fast interrupts. GCC will will ensure
21533 +that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21534 +and/or @code{r13} and only provided that the normal use of the
21535 +corresponding registers have been restricted via the
21536 +@option{-ffixed-@var{reg}} or @option{-mint-register} command line
21537 +options.
21539 +@node S/390 and zSeries Options
21540 +@subsection S/390 and zSeries Options
21541 +@cindex S/390 and zSeries Options
21543 +These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21545 +@table @gcctabopt
21546 +@item -mhard-float
21547 +@itemx -msoft-float
21548 +@opindex mhard-float
21549 +@opindex msoft-float
21550 +Use (do not use) the hardware floating-point instructions and registers
21551 +for floating-point operations. When @option{-msoft-float} is specified,
21552 +functions in @file{libgcc.a} will be used to perform floating-point
21553 +operations. When @option{-mhard-float} is specified, the compiler
21554 +generates IEEE floating-point instructions. This is the default.
21556 +@item -mhard-dfp
21557 +@itemx -mno-hard-dfp
21558 +@opindex mhard-dfp
21559 +@opindex mno-hard-dfp
21560 +Use (do not use) the hardware decimal-floating-point instructions for
21561 +decimal-floating-point operations. When @option{-mno-hard-dfp} is
21562 +specified, functions in @file{libgcc.a} will be used to perform
21563 +decimal-floating-point operations. When @option{-mhard-dfp} is
21564 +specified, the compiler generates decimal-floating-point hardware
21565 +instructions. This is the default for @option{-march=z9-ec} or higher.
21567 +@item -mlong-double-64
21568 +@itemx -mlong-double-128
21569 +@opindex mlong-double-64
21570 +@opindex mlong-double-128
21571 +These switches control the size of @code{long double} type. A size
21572 +of 64bit makes the @code{long double} type equivalent to the @code{double}
21573 +type. This is the default.
21575 +@item -mbackchain
21576 +@itemx -mno-backchain
21577 +@opindex mbackchain
21578 +@opindex mno-backchain
21579 +Store (do not store) the address of the caller's frame as backchain pointer
21580 +into the callee's stack frame.
21581 +A backchain may be needed to allow debugging using tools that do not understand
21582 +DWARF-2 call frame information.
21583 +When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21584 +at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21585 +the backchain is placed into the topmost word of the 96/160 byte register
21586 +save area.
21588 +In general, code compiled with @option{-mbackchain} is call-compatible with
21589 +code compiled with @option{-mmo-backchain}; however, use of the backchain
21590 +for debugging purposes usually requires that the whole binary is built with
21591 +@option{-mbackchain}. Note that the combination of @option{-mbackchain},
21592 +@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21593 +to build a linux kernel use @option{-msoft-float}.
21595 +The default is to not maintain the backchain.
21597 +@item -mpacked-stack
21598 +@itemx -mno-packed-stack
21599 +@opindex mpacked-stack
21600 +@opindex mno-packed-stack
21601 +Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21602 +specified, the compiler uses the all fields of the 96/160 byte register save
21603 +area only for their default purpose; unused fields still take up stack space.
21604 +When @option{-mpacked-stack} is specified, register save slots are densely
21605 +packed at the top of the register save area; unused space is reused for other
21606 +purposes, allowing for more efficient use of the available stack space.
21607 +However, when @option{-mbackchain} is also in effect, the topmost word of
21608 +the save area is always used to store the backchain, and the return address
21609 +register is always saved two words below the backchain.
21611 +As long as the stack frame backchain is not used, code generated with
21612 +@option{-mpacked-stack} is call-compatible with code generated with
21613 +@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21614 +S/390 or zSeries generated code that uses the stack frame backchain at run
21615 +time, not just for debugging purposes. Such code is not call-compatible
21616 +with code compiled with @option{-mpacked-stack}. Also, note that the
21617 +combination of @option{-mbackchain},
21618 +@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21619 +to build a linux kernel use @option{-msoft-float}.
21621 +The default is to not use the packed stack layout.
21623 +@item -msmall-exec
21624 +@itemx -mno-small-exec
21625 +@opindex msmall-exec
21626 +@opindex mno-small-exec
21627 +Generate (or do not generate) code using the @code{bras} instruction
21628 +to do subroutine calls.
21629 +This only works reliably if the total executable size does not
21630 +exceed 64k. The default is to use the @code{basr} instruction instead,
21631 +which does not have this limitation.
21633 +@item -m64
21634 +@itemx -m31
21635 +@opindex m64
21636 +@opindex m31
21637 +When @option{-m31} is specified, generate code compliant to the
21638 +GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21639 +code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21640 +particular to generate 64-bit instructions. For the @samp{s390}
21641 +targets, the default is @option{-m31}, while the @samp{s390x}
21642 +targets default to @option{-m64}.
21644 +@item -mzarch
21645 +@itemx -mesa
21646 +@opindex mzarch
21647 +@opindex mesa
21648 +When @option{-mzarch} is specified, generate code using the
21649 +instructions available on z/Architecture.
21650 +When @option{-mesa} is specified, generate code using the
21651 +instructions available on ESA/390. Note that @option{-mesa} is
21652 +not possible with @option{-m64}.
21653 +When generating code compliant to the GNU/Linux for S/390 ABI,
21654 +the default is @option{-mesa}. When generating code compliant
21655 +to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21657 +@item -mmvcle
21658 +@itemx -mno-mvcle
21659 +@opindex mmvcle
21660 +@opindex mno-mvcle
21661 +Generate (or do not generate) code using the @code{mvcle} instruction
21662 +to perform block moves. When @option{-mno-mvcle} is specified,
21663 +use a @code{mvc} loop instead. This is the default unless optimizing for
21664 +size.
21666 +@item -mdebug
21667 +@itemx -mno-debug
21668 +@opindex mdebug
21669 +@opindex mno-debug
21670 +Print (or do not print) additional debug information when compiling.
21671 +The default is to not print debug information.
21673 +@item -march=@var{cpu-type}
21674 +@opindex march
21675 +Generate code that will run on @var{cpu-type}, which is the name of a system
21676 +representing a certain processor type. Possible values for
21677 +@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
21678 +@samp{z9-109}, @samp{z9-ec} and @samp{z10}.
21679 +When generating code using the instructions available on z/Architecture,
21680 +the default is @option{-march=z900}. Otherwise, the default is
21681 +@option{-march=g5}.
21683 +@item -mtune=@var{cpu-type}
21684 +@opindex mtune
21685 +Tune to @var{cpu-type} everything applicable about the generated code,
21686 +except for the ABI and the set of available instructions.
21687 +The list of @var{cpu-type} values is the same as for @option{-march}.
21688 +The default is the value used for @option{-march}.
21690 +@item -mtpf-trace
21691 +@itemx -mno-tpf-trace
21692 +@opindex mtpf-trace
21693 +@opindex mno-tpf-trace
21694 +Generate code that adds (does not add) in TPF OS specific branches to trace
21695 +routines in the operating system. This option is off by default, even
21696 +when compiling for the TPF OS@.
21698 +@item -mfused-madd
21699 +@itemx -mno-fused-madd
21700 +@opindex mfused-madd
21701 +@opindex mno-fused-madd
21702 +Generate code that uses (does not use) the floating point multiply and
21703 +accumulate instructions. These instructions are generated by default if
21704 +hardware floating point is used.
21706 +@item -mwarn-framesize=@var{framesize}
21707 +@opindex mwarn-framesize
21708 +Emit a warning if the current function exceeds the given frame size. Because
21709 +this is a compile time check it doesn't need to be a real problem when the program
21710 +runs. It is intended to identify functions which most probably cause
21711 +a stack overflow. It is useful to be used in an environment with limited stack
21712 +size e.g.@: the linux kernel.
21714 +@item -mwarn-dynamicstack
21715 +@opindex mwarn-dynamicstack
21716 +Emit a warning if the function calls alloca or uses dynamically
21717 +sized arrays. This is generally a bad idea with a limited stack size.
21719 +@item -mstack-guard=@var{stack-guard}
21720 +@itemx -mstack-size=@var{stack-size}
21721 +@opindex mstack-guard
21722 +@opindex mstack-size
21723 +If these options are provided the s390 back end emits additional instructions in
21724 +the function prologue which trigger a trap if the stack size is @var{stack-guard}
21725 +bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
21726 +If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21727 +the frame size of the compiled function is chosen.
21728 +These options are intended to be used to help debugging stack overflow problems.
21729 +The additionally emitted code causes only little overhead and hence can also be
21730 +used in production like systems without greater performance degradation. The given
21731 +values have to be exact powers of 2 and @var{stack-size} has to be greater than
21732 +@var{stack-guard} without exceeding 64k.
21733 +In order to be efficient the extra code makes the assumption that the stack starts
21734 +at an address aligned to the value given by @var{stack-size}.
21735 +The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21736 +@end table
21738 +@node Score Options
21739 +@subsection Score Options
21740 +@cindex Score Options
21742 +These options are defined for Score implementations:
21744 +@table @gcctabopt
21745 +@item -meb
21746 +@opindex meb
21747 +Compile code for big endian mode. This is the default.
21749 +@item -mel
21750 +@opindex mel
21751 +Compile code for little endian mode.
21753 +@item -mnhwloop
21754 +@opindex mnhwloop
21755 +Disable generate bcnz instruction.
21757 +@item -muls
21758 +@opindex muls
21759 +Enable generate unaligned load and store instruction.
21761 +@item -mmac
21762 +@opindex mmac
21763 +Enable the use of multiply-accumulate instructions. Disabled by default.
21765 +@item -mscore5
21766 +@opindex mscore5
21767 +Specify the SCORE5 as the target architecture.
21769 +@item -mscore5u
21770 +@opindex mscore5u
21771 +Specify the SCORE5U of the target architecture.
21773 +@item -mscore7
21774 +@opindex mscore7
21775 +Specify the SCORE7 as the target architecture. This is the default.
21777 +@item -mscore7d
21778 +@opindex mscore7d
21779 +Specify the SCORE7D as the target architecture.
21780 +@end table
21782 +@node SH Options
21783 +@subsection SH Options
21785 +These @samp{-m} options are defined for the SH implementations:
21787 +@table @gcctabopt
21788 +@item -m1
21789 +@opindex m1
21790 +Generate code for the SH1.
21792 +@item -m2
21793 +@opindex m2
21794 +Generate code for the SH2.
21796 +@item -m2e
21797 +Generate code for the SH2e.
21799 +@item -m2a-nofpu
21800 +@opindex m2a-nofpu
21801 +Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21802 +that the floating-point unit is not used.
21804 +@item -m2a-single-only
21805 +@opindex m2a-single-only
21806 +Generate code for the SH2a-FPU, in such a way that no double-precision
21807 +floating point operations are used.
21809 +@item -m2a-single
21810 +@opindex m2a-single
21811 +Generate code for the SH2a-FPU assuming the floating-point unit is in
21812 +single-precision mode by default.
21814 +@item -m2a
21815 +@opindex m2a
21816 +Generate code for the SH2a-FPU assuming the floating-point unit is in
21817 +double-precision mode by default.
21819 +@item -m3
21820 +@opindex m3
21821 +Generate code for the SH3.
21823 +@item -m3e
21824 +@opindex m3e
21825 +Generate code for the SH3e.
21827 +@item -m4-nofpu
21828 +@opindex m4-nofpu
21829 +Generate code for the SH4 without a floating-point unit.
21831 +@item -m4-single-only
21832 +@opindex m4-single-only
21833 +Generate code for the SH4 with a floating-point unit that only
21834 +supports single-precision arithmetic.
21836 +@item -m4-single
21837 +@opindex m4-single
21838 +Generate code for the SH4 assuming the floating-point unit is in
21839 +single-precision mode by default.
21841 +@item -m4
21842 +@opindex m4
21843 +Generate code for the SH4.
21845 +@item -m4a-nofpu
21846 +@opindex m4a-nofpu
21847 +Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21848 +floating-point unit is not used.
21850 +@item -m4a-single-only
21851 +@opindex m4a-single-only
21852 +Generate code for the SH4a, in such a way that no double-precision
21853 +floating point operations are used.
21855 +@item -m4a-single
21856 +@opindex m4a-single
21857 +Generate code for the SH4a assuming the floating-point unit is in
21858 +single-precision mode by default.
21860 +@item -m4a
21861 +@opindex m4a
21862 +Generate code for the SH4a.
21864 +@item -m4al
21865 +@opindex m4al
21866 +Same as @option{-m4a-nofpu}, except that it implicitly passes
21867 +@option{-dsp} to the assembler. GCC doesn't generate any DSP
21868 +instructions at the moment.
21870 +@item -mb
21871 +@opindex mb
21872 +Compile code for the processor in big endian mode.
21874 +@item -ml
21875 +@opindex ml
21876 +Compile code for the processor in little endian mode.
21878 +@item -mdalign
21879 +@opindex mdalign
21880 +Align doubles at 64-bit boundaries. Note that this changes the calling
21881 +conventions, and thus some functions from the standard C library will
21882 +not work unless you recompile it first with @option{-mdalign}.
21884 +@item -mrelax
21885 +@opindex mrelax
21886 +Shorten some address references at link time, when possible; uses the
21887 +linker option @option{-relax}.
21889 +@item -mbigtable
21890 +@opindex mbigtable
21891 +Use 32-bit offsets in @code{switch} tables. The default is to use
21892 +16-bit offsets.
21894 +@item -mbitops
21895 +@opindex mbitops
21896 +Enable the use of bit manipulation instructions on SH2A.
21898 +@item -mfmovd
21899 +@opindex mfmovd
21900 +Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21901 +alignment constraints.
21903 +@item -mhitachi
21904 +@opindex mhitachi
21905 +Comply with the calling conventions defined by Renesas.
21907 +@item -mrenesas
21908 +@opindex mhitachi
21909 +Comply with the calling conventions defined by Renesas.
21911 +@item -mno-renesas
21912 +@opindex mhitachi
21913 +Comply with the calling conventions defined for GCC before the Renesas
21914 +conventions were available. This option is the default for all
21915 +targets of the SH toolchain except for @samp{sh-symbianelf}.
21917 +@item -mnomacsave
21918 +@opindex mnomacsave
21919 +Mark the @code{MAC} register as call-clobbered, even if
21920 +@option{-mhitachi} is given.
21922 +@item -mieee
21923 +@item -mno-ieee
21924 +@opindex mieee
21925 +@opindex mnoieee
21926 +Control the IEEE compliance of floating-point comparisons, which affects the
21927 +handling of cases where the result of a comparison is unordered. By default
21928 +@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21929 +enabled @option{-mno-ieee} is implicitly set, which results in faster
21930 +floating-point greater-equal and less-equal comparisons. The implcit settings
21931 +can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21933 +@item -minline-ic_invalidate
21934 +@opindex minline-ic_invalidate
21935 +Inline code to invalidate instruction cache entries after setting up
21936 +nested function trampolines.
21937 +This option has no effect if -musermode is in effect and the selected
21938 +code generation option (e.g. -m4) does not allow the use of the icbi
21939 +instruction.
21940 +If the selected code generation option does not allow the use of the icbi
21941 +instruction, and -musermode is not in effect, the inlined code will
21942 +manipulate the instruction cache address array directly with an associative
21943 +write. This not only requires privileged mode, but it will also
21944 +fail if the cache line had been mapped via the TLB and has become unmapped.
21946 +@item -misize
21947 +@opindex misize
21948 +Dump instruction size and location in the assembly code.
21950 +@item -mpadstruct
21951 +@opindex mpadstruct
21952 +This option is deprecated. It pads structures to multiple of 4 bytes,
21953 +which is incompatible with the SH ABI@.
21955 +@item -mspace
21956 +@opindex mspace
21957 +Optimize for space instead of speed. Implied by @option{-Os}.
21959 +@item -mprefergot
21960 +@opindex mprefergot
21961 +When generating position-independent code, emit function calls using
21962 +the Global Offset Table instead of the Procedure Linkage Table.
21964 +@item -musermode
21965 +@opindex musermode
21966 +Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
21967 +if the inlined code would not work in user mode.
21968 +This is the default when the target is @code{sh-*-linux*}.
21970 +@item -multcost=@var{number}
21971 +@opindex multcost=@var{number}
21972 +Set the cost to assume for a multiply insn.
21974 +@item -mdiv=@var{strategy}
21975 +@opindex mdiv=@var{strategy}
21976 +Set the division strategy to use for SHmedia code. @var{strategy} must be
21977 +one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
21978 +inv:call2, inv:fp .
21979 +"fp" performs the operation in floating point. This has a very high latency,
21980 +but needs only a few instructions, so it might be a good choice if
21981 +your code has enough easily exploitable ILP to allow the compiler to
21982 +schedule the floating point instructions together with other instructions.
21983 +Division by zero causes a floating point exception.
21984 +"inv" uses integer operations to calculate the inverse of the divisor,
21985 +and then multiplies the dividend with the inverse. This strategy allows
21986 +cse and hoisting of the inverse calculation. Division by zero calculates
21987 +an unspecified result, but does not trap.
21988 +"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
21989 +have been found, or if the entire operation has been hoisted to the same
21990 +place, the last stages of the inverse calculation are intertwined with the
21991 +final multiply to reduce the overall latency, at the expense of using a few
21992 +more instructions, and thus offering fewer scheduling opportunities with
21993 +other code.
21994 +"call" calls a library function that usually implements the inv:minlat
21995 +strategy.
21996 +This gives high code density for m5-*media-nofpu compilations.
21997 +"call2" uses a different entry point of the same library function, where it
21998 +assumes that a pointer to a lookup table has already been set up, which
21999 +exposes the pointer load to cse / code hoisting optimizations.
22000 +"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
22001 +code generation, but if the code stays unoptimized, revert to the "call",
22002 +"call2", or "fp" strategies, respectively. Note that the
22003 +potentially-trapping side effect of division by zero is carried by a
22004 +separate instruction, so it is possible that all the integer instructions
22005 +are hoisted out, but the marker for the side effect stays where it is.
22006 +A recombination to fp operations or a call is not possible in that case.
22007 +"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
22008 +that the inverse calculation was nor separated from the multiply, they speed
22009 +up division where the dividend fits into 20 bits (plus sign where applicable),
22010 +by inserting a test to skip a number of operations in this case; this test
22011 +slows down the case of larger dividends. inv20u assumes the case of a such
22012 +a small dividend to be unlikely, and inv20l assumes it to be likely.
22014 +@item -maccumulate-outgoing-args
22015 +@opindex maccumulate-outgoing-args
22016 +Reserve space once for outgoing arguments in the function prologue rather
22017 +than around each call. Generally beneficial for performance and size. Also
22018 +needed for unwinding to avoid changing the stack frame around conditional code.
22020 +@item -mdivsi3_libfunc=@var{name}
22021 +@opindex mdivsi3_libfunc=@var{name}
22022 +Set the name of the library function used for 32 bit signed division to
22023 +@var{name}. This only affect the name used in the call and inv:call
22024 +division strategies, and the compiler will still expect the same
22025 +sets of input/output/clobbered registers as if this option was not present.
22027 +@item -mfixed-range=@var{register-range}
22028 +@opindex mfixed-range
22029 +Generate code treating the given register range as fixed registers.
22030 +A fixed register is one that the register allocator can not use. This is
22031 +useful when compiling kernel code. A register range is specified as
22032 +two registers separated by a dash. Multiple register ranges can be
22033 +specified separated by a comma.
22035 +@item -madjust-unroll
22036 +@opindex madjust-unroll
22037 +Throttle unrolling to avoid thrashing target registers.
22038 +This option only has an effect if the gcc code base supports the
22039 +TARGET_ADJUST_UNROLL_MAX target hook.
22041 +@item -mindexed-addressing
22042 +@opindex mindexed-addressing
22043 +Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
22044 +This is only safe if the hardware and/or OS implement 32 bit wrap-around
22045 +semantics for the indexed addressing mode. The architecture allows the
22046 +implementation of processors with 64 bit MMU, which the OS could use to
22047 +get 32 bit addressing, but since no current hardware implementation supports
22048 +this or any other way to make the indexed addressing mode safe to use in
22049 +the 32 bit ABI, the default is -mno-indexed-addressing.
22051 +@item -mgettrcost=@var{number}
22052 +@opindex mgettrcost=@var{number}
22053 +Set the cost assumed for the gettr instruction to @var{number}.
22054 +The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
22056 +@item -mpt-fixed
22057 +@opindex mpt-fixed
22058 +Assume pt* instructions won't trap. This will generally generate better
22059 +scheduled code, but is unsafe on current hardware. The current architecture
22060 +definition says that ptabs and ptrel trap when the target anded with 3 is 3.
22061 +This has the unintentional effect of making it unsafe to schedule ptabs /
22062 +ptrel before a branch, or hoist it out of a loop. For example,
22063 +__do_global_ctors, a part of libgcc that runs constructors at program
22064 +startup, calls functions in a list which is delimited by @minus{}1. With the
22065 +-mpt-fixed option, the ptabs will be done before testing against @minus{}1.
22066 +That means that all the constructors will be run a bit quicker, but when
22067 +the loop comes to the end of the list, the program crashes because ptabs
22068 +loads @minus{}1 into a target register. Since this option is unsafe for any
22069 +hardware implementing the current architecture specification, the default
22070 +is -mno-pt-fixed. Unless the user specifies a specific cost with
22071 +@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
22072 +this deters register allocation using target registers for storing
22073 +ordinary integers.
22075 +@item -minvalid-symbols
22076 +@opindex minvalid-symbols
22077 +Assume symbols might be invalid. Ordinary function symbols generated by
22078 +the compiler will always be valid to load with movi/shori/ptabs or
22079 +movi/shori/ptrel, but with assembler and/or linker tricks it is possible
22080 +to generate symbols that will cause ptabs / ptrel to trap.
22081 +This option is only meaningful when @option{-mno-pt-fixed} is in effect.
22082 +It will then prevent cross-basic-block cse, hoisting and most scheduling
22083 +of symbol loads. The default is @option{-mno-invalid-symbols}.
22084 +@end table
22086 +@node Solaris 2 Options
22087 +@subsection Solaris 2 Options
22088 +@cindex Solaris 2 options
22090 +These @samp{-m} options are supported on Solaris 2:
22092 +@table @gcctabopt
22093 +@item -mimpure-text
22094 +@opindex mimpure-text
22095 +@option{-mimpure-text}, used in addition to @option{-shared}, tells
22096 +the compiler to not pass @option{-z text} to the linker when linking a
22097 +shared object. Using this option, you can link position-dependent
22098 +code into a shared object.
22100 +@option{-mimpure-text} suppresses the ``relocations remain against
22101 +allocatable but non-writable sections'' linker error message.
22102 +However, the necessary relocations will trigger copy-on-write, and the
22103 +shared object is not actually shared across processes. Instead of
22104 +using @option{-mimpure-text}, you should compile all source code with
22105 +@option{-fpic} or @option{-fPIC}.
22107 +@end table
22109 +These switches are supported in addition to the above on Solaris 2:
22111 +@table @gcctabopt
22112 +@item -threads
22113 +@opindex threads
22114 +Add support for multithreading using the Solaris threads library. This
22115 +option sets flags for both the preprocessor and linker. This option does
22116 +not affect the thread safety of object code produced by the compiler or
22117 +that of libraries supplied with it.
22119 +@item -pthreads
22120 +@opindex pthreads
22121 +Add support for multithreading using the POSIX threads library. This
22122 +option sets flags for both the preprocessor and linker. This option does
22123 +not affect the thread safety of object code produced by the compiler or
22124 +that of libraries supplied with it.
22126 +@item -pthread
22127 +@opindex pthread
22128 +This is a synonym for @option{-pthreads}.
22129 +@end table
22131 +@node SPARC Options
22132 +@subsection SPARC Options
22133 +@cindex SPARC options
22135 +These @samp{-m} options are supported on the SPARC:
22137 +@table @gcctabopt
22138 +@item -mno-app-regs
22139 +@itemx -mapp-regs
22140 +@opindex mno-app-regs
22141 +@opindex mapp-regs
22142 +Specify @option{-mapp-regs} to generate output using the global registers
22143 +2 through 4, which the SPARC SVR4 ABI reserves for applications. This
22144 +is the default.
22146 +To be fully SVR4 ABI compliant at the cost of some performance loss,
22147 +specify @option{-mno-app-regs}. You should compile libraries and system
22148 +software with this option.
22150 +@item -mfpu
22151 +@itemx -mhard-float
22152 +@opindex mfpu
22153 +@opindex mhard-float
22154 +Generate output containing floating point instructions. This is the
22155 +default.
22157 +@item -mno-fpu
22158 +@itemx -msoft-float
22159 +@opindex mno-fpu
22160 +@opindex msoft-float
22161 +Generate output containing library calls for floating point.
22162 +@strong{Warning:} the requisite libraries are not available for all SPARC
22163 +targets. Normally the facilities of the machine's usual C compiler are
22164 +used, but this cannot be done directly in cross-compilation. You must make
22165 +your own arrangements to provide suitable library functions for
22166 +cross-compilation. The embedded targets @samp{sparc-*-aout} and
22167 +@samp{sparclite-*-*} do provide software floating point support.
22169 +@option{-msoft-float} changes the calling convention in the output file;
22170 +therefore, it is only useful if you compile @emph{all} of a program with
22171 +this option. In particular, you need to compile @file{libgcc.a}, the
22172 +library that comes with GCC, with @option{-msoft-float} in order for
22173 +this to work.
22175 +@item -mhard-quad-float
22176 +@opindex mhard-quad-float
22177 +Generate output containing quad-word (long double) floating point
22178 +instructions.
22180 +@item -msoft-quad-float
22181 +@opindex msoft-quad-float
22182 +Generate output containing library calls for quad-word (long double)
22183 +floating point instructions. The functions called are those specified
22184 +in the SPARC ABI@. This is the default.
22186 +As of this writing, there are no SPARC implementations that have hardware
22187 +support for the quad-word floating point instructions. They all invoke
22188 +a trap handler for one of these instructions, and then the trap handler
22189 +emulates the effect of the instruction. Because of the trap handler overhead,
22190 +this is much slower than calling the ABI library routines. Thus the
22191 +@option{-msoft-quad-float} option is the default.
22193 +@item -mno-unaligned-doubles
22194 +@itemx -munaligned-doubles
22195 +@opindex mno-unaligned-doubles
22196 +@opindex munaligned-doubles
22197 +Assume that doubles have 8 byte alignment. This is the default.
22199 +With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
22200 +alignment only if they are contained in another type, or if they have an
22201 +absolute address. Otherwise, it assumes they have 4 byte alignment.
22202 +Specifying this option avoids some rare compatibility problems with code
22203 +generated by other compilers. It is not the default because it results
22204 +in a performance loss, especially for floating point code.
22206 +@item -mno-faster-structs
22207 +@itemx -mfaster-structs
22208 +@opindex mno-faster-structs
22209 +@opindex mfaster-structs
22210 +With @option{-mfaster-structs}, the compiler assumes that structures
22211 +should have 8 byte alignment. This enables the use of pairs of
22212 +@code{ldd} and @code{std} instructions for copies in structure
22213 +assignment, in place of twice as many @code{ld} and @code{st} pairs.
22214 +However, the use of this changed alignment directly violates the SPARC
22215 +ABI@. Thus, it's intended only for use on targets where the developer
22216 +acknowledges that their resulting code will not be directly in line with
22217 +the rules of the ABI@.
22219 +@item -mcpu=@var{cpu_type}
22220 +@opindex mcpu
22221 +Set the instruction set, register set, and instruction scheduling parameters
22222 +for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22223 +@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22224 +@samp{leon}, @samp{sparclite}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
22225 +@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
22226 +@samp{ultrasparc3}, @samp{niagara} and @samp{niagara2}.
22228 +Default instruction scheduling parameters are used for values that select
22229 +an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22230 +@samp{sparclite}, @samp{sparclet}, @samp{v9}.
22232 +Here is a list of each supported architecture and their supported
22233 +implementations.
22235 +@smallexample
22236 + v7: cypress
22237 + v8: supersparc, hypersparc, leon
22238 + sparclite: f930, f934, sparclite86x
22239 + sparclet: tsc701
22240 + v9: ultrasparc, ultrasparc3, niagara, niagara2
22241 +@end smallexample
22243 +By default (unless configured otherwise), GCC generates code for the V7
22244 +variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22245 +additionally optimizes it for the Cypress CY7C602 chip, as used in the
22246 +SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22247 +SPARCStation 1, 2, IPX etc.
22249 +With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22250 +architecture. The only difference from V7 code is that the compiler emits
22251 +the integer multiply and integer divide instructions which exist in SPARC-V8
22252 +but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22253 +optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22254 +2000 series.
22256 +With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22257 +the SPARC architecture. This adds the integer multiply, integer divide step
22258 +and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22259 +With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22260 +Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22261 +@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22262 +MB86934 chip, which is the more recent SPARClite with FPU@.
22264 +With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22265 +the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22266 +integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22267 +but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22268 +optimizes it for the TEMIC SPARClet chip.
22270 +With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22271 +architecture. This adds 64-bit integer and floating-point move instructions,
22272 +3 additional floating-point condition code registers and conditional move
22273 +instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22274 +optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22275 +@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22276 +Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22277 +@option{-mcpu=niagara}, the compiler additionally optimizes it for
22278 +Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22279 +additionally optimizes it for Sun UltraSPARC T2 chips.
22281 +@item -mtune=@var{cpu_type}
22282 +@opindex mtune
22283 +Set the instruction scheduling parameters for machine type
22284 +@var{cpu_type}, but do not set the instruction set or register set that the
22285 +option @option{-mcpu=@var{cpu_type}} would.
22287 +The same values for @option{-mcpu=@var{cpu_type}} can be used for
22288 +@option{-mtune=@var{cpu_type}}, but the only useful values are those
22289 +that select a particular CPU implementation. Those are @samp{cypress},
22290 +@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{f930}, @samp{f934},
22291 +@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, @samp{ultrasparc3},
22292 +@samp{niagara}, and @samp{niagara2}.
22294 +@item -mv8plus
22295 +@itemx -mno-v8plus
22296 +@opindex mv8plus
22297 +@opindex mno-v8plus
22298 +With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22299 +difference from the V8 ABI is that the global and out registers are
22300 +considered 64-bit wide. This is enabled by default on Solaris in 32-bit
22301 +mode for all SPARC-V9 processors.
22303 +@item -mvis
22304 +@itemx -mno-vis
22305 +@opindex mvis
22306 +@opindex mno-vis
22307 +With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22308 +Visual Instruction Set extensions. The default is @option{-mno-vis}.
22310 +@item -mfix-at697f
22311 +@opindex mfix-at697f
22312 +Enable the documented workaround for the single erratum of the Atmel AT697F
22313 +processor (which corresponds to erratum #13 of the AT697E processor).
22314 +@end table
22316 +These @samp{-m} options are supported in addition to the above
22317 +on SPARC-V9 processors in 64-bit environments:
22319 +@table @gcctabopt
22320 +@item -mlittle-endian
22321 +@opindex mlittle-endian
22322 +Generate code for a processor running in little-endian mode. It is only
22323 +available for a few configurations and most notably not on Solaris and Linux.
22325 +@item -m32
22326 +@itemx -m64
22327 +@opindex m32
22328 +@opindex m64
22329 +Generate code for a 32-bit or 64-bit environment.
22330 +The 32-bit environment sets int, long and pointer to 32 bits.
22331 +The 64-bit environment sets int to 32 bits and long and pointer
22332 +to 64 bits.
22334 +@item -mcmodel=medlow
22335 +@opindex mcmodel=medlow
22336 +Generate code for the Medium/Low code model: 64-bit addresses, programs
22337 +must be linked in the low 32 bits of memory. Programs can be statically
22338 +or dynamically linked.
22340 +@item -mcmodel=medmid
22341 +@opindex mcmodel=medmid
22342 +Generate code for the Medium/Middle code model: 64-bit addresses, programs
22343 +must be linked in the low 44 bits of memory, the text and data segments must
22344 +be less than 2GB in size and the data segment must be located within 2GB of
22345 +the text segment.
22347 +@item -mcmodel=medany
22348 +@opindex mcmodel=medany
22349 +Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
22350 +may be linked anywhere in memory, the text and data segments must be less
22351 +than 2GB in size and the data segment must be located within 2GB of the
22352 +text segment.
22354 +@item -mcmodel=embmedany
22355 +@opindex mcmodel=embmedany
22356 +Generate code for the Medium/Anywhere code model for embedded systems:
22357 +64-bit addresses, the text and data segments must be less than 2GB in
22358 +size, both starting anywhere in memory (determined at link time). The
22359 +global register %g4 points to the base of the data segment. Programs
22360 +are statically linked and PIC is not supported.
22362 +@item -mstack-bias
22363 +@itemx -mno-stack-bias
22364 +@opindex mstack-bias
22365 +@opindex mno-stack-bias
22366 +With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22367 +frame pointer if present, are offset by @minus{}2047 which must be added back
22368 +when making stack frame references. This is the default in 64-bit mode.
22369 +Otherwise, assume no such offset is present.
22370 +@end table
22372 +@node SPU Options
22373 +@subsection SPU Options
22374 +@cindex SPU options
22376 +These @samp{-m} options are supported on the SPU:
22378 +@table @gcctabopt
22379 +@item -mwarn-reloc
22380 +@itemx -merror-reloc
22381 +@opindex mwarn-reloc
22382 +@opindex merror-reloc
22384 +The loader for SPU does not handle dynamic relocations. By default, GCC
22385 +will give an error when it generates code that requires a dynamic
22386 +relocation. @option{-mno-error-reloc} disables the error,
22387 +@option{-mwarn-reloc} will generate a warning instead.
22389 +@item -msafe-dma
22390 +@itemx -munsafe-dma
22391 +@opindex msafe-dma
22392 +@opindex munsafe-dma
22394 +Instructions which initiate or test completion of DMA must not be
22395 +reordered with respect to loads and stores of the memory which is being
22396 +accessed. Users typically address this problem using the volatile
22397 +keyword, but that can lead to inefficient code in places where the
22398 +memory is known to not change. Rather than mark the memory as volatile
22399 +we treat the DMA instructions as potentially effecting all memory. With
22400 +@option{-munsafe-dma} users must use the volatile keyword to protect
22401 +memory accesses.
22403 +@item -mbranch-hints
22404 +@opindex mbranch-hints
22406 +By default, GCC will generate a branch hint instruction to avoid
22407 +pipeline stalls for always taken or probably taken branches. A hint
22408 +will not be generated closer than 8 instructions away from its branch.
22409 +There is little reason to disable them, except for debugging purposes,
22410 +or to make an object a little bit smaller.
22412 +@item -msmall-mem
22413 +@itemx -mlarge-mem
22414 +@opindex msmall-mem
22415 +@opindex mlarge-mem
22417 +By default, GCC generates code assuming that addresses are never larger
22418 +than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22419 +a full 32 bit address.
22421 +@item -mstdmain
22422 +@opindex mstdmain
22424 +By default, GCC links against startup code that assumes the SPU-style
22425 +main function interface (which has an unconventional parameter list).
22426 +With @option{-mstdmain}, GCC will link your program against startup
22427 +code that assumes a C99-style interface to @code{main}, including a
22428 +local copy of @code{argv} strings.
22430 +@item -mfixed-range=@var{register-range}
22431 +@opindex mfixed-range
22432 +Generate code treating the given register range as fixed registers.
22433 +A fixed register is one that the register allocator can not use. This is
22434 +useful when compiling kernel code. A register range is specified as
22435 +two registers separated by a dash. Multiple register ranges can be
22436 +specified separated by a comma.
22438 +@item -mea32
22439 +@itemx -mea64
22440 +@opindex mea32
22441 +@opindex mea64
22442 +Compile code assuming that pointers to the PPU address space accessed
22443 +via the @code{__ea} named address space qualifier are either 32 or 64
22444 +bits wide. The default is 32 bits. As this is an ABI changing option,
22445 +all object code in an executable must be compiled with the same setting.
22447 +@item -maddress-space-conversion
22448 +@itemx -mno-address-space-conversion
22449 +@opindex maddress-space-conversion
22450 +@opindex mno-address-space-conversion
22451 +Allow/disallow treating the @code{__ea} address space as superset
22452 +of the generic address space. This enables explicit type casts
22453 +between @code{__ea} and generic pointer as well as implicit
22454 +conversions of generic pointers to @code{__ea} pointers. The
22455 +default is to allow address space pointer conversions.
22457 +@item -mcache-size=@var{cache-size}
22458 +@opindex mcache-size
22459 +This option controls the version of libgcc that the compiler links to an
22460 +executable and selects a software-managed cache for accessing variables
22461 +in the @code{__ea} address space with a particular cache size. Possible
22462 +options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22463 +and @samp{128}. The default cache size is 64KB.
22465 +@item -matomic-updates
22466 +@itemx -mno-atomic-updates
22467 +@opindex matomic-updates
22468 +@opindex mno-atomic-updates
22469 +This option controls the version of libgcc that the compiler links to an
22470 +executable and selects whether atomic updates to the software-managed
22471 +cache of PPU-side variables are used. If you use atomic updates, changes
22472 +to a PPU variable from SPU code using the @code{__ea} named address space
22473 +qualifier will not interfere with changes to other PPU variables residing
22474 +in the same cache line from PPU code. If you do not use atomic updates,
22475 +such interference may occur; however, writing back cache lines will be
22476 +more efficient. The default behavior is to use atomic updates.
22478 +@item -mdual-nops
22479 +@itemx -mdual-nops=@var{n}
22480 +@opindex mdual-nops
22481 +By default, GCC will insert nops to increase dual issue when it expects
22482 +it to increase performance. @var{n} can be a value from 0 to 10. A
22483 +smaller @var{n} will insert fewer nops. 10 is the default, 0 is the
22484 +same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22486 +@item -mhint-max-nops=@var{n}
22487 +@opindex mhint-max-nops
22488 +Maximum number of nops to insert for a branch hint. A branch hint must
22489 +be at least 8 instructions away from the branch it is effecting. GCC
22490 +will insert up to @var{n} nops to enforce this, otherwise it will not
22491 +generate the branch hint.
22493 +@item -mhint-max-distance=@var{n}
22494 +@opindex mhint-max-distance
22495 +The encoding of the branch hint instruction limits the hint to be within
22496 +256 instructions of the branch it is effecting. By default, GCC makes
22497 +sure it is within 125.
22499 +@item -msafe-hints
22500 +@opindex msafe-hints
22501 +Work around a hardware bug which causes the SPU to stall indefinitely.
22502 +By default, GCC will insert the @code{hbrp} instruction to make sure
22503 +this stall won't happen.
22505 +@end table
22507 +@node System V Options
22508 +@subsection Options for System V
22510 +These additional options are available on System V Release 4 for
22511 +compatibility with other compilers on those systems:
22513 +@table @gcctabopt
22514 +@item -G
22515 +@opindex G
22516 +Create a shared object.
22517 +It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22519 +@item -Qy
22520 +@opindex Qy
22521 +Identify the versions of each tool used by the compiler, in a
22522 +@code{.ident} assembler directive in the output.
22524 +@item -Qn
22525 +@opindex Qn
22526 +Refrain from adding @code{.ident} directives to the output file (this is
22527 +the default).
22529 +@item -YP,@var{dirs}
22530 +@opindex YP
22531 +Search the directories @var{dirs}, and no others, for libraries
22532 +specified with @option{-l}.
22534 +@item -Ym,@var{dir}
22535 +@opindex Ym
22536 +Look in the directory @var{dir} to find the M4 preprocessor.
22537 +The assembler uses this option.
22538 +@c This is supposed to go with a -Yd for predefined M4 macro files, but
22539 +@c the generic assembler that comes with Solaris takes just -Ym.
22540 +@end table
22542 +@node V850 Options
22543 +@subsection V850 Options
22544 +@cindex V850 Options
22546 +These @samp{-m} options are defined for V850 implementations:
22548 +@table @gcctabopt
22549 +@item -mlong-calls
22550 +@itemx -mno-long-calls
22551 +@opindex mlong-calls
22552 +@opindex mno-long-calls
22553 +Treat all calls as being far away (near). If calls are assumed to be
22554 +far away, the compiler will always load the functions address up into a
22555 +register, and call indirect through the pointer.
22557 +@item -mno-ep
22558 +@itemx -mep
22559 +@opindex mno-ep
22560 +@opindex mep
22561 +Do not optimize (do optimize) basic blocks that use the same index
22562 +pointer 4 or more times to copy pointer into the @code{ep} register, and
22563 +use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22564 +option is on by default if you optimize.
22566 +@item -mno-prolog-function
22567 +@itemx -mprolog-function
22568 +@opindex mno-prolog-function
22569 +@opindex mprolog-function
22570 +Do not use (do use) external functions to save and restore registers
22571 +at the prologue and epilogue of a function. The external functions
22572 +are slower, but use less code space if more than one function saves
22573 +the same number of registers. The @option{-mprolog-function} option
22574 +is on by default if you optimize.
22576 +@item -mspace
22577 +@opindex mspace
22578 +Try to make the code as small as possible. At present, this just turns
22579 +on the @option{-mep} and @option{-mprolog-function} options.
22581 +@item -mtda=@var{n}
22582 +@opindex mtda
22583 +Put static or global variables whose size is @var{n} bytes or less into
22584 +the tiny data area that register @code{ep} points to. The tiny data
22585 +area can hold up to 256 bytes in total (128 bytes for byte references).
22587 +@item -msda=@var{n}
22588 +@opindex msda
22589 +Put static or global variables whose size is @var{n} bytes or less into
22590 +the small data area that register @code{gp} points to. The small data
22591 +area can hold up to 64 kilobytes.
22593 +@item -mzda=@var{n}
22594 +@opindex mzda
22595 +Put static or global variables whose size is @var{n} bytes or less into
22596 +the first 32 kilobytes of memory.
22598 +@item -mv850
22599 +@opindex mv850
22600 +Specify that the target processor is the V850.
22602 +@item -mbig-switch
22603 +@opindex mbig-switch
22604 +Generate code suitable for big switch tables. Use this option only if
22605 +the assembler/linker complain about out of range branches within a switch
22606 +table.
22608 +@item -mapp-regs
22609 +@opindex mapp-regs
22610 +This option will cause r2 and r5 to be used in the code generated by
22611 +the compiler. This setting is the default.
22613 +@item -mno-app-regs
22614 +@opindex mno-app-regs
22615 +This option will cause r2 and r5 to be treated as fixed registers.
22617 +@item -mv850e2v3
22618 +@opindex mv850e2v3
22619 +Specify that the target processor is the V850E2V3. The preprocessor
22620 +constants @samp{__v850e2v3__} will be defined if
22621 +this option is used.
22623 +@item -mv850e2
22624 +@opindex mv850e2
22625 +Specify that the target processor is the V850E2. The preprocessor
22626 +constants @samp{__v850e2__} will be defined if
22628 +@item -mv850e1
22629 +@opindex mv850e1
22630 +Specify that the target processor is the V850E1. The preprocessor
22631 +constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
22633 +@item -mv850es
22634 +@opindex mv850es
22635 +Specify that the target processor is the V850ES. This is an alias for
22636 +the @option{-mv850e1} option.
22638 +@item -mv850e
22639 +@opindex mv850e
22640 +Specify that the target processor is the V850E@. The preprocessor
22641 +constant @samp{__v850e__} will be defined if this option is used.
22643 +If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22644 +nor @option{-mv850e2} nor @option{-mv850e2v3}
22645 +are defined then a default target processor will be chosen and the
22646 +relevant @samp{__v850*__} preprocessor constant will be defined.
22648 +The preprocessor constants @samp{__v850} and @samp{__v851__} are always
22649 +defined, regardless of which processor variant is the target.
22651 +@item -mdisable-callt
22652 +@opindex mdisable-callt
22653 +This option will suppress generation of the CALLT instruction for the
22654 +v850e, v850e1, v850e2 and v850e2v3 flavors of the v850 architecture. The default is
22655 +@option{-mno-disable-callt} which allows the CALLT instruction to be used.
22657 +@end table
22659 +@node VAX Options
22660 +@subsection VAX Options
22661 +@cindex VAX options
22663 +These @samp{-m} options are defined for the VAX:
22665 +@table @gcctabopt
22666 +@item -munix
22667 +@opindex munix
22668 +Do not output certain jump instructions (@code{aobleq} and so on)
22669 +that the Unix assembler for the VAX cannot handle across long
22670 +ranges.
22672 +@item -mgnu
22673 +@opindex mgnu
22674 +Do output those jump instructions, on the assumption that you
22675 +will assemble with the GNU assembler.
22677 +@item -mg
22678 +@opindex mg
22679 +Output code for g-format floating point numbers instead of d-format.
22680 +@end table
22682 +@node VxWorks Options
22683 +@subsection VxWorks Options
22684 +@cindex VxWorks Options
22686 +The options in this section are defined for all VxWorks targets.
22687 +Options specific to the target hardware are listed with the other
22688 +options for that target.
22690 +@table @gcctabopt
22691 +@item -mrtp
22692 +@opindex mrtp
22693 +GCC can generate code for both VxWorks kernels and real time processes
22694 +(RTPs). This option switches from the former to the latter. It also
22695 +defines the preprocessor macro @code{__RTP__}.
22697 +@item -non-static
22698 +@opindex non-static
22699 +Link an RTP executable against shared libraries rather than static
22700 +libraries. The options @option{-static} and @option{-shared} can
22701 +also be used for RTPs (@pxref{Link Options}); @option{-static}
22702 +is the default.
22704 +@item -Bstatic
22705 +@itemx -Bdynamic
22706 +@opindex Bstatic
22707 +@opindex Bdynamic
22708 +These options are passed down to the linker. They are defined for
22709 +compatibility with Diab.
22711 +@item -Xbind-lazy
22712 +@opindex Xbind-lazy
22713 +Enable lazy binding of function calls. This option is equivalent to
22714 +@option{-Wl,-z,now} and is defined for compatibility with Diab.
22716 +@item -Xbind-now
22717 +@opindex Xbind-now
22718 +Disable lazy binding of function calls. This option is the default and
22719 +is defined for compatibility with Diab.
22720 +@end table
22722 +@node x86-64 Options
22723 +@subsection x86-64 Options
22724 +@cindex x86-64 options
22726 +These are listed under @xref{i386 and x86-64 Options}.
22728 +@node Xstormy16 Options
22729 +@subsection Xstormy16 Options
22730 +@cindex Xstormy16 Options
22732 +These options are defined for Xstormy16:
22734 +@table @gcctabopt
22735 +@item -msim
22736 +@opindex msim
22737 +Choose startup files and linker script suitable for the simulator.
22738 +@end table
22740 +@node Xtensa Options
22741 +@subsection Xtensa Options
22742 +@cindex Xtensa Options
22744 +These options are supported for Xtensa targets:
22746 +@table @gcctabopt
22747 +@item -mconst16
22748 +@itemx -mno-const16
22749 +@opindex mconst16
22750 +@opindex mno-const16
22751 +Enable or disable use of @code{CONST16} instructions for loading
22752 +constant values. The @code{CONST16} instruction is currently not a
22753 +standard option from Tensilica. When enabled, @code{CONST16}
22754 +instructions are always used in place of the standard @code{L32R}
22755 +instructions. The use of @code{CONST16} is enabled by default only if
22756 +the @code{L32R} instruction is not available.
22758 +@item -mfused-madd
22759 +@itemx -mno-fused-madd
22760 +@opindex mfused-madd
22761 +@opindex mno-fused-madd
22762 +Enable or disable use of fused multiply/add and multiply/subtract
22763 +instructions in the floating-point option. This has no effect if the
22764 +floating-point option is not also enabled. Disabling fused multiply/add
22765 +and multiply/subtract instructions forces the compiler to use separate
22766 +instructions for the multiply and add/subtract operations. This may be
22767 +desirable in some cases where strict IEEE 754-compliant results are
22768 +required: the fused multiply add/subtract instructions do not round the
22769 +intermediate result, thereby producing results with @emph{more} bits of
22770 +precision than specified by the IEEE standard. Disabling fused multiply
22771 +add/subtract instructions also ensures that the program output is not
22772 +sensitive to the compiler's ability to combine multiply and add/subtract
22773 +operations.
22775 +@item -mserialize-volatile
22776 +@itemx -mno-serialize-volatile
22777 +@opindex mserialize-volatile
22778 +@opindex mno-serialize-volatile
22779 +When this option is enabled, GCC inserts @code{MEMW} instructions before
22780 +@code{volatile} memory references to guarantee sequential consistency.
22781 +The default is @option{-mserialize-volatile}. Use
22782 +@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
22784 +@item -mforce-no-pic
22785 +@opindex mforce-no-pic
22786 +For targets, like GNU/Linux, where all user-mode Xtensa code must be
22787 +position-independent code (PIC), this option disables PIC for compiling
22788 +kernel code.
22790 +@item -mtext-section-literals
22791 +@itemx -mno-text-section-literals
22792 +@opindex mtext-section-literals
22793 +@opindex mno-text-section-literals
22794 +Control the treatment of literal pools. The default is
22795 +@option{-mno-text-section-literals}, which places literals in a separate
22796 +section in the output file. This allows the literal pool to be placed
22797 +in a data RAM/ROM, and it also allows the linker to combine literal
22798 +pools from separate object files to remove redundant literals and
22799 +improve code size. With @option{-mtext-section-literals}, the literals
22800 +are interspersed in the text section in order to keep them as close as
22801 +possible to their references. This may be necessary for large assembly
22802 +files.
22804 +@item -mtarget-align
22805 +@itemx -mno-target-align
22806 +@opindex mtarget-align
22807 +@opindex mno-target-align
22808 +When this option is enabled, GCC instructs the assembler to
22809 +automatically align instructions to reduce branch penalties at the
22810 +expense of some code density. The assembler attempts to widen density
22811 +instructions to align branch targets and the instructions following call
22812 +instructions. If there are not enough preceding safe density
22813 +instructions to align a target, no widening will be performed. The
22814 +default is @option{-mtarget-align}. These options do not affect the
22815 +treatment of auto-aligned instructions like @code{LOOP}, which the
22816 +assembler will always align, either by widening density instructions or
22817 +by inserting no-op instructions.
22819 +@item -mlongcalls
22820 +@itemx -mno-longcalls
22821 +@opindex mlongcalls
22822 +@opindex mno-longcalls
22823 +When this option is enabled, GCC instructs the assembler to translate
22824 +direct calls to indirect calls unless it can determine that the target
22825 +of a direct call is in the range allowed by the call instruction. This
22826 +translation typically occurs for calls to functions in other source
22827 +files. Specifically, the assembler translates a direct @code{CALL}
22828 +instruction into an @code{L32R} followed by a @code{CALLX} instruction.
22829 +The default is @option{-mno-longcalls}. This option should be used in
22830 +programs where the call target can potentially be out of range. This
22831 +option is implemented in the assembler, not the compiler, so the
22832 +assembly code generated by GCC will still show direct call
22833 +instructions---look at the disassembled object code to see the actual
22834 +instructions. Note that the assembler will use an indirect call for
22835 +every cross-file call, not just those that really will be out of range.
22836 +@end table
22838 +@node zSeries Options
22839 +@subsection zSeries Options
22840 +@cindex zSeries options
22842 +These are listed under @xref{S/390 and zSeries Options}.
22844 +@node Code Gen Options
22845 +@section Options for Code Generation Conventions
22846 +@cindex code generation conventions
22847 +@cindex options, code generation
22848 +@cindex run-time options
22850 +These machine-independent options control the interface conventions
22851 +used in code generation.
22853 +Most of them have both positive and negative forms; the negative form
22854 +of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
22855 +one of the forms is listed---the one which is not the default. You
22856 +can figure out the other form by either removing @samp{no-} or adding
22857 +it.
22859 +@table @gcctabopt
22860 +@item -fbounds-check
22861 +@opindex fbounds-check
22862 +For front-ends that support it, generate additional code to check that
22863 +indices used to access arrays are within the declared range. This is
22864 +currently only supported by the Java and Fortran front-ends, where
22865 +this option defaults to true and false respectively.
22867 +@item -ftrapv
22868 +@opindex ftrapv
22869 +This option generates traps for signed overflow on addition, subtraction,
22870 +multiplication operations.
22872 +@item -fwrapv
22873 +@opindex fwrapv
22874 +This option instructs the compiler to assume that signed arithmetic
22875 +overflow of addition, subtraction and multiplication wraps around
22876 +using twos-complement representation. This flag enables some optimizations
22877 +and disables others. This option is enabled by default for the Java
22878 +front-end, as required by the Java language specification.
22880 +@item -fexceptions
22881 +@opindex fexceptions
22882 +Enable exception handling. Generates extra code needed to propagate
22883 +exceptions. For some targets, this implies GCC will generate frame
22884 +unwind information for all functions, which can produce significant data
22885 +size overhead, although it does not affect execution. If you do not
22886 +specify this option, GCC will enable it by default for languages like
22887 +C++ which normally require exception handling, and disable it for
22888 +languages like C that do not normally require it. However, you may need
22889 +to enable this option when compiling C code that needs to interoperate
22890 +properly with exception handlers written in C++. You may also wish to
22891 +disable this option if you are compiling older C++ programs that don't
22892 +use exception handling.
22894 +@item -fnon-call-exceptions
22895 +@opindex fnon-call-exceptions
22896 +Generate code that allows trapping instructions to throw exceptions.
22897 +Note that this requires platform-specific runtime support that does
22898 +not exist everywhere. Moreover, it only allows @emph{trapping}
22899 +instructions to throw exceptions, i.e.@: memory references or floating
22900 +point instructions. It does not allow exceptions to be thrown from
22901 +arbitrary signal handlers such as @code{SIGALRM}.
22903 +@item -funwind-tables
22904 +@opindex funwind-tables
22905 +Similar to @option{-fexceptions}, except that it will just generate any needed
22906 +static data, but will not affect the generated code in any other way.
22907 +You will normally not enable this option; instead, a language processor
22908 +that needs this handling would enable it on your behalf.
22910 +@item -fasynchronous-unwind-tables
22911 +@opindex fasynchronous-unwind-tables
22912 +Generate unwind table in dwarf2 format, if supported by target machine. The
22913 +table is exact at each instruction boundary, so it can be used for stack
22914 +unwinding from asynchronous events (such as debugger or garbage collector).
22916 +@item -fpcc-struct-return
22917 +@opindex fpcc-struct-return
22918 +Return ``short'' @code{struct} and @code{union} values in memory like
22919 +longer ones, rather than in registers. This convention is less
22920 +efficient, but it has the advantage of allowing intercallability between
22921 +GCC-compiled files and files compiled with other compilers, particularly
22922 +the Portable C Compiler (pcc).
22924 +The precise convention for returning structures in memory depends
22925 +on the target configuration macros.
22927 +Short structures and unions are those whose size and alignment match
22928 +that of some integer type.
22930 +@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
22931 +switch is not binary compatible with code compiled with the
22932 +@option{-freg-struct-return} switch.
22933 +Use it to conform to a non-default application binary interface.
22935 +@item -freg-struct-return
22936 +@opindex freg-struct-return
22937 +Return @code{struct} and @code{union} values in registers when possible.
22938 +This is more efficient for small structures than
22939 +@option{-fpcc-struct-return}.
22941 +If you specify neither @option{-fpcc-struct-return} nor
22942 +@option{-freg-struct-return}, GCC defaults to whichever convention is
22943 +standard for the target. If there is no standard convention, GCC
22944 +defaults to @option{-fpcc-struct-return}, except on targets where GCC is
22945 +the principal compiler. In those cases, we can choose the standard, and
22946 +we chose the more efficient register return alternative.
22948 +@strong{Warning:} code compiled with the @option{-freg-struct-return}
22949 +switch is not binary compatible with code compiled with the
22950 +@option{-fpcc-struct-return} switch.
22951 +Use it to conform to a non-default application binary interface.
22953 +@item -fshort-enums
22954 +@opindex fshort-enums
22955 +Allocate to an @code{enum} type only as many bytes as it needs for the
22956 +declared range of possible values. Specifically, the @code{enum} type
22957 +will be equivalent to the smallest integer type which has enough room.
22959 +@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
22960 +code that is not binary compatible with code generated without that switch.
22961 +Use it to conform to a non-default application binary interface.
22963 +@item -fshort-double
22964 +@opindex fshort-double
22965 +Use the same size for @code{double} as for @code{float}.
22967 +@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
22968 +code that is not binary compatible with code generated without that switch.
22969 +Use it to conform to a non-default application binary interface.
22971 +@item -fshort-wchar
22972 +@opindex fshort-wchar
22973 +Override the underlying type for @samp{wchar_t} to be @samp{short
22974 +unsigned int} instead of the default for the target. This option is
22975 +useful for building programs to run under WINE@.
22977 +@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
22978 +code that is not binary compatible with code generated without that switch.
22979 +Use it to conform to a non-default application binary interface.
22981 +@item -fno-common
22982 +@opindex fno-common
22983 +In C code, controls the placement of uninitialized global variables.
22984 +Unix C compilers have traditionally permitted multiple definitions of
22985 +such variables in different compilation units by placing the variables
22986 +in a common block.
22987 +This is the behavior specified by @option{-fcommon}, and is the default
22988 +for GCC on most targets.
22989 +On the other hand, this behavior is not required by ISO C, and on some
22990 +targets may carry a speed or code size penalty on variable references.
22991 +The @option{-fno-common} option specifies that the compiler should place
22992 +uninitialized global variables in the data section of the object file,
22993 +rather than generating them as common blocks.
22994 +This has the effect that if the same variable is declared
22995 +(without @code{extern}) in two different compilations,
22996 +you will get a multiple-definition error when you link them.
22997 +In this case, you must compile with @option{-fcommon} instead.
22998 +Compiling with @option{-fno-common} is useful on targets for which
22999 +it provides better performance, or if you wish to verify that the
23000 +program will work on other systems which always treat uninitialized
23001 +variable declarations this way.
23003 +@item -fno-ident
23004 +@opindex fno-ident
23005 +Ignore the @samp{#ident} directive.
23007 +@item -finhibit-size-directive
23008 +@opindex finhibit-size-directive
23009 +Don't output a @code{.size} assembler directive, or anything else that
23010 +would cause trouble if the function is split in the middle, and the
23011 +two halves are placed at locations far apart in memory. This option is
23012 +used when compiling @file{crtstuff.c}; you should not need to use it
23013 +for anything else.
23015 +@item -fverbose-asm
23016 +@opindex fverbose-asm
23017 +Put extra commentary information in the generated assembly code to
23018 +make it more readable. This option is generally only of use to those
23019 +who actually need to read the generated assembly code (perhaps while
23020 +debugging the compiler itself).
23022 +@option{-fno-verbose-asm}, the default, causes the
23023 +extra information to be omitted and is useful when comparing two assembler
23024 +files.
23026 +@item -frecord-gcc-switches
23027 +@opindex frecord-gcc-switches
23028 +This switch causes the command line that was used to invoke the
23029 +compiler to be recorded into the object file that is being created.
23030 +This switch is only implemented on some targets and the exact format
23031 +of the recording is target and binary file format dependent, but it
23032 +usually takes the form of a section containing ASCII text. This
23033 +switch is related to the @option{-fverbose-asm} switch, but that
23034 +switch only records information in the assembler output file as
23035 +comments, so it never reaches the object file.
23037 +@item -fpic
23038 +@opindex fpic
23039 +@cindex global offset table
23040 +@cindex PIC
23041 +Generate position-independent code (PIC) suitable for use in a shared
23042 +library, if supported for the target machine. Such code accesses all
23043 +constant addresses through a global offset table (GOT)@. The dynamic
23044 +loader resolves the GOT entries when the program starts (the dynamic
23045 +loader is not part of GCC; it is part of the operating system). If
23046 +the GOT size for the linked executable exceeds a machine-specific
23047 +maximum size, you get an error message from the linker indicating that
23048 +@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
23049 +instead. (These maximums are 8k on the SPARC and 32k
23050 +on the m68k and RS/6000. The 386 has no such limit.)
23052 +Position-independent code requires special support, and therefore works
23053 +only on certain machines. For the 386, GCC supports PIC for System V
23054 +but not for the Sun 386i. Code generated for the IBM RS/6000 is always
23055 +position-independent.
23057 +When this flag is set, the macros @code{__pic__} and @code{__PIC__}
23058 +are defined to 1.
23060 +@item -fPIC
23061 +@opindex fPIC
23062 +If supported for the target machine, emit position-independent code,
23063 +suitable for dynamic linking and avoiding any limit on the size of the
23064 +global offset table. This option makes a difference on the m68k,
23065 +PowerPC and SPARC@.
23067 +Position-independent code requires special support, and therefore works
23068 +only on certain machines.
23070 +When this flag is set, the macros @code{__pic__} and @code{__PIC__}
23071 +are defined to 2.
23073 +@item -fpie
23074 +@itemx -fPIE
23075 +@opindex fpie
23076 +@opindex fPIE
23077 +These options are similar to @option{-fpic} and @option{-fPIC}, but
23078 +generated position independent code can be only linked into executables.
23079 +Usually these options are used when @option{-pie} GCC option will be
23080 +used during linking.
23082 +@option{-fpie} and @option{-fPIE} both define the macros
23083 +@code{__pie__} and @code{__PIE__}. The macros have the value 1
23084 +for @option{-fpie} and 2 for @option{-fPIE}.
23086 +@item -fno-jump-tables
23087 +@opindex fno-jump-tables
23088 +Do not use jump tables for switch statements even where it would be
23089 +more efficient than other code generation strategies. This option is
23090 +of use in conjunction with @option{-fpic} or @option{-fPIC} for
23091 +building code which forms part of a dynamic linker and cannot
23092 +reference the address of a jump table. On some targets, jump tables
23093 +do not require a GOT and this option is not needed.
23095 +@item -ffixed-@var{reg}
23096 +@opindex ffixed
23097 +Treat the register named @var{reg} as a fixed register; generated code
23098 +should never refer to it (except perhaps as a stack pointer, frame
23099 +pointer or in some other fixed role).
23101 +@var{reg} must be the name of a register. The register names accepted
23102 +are machine-specific and are defined in the @code{REGISTER_NAMES}
23103 +macro in the machine description macro file.
23105 +This flag does not have a negative form, because it specifies a
23106 +three-way choice.
23108 +@item -fcall-used-@var{reg}
23109 +@opindex fcall-used
23110 +Treat the register named @var{reg} as an allocable register that is
23111 +clobbered by function calls. It may be allocated for temporaries or
23112 +variables that do not live across a call. Functions compiled this way
23113 +will not save and restore the register @var{reg}.
23115 +It is an error to used this flag with the frame pointer or stack pointer.
23116 +Use of this flag for other registers that have fixed pervasive roles in
23117 +the machine's execution model will produce disastrous results.
23119 +This flag does not have a negative form, because it specifies a
23120 +three-way choice.
23122 +@item -fcall-saved-@var{reg}
23123 +@opindex fcall-saved
23124 +Treat the register named @var{reg} as an allocable register saved by
23125 +functions. It may be allocated even for temporaries or variables that
23126 +live across a call. Functions compiled this way will save and restore
23127 +the register @var{reg} if they use it.
23129 +It is an error to used this flag with the frame pointer or stack pointer.
23130 +Use of this flag for other registers that have fixed pervasive roles in
23131 +the machine's execution model will produce disastrous results.
23133 +A different sort of disaster will result from the use of this flag for
23134 +a register in which function values may be returned.
23136 +This flag does not have a negative form, because it specifies a
23137 +three-way choice.
23139 +@item -fpack-struct[=@var{n}]
23140 +@opindex fpack-struct
23141 +Without a value specified, pack all structure members together without
23142 +holes. When a value is specified (which must be a small power of two), pack
23143 +structure members according to this value, representing the maximum
23144 +alignment (that is, objects with default alignment requirements larger than
23145 +this will be output potentially unaligned at the next fitting location.
23147 +@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
23148 +code that is not binary compatible with code generated without that switch.
23149 +Additionally, it makes the code suboptimal.
23150 +Use it to conform to a non-default application binary interface.
23152 +@item -finstrument-functions
23153 +@opindex finstrument-functions
23154 +Generate instrumentation calls for entry and exit to functions. Just
23155 +after function entry and just before function exit, the following
23156 +profiling functions will be called with the address of the current
23157 +function and its call site. (On some platforms,
23158 +@code{__builtin_return_address} does not work beyond the current
23159 +function, so the call site information may not be available to the
23160 +profiling functions otherwise.)
23162 +@smallexample
23163 +void __cyg_profile_func_enter (void *this_fn,
23164 + void *call_site);
23165 +void __cyg_profile_func_exit (void *this_fn,
23166 + void *call_site);
23167 +@end smallexample
23169 +The first argument is the address of the start of the current function,
23170 +which may be looked up exactly in the symbol table.
23172 +This instrumentation is also done for functions expanded inline in other
23173 +functions. The profiling calls will indicate where, conceptually, the
23174 +inline function is entered and exited. This means that addressable
23175 +versions of such functions must be available. If all your uses of a
23176 +function are expanded inline, this may mean an additional expansion of
23177 +code size. If you use @samp{extern inline} in your C code, an
23178 +addressable version of such functions must be provided. (This is
23179 +normally the case anyways, but if you get lucky and the optimizer always
23180 +expands the functions inline, you might have gotten away without
23181 +providing static copies.)
23183 +A function may be given the attribute @code{no_instrument_function}, in
23184 +which case this instrumentation will not be done. This can be used, for
23185 +example, for the profiling functions listed above, high-priority
23186 +interrupt routines, and any functions from which the profiling functions
23187 +cannot safely be called (perhaps signal handlers, if the profiling
23188 +routines generate output or allocate memory).
23190 +@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
23191 +@opindex finstrument-functions-exclude-file-list
23193 +Set the list of functions that are excluded from instrumentation (see
23194 +the description of @code{-finstrument-functions}). If the file that
23195 +contains a function definition matches with one of @var{file}, then
23196 +that function is not instrumented. The match is done on substrings:
23197 +if the @var{file} parameter is a substring of the file name, it is
23198 +considered to be a match.
23200 +For example:
23202 +@smallexample
23203 +-finstrument-functions-exclude-file-list=/bits/stl,include/sys
23204 +@end smallexample
23206 +@noindent
23207 +will exclude any inline function defined in files whose pathnames
23208 +contain @code{/bits/stl} or @code{include/sys}.
23210 +If, for some reason, you want to include letter @code{','} in one of
23211 +@var{sym}, write @code{'\,'}. For example,
23212 +@code{-finstrument-functions-exclude-file-list='\,\,tmp'}
23213 +(note the single quote surrounding the option).
23215 +@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
23216 +@opindex finstrument-functions-exclude-function-list
23218 +This is similar to @code{-finstrument-functions-exclude-file-list},
23219 +but this option sets the list of function names to be excluded from
23220 +instrumentation. The function name to be matched is its user-visible
23221 +name, such as @code{vector<int> blah(const vector<int> &)}, not the
23222 +internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
23223 +match is done on substrings: if the @var{sym} parameter is a substring
23224 +of the function name, it is considered to be a match. For C99 and C++
23225 +extended identifiers, the function name must be given in UTF-8, not
23226 +using universal character names.
23228 +@item -fstack-check
23229 +@opindex fstack-check
23230 +Generate code to verify that you do not go beyond the boundary of the
23231 +stack. You should specify this flag if you are running in an
23232 +environment with multiple threads, but only rarely need to specify it in
23233 +a single-threaded environment since stack overflow is automatically
23234 +detected on nearly all systems if there is only one stack.
23236 +Note that this switch does not actually cause checking to be done; the
23237 +operating system or the language runtime must do that. The switch causes
23238 +generation of code to ensure that they see the stack being extended.
23240 +You can additionally specify a string parameter: @code{no} means no
23241 +checking, @code{generic} means force the use of old-style checking,
23242 +@code{specific} means use the best checking method and is equivalent
23243 +to bare @option{-fstack-check}.
23245 +Old-style checking is a generic mechanism that requires no specific
23246 +target support in the compiler but comes with the following drawbacks:
23248 +@enumerate
23249 +@item
23250 +Modified allocation strategy for large objects: they will always be
23251 +allocated dynamically if their size exceeds a fixed threshold.
23253 +@item
23254 +Fixed limit on the size of the static frame of functions: when it is
23255 +topped by a particular function, stack checking is not reliable and
23256 +a warning is issued by the compiler.
23258 +@item
23259 +Inefficiency: because of both the modified allocation strategy and the
23260 +generic implementation, the performances of the code are hampered.
23261 +@end enumerate
23263 +Note that old-style stack checking is also the fallback method for
23264 +@code{specific} if no target support has been added in the compiler.
23266 +@item -fstack-limit-register=@var{reg}
23267 +@itemx -fstack-limit-symbol=@var{sym}
23268 +@itemx -fno-stack-limit
23269 +@opindex fstack-limit-register
23270 +@opindex fstack-limit-symbol
23271 +@opindex fno-stack-limit
23272 +Generate code to ensure that the stack does not grow beyond a certain value,
23273 +either the value of a register or the address of a symbol. If the stack
23274 +would grow beyond the value, a signal is raised. For most targets,
23275 +the signal is raised before the stack overruns the boundary, so
23276 +it is possible to catch the signal without taking special precautions.
23278 +For instance, if the stack starts at absolute address @samp{0x80000000}
23279 +and grows downwards, you can use the flags
23280 +@option{-fstack-limit-symbol=__stack_limit} and
23281 +@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
23282 +of 128KB@. Note that this may only work with the GNU linker.
23284 +@item -fsplit-stack
23285 +@opindex fsplit-stack
23286 +Generate code to automatically split the stack before it overflows.
23287 +The resulting program has a discontiguous stack which can only
23288 +overflow if the program is unable to allocate any more memory. This
23289 +is most useful when running threaded programs, as it is no longer
23290 +necessary to calculate a good stack size to use for each thread. This
23291 +is currently only implemented for the i386 and x86_64 backends running
23292 +GNU/Linux.
23294 +When code compiled with @option{-fsplit-stack} calls code compiled
23295 +without @option{-fsplit-stack}, there may not be much stack space
23296 +available for the latter code to run. If compiling all code,
23297 +including library code, with @option{-fsplit-stack} is not an option,
23298 +then the linker can fix up these calls so that the code compiled
23299 +without @option{-fsplit-stack} always has a large stack. Support for
23300 +this is implemented in the gold linker in GNU binutils release 2.21
23301 +and later.
23303 +@item -fleading-underscore
23304 +@opindex fleading-underscore
23305 +This option and its counterpart, @option{-fno-leading-underscore}, forcibly
23306 +change the way C symbols are represented in the object file. One use
23307 +is to help link with legacy assembly code.
23309 +@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
23310 +generate code that is not binary compatible with code generated without that
23311 +switch. Use it to conform to a non-default application binary interface.
23312 +Not all targets provide complete support for this switch.
23314 +@item -ftls-model=@var{model}
23315 +@opindex ftls-model
23316 +Alter the thread-local storage model to be used (@pxref{Thread-Local}).
23317 +The @var{model} argument should be one of @code{global-dynamic},
23318 +@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
23320 +The default without @option{-fpic} is @code{initial-exec}; with
23321 +@option{-fpic} the default is @code{global-dynamic}.
23323 +@item -fvisibility=@var{default|internal|hidden|protected}
23324 +@opindex fvisibility
23325 +Set the default ELF image symbol visibility to the specified option---all
23326 +symbols will be marked with this unless overridden within the code.
23327 +Using this feature can very substantially improve linking and
23328 +load times of shared object libraries, produce more optimized
23329 +code, provide near-perfect API export and prevent symbol clashes.
23330 +It is @strong{strongly} recommended that you use this in any shared objects
23331 +you distribute.
23333 +Despite the nomenclature, @code{default} always means public; i.e.,
23334 +available to be linked against from outside the shared object.
23335 +@code{protected} and @code{internal} are pretty useless in real-world
23336 +usage so the only other commonly used option will be @code{hidden}.
23337 +The default if @option{-fvisibility} isn't specified is
23338 +@code{default}, i.e., make every
23339 +symbol public---this causes the same behavior as previous versions of
23340 +GCC@.
23342 +A good explanation of the benefits offered by ensuring ELF
23343 +symbols have the correct visibility is given by ``How To Write
23344 +Shared Libraries'' by Ulrich Drepper (which can be found at
23345 +@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
23346 +solution made possible by this option to marking things hidden when
23347 +the default is public is to make the default hidden and mark things
23348 +public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
23349 +and @code{__attribute__ ((visibility("default")))} instead of
23350 +@code{__declspec(dllexport)} you get almost identical semantics with
23351 +identical syntax. This is a great boon to those working with
23352 +cross-platform projects.
23354 +For those adding visibility support to existing code, you may find
23355 +@samp{#pragma GCC visibility} of use. This works by you enclosing
23356 +the declarations you wish to set visibility for with (for example)
23357 +@samp{#pragma GCC visibility push(hidden)} and
23358 +@samp{#pragma GCC visibility pop}.
23359 +Bear in mind that symbol visibility should be viewed @strong{as
23360 +part of the API interface contract} and thus all new code should
23361 +always specify visibility when it is not the default; i.e., declarations
23362 +only for use within the local DSO should @strong{always} be marked explicitly
23363 +as hidden as so to avoid PLT indirection overheads---making this
23364 +abundantly clear also aids readability and self-documentation of the code.
23365 +Note that due to ISO C++ specification requirements, operator new and
23366 +operator delete must always be of default visibility.
23368 +Be aware that headers from outside your project, in particular system
23369 +headers and headers from any other library you use, may not be
23370 +expecting to be compiled with visibility other than the default. You
23371 +may need to explicitly say @samp{#pragma GCC visibility push(default)}
23372 +before including any such headers.
23374 +@samp{extern} declarations are not affected by @samp{-fvisibility}, so
23375 +a lot of code can be recompiled with @samp{-fvisibility=hidden} with
23376 +no modifications. However, this means that calls to @samp{extern}
23377 +functions with no explicit visibility will use the PLT, so it is more
23378 +effective to use @samp{__attribute ((visibility))} and/or
23379 +@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
23380 +declarations should be treated as hidden.
23382 +Note that @samp{-fvisibility} does affect C++ vague linkage
23383 +entities. This means that, for instance, an exception class that will
23384 +be thrown between DSOs must be explicitly marked with default
23385 +visibility so that the @samp{type_info} nodes will be unified between
23386 +the DSOs.
23388 +An overview of these techniques, their benefits and how to use them
23389 +is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
23391 +@item -fstrict-volatile-bitfields
23392 +@opindex fstrict-volatile-bitfields
23393 +This option should be used if accesses to volatile bitfields (or other
23394 +structure fields, although the compiler usually honors those types
23395 +anyway) should use a single access of the width of the
23396 +field's type, aligned to a natural alignment if possible. For
23397 +example, targets with memory-mapped peripheral registers might require
23398 +all such accesses to be 16 bits wide; with this flag the user could
23399 +declare all peripheral bitfields as ``unsigned short'' (assuming short
23400 +is 16 bits on these targets) to force GCC to use 16 bit accesses
23401 +instead of, perhaps, a more efficient 32 bit access.
23403 +If this option is disabled, the compiler will use the most efficient
23404 +instruction. In the previous example, that might be a 32-bit load
23405 +instruction, even though that will access bytes that do not contain
23406 +any portion of the bitfield, or memory-mapped registers unrelated to
23407 +the one being updated.
23409 +If the target requires strict alignment, and honoring the field
23410 +type would require violating this alignment, a warning is issued.
23411 +If the field has @code{packed} attribute, the access is done without
23412 +honoring the field type. If the field doesn't have @code{packed}
23413 +attribute, the access is done honoring the field type. In both cases,
23414 +GCC assumes that the user knows something about the target hardware
23415 +that it is unaware of.
23417 +The default value of this option is determined by the application binary
23418 +interface for the target processor.
23420 +@end table
23422 +@c man end
23424 +@node Environment Variables
23425 +@section Environment Variables Affecting GCC
23426 +@cindex environment variables
23428 +@c man begin ENVIRONMENT
23429 +This section describes several environment variables that affect how GCC
23430 +operates. Some of them work by specifying directories or prefixes to use
23431 +when searching for various kinds of files. Some are used to specify other
23432 +aspects of the compilation environment.
23434 +Note that you can also specify places to search using options such as
23435 +@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
23436 +take precedence over places specified using environment variables, which
23437 +in turn take precedence over those specified by the configuration of GCC@.
23438 +@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
23439 +GNU Compiler Collection (GCC) Internals}.
23441 +@table @env
23442 +@item LANG
23443 +@itemx LC_CTYPE
23444 +@c @itemx LC_COLLATE
23445 +@itemx LC_MESSAGES
23446 +@c @itemx LC_MONETARY
23447 +@c @itemx LC_NUMERIC
23448 +@c @itemx LC_TIME
23449 +@itemx LC_ALL
23450 +@findex LANG
23451 +@findex LC_CTYPE
23452 +@c @findex LC_COLLATE
23453 +@findex LC_MESSAGES
23454 +@c @findex LC_MONETARY
23455 +@c @findex LC_NUMERIC
23456 +@c @findex LC_TIME
23457 +@findex LC_ALL
23458 +@cindex locale
23459 +These environment variables control the way that GCC uses
23460 +localization information that allow GCC to work with different
23461 +national conventions. GCC inspects the locale categories
23462 +@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
23463 +so. These locale categories can be set to any value supported by your
23464 +installation. A typical value is @samp{en_GB.UTF-8} for English in the United
23465 +Kingdom encoded in UTF-8.
23467 +The @env{LC_CTYPE} environment variable specifies character
23468 +classification. GCC uses it to determine the character boundaries in
23469 +a string; this is needed for some multibyte encodings that contain quote
23470 +and escape characters that would otherwise be interpreted as a string
23471 +end or escape.
23473 +The @env{LC_MESSAGES} environment variable specifies the language to
23474 +use in diagnostic messages.
23476 +If the @env{LC_ALL} environment variable is set, it overrides the value
23477 +of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
23478 +and @env{LC_MESSAGES} default to the value of the @env{LANG}
23479 +environment variable. If none of these variables are set, GCC
23480 +defaults to traditional C English behavior.
23482 +@item TMPDIR
23483 +@findex TMPDIR
23484 +If @env{TMPDIR} is set, it specifies the directory to use for temporary
23485 +files. GCC uses temporary files to hold the output of one stage of
23486 +compilation which is to be used as input to the next stage: for example,
23487 +the output of the preprocessor, which is the input to the compiler
23488 +proper.
23490 +@item GCC_EXEC_PREFIX
23491 +@findex GCC_EXEC_PREFIX
23492 +If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
23493 +names of the subprograms executed by the compiler. No slash is added
23494 +when this prefix is combined with the name of a subprogram, but you can
23495 +specify a prefix that ends with a slash if you wish.
23497 +If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
23498 +an appropriate prefix to use based on the pathname it was invoked with.
23500 +If GCC cannot find the subprogram using the specified prefix, it
23501 +tries looking in the usual places for the subprogram.
23503 +The default value of @env{GCC_EXEC_PREFIX} is
23504 +@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
23505 +the installed compiler. In many cases @var{prefix} is the value
23506 +of @code{prefix} when you ran the @file{configure} script.
23508 +Other prefixes specified with @option{-B} take precedence over this prefix.
23510 +This prefix is also used for finding files such as @file{crt0.o} that are
23511 +used for linking.
23513 +In addition, the prefix is used in an unusual way in finding the
23514 +directories to search for header files. For each of the standard
23515 +directories whose name normally begins with @samp{/usr/local/lib/gcc}
23516 +(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
23517 +replacing that beginning with the specified prefix to produce an
23518 +alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
23519 +@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
23520 +These alternate directories are searched first; the standard directories
23521 +come next. If a standard directory begins with the configured
23522 +@var{prefix} then the value of @var{prefix} is replaced by
23523 +@env{GCC_EXEC_PREFIX} when looking for header files.
23525 +@item COMPILER_PATH
23526 +@findex COMPILER_PATH
23527 +The value of @env{COMPILER_PATH} is a colon-separated list of
23528 +directories, much like @env{PATH}. GCC tries the directories thus
23529 +specified when searching for subprograms, if it can't find the
23530 +subprograms using @env{GCC_EXEC_PREFIX}.
23532 +@item LIBRARY_PATH
23533 +@findex LIBRARY_PATH
23534 +The value of @env{LIBRARY_PATH} is a colon-separated list of
23535 +directories, much like @env{PATH}. When configured as a native compiler,
23536 +GCC tries the directories thus specified when searching for special
23537 +linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
23538 +using GCC also uses these directories when searching for ordinary
23539 +libraries for the @option{-l} option (but directories specified with
23540 +@option{-L} come first).
23542 +@item LANG
23543 +@findex LANG
23544 +@cindex locale definition
23545 +This variable is used to pass locale information to the compiler. One way in
23546 +which this information is used is to determine the character set to be used
23547 +when character literals, string literals and comments are parsed in C and C++.
23548 +When the compiler is configured to allow multibyte characters,
23549 +the following values for @env{LANG} are recognized:
23551 +@table @samp
23552 +@item C-JIS
23553 +Recognize JIS characters.
23554 +@item C-SJIS
23555 +Recognize SJIS characters.
23556 +@item C-EUCJP
23557 +Recognize EUCJP characters.
23558 +@end table
23560 +If @env{LANG} is not defined, or if it has some other value, then the
23561 +compiler will use mblen and mbtowc as defined by the default locale to
23562 +recognize and translate multibyte characters.
23563 +@end table
23565 +@noindent
23566 +Some additional environments variables affect the behavior of the
23567 +preprocessor.
23569 +@include cppenv.texi
23571 +@c man end
23573 +@node Precompiled Headers
23574 +@section Using Precompiled Headers
23575 +@cindex precompiled headers
23576 +@cindex speed of compilation
23578 +Often large projects have many header files that are included in every
23579 +source file. The time the compiler takes to process these header files
23580 +over and over again can account for nearly all of the time required to
23581 +build the project. To make builds faster, GCC allows users to
23582 +`precompile' a header file; then, if builds can use the precompiled
23583 +header file they will be much faster.
23585 +To create a precompiled header file, simply compile it as you would any
23586 +other file, if necessary using the @option{-x} option to make the driver
23587 +treat it as a C or C++ header file. You will probably want to use a
23588 +tool like @command{make} to keep the precompiled header up-to-date when
23589 +the headers it contains change.
23591 +A precompiled header file will be searched for when @code{#include} is
23592 +seen in the compilation. As it searches for the included file
23593 +(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
23594 +compiler looks for a precompiled header in each directory just before it
23595 +looks for the include file in that directory. The name searched for is
23596 +the name specified in the @code{#include} with @samp{.gch} appended. If
23597 +the precompiled header file can't be used, it is ignored.
23599 +For instance, if you have @code{#include "all.h"}, and you have
23600 +@file{all.h.gch} in the same directory as @file{all.h}, then the
23601 +precompiled header file will be used if possible, and the original
23602 +header will be used otherwise.
23604 +Alternatively, you might decide to put the precompiled header file in a
23605 +directory and use @option{-I} to ensure that directory is searched
23606 +before (or instead of) the directory containing the original header.
23607 +Then, if you want to check that the precompiled header file is always
23608 +used, you can put a file of the same name as the original header in this
23609 +directory containing an @code{#error} command.
23611 +This also works with @option{-include}. So yet another way to use
23612 +precompiled headers, good for projects not designed with precompiled
23613 +header files in mind, is to simply take most of the header files used by
23614 +a project, include them from another header file, precompile that header
23615 +file, and @option{-include} the precompiled header. If the header files
23616 +have guards against multiple inclusion, they will be skipped because
23617 +they've already been included (in the precompiled header).
23619 +If you need to precompile the same header file for different
23620 +languages, targets, or compiler options, you can instead make a
23621 +@emph{directory} named like @file{all.h.gch}, and put each precompiled
23622 +header in the directory, perhaps using @option{-o}. It doesn't matter
23623 +what you call the files in the directory, every precompiled header in
23624 +the directory will be considered. The first precompiled header
23625 +encountered in the directory that is valid for this compilation will
23626 +be used; they're searched in no particular order.
23628 +There are many other possibilities, limited only by your imagination,
23629 +good sense, and the constraints of your build system.
23631 +A precompiled header file can be used only when these conditions apply:
23633 +@itemize
23634 +@item
23635 +Only one precompiled header can be used in a particular compilation.
23637 +@item
23638 +A precompiled header can't be used once the first C token is seen. You
23639 +can have preprocessor directives before a precompiled header; you can
23640 +even include a precompiled header from inside another header, so long as
23641 +there are no C tokens before the @code{#include}.
23643 +@item
23644 +The precompiled header file must be produced for the same language as
23645 +the current compilation. You can't use a C precompiled header for a C++
23646 +compilation.
23648 +@item
23649 +The precompiled header file must have been produced by the same compiler
23650 +binary as the current compilation is using.
23652 +@item
23653 +Any macros defined before the precompiled header is included must
23654 +either be defined in the same way as when the precompiled header was
23655 +generated, or must not affect the precompiled header, which usually
23656 +means that they don't appear in the precompiled header at all.
23658 +The @option{-D} option is one way to define a macro before a
23659 +precompiled header is included; using a @code{#define} can also do it.
23660 +There are also some options that define macros implicitly, like
23661 +@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
23662 +defined this way.
23664 +@item If debugging information is output when using the precompiled
23665 +header, using @option{-g} or similar, the same kind of debugging information
23666 +must have been output when building the precompiled header. However,
23667 +a precompiled header built using @option{-g} can be used in a compilation
23668 +when no debugging information is being output.
23670 +@item The same @option{-m} options must generally be used when building
23671 +and using the precompiled header. @xref{Submodel Options},
23672 +for any cases where this rule is relaxed.
23674 +@item Each of the following options must be the same when building and using
23675 +the precompiled header:
23677 +@gccoptlist{-fexceptions}
23679 +@item
23680 +Some other command-line options starting with @option{-f},
23681 +@option{-p}, or @option{-O} must be defined in the same way as when
23682 +the precompiled header was generated. At present, it's not clear
23683 +which options are safe to change and which are not; the safest choice
23684 +is to use exactly the same options when generating and using the
23685 +precompiled header. The following are known to be safe:
23687 +@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
23688 +-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
23689 +-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
23690 +-pedantic-errors}
23692 +@end itemize
23694 +For all of these except the last, the compiler will automatically
23695 +ignore the precompiled header if the conditions aren't met. If you
23696 +find an option combination that doesn't work and doesn't cause the
23697 +precompiled header to be ignored, please consider filing a bug report,
23698 +see @ref{Bugs}.
23700 +If you do use differing options when generating and using the
23701 +precompiled header, the actual behavior will be a mixture of the
23702 +behavior for the options. For instance, if you use @option{-g} to
23703 +generate the precompiled header but not when using it, you may or may
23704 +not get debugging information for routines in the precompiled header.
23705 diff -urN gcc-4.8.1/gcc/doc/invoke.texi.rej.old gcc-4.8.1.new/gcc/doc/invoke.texi.rej.old
23706 --- gcc-4.8.1/gcc/doc/invoke.texi.rej.old 1969-12-31 19:00:00.000000000 -0500
23707 +++ gcc-4.8.1.new/gcc/doc/invoke.texi.rej.old 2013-12-02 20:22:15.932776266 -0500
23708 @@ -0,0 +1,66 @@
23709 +--- gcc/doc/invoke.texi 2011-10-24 14:22:21.000000000 +0200
23710 ++++ gcc/doc/invoke.texi 2013-08-26 07:55:42.000000000 +0200
23711 +@@ -165,7 +165,7 @@
23712 + -pipe -pass-exit-codes @gol
23713 + -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
23714 + --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
23715 +--fdump-ada-spec@r{[}-slim@r{]}} -fdump-go-spec=@var{file}
23716 ++-fdump-ada-spec@r{[}-slim@r{]} -fdump-go-spec=@var{file}}
23718 + @item C Language Options
23719 + @xref{C Dialect Options,,Options Controlling C Dialect}.
23720 +@@ -5085,11 +5085,11 @@
23721 + @option{-fdump-rtl-ce3} enable dumping after the three
23722 + if conversion passes.
23724 +-@itemx -fdump-rtl-cprop_hardreg
23725 ++@item -fdump-rtl-cprop_hardreg
23726 + @opindex fdump-rtl-cprop_hardreg
23727 + Dump after hard register copy propagation.
23729 +-@itemx -fdump-rtl-csa
23730 ++@item -fdump-rtl-csa
23731 + @opindex fdump-rtl-csa
23732 + Dump after combining stack adjustments.
23734 +@@ -5100,11 +5100,11 @@
23735 + @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
23736 + the two common sub-expression elimination passes.
23738 +-@itemx -fdump-rtl-dce
23739 ++@item -fdump-rtl-dce
23740 + @opindex fdump-rtl-dce
23741 + Dump after the standalone dead code elimination passes.
23743 +-@itemx -fdump-rtl-dbr
23744 ++@item -fdump-rtl-dbr
23745 + @opindex fdump-rtl-dbr
23746 + Dump after delayed branch scheduling.
23748 +@@ -5149,7 +5149,7 @@
23749 + @opindex fdump-rtl-initvals
23750 + Dump after the computation of the initial value sets.
23752 +-@itemx -fdump-rtl-into_cfglayout
23753 ++@item -fdump-rtl-into_cfglayout
23754 + @opindex fdump-rtl-into_cfglayout
23755 + Dump after converting to cfglayout mode.
23757 +@@ -5179,7 +5179,7 @@
23758 + @opindex fdump-rtl-rnreg
23759 + Dump after register renumbering.
23761 +-@itemx -fdump-rtl-outof_cfglayout
23762 ++@item -fdump-rtl-outof_cfglayout
23763 + @opindex fdump-rtl-outof_cfglayout
23764 + Dump after converting from cfglayout mode.
23766 +@@ -5191,7 +5191,7 @@
23767 + @opindex fdump-rtl-postreload
23768 + Dump after post-reload optimizations.
23770 +-@itemx -fdump-rtl-pro_and_epilogue
23771 ++@item -fdump-rtl-pro_and_epilogue
23772 + @opindex fdump-rtl-pro_and_epilogue
23773 + Dump after generating the function pro and epilogues.
23775 diff -urN gcc-4.8.1/gcc/gengtype.c.old gcc-4.8.1.new/gcc/gengtype.c.old
23776 --- gcc-4.8.1/gcc/gengtype.c.old 1969-12-31 19:00:00.000000000 -0500
23777 +++ gcc-4.8.1.new/gcc/gengtype.c.old 2012-02-14 18:31:42.000000000 -0500
23778 @@ -0,0 +1,5004 @@
23779 +/* Process source files and output type information.
23780 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
23781 + Free Software Foundation, Inc.
23783 + This file is part of GCC.
23785 + GCC is free software; you can redistribute it and/or modify it under
23786 + the terms of the GNU General Public License as published by the Free
23787 + Software Foundation; either version 3, or (at your option) any later
23788 + version.
23790 + GCC is distributed in the hope that it will be useful, but WITHOUT ANY
23791 + WARRANTY; without even the implied warranty of MERCHANTABILITY or
23792 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23793 + for more details.
23795 + You should have received a copy of the GNU General Public License
23796 + along with GCC; see the file COPYING3. If not see
23797 + <http://www.gnu.org/licenses/>. */
23799 +#include "bconfig.h"
23800 +#include "system.h"
23801 +#include "errors.h" /* for fatal */
23802 +#include "getopt.h"
23803 +#include "double-int.h"
23804 +#include "version.h" /* for version_string & pkgversion_string. */
23805 +#include "hashtab.h"
23806 +#include "xregex.h"
23807 +#include "obstack.h"
23808 +#include "gengtype.h"
23810 +/* Data types, macros, etc. used only in this file. */
23813 +/* The list of output files. */
23814 +outf_p output_files;
23816 +/* The output header file that is included into pretty much every
23817 + source file. */
23818 +outf_p header_file;
23821 +/* The name of the file containing the list of input files. */
23822 +static char *inputlist;
23824 +/* The plugin input files and their number; in that case only
23825 + a single file is produced. */
23826 +static input_file **plugin_files;
23827 +static size_t nb_plugin_files;
23829 +/* The generated plugin output file and name. */
23830 +static outf_p plugin_output;
23831 +static char *plugin_output_filename;
23833 +/* Our source directory and its length. */
23834 +const char *srcdir;
23835 +size_t srcdir_len;
23837 +/* Variables used for reading and writing the state. */
23838 +const char *read_state_filename;
23839 +const char *write_state_filename;
23841 +/* Variables to help debugging. */
23842 +int do_dump;
23843 +int do_debug;
23845 +/* Level for verbose messages. */
23846 +int verbosity_level;
23848 +/* We have a type count and use it to set the state_number of newly
23849 + allocated types to some unique negative number. */
23850 +static int type_count;
23852 +/* The backup directory should be in the same file system as the
23853 + generated files, otherwise the rename(2) system call would fail.
23854 + If NULL, no backup is made when overwriting a generated file. */
23855 +static const char* backup_dir; /* (-B) program option. */
23858 +static outf_p create_file (const char *, const char *);
23860 +static const char *get_file_basename (const input_file *);
23861 +static const char *get_file_realbasename (const input_file *);
23863 +static int get_prefix_langdir_index (const char *);
23864 +static const char *get_file_langdir (const input_file *);
23867 +/* Nonzero iff an error has occurred. */
23868 +bool hit_error = false;
23870 +static void gen_rtx_next (void);
23871 +static void write_rtx_next (void);
23872 +static void open_base_files (void);
23873 +static void close_output_files (void);
23875 +/* Report an error at POS, printing MSG. */
23877 +void
23878 +error_at_line (const struct fileloc *pos, const char *msg, ...)
23880 + va_list ap;
23882 + gcc_assert (pos != NULL && pos->file != NULL);
23883 + va_start (ap, msg);
23885 + fprintf (stderr, "%s:%d: ", get_input_file_name (pos->file), pos->line);
23886 + vfprintf (stderr, msg, ap);
23887 + fputc ('\n', stderr);
23888 + hit_error = true;
23890 + va_end (ap);
23893 +/* asprintf, but produces fatal message on out-of-memory. */
23894 +char *
23895 +xasprintf (const char *format, ...)
23897 + int n;
23898 + char *result;
23899 + va_list ap;
23901 + va_start (ap, format);
23902 + n = vasprintf (&result, format, ap);
23903 + if (result == NULL || n < 0)
23904 + fatal ("out of memory");
23905 + va_end (ap);
23907 + return result;
23910 +/* Input file handling. */
23912 +/* Table of all input files. */
23913 +const input_file **gt_files;
23914 +size_t num_gt_files;
23916 +/* A number of places use the name of this "gengtype.c" file for a
23917 + location for things that we can't rely on the source to define.
23918 + Make sure we can still use pointer comparison on filenames. */
23919 +input_file* this_file;
23920 +/* The "system.h" file is likewise specially useful. */
23921 +input_file* system_h_file;
23923 +/* Vector of per-language directories. */
23924 +const char **lang_dir_names;
23925 +size_t num_lang_dirs;
23927 +/* An array of output files suitable for definitions. There is one
23928 + BASE_FILES entry for each language. */
23929 +static outf_p *base_files;
23933 +#if ENABLE_CHECKING
23934 +/* Utility debugging function, printing the various type counts within
23935 + a list of types. Called thru the DBGPRINT_COUNT_TYPE macro. */
23936 +void
23937 +dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
23939 + int nb_types = 0, nb_scalar = 0, nb_string = 0;
23940 + int nb_struct = 0, nb_union = 0, nb_array = 0, nb_pointer = 0;
23941 + int nb_lang_struct = 0, nb_param_struct = 0;
23942 + type_p p = NULL;
23943 + for (p = t; p; p = p->next)
23945 + nb_types++;
23946 + switch (p->kind)
23948 + case TYPE_SCALAR:
23949 + nb_scalar++;
23950 + break;
23951 + case TYPE_STRING:
23952 + nb_string++;
23953 + break;
23954 + case TYPE_STRUCT:
23955 + nb_struct++;
23956 + break;
23957 + case TYPE_UNION:
23958 + nb_union++;
23959 + break;
23960 + case TYPE_POINTER:
23961 + nb_pointer++;
23962 + break;
23963 + case TYPE_ARRAY:
23964 + nb_array++;
23965 + break;
23966 + case TYPE_LANG_STRUCT:
23967 + nb_lang_struct++;
23968 + break;
23969 + case TYPE_PARAM_STRUCT:
23970 + nb_param_struct++;
23971 + break;
23972 + default:
23973 + gcc_unreachable ();
23976 + fprintf (stderr, "\n" "%s:%d: %s: @@%%@@ %d types ::\n",
23977 + lbasename (fil), lin, msg, nb_types);
23978 + if (nb_scalar > 0 || nb_string > 0)
23979 + fprintf (stderr, "@@%%@@ %d scalars, %d strings\n", nb_scalar, nb_string);
23980 + if (nb_struct > 0 || nb_union > 0)
23981 + fprintf (stderr, "@@%%@@ %d structs, %d unions\n", nb_struct, nb_union);
23982 + if (nb_pointer > 0 || nb_array > 0)
23983 + fprintf (stderr, "@@%%@@ %d pointers, %d arrays\n", nb_pointer, nb_array);
23984 + if (nb_lang_struct > 0 || nb_param_struct > 0)
23985 + fprintf (stderr, "@@%%@@ %d lang_structs, %d param_structs\n",
23986 + nb_lang_struct, nb_param_struct);
23987 + fprintf (stderr, "\n");
23989 +#endif /* ENABLE_CHECKING */
23991 +/* Scan the input file, LIST, and determine how much space we need to
23992 + store strings in. Also, count the number of language directories
23993 + and files. The numbers returned are overestimates as they does not
23994 + consider repeated files. */
23995 +static size_t
23996 +measure_input_list (FILE *list)
23998 + size_t n = 0;
23999 + int c;
24000 + bool atbol = true;
24001 + num_lang_dirs = 0;
24002 + num_gt_files = plugin_files ? nb_plugin_files : 0;
24003 + while ((c = getc (list)) != EOF)
24005 + n++;
24006 + if (atbol)
24008 + if (c == '[')
24009 + num_lang_dirs++;
24010 + else
24012 + /* Add space for a lang_bitmap before the input file name. */
24013 + n += sizeof (lang_bitmap);
24014 + num_gt_files++;
24016 + atbol = false;
24019 + if (c == '\n')
24020 + atbol = true;
24023 + rewind (list);
24024 + return n;
24027 +/* Read one input line from LIST to HEREP (which is updated). A
24028 + pointer to the string is returned via LINEP. If it was a language
24029 + subdirectory in square brackets, strip off the square brackets and
24030 + return true. Otherwise, leave space before the string for a
24031 + lang_bitmap, and return false. At EOF, returns false, does not
24032 + touch *HEREP, and sets *LINEP to NULL. POS is used for
24033 + diagnostics. */
24034 +static bool
24035 +read_input_line (FILE *list, char **herep, char **linep, struct fileloc *pos)
24037 + char *here = *herep;
24038 + char *line;
24039 + int c = getc (list);
24041 + /* Read over whitespace. */
24042 + while (c == '\n' || c == ' ')
24043 + c = getc (list);
24045 + if (c == EOF)
24047 + *linep = 0;
24048 + return false;
24050 + else if (c == '[')
24052 + /* No space for a lang_bitmap is necessary. Discard the '['. */
24053 + c = getc (list);
24054 + line = here;
24055 + while (c != ']' && c != '\n' && c != EOF)
24057 + *here++ = c;
24058 + c = getc (list);
24060 + *here++ = '\0';
24062 + if (c == ']')
24064 + c = getc (list); /* eat what should be a newline */
24065 + if (c != '\n' && c != EOF)
24066 + error_at_line (pos, "junk on line after language tag [%s]", line);
24068 + else
24069 + error_at_line (pos, "missing close bracket for language tag [%s",
24070 + line);
24072 + *herep = here;
24073 + *linep = line;
24074 + return true;
24076 + else
24078 + /* Leave space for a lang_bitmap. */
24079 + memset (here, 0, sizeof (lang_bitmap));
24080 + here += sizeof (lang_bitmap);
24081 + line = here;
24082 + do
24084 + *here++ = c;
24085 + c = getc (list);
24087 + while (c != EOF && c != '\n');
24088 + *here++ = '\0';
24089 + *herep = here;
24090 + *linep = line;
24091 + return false;
24095 +/* Read the list of input files from LIST and compute all of the
24096 + relevant tables. There is one file per line of the list. At
24097 + first, all the files on the list are language-generic, but
24098 + eventually a line will appear which is the name of a language
24099 + subdirectory in square brackets, like this: [cp]. All subsequent
24100 + files are specific to that language, until another language
24101 + subdirectory tag appears. Files can appear more than once, if
24102 + they apply to more than one language. */
24103 +static void
24104 +read_input_list (const char *listname)
24106 + FILE *list = fopen (listname, "r");
24107 + if (!list)
24108 + fatal ("cannot open %s: %s", listname, xstrerror (errno));
24109 + else
24111 + struct fileloc epos;
24112 + size_t bufsz = measure_input_list (list);
24113 + char *buf = XNEWVEC (char, bufsz);
24114 + char *here = buf;
24115 + char *committed = buf;
24116 + char *limit = buf + bufsz;
24117 + char *line;
24118 + bool is_language;
24119 + size_t langno = 0;
24120 + size_t nfiles = 0;
24121 + lang_bitmap curlangs = (1 << num_lang_dirs) - 1;
24123 + epos.file = input_file_by_name (listname);
24124 + epos.line = 0;
24126 + lang_dir_names = XNEWVEC (const char *, num_lang_dirs);
24127 + gt_files = XNEWVEC (const input_file *, num_gt_files);
24129 + for (;;)
24131 + next_line:
24132 + epos.line++;
24133 + committed = here;
24134 + is_language = read_input_line (list, &here, &line, &epos);
24135 + gcc_assert (here <= limit);
24136 + if (line == 0)
24137 + break;
24138 + else if (is_language)
24140 + size_t i;
24141 + gcc_assert (langno <= num_lang_dirs);
24142 + for (i = 0; i < langno; i++)
24143 + if (strcmp (lang_dir_names[i], line) == 0)
24145 + error_at_line (&epos, "duplicate language tag [%s]",
24146 + line);
24147 + curlangs = 1 << i;
24148 + here = committed;
24149 + goto next_line;
24152 + curlangs = 1 << langno;
24153 + lang_dir_names[langno++] = line;
24155 + else
24157 + size_t i;
24158 + input_file *inpf = input_file_by_name (line);
24159 + gcc_assert (nfiles <= num_gt_files);
24160 + for (i = 0; i < nfiles; i++)
24161 + /* Since the input_file-s are uniquely hash-consed, we
24162 + can just compare pointers! */
24163 + if (gt_files[i] == inpf)
24165 + /* Throw away the string we just read, and add the
24166 + current language to the existing string's bitmap. */
24167 + lang_bitmap bmap = get_lang_bitmap (inpf);
24168 + if (bmap & curlangs)
24169 + error_at_line (&epos,
24170 + "file %s specified more than once "
24171 + "for language %s", line,
24172 + langno ==
24173 + 0 ? "(all)" : lang_dir_names[langno -
24174 + 1]);
24176 + bmap |= curlangs;
24177 + set_lang_bitmap (inpf, bmap);
24178 + here = committed;
24179 + goto next_line;
24182 + set_lang_bitmap (inpf, curlangs);
24183 + gt_files[nfiles++] = inpf;
24186 + /* Update the global counts now that we know accurately how many
24187 + things there are. (We do not bother resizing the arrays down.) */
24188 + num_lang_dirs = langno;
24189 + /* Add the plugin files if provided. */
24190 + if (plugin_files)
24192 + size_t i;
24193 + for (i = 0; i < nb_plugin_files; i++)
24194 + gt_files[nfiles++] = plugin_files[i];
24196 + num_gt_files = nfiles;
24199 + /* Sanity check: any file that resides in a language subdirectory
24200 + (e.g. 'cp') ought to belong to the corresponding language.
24201 + ??? Still true if for instance ObjC++ is enabled and C++ isn't?
24202 + (Can you even do that? Should you be allowed to?) */
24204 + size_t f;
24205 + for (f = 0; f < num_gt_files; f++)
24207 + lang_bitmap bitmap = get_lang_bitmap (gt_files[f]);
24208 + const char *basename = get_file_basename (gt_files[f]);
24209 + const char *slashpos = strchr (basename, '/');
24211 + if (slashpos)
24213 + size_t l;
24214 + for (l = 0; l < num_lang_dirs; l++)
24215 + if ((size_t) (slashpos - basename) == strlen (lang_dir_names[l])
24216 + && memcmp (basename, lang_dir_names[l],
24217 + strlen (lang_dir_names[l])) == 0)
24219 + if (!(bitmap & (1 << l)))
24220 + error ("%s is in language directory '%s' but is not "
24221 + "tagged for that language",
24222 + basename, lang_dir_names[l]);
24223 + break;
24229 + if (ferror (list))
24230 + fatal ("error reading %s: %s", listname, xstrerror (errno));
24232 + fclose (list);
24237 +/* The one and only TYPE_STRING. */
24239 +struct type string_type = {
24240 + TYPE_STRING, 0, 0, 0, GC_USED, {0}
24243 +/* The two and only TYPE_SCALARs. Their u.scalar_is_char flags are
24244 + set early in main. */
24246 +struct type scalar_nonchar = {
24247 + TYPE_SCALAR, 0, 0, 0, GC_USED, {0}
24250 +struct type scalar_char = {
24251 + TYPE_SCALAR, 0, 0, 0, GC_USED, {0}
24254 +/* Lists of various things. */
24256 +pair_p typedefs;
24257 +type_p structures;
24258 +type_p param_structs;
24259 +pair_p variables;
24261 +static type_p find_param_structure (type_p t, type_p param[NUM_PARAM]);
24262 +static type_p adjust_field_tree_exp (type_p t, options_p opt);
24263 +static type_p adjust_field_rtx_def (type_p t, options_p opt);
24265 +/* Define S as a typedef to T at POS. */
24267 +void
24268 +do_typedef (const char *s, type_p t, struct fileloc *pos)
24270 + pair_p p;
24272 + /* temporary kludge - gengtype doesn't handle conditionals or
24273 + macros. Ignore any attempt to typedef CUMULATIVE_ARGS, unless it
24274 + is coming from this file (main() sets them up with safe dummy
24275 + definitions). */
24276 + if (!strcmp (s, "CUMULATIVE_ARGS") && pos->file != this_file)
24277 + return;
24279 + for (p = typedefs; p != NULL; p = p->next)
24280 + if (strcmp (p->name, s) == 0)
24282 + if (p->type != t)
24284 + error_at_line (pos, "type `%s' previously defined", s);
24285 + error_at_line (&p->line, "previously defined here");
24287 + return;
24290 + p = XNEW (struct pair);
24291 + p->next = typedefs;
24292 + p->name = s;
24293 + p->type = t;
24294 + p->line = *pos;
24295 + p->opt = NULL;
24296 + typedefs = p;
24299 +/* Define S as a typename of a scalar. Cannot be used to define
24300 + typedefs of 'char'. Note: is also used for pointer-to-function
24301 + typedefs (which are therefore not treated as pointers). */
24303 +void
24304 +do_scalar_typedef (const char *s, struct fileloc *pos)
24306 + do_typedef (s, &scalar_nonchar, pos);
24309 +/* Return the type previously defined for S. Use POS to report errors. */
24311 +type_p
24312 +resolve_typedef (const char *s, struct fileloc *pos)
24314 + pair_p p;
24315 + for (p = typedefs; p != NULL; p = p->next)
24316 + if (strcmp (p->name, s) == 0)
24317 + return p->type;
24318 + error_at_line (pos, "unidentified type `%s'", s);
24319 + return &scalar_nonchar; /* treat as "int" */
24322 +/* Create and return a new structure with tag NAME (or a union iff
24323 + ISUNION is nonzero), at POS with fields FIELDS and options O. */
24325 +type_p
24326 +new_structure (const char *name, int isunion, struct fileloc *pos,
24327 + pair_p fields, options_p o)
24329 + type_p si;
24330 + type_p s = NULL;
24331 + lang_bitmap bitmap = get_lang_bitmap (pos->file);
24333 + for (si = structures; si != NULL; si = si->next)
24334 + if (strcmp (name, si->u.s.tag) == 0 && UNION_P (si) == isunion)
24336 + type_p ls = NULL;
24337 + if (si->kind == TYPE_LANG_STRUCT)
24339 + ls = si;
24341 + for (si = ls->u.s.lang_struct; si != NULL; si = si->next)
24342 + if (si->u.s.bitmap == bitmap)
24343 + s = si;
24345 + else if (si->u.s.line.file != NULL && si->u.s.bitmap != bitmap)
24347 + ls = si;
24348 + type_count++;
24349 + si = XCNEW (struct type);
24350 + memcpy (si, ls, sizeof (struct type));
24351 + ls->kind = TYPE_LANG_STRUCT;
24352 + ls->u.s.lang_struct = si;
24353 + ls->u.s.fields = NULL;
24354 + si->next = NULL;
24355 + si->state_number = -type_count;
24356 + si->pointer_to = NULL;
24357 + si->u.s.lang_struct = ls;
24359 + else
24360 + s = si;
24362 + if (ls != NULL && s == NULL)
24364 + type_count++;
24365 + s = XCNEW (struct type);
24366 + s->state_number = -type_count;
24367 + s->next = ls->u.s.lang_struct;
24368 + ls->u.s.lang_struct = s;
24369 + s->u.s.lang_struct = ls;
24371 + break;
24374 + if (s == NULL)
24376 + type_count++;
24377 + s = XCNEW (struct type);
24378 + s->state_number = -type_count;
24379 + s->next = structures;
24380 + structures = s;
24383 + if (s->u.s.line.file != NULL
24384 + || (s->u.s.lang_struct && (s->u.s.lang_struct->u.s.bitmap & bitmap)))
24386 + error_at_line (pos, "duplicate definition of '%s %s'",
24387 + isunion ? "union" : "struct", s->u.s.tag);
24388 + error_at_line (&s->u.s.line, "previous definition here");
24391 + s->kind = isunion ? TYPE_UNION : TYPE_STRUCT;
24392 + s->u.s.tag = name;
24393 + s->u.s.line = *pos;
24394 + s->u.s.fields = fields;
24395 + s->u.s.opt = o;
24396 + s->u.s.bitmap = bitmap;
24397 + if (s->u.s.lang_struct)
24398 + s->u.s.lang_struct->u.s.bitmap |= bitmap;
24400 + return s;
24403 +/* Return the previously-defined structure with tag NAME (or a union
24404 + iff ISUNION is nonzero), or a new empty structure or union if none
24405 + was defined previously. */
24407 +type_p
24408 +find_structure (const char *name, int isunion)
24410 + type_p s;
24412 + for (s = structures; s != NULL; s = s->next)
24413 + if (strcmp (name, s->u.s.tag) == 0 && UNION_P (s) == isunion)
24414 + return s;
24416 + type_count++;
24417 + s = XCNEW (struct type);
24418 + s->next = structures;
24419 + s->state_number = -type_count;
24420 + structures = s;
24421 + s->kind = isunion ? TYPE_UNION : TYPE_STRUCT;
24422 + s->u.s.tag = name;
24423 + structures = s;
24424 + return s;
24427 +/* Return the previously-defined parameterized structure for structure
24428 + T and parameters PARAM, or a new parameterized empty structure or
24429 + union if none was defined previously. */
24431 +static type_p
24432 +find_param_structure (type_p t, type_p param[NUM_PARAM])
24434 + type_p res;
24436 + for (res = param_structs; res; res = res->next)
24437 + if (res->u.param_struct.stru == t
24438 + && memcmp (res->u.param_struct.param, param,
24439 + sizeof (type_p) * NUM_PARAM) == 0)
24440 + break;
24441 + if (res == NULL)
24443 + type_count++;
24444 + res = XCNEW (struct type);
24445 + res->kind = TYPE_PARAM_STRUCT;
24446 + res->next = param_structs;
24447 + res->state_number = -type_count;
24448 + param_structs = res;
24449 + res->u.param_struct.stru = t;
24450 + memcpy (res->u.param_struct.param, param, sizeof (type_p) * NUM_PARAM);
24452 + return res;
24455 +/* Return a scalar type with name NAME. */
24457 +type_p
24458 +create_scalar_type (const char *name)
24460 + if (!strcmp (name, "char") || !strcmp (name, "unsigned char"))
24461 + return &scalar_char;
24462 + else
24463 + return &scalar_nonchar;
24466 +/* Return a pointer to T. */
24468 +type_p
24469 +create_pointer (type_p t)
24471 + if (!t->pointer_to)
24473 + type_p r = XCNEW (struct type);
24474 + type_count++;
24475 + r->state_number = -type_count;
24476 + r->kind = TYPE_POINTER;
24477 + r->u.p = t;
24478 + t->pointer_to = r;
24480 + return t->pointer_to;
24483 +/* Return an array of length LEN. */
24485 +type_p
24486 +create_array (type_p t, const char *len)
24488 + type_p v;
24490 + type_count++;
24491 + v = XCNEW (struct type);
24492 + v->kind = TYPE_ARRAY;
24493 + v->state_number = -type_count;
24494 + v->u.a.p = t;
24495 + v->u.a.len = len;
24496 + return v;
24499 +/* Return a string options structure with name NAME and info INFO.
24500 + NEXT is the next option in the chain. */
24501 +options_p
24502 +create_string_option (options_p next, const char *name, const char *info)
24504 + options_p o = XNEW (struct options);
24505 + o->kind = OPTION_STRING;
24506 + o->next = next;
24507 + o->name = name;
24508 + o->info.string = info;
24509 + return o;
24512 +/* Create a type options structure with name NAME and info INFO. NEXT
24513 + is the next option in the chain. */
24514 +options_p
24515 +create_type_option (options_p next, const char* name, type_p info)
24517 + options_p o = XNEW (struct options);
24518 + o->next = next;
24519 + o->name = name;
24520 + o->kind = OPTION_TYPE;
24521 + o->info.type = info;
24522 + return o;
24525 +/* Create a nested pointer options structure with name NAME and info
24526 + INFO. NEXT is the next option in the chain. */
24527 +options_p
24528 +create_nested_option (options_p next, const char* name,
24529 + struct nested_ptr_data* info)
24531 + options_p o;
24532 + o = XNEW (struct options);
24533 + o->next = next;
24534 + o->name = name;
24535 + o->kind = OPTION_NESTED;
24536 + o->info.nested = info;
24537 + return o;
24540 +/* Return an options structure for a "nested_ptr" option. */
24541 +options_p
24542 +create_nested_ptr_option (options_p next, type_p t,
24543 + const char *to, const char *from)
24545 + struct nested_ptr_data *d = XNEW (struct nested_ptr_data);
24547 + d->type = adjust_field_type (t, 0);
24548 + d->convert_to = to;
24549 + d->convert_from = from;
24550 + return create_nested_option (next, "nested_ptr", d);
24553 +/* Add a variable named S of type T with options O defined at POS,
24554 + to `variables'. */
24555 +void
24556 +note_variable (const char *s, type_p t, options_p o, struct fileloc *pos)
24558 + pair_p n;
24559 + n = XNEW (struct pair);
24560 + n->name = s;
24561 + n->type = t;
24562 + n->line = *pos;
24563 + n->opt = o;
24564 + n->next = variables;
24565 + variables = n;
24568 +/* Most-general structure field creator. */
24569 +static pair_p
24570 +create_field_all (pair_p next, type_p type, const char *name, options_p opt,
24571 + const input_file *inpf, int line)
24573 + pair_p field;
24575 + field = XNEW (struct pair);
24576 + field->next = next;
24577 + field->type = type;
24578 + field->name = name;
24579 + field->opt = opt;
24580 + field->line.file = inpf;
24581 + field->line.line = line;
24582 + return field;
24585 +/* Create a field that came from the source code we are scanning,
24586 + i.e. we have a 'struct fileloc', and possibly options; also,
24587 + adjust_field_type should be called. */
24588 +pair_p
24589 +create_field_at (pair_p next, type_p type, const char *name, options_p opt,
24590 + struct fileloc *pos)
24592 + return create_field_all (next, adjust_field_type (type, opt),
24593 + name, opt, pos->file, pos->line);
24596 +/* Create a fake field with the given type and name. NEXT is the next
24597 + field in the chain. */
24598 +#define create_field(next,type,name) \
24599 + create_field_all(next,type,name, 0, this_file, __LINE__)
24601 +/* Like create_field, but the field is only valid when condition COND
24602 + is true. */
24604 +static pair_p
24605 +create_optional_field_ (pair_p next, type_p type, const char *name,
24606 + const char *cond, int line)
24608 + static int id = 1;
24609 + pair_p union_fields;
24610 + type_p union_type;
24612 + /* Create a fake union type with a single nameless field of type TYPE.
24613 + The field has a tag of "1". This allows us to make the presence
24614 + of a field of type TYPE depend on some boolean "desc" being true. */
24615 + union_fields = create_field (NULL, type, "");
24616 + union_fields->opt =
24617 + create_string_option (union_fields->opt, "dot", "");
24618 + union_fields->opt =
24619 + create_string_option (union_fields->opt, "tag", "1");
24620 + union_type =
24621 + new_structure (xasprintf ("%s_%d", "fake_union", id++), 1,
24622 + &lexer_line, union_fields, NULL);
24624 + /* Create the field and give it the new fake union type. Add a "desc"
24625 + tag that specifies the condition under which the field is valid. */
24626 + return create_field_all (next, union_type, name,
24627 + create_string_option (0, "desc", cond),
24628 + this_file, line);
24631 +#define create_optional_field(next,type,name,cond) \
24632 + create_optional_field_(next,type,name,cond,__LINE__)
24634 +/* Reverse a linked list of 'struct pair's in place. */
24635 +pair_p
24636 +nreverse_pairs (pair_p list)
24638 + pair_p prev = 0, p, next;
24639 + for (p = list; p; p = next)
24641 + next = p->next;
24642 + p->next = prev;
24643 + prev = p;
24645 + return prev;
24649 +/* We don't care how long a CONST_DOUBLE is. */
24650 +#define CONST_DOUBLE_FORMAT "ww"
24651 +/* We don't want to see codes that are only for generator files. */
24652 +#undef GENERATOR_FILE
24654 +enum rtx_code
24656 +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
24657 +#include "rtl.def"
24658 +#undef DEF_RTL_EXPR
24659 + NUM_RTX_CODE
24662 +static const char *const rtx_name[NUM_RTX_CODE] = {
24663 +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
24664 +#include "rtl.def"
24665 +#undef DEF_RTL_EXPR
24668 +static const char *const rtx_format[NUM_RTX_CODE] = {
24669 +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
24670 +#include "rtl.def"
24671 +#undef DEF_RTL_EXPR
24674 +static int rtx_next_new[NUM_RTX_CODE];
24676 +/* We also need codes and names for insn notes (not register notes).
24677 + Note that we do *not* bias the note values here. */
24678 +enum insn_note
24680 +#define DEF_INSN_NOTE(NAME) NAME,
24681 +#include "insn-notes.def"
24682 +#undef DEF_INSN_NOTE
24684 + NOTE_INSN_MAX
24687 +/* We must allocate one more entry here, as we use NOTE_INSN_MAX as the
24688 + default field for line number notes. */
24689 +static const char *const note_insn_name[NOTE_INSN_MAX + 1] = {
24690 +#define DEF_INSN_NOTE(NAME) #NAME,
24691 +#include "insn-notes.def"
24692 +#undef DEF_INSN_NOTE
24695 +#undef CONST_DOUBLE_FORMAT
24696 +#define GENERATOR_FILE
24698 +/* Generate the contents of the rtx_next array. This really doesn't belong
24699 + in gengtype at all, but it's needed for adjust_field_rtx_def. */
24701 +static void
24702 +gen_rtx_next (void)
24704 + int i;
24705 + for (i = 0; i < NUM_RTX_CODE; i++)
24707 + int k;
24709 + rtx_next_new[i] = -1;
24710 + if (strncmp (rtx_format[i], "iuu", 3) == 0)
24711 + rtx_next_new[i] = 2;
24712 + else if (i == COND_EXEC || i == SET || i == EXPR_LIST || i == INSN_LIST)
24713 + rtx_next_new[i] = 1;
24714 + else
24715 + for (k = strlen (rtx_format[i]) - 1; k >= 0; k--)
24716 + if (rtx_format[i][k] == 'e' || rtx_format[i][k] == 'u')
24717 + rtx_next_new[i] = k;
24721 +/* Write out the contents of the rtx_next array. */
24722 +static void
24723 +write_rtx_next (void)
24725 + outf_p f = get_output_file_with_visibility (NULL);
24726 + int i;
24727 + if (!f)
24728 + return;
24730 + oprintf (f, "\n/* Used to implement the RTX_NEXT macro. */\n");
24731 + oprintf (f, "EXPORTED_CONST unsigned char rtx_next[NUM_RTX_CODE] = {\n");
24732 + for (i = 0; i < NUM_RTX_CODE; i++)
24733 + if (rtx_next_new[i] == -1)
24734 + oprintf (f, " 0,\n");
24735 + else
24736 + oprintf (f,
24737 + " RTX_HDR_SIZE + %d * sizeof (rtunion),\n", rtx_next_new[i]);
24738 + oprintf (f, "};\n");
24741 +/* Handle `special("rtx_def")'. This is a special case for field
24742 + `fld' of struct rtx_def, which is an array of unions whose values
24743 + are based in a complex way on the type of RTL. */
24745 +static type_p
24746 +adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
24748 + pair_p flds = NULL;
24749 + options_p nodot;
24750 + int i;
24751 + type_p rtx_tp, rtvec_tp, tree_tp, mem_attrs_tp, note_union_tp, scalar_tp;
24752 + type_p basic_block_tp, reg_attrs_tp, constant_tp, symbol_union_tp;
24754 + if (t->kind != TYPE_UNION)
24756 + error_at_line (&lexer_line,
24757 + "special `rtx_def' must be applied to a union");
24758 + return &string_type;
24761 + nodot = create_string_option (NULL, "dot", "");
24763 + rtx_tp = create_pointer (find_structure ("rtx_def", 0));
24764 + rtvec_tp = create_pointer (find_structure ("rtvec_def", 0));
24765 + tree_tp = create_pointer (find_structure ("tree_node", 1));
24766 + mem_attrs_tp = create_pointer (find_structure ("mem_attrs", 0));
24767 + reg_attrs_tp =
24768 + create_pointer (find_structure ("reg_attrs", 0));
24769 + basic_block_tp =
24770 + create_pointer (find_structure ("basic_block_def", 0));
24771 + constant_tp =
24772 + create_pointer (find_structure ("constant_descriptor_rtx", 0));
24773 + scalar_tp = &scalar_nonchar; /* rtunion int */
24776 + pair_p note_flds = NULL;
24777 + int c;
24779 + for (c = 0; c <= NOTE_INSN_MAX; c++)
24781 + switch (c)
24783 + case NOTE_INSN_MAX:
24784 + case NOTE_INSN_DELETED_LABEL:
24785 + note_flds = create_field (note_flds, &string_type, "rt_str");
24786 + break;
24788 + case NOTE_INSN_BLOCK_BEG:
24789 + case NOTE_INSN_BLOCK_END:
24790 + note_flds = create_field (note_flds, tree_tp, "rt_tree");
24791 + break;
24793 + case NOTE_INSN_VAR_LOCATION:
24794 + note_flds = create_field (note_flds, rtx_tp, "rt_rtx");
24795 + break;
24797 + default:
24798 + note_flds = create_field (note_flds, scalar_tp, "rt_int");
24799 + break;
24801 + /* NOTE_INSN_MAX is used as the default field for line
24802 + number notes. */
24803 + if (c == NOTE_INSN_MAX)
24804 + note_flds->opt =
24805 + create_string_option (nodot, "default", "");
24806 + else
24807 + note_flds->opt =
24808 + create_string_option (nodot, "tag", note_insn_name[c]);
24810 + note_union_tp = new_structure ("rtx_def_note_subunion", 1,
24811 + &lexer_line, note_flds, NULL);
24813 + /* Create a type to represent the various forms of SYMBOL_REF_DATA. */
24815 + pair_p sym_flds;
24816 + sym_flds = create_field (NULL, tree_tp, "rt_tree");
24817 + sym_flds->opt = create_string_option (nodot, "default", "");
24818 + sym_flds = create_field (sym_flds, constant_tp, "rt_constant");
24819 + sym_flds->opt = create_string_option (nodot, "tag", "1");
24820 + symbol_union_tp = new_structure ("rtx_def_symbol_subunion", 1,
24821 + &lexer_line, sym_flds, NULL);
24823 + for (i = 0; i < NUM_RTX_CODE; i++)
24825 + pair_p subfields = NULL;
24826 + size_t aindex, nmindex;
24827 + const char *sname;
24828 + type_p substruct;
24829 + char *ftag;
24831 + for (aindex = 0; aindex < strlen (rtx_format[i]); aindex++)
24833 + type_p t;
24834 + const char *subname;
24836 + switch (rtx_format[i][aindex])
24838 + case '*':
24839 + case 'i':
24840 + case 'n':
24841 + case 'w':
24842 + t = scalar_tp;
24843 + subname = "rt_int";
24844 + break;
24846 + case '0':
24847 + if (i == MEM && aindex == 1)
24848 + t = mem_attrs_tp, subname = "rt_mem";
24849 + else if (i == JUMP_INSN && aindex == 8)
24850 + t = rtx_tp, subname = "rt_rtx";
24851 + else if (i == CODE_LABEL && aindex == 5)
24852 + t = scalar_tp, subname = "rt_int";
24853 + else if (i == CODE_LABEL && aindex == 4)
24854 + t = rtx_tp, subname = "rt_rtx";
24855 + else if (i == LABEL_REF && (aindex == 1 || aindex == 2))
24856 + t = rtx_tp, subname = "rt_rtx";
24857 + else if (i == NOTE && aindex == 4)
24858 + t = note_union_tp, subname = "";
24859 + else if (i == NOTE && aindex == 5)
24860 + t = scalar_tp, subname = "rt_int";
24861 + else if (i == NOTE && aindex >= 7)
24862 + t = scalar_tp, subname = "rt_int";
24863 + else if (i == ADDR_DIFF_VEC && aindex == 4)
24864 + t = scalar_tp, subname = "rt_int";
24865 + else if (i == VALUE && aindex == 0)
24866 + t = scalar_tp, subname = "rt_int";
24867 + else if (i == DEBUG_EXPR && aindex == 0)
24868 + t = tree_tp, subname = "rt_tree";
24869 + else if (i == REG && aindex == 1)
24870 + t = scalar_tp, subname = "rt_int";
24871 + else if (i == REG && aindex == 2)
24872 + t = reg_attrs_tp, subname = "rt_reg";
24873 + else if (i == SCRATCH && aindex == 0)
24874 + t = scalar_tp, subname = "rt_int";
24875 + else if (i == SYMBOL_REF && aindex == 1)
24876 + t = scalar_tp, subname = "rt_int";
24877 + else if (i == SYMBOL_REF && aindex == 2)
24878 + t = symbol_union_tp, subname = "";
24879 + else if (i == BARRIER && aindex >= 3)
24880 + t = scalar_tp, subname = "rt_int";
24881 + else
24883 + error_at_line
24884 + (&lexer_line,
24885 + "rtx type `%s' has `0' in position %lu, can't handle",
24886 + rtx_name[i], (unsigned long) aindex);
24887 + t = &string_type;
24888 + subname = "rt_int";
24890 + break;
24892 + case 's':
24893 + case 'S':
24894 + case 'T':
24895 + t = &string_type;
24896 + subname = "rt_str";
24897 + break;
24899 + case 'e':
24900 + case 'u':
24901 + t = rtx_tp;
24902 + subname = "rt_rtx";
24903 + break;
24905 + case 'E':
24906 + case 'V':
24907 + t = rtvec_tp;
24908 + subname = "rt_rtvec";
24909 + break;
24911 + case 't':
24912 + t = tree_tp;
24913 + subname = "rt_tree";
24914 + break;
24916 + case 'B':
24917 + t = basic_block_tp;
24918 + subname = "rt_bb";
24919 + break;
24921 + default:
24922 + error_at_line
24923 + (&lexer_line,
24924 + "rtx type `%s' has `%c' in position %lu, can't handle",
24925 + rtx_name[i], rtx_format[i][aindex],
24926 + (unsigned long) aindex);
24927 + t = &string_type;
24928 + subname = "rt_int";
24929 + break;
24932 + subfields = create_field (subfields, t,
24933 + xasprintf (".fld[%lu].%s",
24934 + (unsigned long) aindex,
24935 + subname));
24936 + subfields->opt = nodot;
24937 + if (t == note_union_tp)
24938 + subfields->opt =
24939 + create_string_option (subfields->opt, "desc",
24940 + "NOTE_KIND (&%0)");
24941 + if (t == symbol_union_tp)
24942 + subfields->opt =
24943 + create_string_option (subfields->opt, "desc",
24944 + "CONSTANT_POOL_ADDRESS_P (&%0)");
24947 + if (i == SYMBOL_REF)
24949 + /* Add the "block_sym" field if SYMBOL_REF_HAS_BLOCK_INFO_P
24950 + holds. */
24951 + type_p field_tp = find_structure ("block_symbol", 0);
24952 + subfields
24953 + = create_optional_field (subfields, field_tp, "block_sym",
24954 + "SYMBOL_REF_HAS_BLOCK_INFO_P (&%0)");
24957 + sname = xasprintf ("rtx_def_%s", rtx_name[i]);
24958 + substruct = new_structure (sname, 0, &lexer_line, subfields, NULL);
24960 + ftag = xstrdup (rtx_name[i]);
24961 + for (nmindex = 0; nmindex < strlen (ftag); nmindex++)
24962 + ftag[nmindex] = TOUPPER (ftag[nmindex]);
24963 + flds = create_field (flds, substruct, "");
24964 + flds->opt = create_string_option (nodot, "tag", ftag);
24966 + return new_structure ("rtx_def_subunion", 1, &lexer_line, flds, nodot);
24969 +/* Handle `special("tree_exp")'. This is a special case for
24970 + field `operands' of struct tree_exp, which although it claims to contain
24971 + pointers to trees, actually sometimes contains pointers to RTL too.
24972 + Passed T, the old type of the field, and OPT its options. Returns
24973 + a new type for the field. */
24975 +static type_p
24976 +adjust_field_tree_exp (type_p t, options_p opt ATTRIBUTE_UNUSED)
24978 + pair_p flds;
24979 + options_p nodot;
24981 + if (t->kind != TYPE_ARRAY)
24983 + error_at_line (&lexer_line,
24984 + "special `tree_exp' must be applied to an array");
24985 + return &string_type;
24988 + nodot = create_string_option (NULL, "dot", "");
24990 + flds = create_field (NULL, t, "");
24991 + flds->opt = create_string_option (nodot, "length",
24992 + "TREE_OPERAND_LENGTH ((tree) &%0)");
24993 + flds->opt = create_string_option (flds->opt, "default", "");
24995 + return new_structure ("tree_exp_subunion", 1, &lexer_line, flds, nodot);
24998 +/* Perform any special processing on a type T, about to become the type
24999 + of a field. Return the appropriate type for the field.
25000 + At present:
25001 + - Converts pointer-to-char, with no length parameter, to TYPE_STRING;
25002 + - Similarly for arrays of pointer-to-char;
25003 + - Converts structures for which a parameter is provided to
25004 + TYPE_PARAM_STRUCT;
25005 + - Handles "special" options.
25008 +type_p
25009 +adjust_field_type (type_p t, options_p opt)
25011 + int length_p = 0;
25012 + const int pointer_p = t->kind == TYPE_POINTER;
25013 + type_p params[NUM_PARAM];
25014 + int params_p = 0;
25015 + int i;
25017 + for (i = 0; i < NUM_PARAM; i++)
25018 + params[i] = NULL;
25020 + for (; opt; opt = opt->next)
25021 + if (strcmp (opt->name, "length") == 0)
25022 + length_p = 1;
25023 + else if ((strcmp (opt->name, "param_is") == 0
25024 + || (strncmp (opt->name, "param", 5) == 0
25025 + && ISDIGIT (opt->name[5])
25026 + && strcmp (opt->name + 6, "_is") == 0))
25027 + && opt->kind == OPTION_TYPE)
25029 + int num = ISDIGIT (opt->name[5]) ? opt->name[5] - '0' : 0;
25031 + if (!UNION_OR_STRUCT_P (t)
25032 + && (t->kind != TYPE_POINTER || !UNION_OR_STRUCT_P (t->u.p)))
25034 + error_at_line (&lexer_line,
25035 + "option `%s' may only be applied to structures or structure pointers",
25036 + opt->name);
25037 + return t;
25040 + params_p = 1;
25041 + if (params[num] != NULL)
25042 + error_at_line (&lexer_line, "duplicate `%s' option", opt->name);
25043 + if (!ISDIGIT (opt->name[5]))
25044 + params[num] = create_pointer (opt->info.type);
25045 + else
25046 + params[num] = opt->info.type;
25048 + else if (strcmp (opt->name, "special") == 0
25049 + && opt->kind == OPTION_STRING)
25051 + const char *special_name = opt->info.string;
25052 + if (strcmp (special_name, "tree_exp") == 0)
25053 + t = adjust_field_tree_exp (t, opt);
25054 + else if (strcmp (special_name, "rtx_def") == 0)
25055 + t = adjust_field_rtx_def (t, opt);
25056 + else
25057 + error_at_line (&lexer_line, "unknown special `%s'", special_name);
25060 + if (params_p)
25062 + type_p realt;
25064 + if (pointer_p)
25065 + t = t->u.p;
25066 + realt = find_param_structure (t, params);
25067 + t = pointer_p ? create_pointer (realt) : realt;
25070 + if (!length_p
25071 + && pointer_p && t->u.p->kind == TYPE_SCALAR && t->u.p->u.scalar_is_char)
25072 + return &string_type;
25073 + if (t->kind == TYPE_ARRAY && t->u.a.p->kind == TYPE_POINTER
25074 + && t->u.a.p->u.p->kind == TYPE_SCALAR
25075 + && t->u.a.p->u.p->u.scalar_is_char)
25076 + return create_array (&string_type, t->u.a.len);
25078 + return t;
25082 +static void set_gc_used_type (type_p, enum gc_used_enum, type_p *);
25083 +static void set_gc_used (pair_p);
25085 +/* Handle OPT for set_gc_used_type. */
25087 +static void
25088 +process_gc_options (options_p opt, enum gc_used_enum level, int *maybe_undef,
25089 + int *pass_param, int *length, int *skip,
25090 + type_p *nested_ptr)
25092 + options_p o;
25093 + for (o = opt; o; o = o->next)
25094 + if (strcmp (o->name, "ptr_alias") == 0 && level == GC_POINTED_TO
25095 + && o->kind == OPTION_TYPE)
25096 + set_gc_used_type (o->info.type,
25097 + GC_POINTED_TO, NULL);
25098 + else if (strcmp (o->name, "maybe_undef") == 0)
25099 + *maybe_undef = 1;
25100 + else if (strcmp (o->name, "use_params") == 0)
25101 + *pass_param = 1;
25102 + else if (strcmp (o->name, "length") == 0)
25103 + *length = 1;
25104 + else if (strcmp (o->name, "skip") == 0)
25105 + *skip = 1;
25106 + else if (strcmp (o->name, "nested_ptr") == 0
25107 + && o->kind == OPTION_NESTED)
25108 + *nested_ptr = ((const struct nested_ptr_data *) o->info.nested)->type;
25112 +/* Set the gc_used field of T to LEVEL, and handle the types it references. */
25113 +static void
25114 +set_gc_used_type (type_p t, enum gc_used_enum level, type_p param[NUM_PARAM])
25116 + if (t->gc_used >= level)
25117 + return;
25119 + t->gc_used = level;
25121 + switch (t->kind)
25123 + case TYPE_STRUCT:
25124 + case TYPE_UNION:
25126 + pair_p f;
25127 + int dummy;
25128 + type_p dummy2;
25130 + process_gc_options (t->u.s.opt, level, &dummy, &dummy, &dummy, &dummy,
25131 + &dummy2);
25133 + for (f = t->u.s.fields; f; f = f->next)
25135 + int maybe_undef = 0;
25136 + int pass_param = 0;
25137 + int length = 0;
25138 + int skip = 0;
25139 + type_p nested_ptr = NULL;
25140 + process_gc_options (f->opt, level, &maybe_undef, &pass_param,
25141 + &length, &skip, &nested_ptr);
25143 + if (nested_ptr && f->type->kind == TYPE_POINTER)
25144 + set_gc_used_type (nested_ptr, GC_POINTED_TO,
25145 + pass_param ? param : NULL);
25146 + else if (length && f->type->kind == TYPE_POINTER)
25147 + set_gc_used_type (f->type->u.p, GC_USED, NULL);
25148 + else if (maybe_undef && f->type->kind == TYPE_POINTER)
25149 + set_gc_used_type (f->type->u.p, GC_MAYBE_POINTED_TO, NULL);
25150 + else if (pass_param && f->type->kind == TYPE_POINTER && param)
25151 + set_gc_used_type (find_param_structure (f->type->u.p, param),
25152 + GC_POINTED_TO, NULL);
25153 + else if (skip)
25154 + ; /* target type is not used through this field */
25155 + else
25156 + set_gc_used_type (f->type, GC_USED, pass_param ? param : NULL);
25158 + break;
25161 + case TYPE_POINTER:
25162 + set_gc_used_type (t->u.p, GC_POINTED_TO, NULL);
25163 + break;
25165 + case TYPE_ARRAY:
25166 + set_gc_used_type (t->u.a.p, GC_USED, param);
25167 + break;
25169 + case TYPE_LANG_STRUCT:
25170 + for (t = t->u.s.lang_struct; t; t = t->next)
25171 + set_gc_used_type (t, level, param);
25172 + break;
25174 + case TYPE_PARAM_STRUCT:
25176 + int i;
25177 + for (i = 0; i < NUM_PARAM; i++)
25178 + if (t->u.param_struct.param[i] != 0)
25179 + set_gc_used_type (t->u.param_struct.param[i], GC_USED, NULL);
25181 + if (t->u.param_struct.stru->gc_used == GC_POINTED_TO)
25182 + level = GC_POINTED_TO;
25183 + else
25184 + level = GC_USED;
25185 + t->u.param_struct.stru->gc_used = GC_UNUSED;
25186 + set_gc_used_type (t->u.param_struct.stru, level,
25187 + t->u.param_struct.param);
25188 + break;
25190 + default:
25191 + break;
25195 +/* Set the gc_used fields of all the types pointed to by VARIABLES. */
25197 +static void
25198 +set_gc_used (pair_p variables)
25200 + int nbvars = 0;
25201 + pair_p p;
25202 + for (p = variables; p; p = p->next)
25204 + set_gc_used_type (p->type, GC_USED, NULL);
25205 + nbvars++;
25206 + };
25207 + if (verbosity_level >= 2)
25208 + printf ("%s used %d GTY-ed variables\n", progname, nbvars);
25211 +/* File mapping routines. For each input file, there is one output .c file
25212 + (but some output files have many input files), and there is one .h file
25213 + for the whole build. */
25215 +/* Output file handling. */
25217 +/* Create and return an outf_p for a new file for NAME, to be called
25218 + ONAME. */
25220 +static outf_p
25221 +create_file (const char *name, const char *oname)
25223 + static const char *const hdr[] = {
25224 + " Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.\n",
25225 + "\n",
25226 + "This file is part of GCC.\n",
25227 + "\n",
25228 + "GCC is free software; you can redistribute it and/or modify it under\n",
25229 + "the terms of the GNU General Public License as published by the Free\n",
25230 + "Software Foundation; either version 3, or (at your option) any later\n",
25231 + "version.\n",
25232 + "\n",
25233 + "GCC is distributed in the hope that it will be useful, but WITHOUT ANY\n",
25234 + "WARRANTY; without even the implied warranty of MERCHANTABILITY or\n",
25235 + "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n",
25236 + "for more details.\n",
25237 + "\n",
25238 + "You should have received a copy of the GNU General Public License\n",
25239 + "along with GCC; see the file COPYING3. If not see\n",
25240 + "<http://www.gnu.org/licenses/>. */\n",
25241 + "\n",
25242 + "/* This file is machine generated. Do not edit. */\n"
25243 + };
25244 + outf_p f;
25245 + size_t i;
25247 + gcc_assert (name != NULL);
25248 + gcc_assert (oname != NULL);
25249 + f = XCNEW (struct outf);
25250 + f->next = output_files;
25251 + f->name = oname;
25252 + output_files = f;
25254 + oprintf (f, "/* Type information for %s.\n", name);
25255 + for (i = 0; i < ARRAY_SIZE (hdr); i++)
25256 + oprintf (f, "%s", hdr[i]);
25257 + return f;
25260 +/* Print, like fprintf, to O.
25261 + N.B. You might think this could be implemented more efficiently
25262 + with vsnprintf(). Unfortunately, there are C libraries that
25263 + provide that function but without the C99 semantics for its return
25264 + value, making it impossible to know how much space is required. */
25265 +void
25266 +oprintf (outf_p o, const char *format, ...)
25268 + char *s;
25269 + size_t slength;
25270 + va_list ap;
25272 + /* In plugin mode, the O could be a NULL pointer, so avoid crashing
25273 + in that case. */
25274 + if (!o)
25275 + return;
25277 + va_start (ap, format);
25278 + slength = vasprintf (&s, format, ap);
25279 + if (s == NULL || (int) slength < 0)
25280 + fatal ("out of memory");
25281 + va_end (ap);
25283 + if (o->bufused + slength > o->buflength)
25285 + size_t new_len = o->buflength;
25286 + if (new_len == 0)
25287 + new_len = 1024;
25288 + do
25290 + new_len *= 2;
25292 + while (o->bufused + slength >= new_len);
25293 + o->buf = XRESIZEVEC (char, o->buf, new_len);
25294 + o->buflength = new_len;
25296 + memcpy (o->buf + o->bufused, s, slength);
25297 + o->bufused += slength;
25298 + free (s);
25301 +/* Open the global header file and the language-specific header files. */
25303 +static void
25304 +open_base_files (void)
25306 + size_t i;
25308 + if (nb_plugin_files > 0 && plugin_files)
25309 + return;
25311 + header_file = create_file ("GCC", "gtype-desc.h");
25313 + base_files = XNEWVEC (outf_p, num_lang_dirs);
25315 + for (i = 0; i < num_lang_dirs; i++)
25316 + base_files[i] = create_file (lang_dir_names[i],
25317 + xasprintf ("gtype-%s.h", lang_dir_names[i]));
25319 + /* gtype-desc.c is a little special, so we create it here. */
25321 + /* The order of files here matters very much. */
25322 + static const char *const ifiles[] = {
25323 + "config.h", "system.h", "coretypes.h", "tm.h",
25324 + "hashtab.h", "splay-tree.h", "obstack.h", "bitmap.h", "input.h",
25325 + "tree.h", "rtl.h", "function.h", "insn-config.h", "expr.h",
25326 + "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
25327 + "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
25328 + "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
25329 + "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h",
25330 + "target.h", "ipa-prop.h", "lto-streamer.h", "target-globals.h", NULL
25331 + };
25332 + const char *const *ifp;
25333 + outf_p gtype_desc_c;
25335 + gtype_desc_c = create_file ("GCC", "gtype-desc.c");
25336 + for (ifp = ifiles; *ifp; ifp++)
25337 + oprintf (gtype_desc_c, "#include \"%s\"\n", *ifp);
25339 + /* Make sure we handle "cfun" specially. */
25340 + oprintf (gtype_desc_c, "\n/* See definition in function.h. */\n");
25341 + oprintf (gtype_desc_c, "#undef cfun\n");
25345 +/* For INPF an input file, return the real basename of INPF, with all
25346 + the directory components skipped. */
25348 +static const char *
25349 +get_file_realbasename (const input_file *inpf)
25351 + const char *f = get_input_file_name (inpf);
25352 + const char *lastslash = strrchr (f, '/');
25354 + return (lastslash != NULL) ? lastslash + 1 : f;
25357 +/* For INPF a filename, return the relative path to INPF from
25358 + $(srcdir) if the latter is a prefix in INPF, NULL otherwise. */
25360 +const char *
25361 +get_file_srcdir_relative_path (const input_file *inpf)
25363 + const char *f = get_input_file_name (inpf);
25364 + if (strlen (f) > srcdir_len
25365 + && IS_DIR_SEPARATOR (f[srcdir_len])
25366 + && strncmp (f, srcdir, srcdir_len) == 0)
25367 + return f + srcdir_len + 1;
25368 + else
25369 + return NULL;
25372 +/* For INPF an input_file, return the relative path to INPF from
25373 + $(srcdir) if the latter is a prefix in INPF, or the real basename
25374 + of INPF otherwise. */
25376 +static const char *
25377 +get_file_basename (const input_file *inpf)
25379 + const char *srcdir_path = get_file_srcdir_relative_path (inpf);
25381 + return (srcdir_path != NULL) ? srcdir_path : get_file_realbasename (inpf);
25384 +/* For F a filename, return the lang_dir_names relative index of the language
25385 + directory that is a prefix in F, if any, -1 otherwise. */
25387 +static int
25388 +get_prefix_langdir_index (const char *f)
25390 + size_t f_len = strlen (f);
25391 + size_t lang_index;
25393 + for (lang_index = 0; lang_index < num_lang_dirs; lang_index++)
25395 + const char *langdir = lang_dir_names[lang_index];
25396 + size_t langdir_len = strlen (langdir);
25398 + if (f_len > langdir_len
25399 + && IS_DIR_SEPARATOR (f[langdir_len])
25400 + && memcmp (f, langdir, langdir_len) == 0)
25401 + return lang_index;
25404 + return -1;
25407 +/* For INPF an input file, return the name of language directory where
25408 + F is located, if any, NULL otherwise. */
25410 +static const char *
25411 +get_file_langdir (const input_file *inpf)
25413 + /* Get the relative path to INPF from $(srcdir) and find the
25414 + language by comparing the prefix with language directory names.
25415 + If INPF is not even srcdir relative, no point in looking
25416 + further. */
25418 + int lang_index;
25419 + const char *srcdir_relative_path = get_file_srcdir_relative_path (inpf);
25420 + const char *r;
25422 + if (!srcdir_relative_path)
25423 + return NULL;
25425 + lang_index = get_prefix_langdir_index (srcdir_relative_path);
25426 + if (lang_index < 0 && strncmp (srcdir_relative_path, "c-family", 8) == 0)
25427 + r = "c-family";
25428 + else if (lang_index >= 0)
25429 + r = lang_dir_names[lang_index];
25430 + else
25431 + r = NULL;
25433 + return r;
25436 +/* The gt- output file name for INPF. */
25438 +static const char *
25439 +get_file_gtfilename (const input_file *inpf)
25441 + /* Cook up an initial version of the gt- file name from the file real
25442 + basename and the language name, if any. */
25444 + const char *basename = get_file_realbasename (inpf);
25445 + const char *langdir = get_file_langdir (inpf);
25447 + char *result =
25448 + (langdir ? xasprintf ("gt-%s-%s", langdir, basename)
25449 + : xasprintf ("gt-%s", basename));
25451 + /* Then replace all non alphanumerics characters by '-' and change the
25452 + extension to ".h". We expect the input filename extension was at least
25453 + one character long. */
25455 + char *s = result;
25457 + for (; *s != '.'; s++)
25458 + if (!ISALNUM (*s) && *s != '-')
25459 + *s = '-';
25461 + memcpy (s, ".h", sizeof (".h"));
25463 + return result;
25466 +/* Each input_file has its associated output file outf_p. The
25467 + association is computed by the function
25468 + get_output_file_with_visibility. The associated file is cached
25469 + inside input_file in its inpoutf field, so is really computed only
25470 + once. Associated output file paths (i.e. output_name-s) are
25471 + computed by a rule based regexp machinery, using the files_rules
25472 + array of struct file_rule_st. A for_name is also computed, giving
25473 + the source file name for which the output_file is generated; it is
25474 + often the last component of the input_file path. */
25478 + Regexpr machinery to compute the output_name and for_name-s of each
25479 + input_file. We have a sequence of file rules which gives the POSIX
25480 + extended regular expression to match an input file path, and two
25481 + transformed strings for the corresponding output_name and the
25482 + corresponding for_name. The transformed string contain dollars: $0
25483 + is replaced by the entire match, $1 is replaced by the substring
25484 + matching the first parenthesis in the regexp, etc. And $$ is replaced
25485 + by a single verbatim dollar. The rule order is important. The
25486 + general case is last, and the particular cases should come before.
25487 + An action routine can, when needed, update the out_name & for_name
25488 + and/or return the appropriate output file. It is invoked only when a
25489 + rule is triggered. When a rule is triggered, the output_name and
25490 + for_name are computed using their transform string in while $$, $0,
25491 + $1, ... are suitably replaced. If there is an action, it is called.
25492 + In some few cases, the action can directly return the outf_p, but
25493 + usually it just updates the output_name and for_name so should free
25494 + them before replacing them. The get_output_file_with_visibility
25495 + function creates an outf_p only once per each output_name, so it
25496 + scans the output_files list for previously seen output file names.
25497 + */
25499 +/* Signature of actions in file rules. */
25500 +typedef outf_p (frul_actionrout_t) (input_file*, char**, char**);
25503 +struct file_rule_st {
25504 + const char* frul_srcexpr; /* Source string for regexp. */
25505 + int frul_rflags; /* Flags passed to regcomp, usually
25506 + * REG_EXTENDED. */
25507 + regex_t* frul_re; /* Compiled regular expression
25508 + obtained by regcomp. */
25509 + const char* frul_tr_out; /* Transformation string for making
25510 + * the output_name, with $1 ... $9 for
25511 + * subpatterns and $0 for the whole
25512 + * matched filename. */
25513 + const char* frul_tr_for; /* Tranformation string for making the
25514 + for_name. */
25515 + frul_actionrout_t* frul_action; /* The action, if non null, is
25516 + * called once the rule matches, on
25517 + * the transformed out_name &
25518 + * for_name. It could change them
25519 + * and/or give the output file. */
25522 +/* File rule action handling *.h files. */
25523 +static outf_p header_dot_h_frul (input_file*, char**, char**);
25525 +/* File rule action handling *.c files. */
25526 +static outf_p source_dot_c_frul (input_file*, char**, char**);
25528 +#define NULL_REGEX (regex_t*)0
25530 +/* The prefix in our regexp-s matching the directory. */
25531 +#define DIR_PREFIX_REGEX "^(([^/]*/)*)"
25533 +#define NULL_FRULACT (frul_actionrout_t*)0
25535 +/* The array of our rules governing file name generation. Rules order
25536 + matters, so change with extreme care! */
25538 +struct file_rule_st files_rules[] = {
25539 + /* the c-family/ source directory is special. */
25540 + { DIR_PREFIX_REGEX "c-family/([[:alnum:]_-]*)\\.c$",
25541 + REG_EXTENDED, NULL_REGEX,
25542 + "gt-c-family-$3.h", "c-family/$3.c", NULL_FRULACT},
25544 + { DIR_PREFIX_REGEX "c-family/([[:alnum:]_-]*)\\.h$",
25545 + REG_EXTENDED, NULL_REGEX,
25546 + "gt-c-family-$3.h", "c-family/$3.h", NULL_FRULACT},
25548 + /* Both c-lang.h & c-tree.h gives gt-c-decl.h for c-decl.c ! */
25549 + { DIR_PREFIX_REGEX "c-lang\\.h$",
25550 + REG_EXTENDED, NULL_REGEX, "gt-c-decl.h", "c-decl.c", NULL_FRULACT},
25552 + { DIR_PREFIX_REGEX "c-tree\\.h$",
25553 + REG_EXTENDED, NULL_REGEX, "gt-c-decl.h", "c-decl.c", NULL_FRULACT},
25555 + /* cp/cp-tree.h gives gt-cp-tree.h for cp/tree.c ! */
25556 + { DIR_PREFIX_REGEX "cp/cp-tree\\.h$",
25557 + REG_EXTENDED, NULL_REGEX,
25558 + "gt-cp-tree.h", "cp/tree.c", NULL_FRULACT },
25560 + /* cp/decl.h & cp/decl.c gives gt-cp-decl.h for cp/decl.c ! */
25561 + { DIR_PREFIX_REGEX "cp/decl\\.[ch]$",
25562 + REG_EXTENDED, NULL_REGEX,
25563 + "gt-cp-decl.h", "cp/decl.c", NULL_FRULACT },
25565 + /* cp/name-lookup.h gives gt-cp-name-lookup.h for cp/name-lookup.c ! */
25566 + { DIR_PREFIX_REGEX "cp/name-lookup\\.h$",
25567 + REG_EXTENDED, NULL_REGEX,
25568 + "gt-cp-name-lookup.h", "cp/name-lookup.c", NULL_FRULACT },
25570 + /* objc/objc-act.h fives gt-objc-objc-act.h for objc/objc-act.c ! */
25571 + { DIR_PREFIX_REGEX "objc/objc-act\\.h$",
25572 + REG_EXTENDED, NULL_REGEX,
25573 + "gt-objc-objc-act.h", "objc/objc-act.c", NULL_FRULACT },
25575 + /* General cases. For header *.h and source *.c files, we need
25576 + * special actions to handle the language. */
25578 + /* Source *.c files are using get_file_gtfilename to compute their
25579 + output_name and get_file_basename to compute their for_name
25580 + thru the source_dot_c_frul action. */
25581 + { DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.c$",
25582 + REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.c", source_dot_c_frul},
25583 + /* Common header files get "gtype-desc.c" as their output_name,
25584 + * while language specific header files are handled specially. So
25585 + * we need the header_dot_h_frul action. */
25586 + { DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.h$",
25587 + REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.h", header_dot_h_frul},
25589 + { DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.in$",
25590 + REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.in", NULL_FRULACT},
25592 + /* Mandatory null last entry signaling end of rules. */
25593 + {NULL, 0, NULL_REGEX, NULL, NULL, NULL_FRULACT}
25596 +/* Special file rules action for handling *.h header files. It gives
25597 + "gtype-desc.c" for common headers and corresponding output
25598 + files for language-specific header files. */
25599 +static outf_p
25600 +header_dot_h_frul (input_file* inpf, char**poutname,
25601 + char**pforname ATTRIBUTE_UNUSED)
25603 + const char *basename = 0;
25604 + int lang_index = 0;
25605 + DBGPRINTF ("inpf %p inpname %s outname %s forname %s",
25606 + (void*) inpf, get_input_file_name (inpf),
25607 + *poutname, *pforname);
25608 + basename = get_file_basename (inpf);
25609 + lang_index = get_prefix_langdir_index (basename);
25610 + DBGPRINTF ("basename %s lang_index %d", basename, lang_index);
25612 + if (lang_index >= 0)
25614 + /* The header is language specific. Given output_name &
25615 + for_name remains unchanged. The base_files array gives the
25616 + outf_p. */
25617 + DBGPRINTF ("header_dot_h found language specific @ %p '%s'",
25618 + (void*) base_files[lang_index],
25619 + (base_files[lang_index])->name);
25620 + return base_files[lang_index];
25622 + else
25624 + /* The header is common to all front-end languages. So
25625 + output_name is "gtype-desc.c" file. The calling function
25626 + get_output_file_with_visibility will find its outf_p. */
25627 + free (*poutname);
25628 + *poutname = xstrdup ("gtype-desc.c");
25629 + DBGPRINTF ("special 'gtype-desc.c' for inpname %s",
25630 + get_input_file_name (inpf));
25631 + return NULL;
25636 +/* Special file rules action for handling *.c source files using
25637 + * get_file_gtfilename to compute their output_name and
25638 + * get_file_basename to compute their for_name. The output_name is
25639 + * gt-<LANG>-<BASE>.h for language specific source files, and
25640 + * gt-<BASE>.h for common source files. */
25641 +static outf_p
25642 +source_dot_c_frul (input_file* inpf, char**poutname, char**pforname)
25644 + char *newbasename = CONST_CAST (char*, get_file_basename (inpf));
25645 + char *newoutname = CONST_CAST (char*, get_file_gtfilename (inpf));
25646 + DBGPRINTF ("inpf %p inpname %s original outname %s forname %s",
25647 + (void*) inpf, get_input_file_name (inpf),
25648 + *poutname, *pforname);
25649 + DBGPRINTF ("newoutname %s", newoutname);
25650 + DBGPRINTF ("newbasename %s", newbasename);
25651 + free (*poutname);
25652 + free (*pforname);
25653 + *poutname = newoutname;
25654 + *pforname = newbasename;
25655 + return NULL;
25658 +/* Utility function for get_output_file_with_visibility which returns
25659 + * a malloc-ed substituted string using TRS on matching of the FILNAM
25660 + * file name, using the PMATCH array. */
25661 +static char*
25662 +matching_file_name_substitute (const char *filnam, regmatch_t pmatch[10],
25663 + const char *trs)
25665 + struct obstack str_obstack;
25666 + char *str = NULL;
25667 + char *rawstr = NULL;
25668 + const char *pt = NULL;
25669 + DBGPRINTF ("filnam %s", filnam);
25670 + obstack_init (&str_obstack);
25671 + for (pt = trs; *pt; pt++) {
25672 + char c = *pt;
25673 + if (c == '$')
25675 + if (pt[1] == '$')
25677 + /* A double dollar $$ is substituted by a single verbatim
25678 + dollar, but who really uses dollar signs in file
25679 + paths? */
25680 + obstack_1grow (&str_obstack, '$');
25682 + else if (ISDIGIT (pt[1]))
25684 + /* Handle $0 $1 ... $9 by appropriate substitution. */
25685 + int dolnum = pt[1] - '0';
25686 + int so = pmatch[dolnum].rm_so;
25687 + int eo = pmatch[dolnum].rm_eo;
25688 + DBGPRINTF ("so=%d eo=%d dolnum=%d", so, eo, dolnum);
25689 + if (so>=0 && eo>=so)
25690 + obstack_grow (&str_obstack, filnam + so, eo - so);
25692 + else
25694 + /* This can happen only when files_rules is buggy! */
25695 + gcc_unreachable();
25697 + /* Always skip the character after the dollar. */
25698 + pt++;
25700 + else
25701 + obstack_1grow (&str_obstack, c);
25703 + obstack_1grow (&str_obstack, '\0');
25704 + rawstr = XOBFINISH (&str_obstack, char *);
25705 + str = xstrdup (rawstr);
25706 + obstack_free (&str_obstack, rawstr);
25707 + DBGPRINTF ("matched replacement %s", str);
25708 + rawstr = NULL;
25709 + return str;
25713 +/* An output file, suitable for definitions, that can see declarations
25714 + made in INPF and is linked into every language that uses INPF.
25715 + Since the the result is cached inside INPF, that argument cannot be
25716 + declared constant, but is "almost" constant. */
25718 +outf_p
25719 +get_output_file_with_visibility (input_file *inpf)
25721 + outf_p r;
25722 + char *for_name = NULL;
25723 + char *output_name = NULL;
25724 + const char* inpfname;
25726 + /* This can happen when we need a file with visibility on a
25727 + structure that we've never seen. We have to just hope that it's
25728 + globally visible. */
25729 + if (inpf == NULL)
25730 + inpf = system_h_file;
25732 + /* The result is cached in INPF, so return it if already known. */
25733 + if (inpf->inpoutf)
25734 + return inpf->inpoutf;
25736 + /* In plugin mode, return NULL unless the input_file is one of the
25737 + plugin_files. */
25738 + if (plugin_files)
25740 + size_t i;
25741 + for (i = 0; i < nb_plugin_files; i++)
25742 + if (inpf == plugin_files[i])
25744 + inpf->inpoutf = plugin_output;
25745 + return plugin_output;
25748 + return NULL;
25751 + inpfname = get_input_file_name (inpf);
25753 + /* Try each rule in sequence in files_rules until one is triggered. */
25755 + int rulix = 0;
25756 + DBGPRINTF ("passing input file @ %p named %s thru the files_rules",
25757 + (void*) inpf, inpfname);
25759 + for (; files_rules[rulix].frul_srcexpr != NULL; rulix++)
25761 + DBGPRINTF ("rulix#%d srcexpr %s",
25762 + rulix, files_rules[rulix].frul_srcexpr);
25764 + if (!files_rules[rulix].frul_re)
25766 + /* Compile the regexpr lazily. */
25767 + int err = 0;
25768 + files_rules[rulix].frul_re = XCNEW (regex_t);
25769 + err = regcomp (files_rules[rulix].frul_re,
25770 + files_rules[rulix].frul_srcexpr,
25771 + files_rules[rulix].frul_rflags);
25772 + if (err)
25774 + /* The regular expression compilation fails only when
25775 + file_rules is buggy. */
25776 + gcc_unreachable ();
25780 + output_name = NULL;
25781 + for_name = NULL;
25783 + /* Match the regexpr and trigger the rule if matched. */
25785 + /* We have exactly ten pmatch-s, one for each $0, $1, $2,
25786 + $3, ... $9. */
25787 + regmatch_t pmatch[10];
25788 + memset (pmatch, 0, sizeof (pmatch));
25789 + if (!regexec (files_rules[rulix].frul_re,
25790 + inpfname, 10, pmatch, 0))
25792 + DBGPRINTF ("input @ %p filename %s matched rulix#%d pattern %s",
25793 + (void*) inpf, inpfname, rulix,
25794 + files_rules[rulix].frul_srcexpr);
25795 + for_name =
25796 + matching_file_name_substitute (inpfname, pmatch,
25797 + files_rules[rulix].frul_tr_for);
25798 + DBGPRINTF ("for_name %s", for_name);
25799 + output_name =
25800 + matching_file_name_substitute (inpfname, pmatch,
25801 + files_rules[rulix].frul_tr_out);
25802 + DBGPRINTF ("output_name %s", output_name);
25803 + if (files_rules[rulix].frul_action)
25805 + /* Invoke our action routine. */
25806 + outf_p of = NULL;
25807 + DBGPRINTF ("before action rulix#%d output_name %s for_name %s",
25808 + rulix, output_name, for_name);
25809 + of =
25810 + (files_rules[rulix].frul_action) (inpf,
25811 + &output_name, &for_name);
25812 + DBGPRINTF ("after action rulix#%d of=%p output_name %s for_name %s",
25813 + rulix, (void*)of, output_name, for_name);
25814 + /* If the action routine returned something, give it back
25815 + immediately and cache it in inpf. */
25816 + if (of)
25818 + inpf->inpoutf = of;
25819 + return of;
25822 + /* The rule matched, and had no action, or that action did
25823 + not return any output file but could have changed the
25824 + output_name or for_name. We break out of the loop on the
25825 + files_rules. */
25826 + break;
25828 + else
25830 + /* The regexpr did not match. */
25831 + DBGPRINTF ("rulix#%d did not match %s pattern %s",
25832 + rulix, inpfname, files_rules[rulix].frul_srcexpr);
25833 + continue;
25838 + if (!output_name || !for_name)
25840 + /* This is impossible, and could only happen if the files_rules is
25841 + incomplete or buggy. */
25842 + gcc_unreachable ();
25845 + /* Look through to see if we've ever seen this output filename
25846 + before. If found, cache the result in inpf. */
25847 + for (r = output_files; r; r = r->next)
25848 + if (strcmp (r->name, output_name) == 0)
25850 + inpf->inpoutf = r;
25851 + DBGPRINTF ("found r @ %p for output_name %s for_name %s", (void*)r,
25852 + output_name, for_name);
25853 + return r;
25856 + /* If not found, create it, and cache it in inpf. */
25857 + r = create_file (for_name, output_name);
25859 + gcc_assert (r && r->name);
25860 + DBGPRINTF ("created r @ %p for output_name %s for_name %s", (void*) r,
25861 + output_name, for_name);
25862 + inpf->inpoutf = r;
25863 + return r;
25868 +/* The name of an output file, suitable for definitions, that can see
25869 + declarations made in INPF and is linked into every language that
25870 + uses INPF. */
25872 +const char *
25873 +get_output_file_name (input_file* inpf)
25875 + outf_p o = get_output_file_with_visibility (inpf);
25876 + if (o)
25877 + return o->name;
25878 + return NULL;
25881 +/* Check if existing file is equal to the in memory buffer. */
25883 +static bool
25884 +is_file_equal (outf_p of)
25886 + FILE *newfile = fopen (of->name, "r");
25887 + size_t i;
25888 + bool equal;
25889 + if (newfile == NULL)
25890 + return false;
25892 + equal = true;
25893 + for (i = 0; i < of->bufused; i++)
25895 + int ch;
25896 + ch = fgetc (newfile);
25897 + if (ch == EOF || ch != (unsigned char) of->buf[i])
25899 + equal = false;
25900 + break;
25903 + fclose (newfile);
25904 + return equal;
25907 +/* Copy the output to its final destination,
25908 + but don't unnecessarily change modification times. */
25910 +static void
25911 +close_output_files (void)
25913 + int nbwrittenfiles = 0;
25914 + outf_p of;
25916 + for (of = output_files; of; of = of->next)
25919 + if (!is_file_equal (of))
25921 + FILE *newfile = NULL;
25922 + char *backupname = NULL;
25923 + /* Back up the old version of the output file gt-FOO.c as
25924 + BACKUPDIR/gt-FOO.c~ if we have a backup directory. */
25925 + if (backup_dir)
25927 + backupname = concat (backup_dir, "/",
25928 + lbasename (of->name), "~", NULL);
25929 + if (!access (of->name, F_OK) && rename (of->name, backupname))
25930 + fatal ("failed to back up %s as %s: %s",
25931 + of->name, backupname, xstrerror (errno));
25934 + newfile = fopen (of->name, "w");
25935 + if (newfile == NULL)
25936 + fatal ("opening output file %s: %s", of->name, xstrerror (errno));
25937 + if (fwrite (of->buf, 1, of->bufused, newfile) != of->bufused)
25938 + fatal ("writing output file %s: %s", of->name, xstrerror (errno));
25939 + if (fclose (newfile) != 0)
25940 + fatal ("closing output file %s: %s", of->name, xstrerror (errno));
25941 + nbwrittenfiles++;
25942 + if (verbosity_level >= 2 && backupname)
25943 + printf ("%s wrote #%-3d %s backed-up in %s\n",
25944 + progname, nbwrittenfiles, of->name, backupname);
25945 + else if (verbosity_level >= 1)
25946 + printf ("%s write #%-3d %s\n", progname, nbwrittenfiles, of->name);
25947 + free (backupname);
25949 + else
25950 + {
25951 + /* output file remains unchanged. */
25952 + if (verbosity_level >= 2)
25953 + printf ("%s keep %s\n", progname, of->name);
25955 + free (of->buf);
25956 + of->buf = NULL;
25957 + of->bufused = of->buflength = 0;
25959 + if (verbosity_level >= 1)
25960 + printf ("%s wrote %d files.\n", progname, nbwrittenfiles);
25963 +struct flist
25965 + struct flist *next;
25966 + int started_p;
25967 + const input_file* file;
25968 + outf_p f;
25971 +struct walk_type_data;
25973 +/* For scalars and strings, given the item in 'val'.
25974 + For structures, given a pointer to the item in 'val'.
25975 + For misc. pointers, given the item in 'val'.
25977 +typedef void (*process_field_fn) (type_p f, const struct walk_type_data * p);
25978 +typedef void (*func_name_fn) (type_p s, const struct walk_type_data * p);
25980 +/* Parameters for write_types. */
25982 +struct write_types_data
25984 + const char *prefix;
25985 + const char *param_prefix;
25986 + const char *subfield_marker_routine;
25987 + const char *marker_routine;
25988 + const char *reorder_note_routine;
25989 + const char *comment;
25990 + int skip_hooks; /* skip hook generation if non zero */
25993 +static void output_escaped_param (struct walk_type_data *d,
25994 + const char *, const char *);
25995 +static void output_mangled_typename (outf_p, const_type_p);
25996 +static void walk_type (type_p t, struct walk_type_data *d);
25997 +static void write_func_for_structure (type_p orig_s, type_p s, type_p *param,
25998 + const struct write_types_data *wtd);
25999 +static void write_types_process_field
26000 + (type_p f, const struct walk_type_data *d);
26001 +static void write_types (outf_p output_header,
26002 + type_p structures,
26003 + type_p param_structs,
26004 + const struct write_types_data *wtd);
26005 +static void write_types_local_process_field
26006 + (type_p f, const struct walk_type_data *d);
26007 +static void write_local_func_for_structure
26008 + (const_type_p orig_s, type_p s, type_p *param);
26009 +static void write_local (outf_p output_header,
26010 + type_p structures, type_p param_structs);
26011 +static void write_enum_defn (type_p structures, type_p param_structs);
26012 +static int contains_scalar_p (type_p t);
26013 +static void put_mangled_filename (outf_p, const input_file *);
26014 +static void finish_root_table (struct flist *flp, const char *pfx,
26015 + const char *tname, const char *lastname,
26016 + const char *name);
26017 +static void write_root (outf_p, pair_p, type_p, const char *, int,
26018 + struct fileloc *, const char *, bool);
26019 +static void write_array (outf_p f, pair_p v,
26020 + const struct write_types_data *wtd);
26021 +static void write_roots (pair_p, bool);
26023 +/* Parameters for walk_type. */
26025 +struct walk_type_data
26027 + process_field_fn process_field;
26028 + const void *cookie;
26029 + outf_p of;
26030 + options_p opt;
26031 + const char *val;
26032 + const char *prev_val[4];
26033 + int indent;
26034 + int counter;
26035 + const struct fileloc *line;
26036 + lang_bitmap bitmap;
26037 + type_p *param;
26038 + int used_length;
26039 + type_p orig_s;
26040 + const char *reorder_fn;
26041 + bool needs_cast_p;
26042 + bool fn_wants_lvalue;
26045 +/* Print a mangled name representing T to OF. */
26047 +static void
26048 +output_mangled_typename (outf_p of, const_type_p t)
26050 + if (t == NULL)
26051 + oprintf (of, "Z");
26052 + else
26053 + switch (t->kind)
26055 + case TYPE_NONE:
26056 + gcc_unreachable ();
26057 + break;
26058 + case TYPE_POINTER:
26059 + oprintf (of, "P");
26060 + output_mangled_typename (of, t->u.p);
26061 + break;
26062 + case TYPE_SCALAR:
26063 + oprintf (of, "I");
26064 + break;
26065 + case TYPE_STRING:
26066 + oprintf (of, "S");
26067 + break;
26068 + case TYPE_STRUCT:
26069 + case TYPE_UNION:
26070 + case TYPE_LANG_STRUCT:
26071 + oprintf (of, "%lu%s", (unsigned long) strlen (t->u.s.tag),
26072 + t->u.s.tag);
26073 + break;
26074 + case TYPE_PARAM_STRUCT:
26076 + int i;
26077 + for (i = 0; i < NUM_PARAM; i++)
26078 + if (t->u.param_struct.param[i] != NULL)
26079 + output_mangled_typename (of, t->u.param_struct.param[i]);
26080 + output_mangled_typename (of, t->u.param_struct.stru);
26082 + break;
26083 + case TYPE_ARRAY:
26084 + gcc_unreachable ();
26088 +/* Print PARAM to D->OF processing escapes. D->VAL references the
26089 + current object, D->PREV_VAL the object containing the current
26090 + object, ONAME is the name of the option and D->LINE is used to
26091 + print error messages. */
26093 +static void
26094 +output_escaped_param (struct walk_type_data *d, const char *param,
26095 + const char *oname)
26097 + const char *p;
26099 + for (p = param; *p; p++)
26100 + if (*p != '%')
26101 + oprintf (d->of, "%c", *p);
26102 + else
26103 + switch (*++p)
26105 + case 'h':
26106 + oprintf (d->of, "(%s)", d->prev_val[2]);
26107 + break;
26108 + case '0':
26109 + oprintf (d->of, "(%s)", d->prev_val[0]);
26110 + break;
26111 + case '1':
26112 + oprintf (d->of, "(%s)", d->prev_val[1]);
26113 + break;
26114 + case 'a':
26116 + const char *pp = d->val + strlen (d->val);
26117 + while (pp[-1] == ']')
26118 + while (*pp != '[')
26119 + pp--;
26120 + oprintf (d->of, "%s", pp);
26122 + break;
26123 + default:
26124 + error_at_line (d->line, "`%s' option contains bad escape %c%c",
26125 + oname, '%', *p);
26129 +/* Call D->PROCESS_FIELD for every field (or subfield) of D->VAL,
26130 + which is of type T. Write code to D->OF to constrain execution (at
26131 + the point that D->PROCESS_FIELD is called) to the appropriate
26132 + cases. Call D->PROCESS_FIELD on subobjects before calling it on
26133 + pointers to those objects. D->PREV_VAL lists the objects
26134 + containing the current object, D->OPT is a list of options to
26135 + apply, D->INDENT is the current indentation level, D->LINE is used
26136 + to print error messages, D->BITMAP indicates which languages to
26137 + print the structure for, and D->PARAM is the current parameter
26138 + (from an enclosing param_is option). */
26140 +static void
26141 +walk_type (type_p t, struct walk_type_data *d)
26143 + const char *length = NULL;
26144 + const char *desc = NULL;
26145 + int maybe_undef_p = 0;
26146 + int use_param_num = -1;
26147 + int use_params_p = 0;
26148 + options_p oo;
26149 + const struct nested_ptr_data *nested_ptr_d = NULL;
26151 + d->needs_cast_p = false;
26152 + for (oo = d->opt; oo; oo = oo->next)
26153 + if (strcmp (oo->name, "length") == 0 && oo->kind == OPTION_STRING)
26154 + length = oo->info.string;
26155 + else if (strcmp (oo->name, "maybe_undef") == 0)
26156 + maybe_undef_p = 1;
26157 + else if (strncmp (oo->name, "use_param", 9) == 0
26158 + && (oo->name[9] == '\0' || ISDIGIT (oo->name[9])))
26159 + use_param_num = oo->name[9] == '\0' ? 0 : oo->name[9] - '0';
26160 + else if (strcmp (oo->name, "use_params") == 0)
26161 + use_params_p = 1;
26162 + else if (strcmp (oo->name, "desc") == 0 && oo->kind == OPTION_STRING)
26163 + desc = oo->info.string;
26164 + else if (strcmp (oo->name, "mark_hook") == 0)
26166 + else if (strcmp (oo->name, "nested_ptr") == 0
26167 + && oo->kind == OPTION_NESTED)
26168 + nested_ptr_d = (const struct nested_ptr_data *) oo->info.nested;
26169 + else if (strcmp (oo->name, "dot") == 0)
26171 + else if (strcmp (oo->name, "tag") == 0)
26173 + else if (strcmp (oo->name, "special") == 0)
26175 + else if (strcmp (oo->name, "skip") == 0)
26177 + else if (strcmp (oo->name, "default") == 0)
26179 + else if (strcmp (oo->name, "param_is") == 0)
26181 + else if (strncmp (oo->name, "param", 5) == 0
26182 + && ISDIGIT (oo->name[5]) && strcmp (oo->name + 6, "_is") == 0)
26184 + else if (strcmp (oo->name, "chain_next") == 0)
26186 + else if (strcmp (oo->name, "chain_prev") == 0)
26188 + else if (strcmp (oo->name, "chain_circular") == 0)
26190 + else if (strcmp (oo->name, "reorder") == 0)
26192 + else if (strcmp (oo->name, "variable_size") == 0)
26194 + else
26195 + error_at_line (d->line, "unknown option `%s'\n", oo->name);
26197 + if (d->used_length)
26198 + length = NULL;
26200 + if (use_params_p)
26202 + int pointer_p = t->kind == TYPE_POINTER;
26204 + if (pointer_p)
26205 + t = t->u.p;
26206 + if (!UNION_OR_STRUCT_P (t))
26207 + error_at_line (d->line, "`use_params' option on unimplemented type");
26208 + else
26209 + t = find_param_structure (t, d->param);
26210 + if (pointer_p)
26211 + t = create_pointer (t);
26214 + if (use_param_num != -1)
26216 + if (d->param != NULL && d->param[use_param_num] != NULL)
26218 + type_p nt = d->param[use_param_num];
26220 + if (t->kind == TYPE_ARRAY)
26221 + nt = create_array (nt, t->u.a.len);
26222 + else if (length != NULL && t->kind == TYPE_POINTER)
26223 + nt = create_pointer (nt);
26224 + d->needs_cast_p = (t->kind != TYPE_POINTER
26225 + && (nt->kind == TYPE_POINTER
26226 + || nt->kind == TYPE_STRING));
26227 + t = nt;
26229 + else
26230 + error_at_line (d->line, "no parameter defined for `%s'", d->val);
26233 + if (maybe_undef_p
26234 + && (t->kind != TYPE_POINTER || !UNION_OR_STRUCT_P (t->u.p)))
26236 + error_at_line (d->line,
26237 + "field `%s' has invalid option `maybe_undef_p'\n",
26238 + d->val);
26239 + return;
26242 + switch (t->kind)
26244 + case TYPE_SCALAR:
26245 + case TYPE_STRING:
26246 + d->process_field (t, d);
26247 + break;
26249 + case TYPE_POINTER:
26251 + if (maybe_undef_p && t->u.p->u.s.line.file == NULL)
26253 + oprintf (d->of, "%*sgcc_assert (!%s);\n", d->indent, "", d->val);
26254 + break;
26257 + if (!length)
26259 + if (!UNION_OR_STRUCT_P (t->u.p)
26260 + && t->u.p->kind != TYPE_PARAM_STRUCT)
26262 + error_at_line (d->line,
26263 + "field `%s' is pointer to unimplemented type",
26264 + d->val);
26265 + break;
26268 + if (nested_ptr_d)
26270 + const char *oldprevval2 = d->prev_val[2];
26272 + if (!UNION_OR_STRUCT_P (nested_ptr_d->type))
26274 + error_at_line (d->line,
26275 + "field `%s' has invalid "
26276 + "option `nested_ptr'\n", d->val);
26277 + return;
26280 + d->prev_val[2] = d->val;
26281 + oprintf (d->of, "%*s{\n", d->indent, "");
26282 + d->indent += 2;
26283 + d->val = xasprintf ("x%d", d->counter++);
26284 + oprintf (d->of, "%*s%s %s * %s%s =\n", d->indent, "",
26285 + (nested_ptr_d->type->kind == TYPE_UNION
26286 + ? "union" : "struct"),
26287 + nested_ptr_d->type->u.s.tag,
26288 + d->fn_wants_lvalue ? "" : "const ", d->val);
26289 + oprintf (d->of, "%*s", d->indent + 2, "");
26290 + output_escaped_param (d, nested_ptr_d->convert_from,
26291 + "nested_ptr");
26292 + oprintf (d->of, ";\n");
26294 + d->process_field (nested_ptr_d->type, d);
26296 + if (d->fn_wants_lvalue)
26298 + oprintf (d->of, "%*s%s = ", d->indent, "",
26299 + d->prev_val[2]);
26300 + d->prev_val[2] = d->val;
26301 + output_escaped_param (d, nested_ptr_d->convert_to,
26302 + "nested_ptr");
26303 + oprintf (d->of, ";\n");
26306 + d->indent -= 2;
26307 + oprintf (d->of, "%*s}\n", d->indent, "");
26308 + d->val = d->prev_val[2];
26309 + d->prev_val[2] = oldprevval2;
26311 + else
26312 + d->process_field (t->u.p, d);
26314 + else
26316 + int loopcounter = d->counter++;
26317 + const char *oldval = d->val;
26318 + const char *oldprevval3 = d->prev_val[3];
26319 + char *newval;
26321 + oprintf (d->of, "%*sif (%s != NULL) {\n", d->indent, "", d->val);
26322 + d->indent += 2;
26323 + oprintf (d->of, "%*ssize_t i%d;\n", d->indent, "", loopcounter);
26324 + oprintf (d->of, "%*sfor (i%d = 0; i%d != (size_t)(", d->indent,
26325 + "", loopcounter, loopcounter);
26326 + output_escaped_param (d, length, "length");
26327 + oprintf (d->of, "); i%d++) {\n", loopcounter);
26328 + d->indent += 2;
26329 + d->val = newval = xasprintf ("%s[i%d]", oldval, loopcounter);
26330 + d->used_length = 1;
26331 + d->prev_val[3] = oldval;
26332 + walk_type (t->u.p, d);
26333 + free (newval);
26334 + d->val = oldval;
26335 + d->prev_val[3] = oldprevval3;
26336 + d->used_length = 0;
26337 + d->indent -= 2;
26338 + oprintf (d->of, "%*s}\n", d->indent, "");
26339 + d->process_field (t, d);
26340 + d->indent -= 2;
26341 + oprintf (d->of, "%*s}\n", d->indent, "");
26344 + break;
26346 + case TYPE_ARRAY:
26348 + int loopcounter = d->counter++;
26349 + const char *oldval = d->val;
26350 + char *newval;
26352 + /* If it's an array of scalars, we optimize by not generating
26353 + any code. */
26354 + if (t->u.a.p->kind == TYPE_SCALAR)
26355 + break;
26357 + /* When walking an array, compute the length and store it in a
26358 + local variable before walking the array elements, instead of
26359 + recomputing the length expression each time through the loop.
26360 + This is necessary to handle tcc_vl_exp objects like CALL_EXPR,
26361 + where the length is stored in the first array element,
26362 + because otherwise that operand can get overwritten on the
26363 + first iteration. */
26364 + oprintf (d->of, "%*s{\n", d->indent, "");
26365 + d->indent += 2;
26366 + oprintf (d->of, "%*ssize_t i%d;\n", d->indent, "", loopcounter);
26367 + oprintf (d->of, "%*ssize_t l%d = (size_t)(",
26368 + d->indent, "", loopcounter);
26369 + if (length)
26370 + output_escaped_param (d, length, "length");
26371 + else
26372 + oprintf (d->of, "%s", t->u.a.len);
26373 + oprintf (d->of, ");\n");
26375 + oprintf (d->of, "%*sfor (i%d = 0; i%d != l%d; i%d++) {\n",
26376 + d->indent, "",
26377 + loopcounter, loopcounter, loopcounter, loopcounter);
26378 + d->indent += 2;
26379 + d->val = newval = xasprintf ("%s[i%d]", oldval, loopcounter);
26380 + d->used_length = 1;
26381 + walk_type (t->u.a.p, d);
26382 + free (newval);
26383 + d->used_length = 0;
26384 + d->val = oldval;
26385 + d->indent -= 2;
26386 + oprintf (d->of, "%*s}\n", d->indent, "");
26387 + d->indent -= 2;
26388 + oprintf (d->of, "%*s}\n", d->indent, "");
26390 + break;
26392 + case TYPE_STRUCT:
26393 + case TYPE_UNION:
26395 + pair_p f;
26396 + const char *oldval = d->val;
26397 + const char *oldprevval1 = d->prev_val[1];
26398 + const char *oldprevval2 = d->prev_val[2];
26399 + const int union_p = t->kind == TYPE_UNION;
26400 + int seen_default_p = 0;
26401 + options_p o;
26403 + if (!t->u.s.line.file)
26404 + error_at_line (d->line, "incomplete structure `%s'", t->u.s.tag);
26406 + if ((d->bitmap & t->u.s.bitmap) != d->bitmap)
26408 + error_at_line (d->line,
26409 + "structure `%s' defined for mismatching languages",
26410 + t->u.s.tag);
26411 + error_at_line (&t->u.s.line, "one structure defined here");
26414 + /* Some things may also be defined in the structure's options. */
26415 + for (o = t->u.s.opt; o; o = o->next)
26416 + if (!desc && strcmp (o->name, "desc") == 0
26417 + && o->kind == OPTION_STRING)
26418 + desc = o->info.string;
26420 + d->prev_val[2] = oldval;
26421 + d->prev_val[1] = oldprevval2;
26422 + if (union_p)
26424 + if (desc == NULL)
26426 + error_at_line (d->line,
26427 + "missing `desc' option for union `%s'",
26428 + t->u.s.tag);
26429 + desc = "1";
26431 + oprintf (d->of, "%*sswitch (", d->indent, "");
26432 + output_escaped_param (d, desc, "desc");
26433 + oprintf (d->of, ")\n");
26434 + d->indent += 2;
26435 + oprintf (d->of, "%*s{\n", d->indent, "");
26437 + for (f = t->u.s.fields; f; f = f->next)
26439 + options_p oo;
26440 + const char *dot = ".";
26441 + const char *tagid = NULL;
26442 + int skip_p = 0;
26443 + int default_p = 0;
26444 + int use_param_p = 0;
26445 + char *newval;
26447 + d->reorder_fn = NULL;
26448 + for (oo = f->opt; oo; oo = oo->next)
26449 + if (strcmp (oo->name, "dot") == 0
26450 + && oo->kind == OPTION_STRING)
26451 + dot = oo->info.string;
26452 + else if (strcmp (oo->name, "tag") == 0
26453 + && oo->kind == OPTION_STRING)
26454 + tagid = oo->info.string;
26455 + else if (strcmp (oo->name, "skip") == 0)
26456 + skip_p = 1;
26457 + else if (strcmp (oo->name, "default") == 0)
26458 + default_p = 1;
26459 + else if (strcmp (oo->name, "reorder") == 0
26460 + && oo->kind == OPTION_STRING)
26461 + d->reorder_fn = oo->info.string;
26462 + else if (strncmp (oo->name, "use_param", 9) == 0
26463 + && (oo->name[9] == '\0' || ISDIGIT (oo->name[9])))
26464 + use_param_p = 1;
26466 + if (skip_p)
26467 + continue;
26469 + if (union_p && tagid)
26471 + oprintf (d->of, "%*scase %s:\n", d->indent, "", tagid);
26472 + d->indent += 2;
26474 + else if (union_p && default_p)
26476 + oprintf (d->of, "%*sdefault:\n", d->indent, "");
26477 + d->indent += 2;
26478 + seen_default_p = 1;
26480 + else if (!union_p && (default_p || tagid))
26481 + error_at_line (d->line,
26482 + "can't use `%s' outside a union on field `%s'",
26483 + default_p ? "default" : "tag", f->name);
26484 + else if (union_p && !(default_p || tagid)
26485 + && f->type->kind == TYPE_SCALAR)
26487 + fprintf (stderr,
26488 + "%s:%d: warning: field `%s' is missing `tag' or `default' option\n",
26489 + get_input_file_name (d->line->file), d->line->line,
26490 + f->name);
26491 + continue;
26493 + else if (union_p && !(default_p || tagid))
26494 + error_at_line (d->line,
26495 + "field `%s' is missing `tag' or `default' option",
26496 + f->name);
26498 + d->line = &f->line;
26499 + d->val = newval = xasprintf ("%s%s%s", oldval, dot, f->name);
26500 + d->opt = f->opt;
26501 + d->used_length = false;
26503 + if (union_p && use_param_p && d->param == NULL)
26504 + oprintf (d->of, "%*sgcc_unreachable ();\n", d->indent, "");
26505 + else
26506 + walk_type (f->type, d);
26508 + free (newval);
26510 + if (union_p)
26512 + oprintf (d->of, "%*sbreak;\n", d->indent, "");
26513 + d->indent -= 2;
26516 + d->reorder_fn = NULL;
26518 + d->val = oldval;
26519 + d->prev_val[1] = oldprevval1;
26520 + d->prev_val[2] = oldprevval2;
26522 + if (union_p && !seen_default_p)
26524 + oprintf (d->of, "%*sdefault:\n", d->indent, "");
26525 + oprintf (d->of, "%*s break;\n", d->indent, "");
26527 + if (union_p)
26529 + oprintf (d->of, "%*s}\n", d->indent, "");
26530 + d->indent -= 2;
26533 + break;
26535 + case TYPE_LANG_STRUCT:
26537 + type_p nt;
26538 + for (nt = t->u.s.lang_struct; nt; nt = nt->next)
26539 + if ((d->bitmap & nt->u.s.bitmap) == d->bitmap)
26540 + break;
26541 + if (nt == NULL)
26542 + error_at_line (d->line, "structure `%s' differs between languages",
26543 + t->u.s.tag);
26544 + else
26545 + walk_type (nt, d);
26547 + break;
26549 + case TYPE_PARAM_STRUCT:
26551 + type_p *oldparam = d->param;
26553 + d->param = t->u.param_struct.param;
26554 + walk_type (t->u.param_struct.stru, d);
26555 + d->param = oldparam;
26557 + break;
26559 + default:
26560 + gcc_unreachable ();
26564 +/* process_field routine for marking routines. */
26566 +static void
26567 +write_types_process_field (type_p f, const struct walk_type_data *d)
26569 + const struct write_types_data *wtd;
26570 + const char *cast = d->needs_cast_p ? "(void *)" : "";
26571 + wtd = (const struct write_types_data *) d->cookie;
26573 + switch (f->kind)
26575 + case TYPE_NONE:
26576 + gcc_unreachable ();
26577 + case TYPE_POINTER:
26578 + oprintf (d->of, "%*s%s (%s%s", d->indent, "",
26579 + wtd->subfield_marker_routine, cast, d->val);
26580 + if (wtd->param_prefix)
26582 + oprintf (d->of, ", %s", d->prev_val[3]);
26583 + if (d->orig_s)
26585 + oprintf (d->of, ", gt_%s_", wtd->param_prefix);
26586 + output_mangled_typename (d->of, d->orig_s);
26588 + else
26589 + oprintf (d->of, ", gt_%sa_%s", wtd->param_prefix, d->prev_val[0]);
26591 + if (f->u.p->kind == TYPE_PARAM_STRUCT
26592 + && f->u.p->u.s.line.file != NULL)
26594 + oprintf (d->of, ", gt_e_");
26595 + output_mangled_typename (d->of, f);
26597 + else if (UNION_OR_STRUCT_P (f) && f->u.p->u.s.line.file != NULL)
26599 + oprintf (d->of, ", gt_ggc_e_");
26600 + output_mangled_typename (d->of, f);
26602 + else
26603 + oprintf (d->of, ", gt_types_enum_last");
26605 + oprintf (d->of, ");\n");
26606 + if (d->reorder_fn && wtd->reorder_note_routine)
26607 + oprintf (d->of, "%*s%s (%s%s, %s, %s);\n", d->indent, "",
26608 + wtd->reorder_note_routine, cast, d->val,
26609 + d->prev_val[3], d->reorder_fn);
26610 + break;
26612 + case TYPE_STRING:
26613 + case TYPE_STRUCT:
26614 + case TYPE_UNION:
26615 + case TYPE_LANG_STRUCT:
26616 + case TYPE_PARAM_STRUCT:
26617 + oprintf (d->of, "%*sgt_%s_", d->indent, "", wtd->prefix);
26618 + output_mangled_typename (d->of, f);
26619 + oprintf (d->of, " (%s%s);\n", cast, d->val);
26620 + if (d->reorder_fn && wtd->reorder_note_routine)
26621 + oprintf (d->of, "%*s%s (%s%s, %s%s, %s);\n", d->indent, "",
26622 + wtd->reorder_note_routine, cast, d->val, cast, d->val,
26623 + d->reorder_fn);
26624 + break;
26626 + case TYPE_SCALAR:
26627 + break;
26629 + case TYPE_ARRAY:
26630 + gcc_unreachable ();
26634 +/* A subroutine of write_func_for_structure. Write the enum tag for S. */
26636 +static void
26637 +output_type_enum (outf_p of, type_p s)
26639 + if (s->kind == TYPE_PARAM_STRUCT && s->u.param_struct.line.file != NULL)
26641 + oprintf (of, ", gt_e_");
26642 + output_mangled_typename (of, s);
26644 + else if (UNION_OR_STRUCT_P (s) && s->u.s.line.file != NULL)
26646 + oprintf (of, ", gt_ggc_e_");
26647 + output_mangled_typename (of, s);
26649 + else
26650 + oprintf (of, ", gt_types_enum_last");
26653 +/* Return an output file that is suitable for definitions which can
26654 + reference struct S */
26656 +static outf_p
26657 +get_output_file_for_structure (const_type_p s, type_p *param)
26659 + const input_file *fn;
26660 + int i;
26662 + gcc_assert (UNION_OR_STRUCT_P (s));
26663 + fn = s->u.s.line.file;
26665 + /* This is a hack, and not the good kind either. */
26666 + for (i = NUM_PARAM - 1; i >= 0; i--)
26667 + if (param && param[i] && param[i]->kind == TYPE_POINTER
26668 + && UNION_OR_STRUCT_P (param[i]->u.p))
26669 + fn = param[i]->u.p->u.s.line.file;
26671 + /* The call to get_output_file_with_visibility may update fn by
26672 + caching its result inside, so we need the CONST_CAST. */
26673 + return get_output_file_with_visibility (CONST_CAST (input_file*, fn));
26676 +/* For S, a structure that's part of ORIG_S, and using parameters
26677 + PARAM, write out a routine that:
26678 + - Takes a parameter, a void * but actually of type *S
26679 + - If SEEN_ROUTINE returns nonzero, calls write_types_process_field on each
26680 + field of S or its substructures and (in some cases) things
26681 + that are pointed to by S.
26684 +static void
26685 +write_func_for_structure (type_p orig_s, type_p s, type_p *param,
26686 + const struct write_types_data *wtd)
26688 + const char *chain_next = NULL;
26689 + const char *chain_prev = NULL;
26690 + const char *chain_circular = NULL;
26691 + const char *mark_hook_name = NULL;
26692 + options_p opt;
26693 + struct walk_type_data d;
26695 + memset (&d, 0, sizeof (d));
26696 + d.of = get_output_file_for_structure (s, param);
26697 + for (opt = s->u.s.opt; opt; opt = opt->next)
26698 + if (strcmp (opt->name, "chain_next") == 0
26699 + && opt->kind == OPTION_STRING)
26700 + chain_next = opt->info.string;
26701 + else if (strcmp (opt->name, "chain_prev") == 0
26702 + && opt->kind == OPTION_STRING)
26703 + chain_prev = opt->info.string;
26704 + else if (strcmp (opt->name, "chain_circular") == 0
26705 + && opt->kind == OPTION_STRING)
26706 + chain_circular = opt->info.string;
26707 + else if (strcmp (opt->name, "mark_hook") == 0
26708 + && opt->kind == OPTION_STRING)
26709 + mark_hook_name = opt->info.string;
26710 + if (chain_prev != NULL && chain_next == NULL)
26711 + error_at_line (&s->u.s.line, "chain_prev without chain_next");
26712 + if (chain_circular != NULL && chain_next != NULL)
26713 + error_at_line (&s->u.s.line, "chain_circular with chain_next");
26714 + if (chain_circular != NULL)
26715 + chain_next = chain_circular;
26717 + d.process_field = write_types_process_field;
26718 + d.cookie = wtd;
26719 + d.orig_s = orig_s;
26720 + d.opt = s->u.s.opt;
26721 + d.line = &s->u.s.line;
26722 + d.bitmap = s->u.s.bitmap;
26723 + d.param = param;
26724 + d.prev_val[0] = "*x";
26725 + d.prev_val[1] = "not valid postage"; /* Guarantee an error. */
26726 + d.prev_val[3] = "x";
26727 + d.val = "(*x)";
26729 + oprintf (d.of, "\n");
26730 + oprintf (d.of, "void\n");
26731 + if (param == NULL)
26732 + oprintf (d.of, "gt_%sx_%s", wtd->prefix, orig_s->u.s.tag);
26733 + else
26735 + oprintf (d.of, "gt_%s_", wtd->prefix);
26736 + output_mangled_typename (d.of, orig_s);
26738 + oprintf (d.of, " (void *x_p)\n");
26739 + oprintf (d.of, "{\n");
26740 + oprintf (d.of, " %s %s * %sx = (%s %s *)x_p;\n",
26741 + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
26742 + chain_next == NULL ? "const " : "",
26743 + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
26744 + if (chain_next != NULL)
26745 + oprintf (d.of, " %s %s * xlimit = x;\n",
26746 + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
26747 + if (chain_next == NULL)
26749 + oprintf (d.of, " if (%s (x", wtd->marker_routine);
26750 + if (wtd->param_prefix)
26752 + oprintf (d.of, ", x, gt_%s_", wtd->param_prefix);
26753 + output_mangled_typename (d.of, orig_s);
26754 + output_type_enum (d.of, orig_s);
26756 + oprintf (d.of, "))\n");
26758 + else
26760 + if (chain_circular != NULL)
26761 + oprintf (d.of, " if (!%s (xlimit", wtd->marker_routine);
26762 + else
26763 + oprintf (d.of, " while (%s (xlimit", wtd->marker_routine);
26764 + if (wtd->param_prefix)
26766 + oprintf (d.of, ", xlimit, gt_%s_", wtd->param_prefix);
26767 + output_mangled_typename (d.of, orig_s);
26768 + output_type_enum (d.of, orig_s);
26770 + oprintf (d.of, "))\n");
26771 + if (chain_circular != NULL)
26772 + oprintf (d.of, " return;\n do\n");
26773 + if (mark_hook_name && !wtd->skip_hooks)
26775 + oprintf (d.of, " {\n");
26776 + oprintf (d.of, " %s (xlimit);\n ", mark_hook_name);
26778 + oprintf (d.of, " xlimit = (");
26779 + d.prev_val[2] = "*xlimit";
26780 + output_escaped_param (&d, chain_next, "chain_next");
26781 + oprintf (d.of, ");\n");
26782 + if (mark_hook_name && !wtd->skip_hooks)
26783 + oprintf (d.of, " }\n");
26784 + if (chain_prev != NULL)
26786 + oprintf (d.of, " if (x != xlimit)\n");
26787 + oprintf (d.of, " for (;;)\n");
26788 + oprintf (d.of, " {\n");
26789 + oprintf (d.of, " %s %s * const xprev = (",
26790 + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
26792 + d.prev_val[2] = "*x";
26793 + output_escaped_param (&d, chain_prev, "chain_prev");
26794 + oprintf (d.of, ");\n");
26795 + oprintf (d.of, " if (xprev == NULL) break;\n");
26796 + oprintf (d.of, " x = xprev;\n");
26797 + oprintf (d.of, " (void) %s (xprev", wtd->marker_routine);
26798 + if (wtd->param_prefix)
26800 + oprintf (d.of, ", xprev, gt_%s_", wtd->param_prefix);
26801 + output_mangled_typename (d.of, orig_s);
26802 + output_type_enum (d.of, orig_s);
26804 + oprintf (d.of, ");\n");
26805 + oprintf (d.of, " }\n");
26807 + if (chain_circular != NULL)
26809 + oprintf (d.of, " while (%s (xlimit", wtd->marker_routine);
26810 + if (wtd->param_prefix)
26812 + oprintf (d.of, ", xlimit, gt_%s_", wtd->param_prefix);
26813 + output_mangled_typename (d.of, orig_s);
26814 + output_type_enum (d.of, orig_s);
26816 + oprintf (d.of, "));\n");
26817 + if (mark_hook_name && !wtd->skip_hooks)
26818 + oprintf (d.of, " %s (xlimit);\n", mark_hook_name);
26819 + oprintf (d.of, " do\n");
26821 + else
26822 + oprintf (d.of, " while (x != xlimit)\n");
26824 + oprintf (d.of, " {\n");
26825 + if (mark_hook_name && chain_next == NULL && !wtd->skip_hooks)
26827 + oprintf (d.of, " %s (x);\n", mark_hook_name);
26829 + d.prev_val[2] = "*x";
26830 + d.indent = 6;
26831 + walk_type (s, &d);
26833 + if (chain_next != NULL)
26835 + oprintf (d.of, " x = (");
26836 + output_escaped_param (&d, chain_next, "chain_next");
26837 + oprintf (d.of, ");\n");
26840 + oprintf (d.of, " }\n");
26841 + if (chain_circular != NULL)
26842 + oprintf (d.of, " while (x != xlimit);\n");
26843 + oprintf (d.of, "}\n");
26846 +/* Write out marker routines for STRUCTURES and PARAM_STRUCTS. */
26848 +static void
26849 +write_types (outf_p output_header, type_p structures, type_p param_structs,
26850 + const struct write_types_data *wtd)
26852 + int nbfun = 0; /* Count the emitted functions. */
26853 + type_p s;
26855 + oprintf (output_header, "\n/* %s*/\n", wtd->comment);
26856 + /* We first emit the macros and the declarations. Functions' code is
26857 + emitted afterwards. This is needed in plugin mode. */
26858 + oprintf (output_header, "/* macros and declarations */\n");
26859 + for (s = structures; s; s = s->next)
26860 + if (s->gc_used == GC_POINTED_TO || s->gc_used == GC_MAYBE_POINTED_TO)
26862 + options_p opt;
26864 + if (s->gc_used == GC_MAYBE_POINTED_TO && s->u.s.line.file == NULL)
26865 + continue;
26867 + oprintf (output_header, "#define gt_%s_", wtd->prefix);
26868 + output_mangled_typename (output_header, s);
26869 + oprintf (output_header, "(X) do { \\\n");
26870 + oprintf (output_header,
26871 + " if (X != NULL) gt_%sx_%s (X);\\\n", wtd->prefix,
26872 + s->u.s.tag);
26873 + oprintf (output_header, " } while (0)\n");
26875 + for (opt = s->u.s.opt; opt; opt = opt->next)
26876 + if (strcmp (opt->name, "ptr_alias") == 0
26877 + && opt->kind == OPTION_TYPE)
26879 + const_type_p const t = (const_type_p) opt->info.type;
26880 + if (t->kind == TYPE_STRUCT
26881 + || t->kind == TYPE_UNION || t->kind == TYPE_LANG_STRUCT)
26882 + oprintf (output_header,
26883 + "#define gt_%sx_%s gt_%sx_%s\n",
26884 + wtd->prefix, s->u.s.tag, wtd->prefix, t->u.s.tag);
26885 + else
26886 + error_at_line (&s->u.s.line,
26887 + "structure alias is not a structure");
26888 + break;
26890 + if (opt)
26891 + continue;
26893 + /* Declare the marker procedure only once. */
26894 + oprintf (output_header,
26895 + "extern void gt_%sx_%s (void *);\n",
26896 + wtd->prefix, s->u.s.tag);
26898 + if (s->u.s.line.file == NULL)
26900 + fprintf (stderr, "warning: structure `%s' used but not defined\n",
26901 + s->u.s.tag);
26902 + continue;
26906 + for (s = param_structs; s; s = s->next)
26907 + if (s->gc_used == GC_POINTED_TO)
26909 + type_p stru = s->u.param_struct.stru;
26911 + /* Declare the marker procedure. */
26912 + oprintf (output_header, "extern void gt_%s_", wtd->prefix);
26913 + output_mangled_typename (output_header, s);
26914 + oprintf (output_header, " (void *);\n");
26916 + if (stru->u.s.line.file == NULL)
26918 + fprintf (stderr, "warning: structure `%s' used but not defined\n",
26919 + s->u.s.tag);
26920 + continue;
26924 + /* At last we emit the functions code. */
26925 + oprintf (output_header, "\n/* functions code */\n");
26926 + for (s = structures; s; s = s->next)
26927 + if (s->gc_used == GC_POINTED_TO || s->gc_used == GC_MAYBE_POINTED_TO)
26929 + options_p opt;
26931 + if (s->gc_used == GC_MAYBE_POINTED_TO && s->u.s.line.file == NULL)
26932 + continue;
26933 + for (opt = s->u.s.opt; opt; opt = opt->next)
26934 + if (strcmp (opt->name, "ptr_alias") == 0)
26935 + break;
26936 + if (opt)
26937 + continue;
26939 + if (s->kind == TYPE_LANG_STRUCT)
26941 + type_p ss;
26942 + for (ss = s->u.s.lang_struct; ss; ss = ss->next)
26944 + nbfun++;
26945 + DBGPRINTF ("writing func #%d lang_struct ss @ %p '%s'",
26946 + nbfun, (void*) ss, ss->u.s.tag);
26947 + write_func_for_structure (s, ss, NULL, wtd);
26950 + else
26952 + nbfun++;
26953 + DBGPRINTF ("writing func #%d struct s @ %p '%s'",
26954 + nbfun, (void*) s, s->u.s.tag);
26955 + write_func_for_structure (s, s, NULL, wtd);
26958 + else
26960 + /* Structure s is not possibly pointed to, so can be ignored. */
26961 + DBGPRINTF ("ignored s @ %p '%s' gc_used#%d",
26962 + (void*)s, s->u.s.tag,
26963 + (int) s->gc_used);
26966 + for (s = param_structs; s; s = s->next)
26967 + if (s->gc_used == GC_POINTED_TO)
26969 + type_p *param = s->u.param_struct.param;
26970 + type_p stru = s->u.param_struct.stru;
26971 + if (stru->u.s.line.file == NULL)
26972 + continue;
26973 + if (stru->kind == TYPE_LANG_STRUCT)
26975 + type_p ss;
26976 + for (ss = stru->u.s.lang_struct; ss; ss = ss->next)
26978 + nbfun++;
26979 + DBGPRINTF ("writing func #%d param lang_struct ss @ %p '%s'",
26980 + nbfun, (void*) ss, ss->u.s.tag);
26981 + write_func_for_structure (s, ss, param, wtd);
26984 + else
26986 + nbfun++;
26987 + DBGPRINTF ("writing func #%d param struct s @ %p stru @ %p '%s'",
26988 + nbfun, (void*) s,
26989 + (void*) stru, stru->u.s.tag);
26990 + write_func_for_structure (s, stru, param, wtd);
26993 + else
26994 + {
26995 + /* Param structure s is not pointed to, so should be ignored. */
26996 + DBGPRINTF ("ignored s @ %p", (void*)s);
26998 + if (verbosity_level >= 2)
26999 + printf ("%s emitted %d routines for %s\n",
27000 + progname, nbfun, wtd->comment);
27003 +static const struct write_types_data ggc_wtd = {
27004 + "ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL,
27005 + "GC marker procedures. ",
27006 + FALSE
27009 +static const struct write_types_data pch_wtd = {
27010 + "pch_n", "pch_p", "gt_pch_note_object", "gt_pch_note_object",
27011 + "gt_pch_note_reorder",
27012 + "PCH type-walking procedures. ",
27013 + TRUE
27016 +/* Write out the local pointer-walking routines. */
27018 +/* process_field routine for local pointer-walking. */
27020 +static void
27021 +write_types_local_process_field (type_p f, const struct walk_type_data *d)
27023 + switch (f->kind)
27025 + case TYPE_POINTER:
27026 + case TYPE_STRUCT:
27027 + case TYPE_UNION:
27028 + case TYPE_LANG_STRUCT:
27029 + case TYPE_PARAM_STRUCT:
27030 + case TYPE_STRING:
27031 + oprintf (d->of, "%*sif ((void *)(%s) == this_obj)\n", d->indent, "",
27032 + d->prev_val[3]);
27033 + oprintf (d->of, "%*s op (&(%s), cookie);\n", d->indent, "", d->val);
27034 + break;
27036 + case TYPE_SCALAR:
27037 + break;
27039 + default:
27040 + gcc_unreachable ();
27044 +/* For S, a structure that's part of ORIG_S, and using parameters
27045 + PARAM, write out a routine that:
27046 + - Is of type gt_note_pointers
27047 + - Calls PROCESS_FIELD on each field of S or its substructures.
27050 +static void
27051 +write_local_func_for_structure (const_type_p orig_s, type_p s, type_p *param)
27053 + struct walk_type_data d;
27055 + memset (&d, 0, sizeof (d));
27056 + d.of = get_output_file_for_structure (s, param);
27057 + d.process_field = write_types_local_process_field;
27058 + d.opt = s->u.s.opt;
27059 + d.line = &s->u.s.line;
27060 + d.bitmap = s->u.s.bitmap;
27061 + d.param = param;
27062 + d.prev_val[0] = d.prev_val[2] = "*x";
27063 + d.prev_val[1] = "not valid postage"; /* Guarantee an error. */
27064 + d.prev_val[3] = "x";
27065 + d.val = "(*x)";
27066 + d.fn_wants_lvalue = true;
27068 + oprintf (d.of, "\n");
27069 + oprintf (d.of, "void\n");
27070 + oprintf (d.of, "gt_pch_p_");
27071 + output_mangled_typename (d.of, orig_s);
27072 + oprintf (d.of, " (ATTRIBUTE_UNUSED void *this_obj,\n"
27073 + "\tvoid *x_p,\n"
27074 + "\tATTRIBUTE_UNUSED gt_pointer_operator op,\n"
27075 + "\tATTRIBUTE_UNUSED void *cookie)\n");
27076 + oprintf (d.of, "{\n");
27077 + oprintf (d.of, " %s %s * const x ATTRIBUTE_UNUSED = (%s %s *)x_p;\n",
27078 + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
27079 + s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
27080 + d.indent = 2;
27081 + walk_type (s, &d);
27082 + oprintf (d.of, "}\n");
27085 +/* Write out local marker routines for STRUCTURES and PARAM_STRUCTS. */
27087 +static void
27088 +write_local (outf_p output_header, type_p structures, type_p param_structs)
27090 + type_p s;
27092 + if (!output_header)
27093 + return;
27094 + oprintf (output_header, "\n/* Local pointer-walking routines. */\n");
27095 + for (s = structures; s; s = s->next)
27096 + if (s->gc_used == GC_POINTED_TO || s->gc_used == GC_MAYBE_POINTED_TO)
27098 + options_p opt;
27100 + if (s->u.s.line.file == NULL)
27101 + continue;
27102 + for (opt = s->u.s.opt; opt; opt = opt->next)
27103 + if (strcmp (opt->name, "ptr_alias") == 0
27104 + && opt->kind == OPTION_TYPE)
27106 + const_type_p const t = (const_type_p) opt->info.type;
27107 + if (t->kind == TYPE_STRUCT
27108 + || t->kind == TYPE_UNION || t->kind == TYPE_LANG_STRUCT)
27110 + oprintf (output_header, "#define gt_pch_p_");
27111 + output_mangled_typename (output_header, s);
27112 + oprintf (output_header, " gt_pch_p_");
27113 + output_mangled_typename (output_header, t);
27114 + oprintf (output_header, "\n");
27116 + else
27117 + error_at_line (&s->u.s.line,
27118 + "structure alias is not a structure");
27119 + break;
27121 + if (opt)
27122 + continue;
27124 + /* Declare the marker procedure only once. */
27125 + oprintf (output_header, "extern void gt_pch_p_");
27126 + output_mangled_typename (output_header, s);
27127 + oprintf (output_header,
27128 + "\n (void *, void *, gt_pointer_operator, void *);\n");
27130 + if (s->kind == TYPE_LANG_STRUCT)
27132 + type_p ss;
27133 + for (ss = s->u.s.lang_struct; ss; ss = ss->next)
27134 + write_local_func_for_structure (s, ss, NULL);
27136 + else
27137 + write_local_func_for_structure (s, s, NULL);
27140 + for (s = param_structs; s; s = s->next)
27141 + if (s->gc_used == GC_POINTED_TO)
27143 + type_p *param = s->u.param_struct.param;
27144 + type_p stru = s->u.param_struct.stru;
27146 + /* Declare the marker procedure. */
27147 + oprintf (output_header, "extern void gt_pch_p_");
27148 + output_mangled_typename (output_header, s);
27149 + oprintf (output_header,
27150 + "\n (void *, void *, gt_pointer_operator, void *);\n");
27152 + if (stru->u.s.line.file == NULL)
27154 + fprintf (stderr, "warning: structure `%s' used but not defined\n",
27155 + s->u.s.tag);
27156 + continue;
27159 + if (stru->kind == TYPE_LANG_STRUCT)
27161 + type_p ss;
27162 + for (ss = stru->u.s.lang_struct; ss; ss = ss->next)
27163 + write_local_func_for_structure (s, ss, param);
27165 + else
27166 + write_local_func_for_structure (s, stru, param);
27170 +/* Nonzero if S is a type for which typed GC allocators should be output. */
27172 +#define USED_BY_TYPED_GC_P(s) \
27173 + (((s->kind == TYPE_POINTER) \
27174 + && ((s->u.p->gc_used == GC_POINTED_TO) \
27175 + || (s->u.p->gc_used == GC_USED))) \
27176 + || (UNION_OR_STRUCT_P (s) && \
27177 + (((s)->gc_used == GC_POINTED_TO) \
27178 + || ((s)->gc_used == GC_MAYBE_POINTED_TO \
27179 + && s->u.s.line.file != NULL) \
27180 + || ((s)->gc_used == GC_USED \
27181 + && strncmp (s->u.s.tag, "anonymous", strlen ("anonymous"))))))
27184 +/* Write out the 'enum' definition for gt_types_enum. */
27186 +static void
27187 +write_enum_defn (type_p structures, type_p param_structs)
27189 + type_p s;
27190 + int nbstruct = 0;
27191 + int nbparamstruct = 0;
27193 + if (!header_file)
27194 + return;
27195 + oprintf (header_file, "\n/* Enumeration of types known. */\n");
27196 + oprintf (header_file, "enum gt_types_enum {\n");
27197 + for (s = structures; s; s = s->next)
27198 + if (USED_BY_TYPED_GC_P (s))
27200 + nbstruct++;
27201 + DBGPRINTF ("write_enum_defn s @ %p nbstruct %d",
27202 + (void*) s, nbstruct);
27203 + if (UNION_OR_STRUCT_P (s))
27204 + DBGPRINTF ("write_enum_defn s %p #%d is unionorstruct tagged %s",
27205 + (void*) s, nbstruct, s->u.s.tag);
27206 + oprintf (header_file, " gt_ggc_e_");
27207 + output_mangled_typename (header_file, s);
27208 + oprintf (header_file, ",\n");
27210 + for (s = param_structs; s; s = s->next)
27211 + if (s->gc_used == GC_POINTED_TO)
27213 + nbparamstruct++;
27214 + DBGPRINTF ("write_enum_defn s %p nbparamstruct %d",
27215 + (void*) s, nbparamstruct);
27216 + oprintf (header_file, " gt_e_");
27217 + output_mangled_typename (header_file, s);
27218 + oprintf (header_file, ",\n");
27220 + oprintf (header_file, " gt_types_enum_last\n");
27221 + oprintf (header_file, "};\n");
27222 + if (verbosity_level >= 2)
27223 + printf ("%s handled %d GTY-ed structures & %d parameterized structures.\n",
27224 + progname, nbstruct, nbparamstruct);
27228 +/* Might T contain any non-pointer elements? */
27230 +static int
27231 +contains_scalar_p (type_p t)
27233 + switch (t->kind)
27235 + case TYPE_STRING:
27236 + case TYPE_POINTER:
27237 + return 0;
27238 + case TYPE_ARRAY:
27239 + return contains_scalar_p (t->u.a.p);
27240 + default:
27241 + /* Could also check for structures that have no non-pointer
27242 + fields, but there aren't enough of those to worry about. */
27243 + return 1;
27247 +/* Mangle INPF and print it to F. */
27249 +static void
27250 +put_mangled_filename (outf_p f, const input_file *inpf)
27252 + /* The call to get_output_file_name may indirectly update fn since
27253 + get_output_file_with_visibility caches its result inside, so we
27254 + need the CONST_CAST. */
27255 + const char *name = get_output_file_name (CONST_CAST (input_file*, inpf));
27256 + if (!f || !name)
27257 + return;
27258 + for (; *name != 0; name++)
27259 + if (ISALNUM (*name))
27260 + oprintf (f, "%c", *name);
27261 + else
27262 + oprintf (f, "%c", '_');
27265 +/* Finish off the currently-created root tables in FLP. PFX, TNAME,
27266 + LASTNAME, and NAME are all strings to insert in various places in
27267 + the resulting code. */
27269 +static void
27270 +finish_root_table (struct flist *flp, const char *pfx, const char *lastname,
27271 + const char *tname, const char *name)
27273 + struct flist *fli2;
27275 + for (fli2 = flp; fli2; fli2 = fli2->next)
27276 + if (fli2->started_p)
27278 + oprintf (fli2->f, " %s\n", lastname);
27279 + oprintf (fli2->f, "};\n\n");
27282 + for (fli2 = flp; fli2 && base_files; fli2 = fli2->next)
27283 + if (fli2->started_p)
27285 + lang_bitmap bitmap = get_lang_bitmap (fli2->file);
27286 + int fnum;
27288 + for (fnum = 0; bitmap != 0; fnum++, bitmap >>= 1)
27289 + if (bitmap & 1)
27291 + oprintf (base_files[fnum],
27292 + "extern const struct %s gt_%s_", tname, pfx);
27293 + put_mangled_filename (base_files[fnum], fli2->file);
27294 + oprintf (base_files[fnum], "[];\n");
27299 + size_t fnum;
27300 + for (fnum = 0; base_files && fnum < num_lang_dirs; fnum++)
27301 + oprintf (base_files[fnum],
27302 + "EXPORTED_CONST struct %s * const %s[] = {\n", tname, name);
27306 + for (fli2 = flp; fli2; fli2 = fli2->next)
27307 + if (fli2->started_p)
27309 + lang_bitmap bitmap = get_lang_bitmap (fli2->file);
27310 + int fnum;
27312 + fli2->started_p = 0;
27314 + for (fnum = 0; base_files && bitmap != 0; fnum++, bitmap >>= 1)
27315 + if (bitmap & 1)
27317 + oprintf (base_files[fnum], " gt_%s_", pfx);
27318 + put_mangled_filename (base_files[fnum], fli2->file);
27319 + oprintf (base_files[fnum], ",\n");
27324 + size_t fnum;
27325 + for (fnum = 0; base_files && fnum < num_lang_dirs; fnum++)
27327 + oprintf (base_files[fnum], " NULL\n");
27328 + oprintf (base_files[fnum], "};\n");
27333 +/* Write the first three fields (pointer, count and stride) for
27334 + root NAME to F. V and LINE are as for write_root.
27336 + Return true if the entry could be written; return false on error. */
27338 +static bool
27339 +start_root_entry (outf_p f, pair_p v, const char *name, struct fileloc *line)
27341 + type_p ap;
27343 + if (!v)
27345 + error_at_line (line, "`%s' is too complex to be a root", name);
27346 + return false;
27349 + oprintf (f, " {\n");
27350 + oprintf (f, " &%s,\n", name);
27351 + oprintf (f, " 1");
27353 + for (ap = v->type; ap->kind == TYPE_ARRAY; ap = ap->u.a.p)
27354 + if (ap->u.a.len[0])
27355 + oprintf (f, " * (%s)", ap->u.a.len);
27356 + else if (ap == v->type)
27357 + oprintf (f, " * ARRAY_SIZE (%s)", v->name);
27358 + oprintf (f, ",\n");
27359 + oprintf (f, " sizeof (%s", v->name);
27360 + for (ap = v->type; ap->kind == TYPE_ARRAY; ap = ap->u.a.p)
27361 + oprintf (f, "[0]");
27362 + oprintf (f, "),\n");
27363 + return true;
27366 +/* A subroutine of write_root for writing the roots for field FIELD_NAME,
27367 + which has type FIELD_TYPE. Parameters F to EMIT_PCH are the parameters
27368 + of the caller. */
27370 +static void
27371 +write_field_root (outf_p f, pair_p v, type_p type, const char *name,
27372 + int has_length, struct fileloc *line, const char *if_marked,
27373 + bool emit_pch, type_p field_type, const char *field_name)
27375 + struct pair newv;
27376 + /* If the field reference is relative to V, rather than to some
27377 + subcomponent of V, we can mark any subarrays with a single stride.
27378 + We're effectively treating the field as a global variable in its
27379 + own right. */
27380 + if (v && type == v->type)
27382 + newv = *v;
27383 + newv.type = field_type;
27384 + newv.name = ACONCAT ((v->name, ".", field_name, NULL));
27385 + v = &newv;
27387 + /* Otherwise, any arrays nested in the structure are too complex to
27388 + handle. */
27389 + else if (field_type->kind == TYPE_ARRAY)
27390 + v = NULL;
27391 + write_root (f, v, field_type, ACONCAT ((name, ".", field_name, NULL)),
27392 + has_length, line, if_marked, emit_pch);
27395 +/* Write out to F the table entry and any marker routines needed to
27396 + mark NAME as TYPE. V can be one of three values:
27398 + - null, if NAME is too complex to represent using a single
27399 + count and stride. In this case, it is an error for NAME to
27400 + contain any gc-ed data.
27402 + - the outermost array that contains NAME, if NAME is part of an array.
27404 + - the C variable that contains NAME, if NAME is not part of an array.
27406 + LINE is the line of the C source that declares the root variable.
27407 + HAS_LENGTH is nonzero iff V was a variable-length array. IF_MARKED
27408 + is nonzero iff we are building the root table for hash table caches. */
27410 +static void
27411 +write_root (outf_p f, pair_p v, type_p type, const char *name, int has_length,
27412 + struct fileloc *line, const char *if_marked, bool emit_pch)
27414 + switch (type->kind)
27416 + case TYPE_STRUCT:
27418 + pair_p fld;
27419 + for (fld = type->u.s.fields; fld; fld = fld->next)
27421 + int skip_p = 0;
27422 + const char *desc = NULL;
27423 + options_p o;
27425 + for (o = fld->opt; o; o = o->next)
27426 + if (strcmp (o->name, "skip") == 0)
27427 + skip_p = 1;
27428 + else if (strcmp (o->name, "desc") == 0
27429 + && o->kind == OPTION_STRING)
27430 + desc = o->info.string;
27431 + else if (strcmp (o->name, "param_is") == 0)
27433 + else
27434 + error_at_line (line,
27435 + "field `%s' of global `%s' has unknown option `%s'",
27436 + fld->name, name, o->name);
27438 + if (skip_p)
27439 + continue;
27440 + else if (desc && fld->type->kind == TYPE_UNION)
27442 + pair_p validf = NULL;
27443 + pair_p ufld;
27445 + for (ufld = fld->type->u.s.fields; ufld; ufld = ufld->next)
27447 + const char *tag = NULL;
27448 + options_p oo;
27449 + for (oo = ufld->opt; oo; oo = oo->next)
27450 + if (strcmp (oo->name, "tag") == 0
27451 + && oo->kind == OPTION_STRING)
27452 + tag = oo->info.string;
27453 + if (tag == NULL || strcmp (tag, desc) != 0)
27454 + continue;
27455 + if (validf != NULL)
27456 + error_at_line (line,
27457 + "both `%s.%s.%s' and `%s.%s.%s' have tag `%s'",
27458 + name, fld->name, validf->name,
27459 + name, fld->name, ufld->name, tag);
27460 + validf = ufld;
27462 + if (validf != NULL)
27463 + write_field_root (f, v, type, name, 0, line, if_marked,
27464 + emit_pch, validf->type,
27465 + ACONCAT ((fld->name, ".",
27466 + validf->name, NULL)));
27468 + else if (desc)
27469 + error_at_line (line,
27470 + "global `%s.%s' has `desc' option but is not union",
27471 + name, fld->name);
27472 + else
27473 + write_field_root (f, v, type, name, 0, line, if_marked,
27474 + emit_pch, fld->type, fld->name);
27477 + break;
27479 + case TYPE_ARRAY:
27481 + char *newname;
27482 + newname = xasprintf ("%s[0]", name);
27483 + write_root (f, v, type->u.a.p, newname, has_length, line, if_marked,
27484 + emit_pch);
27485 + free (newname);
27487 + break;
27489 + case TYPE_POINTER:
27491 + type_p tp;
27493 + if (!start_root_entry (f, v, name, line))
27494 + return;
27496 + tp = type->u.p;
27498 + if (!has_length && UNION_OR_STRUCT_P (tp))
27500 + oprintf (f, " &gt_ggc_mx_%s,\n", tp->u.s.tag);
27501 + if (emit_pch)
27502 + oprintf (f, " &gt_pch_nx_%s", tp->u.s.tag);
27503 + else
27504 + oprintf (f, " NULL");
27506 + else if (!has_length && tp->kind == TYPE_PARAM_STRUCT)
27508 + oprintf (f, " &gt_ggc_m_");
27509 + output_mangled_typename (f, tp);
27510 + if (emit_pch)
27512 + oprintf (f, ",\n &gt_pch_n_");
27513 + output_mangled_typename (f, tp);
27515 + else
27516 + oprintf (f, ",\n NULL");
27518 + else if (has_length
27519 + && (tp->kind == TYPE_POINTER || UNION_OR_STRUCT_P (tp)))
27521 + oprintf (f, " &gt_ggc_ma_%s,\n", name);
27522 + if (emit_pch)
27523 + oprintf (f, " &gt_pch_na_%s", name);
27524 + else
27525 + oprintf (f, " NULL");
27527 + else
27529 + error_at_line (line,
27530 + "global `%s' is pointer to unimplemented type",
27531 + name);
27533 + if (if_marked)
27534 + oprintf (f, ",\n &%s", if_marked);
27535 + oprintf (f, "\n },\n");
27537 + break;
27539 + case TYPE_STRING:
27541 + if (!start_root_entry (f, v, name, line))
27542 + return;
27544 + oprintf (f, " (gt_pointer_walker) &gt_ggc_m_S,\n");
27545 + oprintf (f, " (gt_pointer_walker) &gt_pch_n_S\n");
27546 + oprintf (f, " },\n");
27548 + break;
27550 + case TYPE_SCALAR:
27551 + break;
27553 + default:
27554 + error_at_line (line, "global `%s' is unimplemented type", name);
27558 +/* This generates a routine to walk an array. */
27560 +static void
27561 +write_array (outf_p f, pair_p v, const struct write_types_data *wtd)
27563 + struct walk_type_data d;
27564 + char *prevval3;
27566 + memset (&d, 0, sizeof (d));
27567 + d.of = f;
27568 + d.cookie = wtd;
27569 + d.indent = 2;
27570 + d.line = &v->line;
27571 + d.opt = v->opt;
27572 + d.bitmap = get_lang_bitmap (v->line.file);
27573 + d.param = NULL;
27575 + d.prev_val[3] = prevval3 = xasprintf ("&%s", v->name);
27577 + if (wtd->param_prefix)
27579 + oprintf (f, "static void gt_%sa_%s\n", wtd->param_prefix, v->name);
27580 + oprintf (f, " (void *, void *, gt_pointer_operator, void *);\n");
27581 + oprintf (f, "static void gt_%sa_%s (ATTRIBUTE_UNUSED void *this_obj,\n",
27582 + wtd->param_prefix, v->name);
27583 + oprintf (d.of,
27584 + " ATTRIBUTE_UNUSED void *x_p,\n"
27585 + " ATTRIBUTE_UNUSED gt_pointer_operator op,\n"
27586 + " ATTRIBUTE_UNUSED void * cookie)\n");
27587 + oprintf (d.of, "{\n");
27588 + d.prev_val[0] = d.prev_val[1] = d.prev_val[2] = d.val = v->name;
27589 + d.process_field = write_types_local_process_field;
27590 + walk_type (v->type, &d);
27591 + oprintf (f, "}\n\n");
27594 + d.opt = v->opt;
27595 + oprintf (f, "static void gt_%sa_%s (void *);\n", wtd->prefix, v->name);
27596 + oprintf (f, "static void\ngt_%sa_%s (ATTRIBUTE_UNUSED void *x_p)\n",
27597 + wtd->prefix, v->name);
27598 + oprintf (f, "{\n");
27599 + d.prev_val[0] = d.prev_val[1] = d.prev_val[2] = d.val = v->name;
27600 + d.process_field = write_types_process_field;
27601 + walk_type (v->type, &d);
27602 + free (prevval3);
27603 + oprintf (f, "}\n\n");
27606 +/* Output a table describing the locations and types of VARIABLES. */
27608 +static void
27609 +write_roots (pair_p variables, bool emit_pch)
27611 + pair_p v;
27612 + struct flist *flp = NULL;
27614 + for (v = variables; v; v = v->next)
27616 + outf_p f =
27617 + get_output_file_with_visibility (CONST_CAST (input_file*,
27618 + v->line.file));
27619 + struct flist *fli;
27620 + const char *length = NULL;
27621 + int deletable_p = 0;
27622 + options_p o;
27623 + for (o = v->opt; o; o = o->next)
27624 + if (strcmp (o->name, "length") == 0
27625 + && o->kind == OPTION_STRING)
27626 + length = o->info.string;
27627 + else if (strcmp (o->name, "deletable") == 0)
27628 + deletable_p = 1;
27629 + else if (strcmp (o->name, "param_is") == 0)
27631 + else if (strncmp (o->name, "param", 5) == 0
27632 + && ISDIGIT (o->name[5]) && strcmp (o->name + 6, "_is") == 0)
27634 + else if (strcmp (o->name, "if_marked") == 0)
27636 + else
27637 + error_at_line (&v->line,
27638 + "global `%s' has unknown option `%s'",
27639 + v->name, o->name);
27641 + for (fli = flp; fli; fli = fli->next)
27642 + if (fli->f == f && f)
27643 + break;
27644 + if (fli == NULL)
27646 + fli = XNEW (struct flist);
27647 + fli->f = f;
27648 + fli->next = flp;
27649 + fli->started_p = 0;
27650 + fli->file = v->line.file;
27651 + gcc_assert (fli->file);
27652 + flp = fli;
27654 + oprintf (f, "\n/* GC roots. */\n\n");
27657 + if (!deletable_p
27658 + && length
27659 + && v->type->kind == TYPE_POINTER
27660 + && (v->type->u.p->kind == TYPE_POINTER
27661 + || v->type->u.p->kind == TYPE_STRUCT))
27663 + write_array (f, v, &ggc_wtd);
27664 + write_array (f, v, &pch_wtd);
27668 + for (v = variables; v; v = v->next)
27670 + outf_p f = get_output_file_with_visibility (CONST_CAST (input_file*,
27671 + v->line.file));
27672 + struct flist *fli;
27673 + int skip_p = 0;
27674 + int length_p = 0;
27675 + options_p o;
27677 + for (o = v->opt; o; o = o->next)
27678 + if (strcmp (o->name, "length") == 0)
27679 + length_p = 1;
27680 + else if (strcmp (o->name, "deletable") == 0
27681 + || strcmp (o->name, "if_marked") == 0)
27682 + skip_p = 1;
27684 + if (skip_p)
27685 + continue;
27687 + for (fli = flp; fli; fli = fli->next)
27688 + if (fli->f == f)
27689 + break;
27690 + if (!fli->started_p)
27692 + fli->started_p = 1;
27694 + oprintf (f, "EXPORTED_CONST struct ggc_root_tab gt_ggc_r_");
27695 + put_mangled_filename (f, v->line.file);
27696 + oprintf (f, "[] = {\n");
27699 + write_root (f, v, v->type, v->name, length_p, &v->line, NULL, emit_pch);
27702 + finish_root_table (flp, "ggc_r", "LAST_GGC_ROOT_TAB", "ggc_root_tab",
27703 + "gt_ggc_rtab");
27705 + for (v = variables; v; v = v->next)
27707 + outf_p f = get_output_file_with_visibility (CONST_CAST (input_file*,
27708 + v->line.file));
27709 + struct flist *fli;
27710 + int skip_p = 1;
27711 + options_p o;
27713 + for (o = v->opt; o; o = o->next)
27714 + if (strcmp (o->name, "deletable") == 0)
27715 + skip_p = 0;
27716 + else if (strcmp (o->name, "if_marked") == 0)
27717 + skip_p = 1;
27719 + if (skip_p)
27720 + continue;
27722 + for (fli = flp; fli; fli = fli->next)
27723 + if (fli->f == f)
27724 + break;
27725 + if (!fli->started_p)
27727 + fli->started_p = 1;
27729 + oprintf (f, "EXPORTED_CONST struct ggc_root_tab gt_ggc_rd_");
27730 + put_mangled_filename (f, v->line.file);
27731 + oprintf (f, "[] = {\n");
27734 + oprintf (f, " { &%s, 1, sizeof (%s), NULL, NULL },\n",
27735 + v->name, v->name);
27738 + finish_root_table (flp, "ggc_rd", "LAST_GGC_ROOT_TAB", "ggc_root_tab",
27739 + "gt_ggc_deletable_rtab");
27741 + for (v = variables; v; v = v->next)
27743 + outf_p f = get_output_file_with_visibility (CONST_CAST (input_file*,
27744 + v->line.file));
27745 + struct flist *fli;
27746 + const char *if_marked = NULL;
27747 + int length_p = 0;
27748 + options_p o;
27750 + for (o = v->opt; o; o = o->next)
27751 + if (strcmp (o->name, "length") == 0)
27752 + length_p = 1;
27753 + else if (strcmp (o->name, "if_marked") == 0
27754 + && o->kind == OPTION_STRING)
27755 + if_marked = o->info.string;
27756 + if (if_marked == NULL)
27757 + continue;
27758 + if (v->type->kind != TYPE_POINTER
27759 + || v->type->u.p->kind != TYPE_PARAM_STRUCT
27760 + || v->type->u.p->u.param_struct.stru != find_structure ("htab", 0))
27762 + error_at_line (&v->line,
27763 + "if_marked option used but not hash table");
27764 + continue;
27767 + for (fli = flp; fli; fli = fli->next)
27768 + if (fli->f == f)
27769 + break;
27770 + if (!fli->started_p)
27772 + fli->started_p = 1;
27774 + oprintf (f, "EXPORTED_CONST struct ggc_cache_tab gt_ggc_rc_");
27775 + put_mangled_filename (f, v->line.file);
27776 + oprintf (f, "[] = {\n");
27779 + write_root (f, v, v->type->u.p->u.param_struct.param[0],
27780 + v->name, length_p, &v->line, if_marked, emit_pch);
27783 + finish_root_table (flp, "ggc_rc", "LAST_GGC_CACHE_TAB", "ggc_cache_tab",
27784 + "gt_ggc_cache_rtab");
27786 + if (!emit_pch)
27787 + return;
27789 + for (v = variables; v; v = v->next)
27791 + outf_p f = get_output_file_with_visibility (CONST_CAST (input_file*,
27792 + v->line.file));
27793 + struct flist *fli;
27794 + int length_p = 0;
27795 + int if_marked_p = 0;
27796 + options_p o;
27798 + for (o = v->opt; o; o = o->next)
27799 + if (strcmp (o->name, "length") == 0)
27800 + length_p = 1;
27801 + else if (strcmp (o->name, "if_marked") == 0)
27802 + if_marked_p = 1;
27804 + if (!if_marked_p)
27805 + continue;
27807 + for (fli = flp; fli; fli = fli->next)
27808 + if (fli->f == f)
27809 + break;
27810 + if (!fli->started_p)
27812 + fli->started_p = 1;
27814 + oprintf (f, "EXPORTED_CONST struct ggc_root_tab gt_pch_rc_");
27815 + put_mangled_filename (f, v->line.file);
27816 + oprintf (f, "[] = {\n");
27819 + write_root (f, v, v->type, v->name, length_p, &v->line, NULL, emit_pch);
27822 + finish_root_table (flp, "pch_rc", "LAST_GGC_ROOT_TAB", "ggc_root_tab",
27823 + "gt_pch_cache_rtab");
27825 + for (v = variables; v; v = v->next)
27827 + outf_p f = get_output_file_with_visibility (CONST_CAST (input_file*,
27828 + v->line.file));
27829 + struct flist *fli;
27830 + int skip_p = 0;
27831 + options_p o;
27833 + for (o = v->opt; o; o = o->next)
27834 + if (strcmp (o->name, "deletable") == 0
27835 + || strcmp (o->name, "if_marked") == 0)
27836 + skip_p = 1;
27838 + if (skip_p)
27839 + continue;
27841 + if (!contains_scalar_p (v->type))
27842 + continue;
27844 + for (fli = flp; fli; fli = fli->next)
27845 + if (fli->f == f)
27846 + break;
27847 + if (!fli->started_p)
27849 + fli->started_p = 1;
27851 + oprintf (f, "EXPORTED_CONST struct ggc_root_tab gt_pch_rs_");
27852 + put_mangled_filename (f, v->line.file);
27853 + oprintf (f, "[] = {\n");
27856 + oprintf (f, " { &%s, 1, sizeof (%s), NULL, NULL },\n",
27857 + v->name, v->name);
27860 + finish_root_table (flp, "pch_rs", "LAST_GGC_ROOT_TAB", "ggc_root_tab",
27861 + "gt_pch_scalar_rtab");
27864 +/* Record the definition of a generic VEC structure, as if we had expanded
27865 + the macros in vec.h:
27867 + typedef struct VEC_<type>_base GTY(()) {
27868 + unsigned num;
27869 + unsigned alloc;
27870 + <type> GTY((length ("%h.num"))) vec[1];
27871 + } VEC_<type>_base
27873 + where the GTY(()) tags are only present if is_scalar is _false_. */
27875 +void
27876 +note_def_vec (const char *type_name, bool is_scalar, struct fileloc *pos)
27878 + pair_p fields;
27879 + type_p t;
27880 + options_p o;
27881 + type_p len_ty = create_scalar_type ("unsigned");
27882 + const char *name = concat ("VEC_", type_name, "_base", (char *) 0);
27884 + if (is_scalar)
27886 + t = create_scalar_type (type_name);
27887 + o = 0;
27889 + else
27891 + t = resolve_typedef (type_name, pos);
27892 + o = create_string_option (0, "length", "%h.num");
27894 + /* We assemble the field list in reverse order. */
27895 + fields = create_field_at (0, create_array (t, "1"), "vec", o, pos);
27896 + fields = create_field_at (fields, len_ty, "alloc", 0, pos);
27897 + fields = create_field_at (fields, len_ty, "num", 0, pos);
27899 + do_typedef (name, new_structure (name, 0, pos, fields, 0), pos);
27902 +/* Record the definition of an allocation-specific VEC structure, as if
27903 + we had expanded the macros in vec.h:
27905 + typedef struct VEC_<type>_<astrat> {
27906 + VEC_<type>_base base;
27907 + } VEC_<type>_<astrat>;
27909 +void
27910 +note_def_vec_alloc (const char *type, const char *astrat, struct fileloc *pos)
27912 + const char *astratname = concat ("VEC_", type, "_", astrat, (char *) 0);
27913 + const char *basename = concat ("VEC_", type, "_base", (char *) 0);
27915 + pair_p field = create_field_at (0, resolve_typedef (basename, pos),
27916 + "base", 0, pos);
27918 + do_typedef (astratname, new_structure (astratname, 0, pos, field, 0), pos);
27921 +/* Returns the specifier keyword for a string or union type S, empty string
27922 + otherwise. */
27924 +static const char *
27925 +get_type_specifier (const type_p s)
27927 + if (s->kind == TYPE_STRUCT || s->kind == TYPE_LANG_STRUCT)
27928 + return "struct ";
27929 + if (s->kind == TYPE_UNION)
27930 + return "union ";
27931 + return "";
27934 +/* TRUE if type S has the GTY variable_size annotation. */
27936 +static bool
27937 +variable_size_p (const type_p s)
27939 + options_p o;
27940 + for (o = s->u.s.opt; o; o = o->next)
27941 + if (strcmp (o->name, "variable_size") == 0)
27942 + return true;
27943 + return false;
27946 +enum alloc_quantity
27947 +{ single, vector };
27948 +enum alloc_zone
27949 +{ any_zone, specific_zone };
27951 +/* Writes one typed allocator definition for type identifier TYPE_NAME with
27952 + optional type specifier TYPE_SPECIFIER. The allocator name will contain
27953 + ALLOCATOR_TYPE. If VARIABLE_SIZE is true, the allocator will have an extra
27954 + parameter specifying number of bytes to allocate. If QUANTITY is set to
27955 + VECTOR, a vector allocator will be output, if ZONE is set to SPECIFIC_ZONE,
27956 + the allocator will be zone-specific. */
27958 +static void
27959 +write_typed_alloc_def (bool variable_size, const char *type_specifier,
27960 + const char *type_name, const char *allocator_type,
27961 + enum alloc_quantity quantity, enum alloc_zone zone)
27963 + bool two_args = variable_size && (quantity == vector);
27964 + bool third_arg = ((zone == specific_zone)
27965 + && (variable_size || (quantity == vector)));
27967 + oprintf (header_file, "#define ggc_alloc_%s%s", allocator_type, type_name);
27968 + oprintf (header_file, "(%s%s%s%s%s) ",
27969 + (variable_size ? "SIZE" : ""),
27970 + (two_args ? ", " : ""),
27971 + (quantity == vector) ? "n" : "",
27972 + (third_arg ? ", " : ""), (zone == specific_zone) ? "z" : "");
27973 + oprintf (header_file, "((%s%s *)", type_specifier, type_name);
27974 + oprintf (header_file, "(ggc_internal_%salloc_stat (", allocator_type);
27975 + if (zone == specific_zone)
27976 + oprintf (header_file, "z, ");
27977 + if (variable_size)
27978 + oprintf (header_file, "SIZE");
27979 + else
27980 + oprintf (header_file, "sizeof (%s%s)", type_specifier, type_name);
27981 + if (quantity == vector)
27982 + oprintf (header_file, ", n");
27983 + oprintf (header_file, " MEM_STAT_INFO)))\n");
27986 +/* Writes a typed allocator definition for a struct or union S. */
27988 +static void
27989 +write_typed_struct_alloc_def (const type_p s, const char *allocator_type,
27990 + enum alloc_quantity quantity,
27991 + enum alloc_zone zone)
27993 + write_typed_alloc_def (variable_size_p (s), get_type_specifier (s),
27994 + s->u.s.tag, allocator_type, quantity, zone);
27997 +/* Writes a typed allocator definition for a typedef P. */
27999 +static void
28000 +write_typed_typedef_alloc_def (const pair_p p, const char *allocator_type,
28001 + enum alloc_quantity quantity,
28002 + enum alloc_zone zone)
28004 + write_typed_alloc_def (variable_size_p (p->type), "", p->name,
28005 + allocator_type, quantity, zone);
28008 +/* Writes typed allocator definitions for the types in STRUCTURES and
28009 + TYPEDEFS that are used by GC. */
28011 +static void
28012 +write_typed_alloc_defns (const type_p structures, const pair_p typedefs)
28014 + type_p s;
28015 + pair_p p;
28017 + oprintf (header_file,
28018 + "\n/* Allocators for known structs and unions. */\n\n");
28019 + for (s = structures; s; s = s->next)
28021 + if (!USED_BY_TYPED_GC_P (s))
28022 + continue;
28023 + write_typed_struct_alloc_def (s, "", single, any_zone);
28024 + write_typed_struct_alloc_def (s, "cleared_", single, any_zone);
28025 + write_typed_struct_alloc_def (s, "vec_", vector, any_zone);
28026 + write_typed_struct_alloc_def (s, "cleared_vec_", vector, any_zone);
28027 + write_typed_struct_alloc_def (s, "zone_", single, specific_zone);
28028 + write_typed_struct_alloc_def (s, "zone_cleared_", single,
28029 + specific_zone);
28030 + write_typed_struct_alloc_def (s, "zone_vec_", vector, specific_zone);
28031 + write_typed_struct_alloc_def (s, "zone_cleared_vec_", vector,
28032 + specific_zone);
28035 + oprintf (header_file, "\n/* Allocators for known typedefs. */\n");
28036 + for (p = typedefs; p; p = p->next)
28038 + s = p->type;
28039 + if (!USED_BY_TYPED_GC_P (s) || (strcmp (p->name, s->u.s.tag) == 0))
28040 + continue;
28041 + write_typed_typedef_alloc_def (p, "", single, any_zone);
28042 + write_typed_typedef_alloc_def (p, "cleared_", single, any_zone);
28043 + write_typed_typedef_alloc_def (p, "vec_", vector, any_zone);
28044 + write_typed_typedef_alloc_def (p, "cleared_vec_", vector, any_zone);
28045 + write_typed_typedef_alloc_def (p, "zone_", single, specific_zone);
28046 + write_typed_typedef_alloc_def (p, "zone_cleared_", single,
28047 + specific_zone);
28048 + write_typed_typedef_alloc_def (p, "zone_cleared_vec_", vector,
28049 + specific_zone);
28053 +/* Prints not-as-ugly version of a typename of T to OF. Trades the uniquness
28054 + guaranteee for somewhat increased readability. If name conflicts do happen,
28055 + this funcion will have to be adjusted to be more like
28056 + output_mangled_typename. */
28058 +static void
28059 +output_typename (outf_p of, const_type_p t)
28061 + switch (t->kind)
28063 + case TYPE_STRING:
28064 + oprintf (of, "str");
28065 + break;
28066 + case TYPE_SCALAR:
28067 + oprintf (of, "scalar");
28068 + break;
28069 + case TYPE_POINTER:
28070 + output_typename (of, t->u.p);
28071 + break;
28072 + case TYPE_STRUCT:
28073 + case TYPE_UNION:
28074 + case TYPE_LANG_STRUCT:
28075 + oprintf (of, "%s", t->u.s.tag);
28076 + break;
28077 + case TYPE_PARAM_STRUCT:
28079 + int i;
28080 + for (i = 0; i < NUM_PARAM; i++)
28081 + if (t->u.param_struct.param[i] != NULL)
28083 + output_typename (of, t->u.param_struct.param[i]);
28084 + oprintf (of, "_");
28086 + output_typename (of, t->u.param_struct.stru);
28087 + break;
28089 + default:
28090 + gcc_unreachable ();
28094 +/* Writes a typed GC allocator for type S that is suitable as a callback for
28095 + the splay tree implementation in libiberty. */
28097 +static void
28098 +write_splay_tree_allocator_def (const_type_p s)
28100 + outf_p of = get_output_file_with_visibility (NULL);
28101 + oprintf (of, "void * ggc_alloc_splay_tree_");
28102 + output_typename (of, s);
28103 + oprintf (of, " (int sz, void * nl)\n");
28104 + oprintf (of, "{\n");
28105 + oprintf (of, " return ggc_splay_alloc (");
28106 + oprintf (of, "gt_e_");
28107 + output_mangled_typename (of, s);
28108 + oprintf (of, ", sz, nl);\n");
28109 + oprintf (of, "}\n\n");
28112 +/* Writes typed GC allocators for PARAM_STRUCTS that are suitable as callbacks
28113 + for the splay tree implementation in libiberty. */
28115 +static void
28116 +write_splay_tree_allocators (const_type_p param_structs)
28118 + const_type_p s;
28120 + oprintf (header_file, "\n/* Splay tree callback allocators. */\n");
28121 + for (s = param_structs; s; s = s->next)
28122 + if (s->gc_used == GC_POINTED_TO)
28124 + oprintf (header_file, "extern void * ggc_alloc_splay_tree_");
28125 + output_typename (header_file, s);
28126 + oprintf (header_file, " (int, void *);\n");
28127 + write_splay_tree_allocator_def (s);
28131 +static void dump_pair (int indent, pair_p p);
28132 +static void dump_type (int indent, type_p p);
28133 +static void dump_type_list (int indent, type_p p);
28135 +#define INDENT 2
28137 +/* Dumps the value of typekind KIND. */
28139 +static void
28140 +dump_typekind (int indent, enum typekind kind)
28142 + printf ("%*ckind = ", indent, ' ');
28143 + switch (kind)
28145 + case TYPE_SCALAR:
28146 + printf ("TYPE_SCALAR");
28147 + break;
28148 + case TYPE_STRING:
28149 + printf ("TYPE_STRING");
28150 + break;
28151 + case TYPE_STRUCT:
28152 + printf ("TYPE_STRUCT");
28153 + break;
28154 + case TYPE_UNION:
28155 + printf ("TYPE_UNION");
28156 + break;
28157 + case TYPE_POINTER:
28158 + printf ("TYPE_POINTER");
28159 + break;
28160 + case TYPE_ARRAY:
28161 + printf ("TYPE_ARRAY");
28162 + break;
28163 + case TYPE_LANG_STRUCT:
28164 + printf ("TYPE_LANG_STRUCT");
28165 + break;
28166 + case TYPE_PARAM_STRUCT:
28167 + printf ("TYPE_PARAM_STRUCT");
28168 + break;
28169 + default:
28170 + gcc_unreachable ();
28172 + printf ("\n");
28175 +/* Dumps the value of GC_USED flag. */
28177 +static void
28178 +dump_gc_used (int indent, enum gc_used_enum gc_used)
28180 + printf ("%*cgc_used = ", indent, ' ');
28181 + switch (gc_used)
28183 + case GC_UNUSED:
28184 + printf ("GC_UNUSED");
28185 + break;
28186 + case GC_USED:
28187 + printf ("GC_USED");
28188 + break;
28189 + case GC_MAYBE_POINTED_TO:
28190 + printf ("GC_MAYBE_POINTED_TO");
28191 + break;
28192 + case GC_POINTED_TO:
28193 + printf ("GC_POINTED_TO");
28194 + break;
28195 + default:
28196 + gcc_unreachable ();
28198 + printf ("\n");
28201 +/* Dumps the type options OPT. */
28203 +static void
28204 +dump_options (int indent, options_p opt)
28206 + options_p o;
28207 + printf ("%*coptions = ", indent, ' ');
28208 + o = opt;
28209 + while (o)
28211 + switch (o->kind)
28213 + case OPTION_STRING:
28214 + printf ("%s:string %s ", o->name, o->info.string);
28215 + break;
28216 + case OPTION_TYPE:
28217 + printf ("%s:type ", o->name);
28218 + dump_type (indent+1, o->info.type);
28219 + break;
28220 + case OPTION_NESTED:
28221 + printf ("%s:nested ", o->name);
28222 + break;
28223 + case OPTION_NONE:
28224 + gcc_unreachable ();
28226 + o = o->next;
28228 + printf ("\n");
28231 +/* Dumps the source file location in LINE. */
28233 +static void
28234 +dump_fileloc (int indent, struct fileloc line)
28236 + printf ("%*cfileloc: file = %s, line = %d\n", indent, ' ',
28237 + get_input_file_name (line.file),
28238 + line.line);
28241 +/* Recursively dumps the struct, union, or a language-specific
28242 + struct T. */
28244 +static void
28245 +dump_type_u_s (int indent, type_p t)
28247 + pair_p fields;
28249 + gcc_assert (t->kind == TYPE_STRUCT || t->kind == TYPE_UNION
28250 + || t->kind == TYPE_LANG_STRUCT);
28251 + printf ("%*cu.s.tag = %s\n", indent, ' ', t->u.s.tag);
28252 + dump_fileloc (indent, t->u.s.line);
28253 + printf ("%*cu.s.fields =\n", indent, ' ');
28254 + fields = t->u.s.fields;
28255 + while (fields)
28257 + dump_pair (indent + INDENT, fields);
28258 + fields = fields->next;
28260 + printf ("%*cend of fields of type %p\n", indent, ' ', (void *) t);
28261 + dump_options (indent, t->u.s.opt);
28262 + printf ("%*cu.s.bitmap = %X\n", indent, ' ', t->u.s.bitmap);
28263 + if (t->kind == TYPE_LANG_STRUCT)
28265 + printf ("%*cu.s.lang_struct:\n", indent, ' ');
28266 + dump_type_list (indent + INDENT, t->u.s.lang_struct);
28270 +/* Recursively dumps the array T. */
28272 +static void
28273 +dump_type_u_a (int indent, type_p t)
28275 + gcc_assert (t->kind == TYPE_ARRAY);
28276 + printf ("%*clen = %s, u.a.p:\n", indent, ' ', t->u.a.len);
28277 + dump_type_list (indent + INDENT, t->u.a.p);
28280 +/* Recursively dumps the parameterized struct T. */
28282 +static void
28283 +dump_type_u_param_struct (int indent, type_p t)
28285 + int i;
28286 + gcc_assert (t->kind == TYPE_PARAM_STRUCT);
28287 + printf ("%*cu.param_struct.stru:\n", indent, ' ');
28288 + dump_type_list (indent, t->u.param_struct.stru);
28289 + dump_fileloc (indent, t->u.param_struct.line);
28290 + for (i = 0; i < NUM_PARAM; i++)
28292 + if (t->u.param_struct.param[i] == NULL)
28293 + continue;
28294 + printf ("%*cu.param_struct.param[%d]:\n", indent, ' ', i);
28295 + dump_type (indent + INDENT, t->u.param_struct.param[i]);
28299 +/* Recursively dumps the type list T. */
28301 +static void
28302 +dump_type_list (int indent, type_p t)
28304 + type_p p = t;
28305 + while (p)
28307 + dump_type (indent, p);
28308 + p = p->next;
28312 +static htab_t seen_types;
28314 +/* Recursively dumps the type T if it was not dumped previously. */
28316 +static void
28317 +dump_type (int indent, type_p t)
28319 + PTR *slot;
28321 + printf ("%*cType at %p: ", indent, ' ', (void *) t);
28322 + slot = htab_find_slot (seen_types, t, INSERT);
28323 + if (*slot != NULL)
28325 + printf ("already seen.\n");
28326 + return;
28328 + *slot = t;
28329 + printf ("\n");
28331 + dump_typekind (indent, t->kind);
28332 + printf ("%*cpointer_to = %p\n", indent + INDENT, ' ',
28333 + (void *) t->pointer_to);
28334 + dump_gc_used (indent + INDENT, t->gc_used);
28335 + switch (t->kind)
28337 + case TYPE_SCALAR:
28338 + printf ("%*cscalar_is_char = %s\n", indent + INDENT, ' ',
28339 + t->u.scalar_is_char ? "true" : "false");
28340 + break;
28341 + case TYPE_STRING:
28342 + break;
28343 + case TYPE_STRUCT:
28344 + case TYPE_UNION:
28345 + case TYPE_LANG_STRUCT:
28346 + dump_type_u_s (indent + INDENT, t);
28347 + break;
28348 + case TYPE_POINTER:
28349 + printf ("%*cp:\n", indent + INDENT, ' ');
28350 + dump_type (indent + INDENT, t->u.p);
28351 + break;
28352 + case TYPE_ARRAY:
28353 + dump_type_u_a (indent + INDENT, t);
28354 + break;
28355 + case TYPE_PARAM_STRUCT:
28356 + dump_type_u_param_struct (indent + INDENT, t);
28357 + break;
28358 + default:
28359 + gcc_unreachable ();
28361 + printf ("%*cEnd of type at %p\n", indent, ' ', (void *) t);
28364 +/* Dumps the pair P. */
28366 +static void
28367 +dump_pair (int indent, pair_p p)
28369 + printf ("%*cpair: name = %s\n", indent, ' ', p->name);
28370 + dump_type (indent, p->type);
28371 + dump_fileloc (indent, p->line);
28372 + dump_options (indent, p->opt);
28373 + printf ("%*cEnd of pair %s\n", indent, ' ', p->name);
28376 +/* Dumps the list of pairs PP. */
28378 +static void
28379 +dump_pair_list (const char *name, pair_p pp)
28381 + pair_p p;
28382 + printf ("%s:\n", name);
28383 + for (p = pp; p != NULL; p = p->next)
28384 + dump_pair (0, p);
28385 + printf ("End of %s\n\n", name);
28388 +/* Dumps the STRUCTURES. */
28390 +static void
28391 +dump_structures (const char *name, type_p structures)
28393 + printf ("%s:\n", name);
28394 + dump_type_list (0, structures);
28395 + printf ("End of %s\n\n", name);
28398 +/* Dumps the internal structures of gengtype. This is useful to debug
28399 + gengtype itself, or to understand what it does, e.g. for plugin
28400 + developers. */
28402 +static void
28403 +dump_everything (void)
28405 + seen_types = htab_create (100, htab_hash_pointer, htab_eq_pointer, NULL);
28406 + dump_pair_list ("typedefs", typedefs);
28407 + dump_structures ("structures", structures);
28408 + dump_structures ("param_structs", param_structs);
28409 + dump_pair_list ("variables", variables);
28410 + htab_delete (seen_types);
28415 +/* Option specification for getopt_long. */
28416 +static const struct option gengtype_long_options[] = {
28417 + {"help", no_argument, NULL, 'h'},
28418 + {"version", no_argument, NULL, 'V'},
28419 + {"verbose", no_argument, NULL, 'v'},
28420 + {"dump", no_argument, NULL, 'd'},
28421 + {"debug", no_argument, NULL, 'D'},
28422 + {"plugin", required_argument, NULL, 'P'},
28423 + {"srcdir", required_argument, NULL, 'S'},
28424 + {"backupdir", required_argument, NULL, 'B'},
28425 + {"inputs", required_argument, NULL, 'I'},
28426 + {"read-state", required_argument, NULL, 'r'},
28427 + {"write-state", required_argument, NULL, 'w'},
28428 + /* Terminating NULL placeholder. */
28429 + {NULL, no_argument, NULL, 0},
28433 +static void
28434 +print_usage (void)
28436 + printf ("Usage: %s\n", progname);
28437 + printf ("\t -h | --help " " \t# Give this help.\n");
28438 + printf ("\t -D | --debug "
28439 + " \t# Give debug output to debug %s itself.\n", progname);
28440 + printf ("\t -V | --version " " \t# Give version information.\n");
28441 + printf ("\t -v | --verbose \t# Increase verbosity. Can be given several times.\n");
28442 + printf ("\t -d | --dump " " \t# Dump state for debugging.\n");
28443 + printf ("\t -P | --plugin <output-file> <plugin-src> ... "
28444 + " \t# Generate for plugin.\n");
28445 + printf ("\t -S | --srcdir <GCC-directory> "
28446 + " \t# Specify the GCC source directory.\n");
28447 + printf ("\t -B | --backupdir <directory> "
28448 + " \t# Specify the backup directory for updated files.\n");
28449 + printf ("\t -I | --inputs <input-list> "
28450 + " \t# Specify the file with source files list.\n");
28451 + printf ("\t -w | --write-state <state-file> " " \t# Write a state file.\n");
28452 + printf ("\t -r | --read-state <state-file> " " \t# Read a state file.\n");
28455 +static void
28456 +print_version (void)
28458 + printf ("%s %s%s\n", progname, pkgversion_string, version_string);
28459 + printf ("Report bugs: %s\n", bug_report_url);
28462 +/* Parse the program options using getopt_long... */
28463 +static void
28464 +parse_program_options (int argc, char **argv)
28466 + int opt = -1;
28467 + while ((opt = getopt_long (argc, argv, "hVvdP:S:B:I:w:r:D",
28468 + gengtype_long_options, NULL)) >= 0)
28470 + switch (opt)
28472 + case 'h': /* --help */
28473 + print_usage ();
28474 + break;
28475 + case 'V': /* --version */
28476 + print_version ();
28477 + break;
28478 + case 'd': /* --dump */
28479 + do_dump = 1;
28480 + break;
28481 + case 'D': /* --debug */
28482 + do_debug = 1;
28483 + break;
28484 + case 'v': /* --verbose */
28485 + verbosity_level++;
28486 + break;
28487 + case 'P': /* --plugin */
28488 + if (optarg)
28489 + plugin_output_filename = optarg;
28490 + else
28491 + fatal ("missing plugin output file name");
28492 + break;
28493 + case 'S': /* --srcdir */
28494 + if (optarg)
28495 + srcdir = optarg;
28496 + else
28497 + fatal ("missing source directory");
28498 + srcdir_len = strlen (srcdir);
28499 + break;
28500 + case 'B': /* --backupdir */
28501 + if (optarg)
28502 + backup_dir = optarg;
28503 + else
28504 + fatal ("missing backup directory");
28505 + break;
28506 + case 'I': /* --inputs */
28507 + if (optarg)
28508 + inputlist = optarg;
28509 + else
28510 + fatal ("missing input list");
28511 + break;
28512 + case 'r': /* --read-state */
28513 + if (optarg)
28514 + read_state_filename = optarg;
28515 + else
28516 + fatal ("missing read state file");
28517 + DBGPRINTF ("read state %s\n", optarg);
28518 + break;
28519 + case 'w': /* --write-state */
28520 + DBGPRINTF ("write state %s\n", optarg);
28521 + if (optarg)
28522 + write_state_filename = optarg;
28523 + else
28524 + fatal ("missing write state file");
28525 + break;
28526 + default:
28527 + fprintf (stderr, "%s: unknown flag '%c'\n", progname, opt);
28528 + print_usage ();
28529 + fatal ("unexpected flag");
28531 + };
28532 + if (plugin_output_filename)
28534 + /* In plugin mode we require some input files. */
28535 + int i = 0;
28536 + if (optind >= argc)
28537 + fatal ("no source files given in plugin mode");
28538 + nb_plugin_files = argc - optind;
28539 + plugin_files = XNEWVEC (input_file*, nb_plugin_files);
28540 + for (i = 0; i < (int) nb_plugin_files; i++)
28542 + char *name = argv[i + optind];
28543 + plugin_files[i] = input_file_by_name (name);
28550 +/******* Manage input files. ******/
28552 +/* Hash table of unique input file names. */
28553 +static htab_t input_file_htab;
28555 +/* Find or allocate a new input_file by hash-consing it. */
28556 +input_file*
28557 +input_file_by_name (const char* name)
28559 + PTR* slot;
28560 + input_file* f = NULL;
28561 + int namlen = 0;
28562 + if (!name)
28563 + return NULL;
28564 + namlen = strlen (name);
28565 + f = XCNEWVAR (input_file, sizeof (input_file)+namlen+2);
28566 + f->inpbitmap = 0;
28567 + f->inpoutf = NULL;
28568 + strcpy (f->inpname, name);
28569 + slot = htab_find_slot (input_file_htab, f, INSERT);
28570 + gcc_assert (slot != NULL);
28571 + if (*slot)
28573 + /* Already known input file. */
28574 + free (f);
28575 + return (input_file*)(*slot);
28577 + /* New input file. */
28578 + *slot = f;
28579 + return f;
28582 +/* Hash table support routines for input_file-s. */
28583 +static hashval_t
28584 +htab_hash_inputfile (const void *p)
28586 + const input_file *inpf = (const input_file *) p;
28587 + gcc_assert (inpf);
28588 + return htab_hash_string (get_input_file_name (inpf));
28591 +static int
28592 +htab_eq_inputfile (const void *x, const void *y)
28594 + const input_file *inpfx = (const input_file *) x;
28595 + const input_file *inpfy = (const input_file *) y;
28596 + gcc_assert (inpfx != NULL && inpfy != NULL);
28597 + return !strcmp (get_input_file_name (inpfx), get_input_file_name (inpfy));
28601 +int
28602 +main (int argc, char **argv)
28604 + size_t i;
28605 + static struct fileloc pos = { NULL, 0 };
28606 + outf_p output_header;
28608 + /* Mandatory common initializations. */
28609 + progname = "gengtype"; /* For fatal and messages. */
28610 + /* Create the hash-table used to hash-cons input files. */
28611 + input_file_htab =
28612 + htab_create (800, htab_hash_inputfile, htab_eq_inputfile, NULL);
28613 + /* Initialize our special input files. */
28614 + this_file = input_file_by_name (__FILE__);
28615 + system_h_file = input_file_by_name ("system.h");
28616 + /* Set the scalar_is_char union number for predefined scalar types. */
28617 + scalar_nonchar.u.scalar_is_char = FALSE;
28618 + scalar_char.u.scalar_is_char = TRUE;
28620 + parse_program_options (argc, argv);
28622 +#if ENABLE_CHECKING
28623 + if (do_debug)
28625 + time_t now = (time_t) 0;
28626 + time (&now);
28627 + DBGPRINTF ("gengtype started pid %d at %s",
28628 + (int) getpid (), ctime (&now));
28630 +#endif /* ENABLE_CHECKING */
28632 + /* Parse the input list and the input files. */
28633 + DBGPRINTF ("inputlist %s", inputlist);
28634 + if (read_state_filename)
28636 + if (inputlist)
28637 + fatal ("input list %s cannot be given with a read state file %s",
28638 + inputlist, read_state_filename);
28639 + read_state (read_state_filename);
28640 + DBGPRINT_COUNT_TYPE ("structures after read_state", structures);
28641 + DBGPRINT_COUNT_TYPE ("param_structs after read_state", param_structs);
28643 + else if (inputlist)
28645 + /* These types are set up with #define or else outside of where
28646 + we can see them. We should initialize them before calling
28647 + read_input_list. */
28648 +#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
28649 + Call;} while(0)
28650 + POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
28651 + POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
28652 + POS_HERE (do_scalar_typedef ("FIXED_VALUE_TYPE", &pos));
28653 + POS_HERE (do_scalar_typedef ("double_int", &pos));
28654 + POS_HERE (do_scalar_typedef ("uint64_t", &pos));
28655 + POS_HERE (do_scalar_typedef ("uint8", &pos));
28656 + POS_HERE (do_scalar_typedef ("jword", &pos));
28657 + POS_HERE (do_scalar_typedef ("JCF_u2", &pos));
28658 + POS_HERE (do_scalar_typedef ("void", &pos));
28659 + POS_HERE (do_typedef ("PTR",
28660 + create_pointer (resolve_typedef ("void", &pos)),
28661 + &pos));
28662 +#undef POS_HERE
28663 + read_input_list (inputlist);
28664 + for (i = 0; i < num_gt_files; i++)
28666 + parse_file (get_input_file_name (gt_files[i]));
28667 + DBGPRINTF ("parsed file #%d %s",
28668 + (int) i, get_input_file_name (gt_files[i]));
28670 + if (verbosity_level >= 1)
28671 + printf ("%s parsed %d files with %d GTY types\n",
28672 + progname, (int) num_gt_files, type_count);
28674 + DBGPRINT_COUNT_TYPE ("structures after parsing", structures);
28675 + DBGPRINT_COUNT_TYPE ("param_structs after parsing", param_structs);
28678 + else
28679 + fatal ("either an input list or a read state file should be given");
28680 + if (hit_error)
28681 + return 1;
28684 + if (plugin_output_filename)
28686 + size_t ix = 0;
28687 + /* In plugin mode, we should have read a state file, and have
28688 + given at least one plugin file. */
28689 + if (!read_state_filename)
28690 + fatal ("No read state given in plugin mode for %s",
28691 + plugin_output_filename);
28693 + if (nb_plugin_files == 0 || !plugin_files)
28694 + fatal ("No plugin files given in plugin mode for %s",
28695 + plugin_output_filename);
28697 + /* Parse our plugin files and augment the state. */
28698 + for (ix = 0; ix < nb_plugin_files; ix++)
28699 + parse_file (get_input_file_name (plugin_files[ix]));
28701 + if (hit_error)
28702 + return 1;
28704 + plugin_output = create_file ("GCC", plugin_output_filename);
28705 + DBGPRINTF ("created plugin_output %p named %s",
28706 + (void *) plugin_output, plugin_output->name);
28708 + else
28709 + { /* No plugin files, we are in normal mode. */
28710 + if (!srcdir)
28711 + fatal ("gengtype needs a source directory in normal mode");
28713 + if (hit_error)
28714 + return 1;
28716 + gen_rtx_next ();
28718 + /* The call to set_gc_used may indirectly call find_param_structure
28719 + hence enlarge the param_structs list of types. */
28720 + set_gc_used (variables);
28722 + /* The state at this point is read from the state input file or by
28723 + parsing source files and optionally augmented by parsing plugin
28724 + source files. Write it now. */
28725 + if (write_state_filename)
28727 + DBGPRINT_COUNT_TYPE ("structures before write_state", structures);
28728 + DBGPRINT_COUNT_TYPE ("param_structs before write_state", param_structs);
28730 + if (hit_error)
28731 + fatal ("didn't write state file %s after errors",
28732 + write_state_filename);
28734 + DBGPRINTF ("before write_state %s", write_state_filename);
28735 + write_state (write_state_filename);
28737 + if (do_dump)
28738 + dump_everything ();
28740 + /* After having written the state file we return immediately to
28741 + avoid generating any output file. */
28742 + if (hit_error)
28743 + return 1;
28744 + else
28745 + return 0;
28749 + open_base_files ();
28751 + write_enum_defn (structures, param_structs);
28752 + write_typed_alloc_defns (structures, typedefs);
28753 + output_header = plugin_output ? plugin_output : header_file;
28754 + DBGPRINT_COUNT_TYPE ("structures before write_types outputheader",
28755 + structures);
28756 + DBGPRINT_COUNT_TYPE ("param_structs before write_types outputheader",
28757 + param_structs);
28759 + write_types (output_header, structures, param_structs, &ggc_wtd);
28760 + if (plugin_files == NULL)
28762 + DBGPRINT_COUNT_TYPE ("structures before write_types headerfil",
28763 + structures);
28764 + DBGPRINT_COUNT_TYPE ("param_structs before write_types headerfil",
28765 + param_structs);
28766 + write_types (header_file, structures, param_structs, &pch_wtd);
28767 + write_local (header_file, structures, param_structs);
28769 + write_splay_tree_allocators (param_structs);
28770 + write_roots (variables, plugin_files == NULL);
28771 + write_rtx_next ();
28772 + close_output_files ();
28774 + if (do_dump)
28775 + dump_everything ();
28777 + /* Don't bother about free-ing any input or plugin file, etc. */
28779 + if (hit_error)
28780 + return 1;
28781 + return 0;
28783 diff -urN gcc-4.8.1/gcc/gengtype.c.rej.old gcc-4.8.1.new/gcc/gengtype.c.rej.old
28784 --- gcc-4.8.1/gcc/gengtype.c.rej.old 1969-12-31 19:00:00.000000000 -0500
28785 +++ gcc-4.8.1.new/gcc/gengtype.c.rej.old 2013-12-02 20:22:15.936776290 -0500
28786 @@ -0,0 +1,17 @@
28787 +--- gcc/gengtype.c 2010-11-25 20:03:27.000000000 +0100
28788 ++++ gcc/gengtype.c 2013-08-26 07:55:42.000000000 +0200
28789 +@@ -3594,13 +3594,13 @@
28790 + int has_length, struct fileloc *line, const char *if_marked,
28791 + bool emit_pch, type_p field_type, const char *field_name)
28793 ++ struct pair newv;
28794 + /* If the field reference is relative to V, rather than to some
28795 + subcomponent of V, we can mark any subarrays with a single stride.
28796 + We're effectively treating the field as a global variable in its
28797 + own right. */
28798 + if (v && type == v->type)
28800 +- struct pair newv;
28802 + newv = *v;
28803 + newv.type = field_type;
28804 diff -urN gcc-4.8.1/gcc/ginclude/aros/types/null.h gcc-4.8.1.new/gcc/ginclude/aros/types/null.h
28805 --- gcc-4.8.1/gcc/ginclude/aros/types/null.h 1969-12-31 19:00:00.000000000 -0500
28806 +++ gcc-4.8.1.new/gcc/ginclude/aros/types/null.h 2013-12-02 20:22:15.936776290 -0500
28807 @@ -0,0 +1,3 @@
28808 +/* Replace AROS' NULL definition with gcc's one */
28809 +#define __need_NULL
28810 +#include <stddef.h>
28811 diff -urN gcc-4.8.1/gcc/ginclude/aros/types/ptrdiff_t.h gcc-4.8.1.new/gcc/ginclude/aros/types/ptrdiff_t.h
28812 --- gcc-4.8.1/gcc/ginclude/aros/types/ptrdiff_t.h 1969-12-31 19:00:00.000000000 -0500
28813 +++ gcc-4.8.1.new/gcc/ginclude/aros/types/ptrdiff_t.h 2013-12-02 20:22:15.936776290 -0500
28814 @@ -0,0 +1,3 @@
28815 +/* Replace AROS' ptrdiff_t definition with gcc's one */
28816 +#define __need_ptrdiff_t
28817 +#include <stddef.h>
28818 diff -urN gcc-4.8.1/gcc/ginclude/aros/types/size_t.h gcc-4.8.1.new/gcc/ginclude/aros/types/size_t.h
28819 --- gcc-4.8.1/gcc/ginclude/aros/types/size_t.h 1969-12-31 19:00:00.000000000 -0500
28820 +++ gcc-4.8.1.new/gcc/ginclude/aros/types/size_t.h 2013-12-02 20:22:15.936776290 -0500
28821 @@ -0,0 +1,3 @@
28822 +/* Replace AROS' size_t definition with gcc's one */
28823 +#define __need_size_t
28824 +#include <stddef.h>
28825 diff -urN gcc-4.8.1/gcc/ginclude/aros/types/wchar_t.h gcc-4.8.1.new/gcc/ginclude/aros/types/wchar_t.h
28826 --- gcc-4.8.1/gcc/ginclude/aros/types/wchar_t.h 1969-12-31 19:00:00.000000000 -0500
28827 +++ gcc-4.8.1.new/gcc/ginclude/aros/types/wchar_t.h 2013-12-02 20:22:15.936776290 -0500
28828 @@ -0,0 +1,3 @@
28829 +/* Replace AROS' wchar_t definition with gcc's one */
28830 +#define __need_wchar_t
28831 +#include <stddef.h>
28832 diff -urN gcc-4.8.1/gcc/ginclude/aros/types/wint_t.h gcc-4.8.1.new/gcc/ginclude/aros/types/wint_t.h
28833 --- gcc-4.8.1/gcc/ginclude/aros/types/wint_t.h 1969-12-31 19:00:00.000000000 -0500
28834 +++ gcc-4.8.1.new/gcc/ginclude/aros/types/wint_t.h 2013-12-02 20:22:15.936776290 -0500
28835 @@ -0,0 +1,3 @@
28836 +/* Replace AROS' wint_t definition with gcc's one */
28837 +#define __need_wint_t
28838 +#include <stddef.h>
28839 diff -urN gcc-4.8.1/gcc/ginclude/stddef.h gcc-4.8.1.new/gcc/ginclude/stddef.h
28840 --- gcc-4.8.1/gcc/ginclude/stddef.h 2011-01-29 17:15:52.000000000 -0500
28841 +++ gcc-4.8.1.new/gcc/ginclude/stddef.h 2013-12-02 20:22:15.936776290 -0500
28842 @@ -131,6 +131,7 @@
28843 #ifndef __PTRDIFF_T
28844 #ifndef _PTRDIFF_T_
28845 #ifndef _BSD_PTRDIFF_T_
28846 +#ifndef _AROS_TYPES_PTRDIFF_T_H
28847 #ifndef ___int_ptrdiff_t_h
28848 #ifndef _GCC_PTRDIFF_T
28849 #define _PTRDIFF_T
28850 @@ -140,6 +141,7 @@
28851 #define __PTRDIFF_T
28852 #define _PTRDIFF_T_
28853 #define _BSD_PTRDIFF_T_
28854 +#define _AROS_TYPES_PTRDIFF_T_H
28855 #define ___int_ptrdiff_t_h
28856 #define _GCC_PTRDIFF_T
28857 #ifndef __PTRDIFF_TYPE__
28858 @@ -149,6 +151,7 @@
28859 typedef __PTRDIFF_TYPE__ ptrdiff_t;
28860 #endif /* _GCC_PTRDIFF_T */
28861 #endif /* ___int_ptrdiff_t_h */
28862 +#endif /* _AROS_TYPES_PTRDIFF_T_H */
28863 #endif /* _BSD_PTRDIFF_T_ */
28864 #endif /* _PTRDIFF_T_ */
28865 #endif /* __PTRDIFF_T */
28866 @@ -176,6 +179,7 @@
28867 #ifndef __SIZE_T
28868 #ifndef _SIZE_T_
28869 #ifndef _BSD_SIZE_T_
28870 +#ifndef _AROS_TYPES_SIZE_T_H
28871 #ifndef _SIZE_T_DEFINED_
28872 #ifndef _SIZE_T_DEFINED
28873 #ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */
28874 @@ -194,6 +198,7 @@
28875 #define __SIZE_T
28876 #define _SIZE_T_
28877 #define _BSD_SIZE_T_
28878 +#define _AROS_TYPES_SIZE_T_H
28879 #define _SIZE_T_DEFINED_
28880 #define _SIZE_T_DEFINED
28881 #define _BSD_SIZE_T_DEFINED_ /* Darwin */
28882 @@ -222,6 +227,7 @@
28883 #endif /* _BSD_SIZE_T_DEFINED_ */
28884 #endif /* _SIZE_T_DEFINED */
28885 #endif /* _SIZE_T_DEFINED_ */
28886 +#endif /* _AROS_TYPES_SIZE_T_H */
28887 #endif /* _BSD_SIZE_T_ */
28888 #endif /* _SIZE_T_ */
28889 #endif /* __SIZE_T */
28890 diff -urN gcc-4.8.1/include/filenames.h gcc-4.8.1.new/include/filenames.h
28891 --- gcc-4.8.1/include/filenames.h 2011-02-28 13:23:25.000000000 -0500
28892 +++ gcc-4.8.1.new/include/filenames.h 2013-12-02 20:22:15.936776290 -0500
28893 @@ -37,6 +37,10 @@
28894 # define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f)
28895 # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
28896 # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
28897 +#elif defined __AROS__
28898 +# define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == ':')
28899 +# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (strchr((f), ':')))
28900 +# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM
28901 #else /* not DOSish */
28902 # define HAS_DRIVE_SPEC(f) (0)
28903 # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
28904 diff -urN gcc-4.8.1/libcpp/configure gcc-4.8.1.new/libcpp/configure
28905 --- gcc-4.8.1/libcpp/configure 2013-04-12 05:58:00.000000000 -0400
28906 +++ gcc-4.8.1.new/libcpp/configure 2013-12-02 20:22:15.940776306 -0500
28907 @@ -7092,6 +7092,7 @@
28908 arm*-*-*eabi* | \
28909 arm*-*-rtems[.0-9]* | \
28910 arm*-*-symbianelf* | \
28911 + arm*-*-aros | \
28912 x86_64-*-* | \
28913 ia64-*-* | \
28914 hppa*64*-*-* | \
28915 diff -urN gcc-4.8.1/libcpp/configure.ac gcc-4.8.1.new/libcpp/configure.ac
28916 --- gcc-4.8.1/libcpp/configure.ac 2013-04-03 11:45:53.000000000 -0400
28917 +++ gcc-4.8.1.new/libcpp/configure.ac 2013-12-02 20:22:15.940776306 -0500
28918 @@ -142,6 +142,7 @@
28919 arm*-*-*eabi* | \
28920 arm*-*-rtems[.0-9]* | \
28921 arm*-*-symbianelf* | \
28922 + arm*-*-aros | \
28923 x86_64-*-* | \
28924 ia64-*-* | \
28925 hppa*64*-*-* | \
28926 diff -urN gcc-4.8.1/libgcc/config.host gcc-4.8.1.new/libgcc/config.host
28927 --- gcc-4.8.1/libgcc/config.host 2011-11-23 17:15:54.000000000 -0500
28928 +++ gcc-4.8.1.new/libgcc/config.host 2013-12-02 20:22:15.940776306 -0500
28929 @@ -590,6 +590,8 @@
28931 mep*-*-*)
28933 +*-*-aros*)
28934 + ;;
28936 echo "*** Configuration ${host} not supported" 1>&2
28937 exit 1
28938 diff -urN gcc-4.8.1/libiberty/filename_cmp.c gcc-4.8.1.new/libiberty/filename_cmp.c
28939 --- gcc-4.8.1/libiberty/filename_cmp.c 2011-02-28 13:23:25.000000000 -0500
28940 +++ gcc-4.8.1.new/libiberty/filename_cmp.c 2013-12-02 20:22:15.940776306 -0500
28941 @@ -51,8 +51,11 @@
28942 filename_cmp (const char *s1, const char *s2)
28944 -#if !defined(HAVE_DOS_BASED_FILE_SYSTEM) \
28945 - && !defined(HAVE_CASE_INSENSITIVE_FILE_SYSTEM)
28946 +#if !defined(HAVE_DOS_BASED_FILE_SYSTEM)
28947 +#if defined(HAVE_CASE_INSENSITIVE_FILE_SYSTEM)
28948 + return strcasecmp(s1, s2);
28949 +#else
28950 return strcmp(s1, s2);
28951 +#endif
28952 #else
28953 for (;;)
28955 diff -urN gcc-4.8.1/libobjc/configure gcc-4.8.1.new/libobjc/configure
28956 --- gcc-4.8.1/libobjc/configure 2011-11-20 16:24:07.000000000 -0500
28957 +++ gcc-4.8.1.new/libobjc/configure 2013-12-02 20:22:15.944776326 -0500
28958 @@ -11249,215 +11249,7 @@
28962 -# Check if we have thread-local storage
28965 - # Check whether --enable-tls was given.
28966 -if test "${enable_tls+set}" = set; then :
28967 - enableval=$enable_tls;
28968 - case "$enableval" in
28969 - yes|no) ;;
28970 - *) as_fn_error "Argument to enable/disable tls must be yes or no" "$LINENO" 5 ;;
28971 - esac
28973 -else
28974 - enable_tls=yes
28978 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports thread-local storage" >&5
28979 -$as_echo_n "checking whether the target supports thread-local storage... " >&6; }
28980 -if test "${gcc_cv_have_tls+set}" = set; then :
28981 - $as_echo_n "(cached) " >&6
28982 -else
28984 - if test "$cross_compiling" = yes; then :
28985 - if test x$gcc_no_link = xyes; then
28986 - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
28988 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
28989 -/* end confdefs.h. */
28990 -__thread int a; int b; int main() { return a = b; }
28991 -_ACEOF
28992 -if ac_fn_c_try_link "$LINENO"; then :
28993 - chktls_save_LDFLAGS="$LDFLAGS"
28994 - case $host in
28995 - *-*-linux*)
28996 - LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS"
28997 - ;;
28998 - esac
28999 - chktls_save_CFLAGS="$CFLAGS"
29000 - CFLAGS="-fPIC $CFLAGS"
29001 - if test x$gcc_no_link = xyes; then
29002 - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
29004 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29005 -/* end confdefs.h. */
29006 -int f() { return 0; }
29007 -_ACEOF
29008 -if ac_fn_c_try_link "$LINENO"; then :
29009 - if test x$gcc_no_link = xyes; then
29010 - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
29012 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29013 -/* end confdefs.h. */
29014 -__thread int a; int b; int f() { return a = b; }
29015 -_ACEOF
29016 -if ac_fn_c_try_link "$LINENO"; then :
29017 - gcc_cv_have_tls=yes
29018 -else
29019 - gcc_cv_have_tls=no
29021 -rm -f core conftest.err conftest.$ac_objext \
29022 - conftest$ac_exeext conftest.$ac_ext
29023 -else
29024 - gcc_cv_have_tls=yes
29026 -rm -f core conftest.err conftest.$ac_objext \
29027 - conftest$ac_exeext conftest.$ac_ext
29028 - CFLAGS="$chktls_save_CFLAGS"
29029 - LDFLAGS="$chktls_save_LDFLAGS"
29030 -else
29031 - gcc_cv_have_tls=no
29033 -rm -f core conftest.err conftest.$ac_objext \
29034 - conftest$ac_exeext conftest.$ac_ext
29037 -else
29038 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29039 -/* end confdefs.h. */
29040 -__thread int a; int b; int main() { return a = b; }
29041 -_ACEOF
29042 -if ac_fn_c_try_run "$LINENO"; then :
29043 - chktls_save_LDFLAGS="$LDFLAGS"
29044 - LDFLAGS="-static $LDFLAGS"
29045 - if test x$gcc_no_link = xyes; then
29046 - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
29048 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29049 -/* end confdefs.h. */
29050 -int main() { return 0; }
29051 -_ACEOF
29052 -if ac_fn_c_try_link "$LINENO"; then :
29053 - if test "$cross_compiling" = yes; then :
29054 - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
29055 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
29056 -as_fn_error "cannot run test program while cross compiling
29057 -See \`config.log' for more details." "$LINENO" 5; }
29058 -else
29059 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29060 -/* end confdefs.h. */
29061 -__thread int a; int b; int main() { return a = b; }
29062 -_ACEOF
29063 -if ac_fn_c_try_run "$LINENO"; then :
29064 - gcc_cv_have_tls=yes
29065 -else
29066 - gcc_cv_have_tls=no
29068 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
29069 - conftest.$ac_objext conftest.beam conftest.$ac_ext
29072 -else
29073 - gcc_cv_have_tls=yes
29075 -rm -f core conftest.err conftest.$ac_objext \
29076 - conftest$ac_exeext conftest.$ac_ext
29077 - LDFLAGS="$chktls_save_LDFLAGS"
29078 - if test $gcc_cv_have_tls = yes; then
29079 - chktls_save_CFLAGS="$CFLAGS"
29080 - thread_CFLAGS=failed
29081 - for flag in '' '-pthread' '-lpthread'; do
29082 - CFLAGS="$flag $chktls_save_CFLAGS"
29083 - if test x$gcc_no_link = xyes; then
29084 - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
29086 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29087 -/* end confdefs.h. */
29088 -#include <pthread.h>
29089 - void *g(void *d) { return NULL; }
29090 -int
29091 -main ()
29093 -pthread_t t; pthread_create(&t,NULL,g,NULL);
29095 - return 0;
29097 -_ACEOF
29098 -if ac_fn_c_try_link "$LINENO"; then :
29099 - thread_CFLAGS="$flag"
29101 -rm -f core conftest.err conftest.$ac_objext \
29102 - conftest$ac_exeext conftest.$ac_ext
29103 - if test "X$thread_CFLAGS" != Xfailed; then
29104 - break
29105 - fi
29106 - done
29107 - CFLAGS="$chktls_save_CFLAGS"
29108 - if test "X$thread_CFLAGS" != Xfailed; then
29109 - CFLAGS="$thread_CFLAGS $chktls_save_CFLAGS"
29110 - if test "$cross_compiling" = yes; then :
29111 - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
29112 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
29113 -as_fn_error "cannot run test program while cross compiling
29114 -See \`config.log' for more details." "$LINENO" 5; }
29115 -else
29116 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
29117 -/* end confdefs.h. */
29118 -#include <pthread.h>
29119 - __thread int a;
29120 - static int *volatile a_in_other_thread;
29121 - static void *
29122 - thread_func (void *arg)
29124 - a_in_other_thread = &a;
29125 - return (void *)0;
29127 -int
29128 -main ()
29130 -pthread_t thread;
29131 - void *thread_retval;
29132 - int *volatile a_in_main_thread;
29133 - a_in_main_thread = &a;
29134 - if (pthread_create (&thread, (pthread_attr_t *)0,
29135 - thread_func, (void *)0))
29136 - return 0;
29137 - if (pthread_join (thread, &thread_retval))
29138 - return 0;
29139 - return (a_in_other_thread == a_in_main_thread);
29141 - return 0;
29143 -_ACEOF
29144 -if ac_fn_c_try_run "$LINENO"; then :
29145 - gcc_cv_have_tls=yes
29146 -else
29147 - gcc_cv_have_tls=no
29149 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
29150 - conftest.$ac_objext conftest.beam conftest.$ac_ext
29153 - CFLAGS="$chktls_save_CFLAGS"
29154 - fi
29155 - fi
29156 -else
29157 - gcc_cv_have_tls=no
29159 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
29160 - conftest.$ac_objext conftest.beam conftest.$ac_ext
29164 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_tls" >&5
29165 -$as_echo "$gcc_cv_have_tls" >&6; }
29166 - if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then
29168 -$as_echo "#define HAVE_TLS 1" >>confdefs.h
29170 - fi
29171 +#dnl GCC_ENABLE_TLS
29173 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exception model to use" >&5
29174 $as_echo_n "checking for exception model to use... " >&6; }
29175 diff -urN gcc-4.8.1/libobjc/configure.ac gcc-4.8.1.new/libobjc/configure.ac
29176 --- gcc-4.8.1/libobjc/configure.ac 2010-12-05 19:50:04.000000000 -0500
29177 +++ gcc-4.8.1.new/libobjc/configure.ac 2013-12-02 20:22:15.944776326 -0500
29178 @@ -217,7 +217,7 @@
29181 # Check if we have thread-local storage
29182 -GCC_CHECK_TLS
29183 +dnl GCC_CHECK_TLS
29185 AC_MSG_CHECKING([for exception model to use])
29186 AC_LANG_PUSH(C)
29187 diff -urN gcc-4.8.1/libstdc++-v3/config/os/aros/ctype_base.h gcc-4.8.1.new/libstdc++-v3/config/os/aros/ctype_base.h
29188 --- gcc-4.8.1/libstdc++-v3/config/os/aros/ctype_base.h 1969-12-31 19:00:00.000000000 -0500
29189 +++ gcc-4.8.1.new/libstdc++-v3/config/os/aros/ctype_base.h 2013-12-02 20:22:15.944776326 -0500
29190 @@ -0,0 +1,27 @@
29191 +namespace std _GLIBCXX_VISIBILITY(default)
29193 +_GLIBCXX_BEGIN_NAMESPACE_VERSION
29195 +struct ctype_base {
29196 + /* Non-standard typedefs */
29197 + typedef int * __to_type;
29199 + /* NB: Offsets into ctype<char>::_M_table force a particular size
29200 + on the mask type. Because of this, we don't use an enum. */
29201 + typedef unsigned short int mask;
29203 + static const mask upper = _ISupper;
29204 + static const mask lower = _ISlower;
29205 + static const mask alpha = _ISalpha;
29206 + static const mask digit = _ISdigit;
29207 + static const mask xdigit = _ISxdigit;
29208 + static const mask space = _ISspace;
29209 + static const mask print = _ISprint;
29210 + static const mask graph = _ISgraph;
29211 + static const mask cntrl = _IScntrl;
29212 + static const mask punct = _ISpunct;
29213 + static const mask alnum = _ISalnum;
29216 +_GLIBCXX_END_NAMESPACE_VERSION
29217 +} // namespace
29218 diff -urN gcc-4.8.1/libstdc++-v3/config/os/aros/ctype_inline.h gcc-4.8.1.new/libstdc++-v3/config/os/aros/ctype_inline.h
29219 --- gcc-4.8.1/libstdc++-v3/config/os/aros/ctype_inline.h 1969-12-31 19:00:00.000000000 -0500
29220 +++ gcc-4.8.1.new/libstdc++-v3/config/os/aros/ctype_inline.h 2013-12-02 20:22:15.944776326 -0500
29221 @@ -0,0 +1,173 @@
29222 +// Locale support -*- C++ -*-
29224 +// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
29226 +// This file is part of the GNU ISO C++ Library. This library is free
29227 +// software; you can redistribute it and/or modify it under the
29228 +// terms of the GNU General Public License as published by the
29229 +// Free Software Foundation; either version 2, or (at your option)
29230 +// any later version.
29232 +// This library is distributed in the hope that it will be useful,
29233 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
29234 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29235 +// GNU General Public License for more details.
29237 +// You should have received a copy of the GNU General Public License along
29238 +// with this library; see the file COPYING. If not, write to the Free
29239 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
29240 +// USA.
29242 +// As a special exception, you may use this file as part of a free software
29243 +// library without restriction. Specifically, if other files instantiate
29244 +// templates or use macros or inline functions from this file, or you compile
29245 +// this file and link it with other files to produce an executable, this
29246 +// file does not by itself cause the resulting executable to be covered by
29247 +// the GNU General Public License. This exception does not however
29248 +// invalidate any other reasons why the executable file might be covered by
29249 +// the GNU General Public License.
29251 +/** @file ctype_inline.h
29252 + * This is an internal header file, included by other library headers.
29253 + * You should not attempt to use it directly.
29254 + */
29257 +// ISO C++ 14882: 22.1 Locales
29260 +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
29261 +// functions go in ctype.cc
29263 +// The following definitions are portable, but insanely slow. If one
29264 +// cares at all about performance, then specialized ctype
29265 +// functionality should be added for the native os in question: see
29266 +// the config/os/bits/ctype_*.h files.
29268 +// Constructing a synthetic "C" table should be seriously considered...
29270 +namespace std _GLIBCXX_VISIBILITY(default)
29272 +_GLIBCXX_BEGIN_NAMESPACE_VERSION
29274 + bool
29275 + ctype<char>::
29276 + is(mask __m, char __c) const
29277 + {
29278 + if (_M_table)
29279 + return _M_table[static_cast<unsigned char>(__c)] & __m;
29280 + else
29282 + bool __ret = false;
29283 + const size_t __bitmasksize = 15;
29284 + size_t __bitcur = 0; // Lowest bitmask in ctype_base == 0
29285 + for (; __bitcur <= __bitmasksize; ++__bitcur)
29287 + const mask __bit = static_cast<mask>(1 << __bitcur);
29288 + if (__m & __bit)
29290 + bool __testis;
29291 + switch (__bit)
29293 + case space:
29294 + __testis = isspace(__c);
29295 + break;
29296 + case print:
29297 + __testis = isprint(__c);
29298 + break;
29299 + case cntrl:
29300 + __testis = iscntrl(__c);
29301 + break;
29302 + case upper:
29303 + __testis = isupper(__c);
29304 + break;
29305 + case lower:
29306 + __testis = islower(__c);
29307 + break;
29308 + case alpha:
29309 + __testis = isalpha(__c);
29310 + break;
29311 + case digit:
29312 + __testis = isdigit(__c);
29313 + break;
29314 + case punct:
29315 + __testis = ispunct(__c);
29316 + break;
29317 + case xdigit:
29318 + __testis = isxdigit(__c);
29319 + break;
29320 + case alnum:
29321 + __testis = isalnum(__c);
29322 + break;
29323 + case graph:
29324 + __testis = isgraph(__c);
29325 + break;
29326 + default:
29327 + __testis = false;
29328 + break;
29330 + __ret |= __testis;
29333 + return __ret;
29337 + const char*
29338 + ctype<char>::
29339 + is(const char* __low, const char* __high, mask* __vec) const
29341 + if (_M_table)
29342 + while (__low < __high)
29343 + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
29344 + else
29346 + // Highest bitmask in ctype_base == 10.
29347 + const size_t __bitmasksize = 15;
29348 + for (;__low < __high; ++__vec, ++__low)
29350 + mask __m = 0;
29351 + // Lowest bitmask in ctype_base == 0
29352 + size_t __i = 0;
29353 + for (;__i <= __bitmasksize; ++__i)
29355 + const mask __bit = static_cast<mask>(1 << __i);
29356 + if (this->is(__bit, *__low))
29357 + __m |= __bit;
29359 + *__vec = __m;
29362 + return __high;
29365 + const char*
29366 + ctype<char>::
29367 + scan_is(mask __m, const char* __low, const char* __high) const
29369 + if (_M_table)
29370 + while (__low < __high
29371 + && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
29372 + ++__low;
29373 + else
29374 + while (__low < __high && !this->is(__m, *__low))
29375 + ++__low;
29376 + return __low;
29379 + const char*
29380 + ctype<char>::
29381 + scan_not(mask __m, const char* __low, const char* __high) const
29383 + if (_M_table)
29384 + while (__low < __high
29385 + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
29386 + ++__low;
29387 + else
29388 + while (__low < __high && this->is(__m, *__low) != 0)
29389 + ++__low;
29390 + return __low;
29393 +_GLIBCXX_END_NAMESPACE_VERSION
29394 +} // namespace
29395 diff -urN gcc-4.8.1/libstdc++-v3/config/os/aros/ctype_noninline.h gcc-4.8.1.new/libstdc++-v3/config/os/aros/ctype_noninline.h
29396 --- gcc-4.8.1/libstdc++-v3/config/os/aros/ctype_noninline.h 1969-12-31 19:00:00.000000000 -0500
29397 +++ gcc-4.8.1.new/libstdc++-v3/config/os/aros/ctype_noninline.h 2013-12-02 20:22:15.944776326 -0500
29398 @@ -0,0 +1,56 @@
29399 + const ctype_base::mask*
29400 + ctype<char>::classic_table() throw()
29401 + { return *__ctype_b_ptr; }
29403 + ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
29404 + size_t __refs)
29405 + : facet(__refs), _M_del(__table != 0 && __del),
29406 + _M_toupper(NULL), _M_tolower(NULL),
29407 + _M_table(__table ? __table : classic_table())
29408 + {
29409 + memset(_M_widen, 0, sizeof(_M_widen));
29410 + _M_widen_ok = 0;
29411 + memset(_M_narrow, 0, sizeof(_M_narrow));
29412 + _M_narrow_ok = 0;
29415 + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
29416 + : facet(__refs), _M_del(__table != 0 && __del),
29417 + _M_toupper(NULL), _M_tolower(NULL),
29418 + _M_table(__table ? __table : classic_table())
29419 + {
29420 + memset(_M_widen, 0, sizeof(_M_widen));
29421 + _M_widen_ok = 0;
29422 + memset(_M_narrow, 0, sizeof(_M_narrow));
29423 + _M_narrow_ok = 0;
29426 + char
29427 + ctype<char>::do_toupper(char __c) const
29428 + { return ::toupper((int) __c); }
29430 + const char*
29431 + ctype<char>::do_toupper(char* __low, const char* __high) const
29433 + while (__low < __high)
29435 + *__low = ::toupper((int) *__low);
29436 + ++__low;
29438 + return __high;
29441 + char
29442 + ctype<char>::do_tolower(char __c) const
29443 + { return ::tolower((int) __c); }
29445 + const char*
29446 + ctype<char>::do_tolower(char* __low, const char* __high) const
29448 + while (__low < __high)
29450 + *__low = ::tolower((int) *__low);
29451 + ++__low;
29453 + return __high;
29455 diff -urN gcc-4.8.1/libstdc++-v3/config/os/aros/os_defines.h gcc-4.8.1.new/libstdc++-v3/config/os/aros/os_defines.h
29456 --- gcc-4.8.1/libstdc++-v3/config/os/aros/os_defines.h 1969-12-31 19:00:00.000000000 -0500
29457 +++ gcc-4.8.1.new/libstdc++-v3/config/os/aros/os_defines.h 2013-12-02 20:22:15.944776326 -0500
29458 @@ -0,0 +1,6 @@
29459 +#ifndef _GLIBCXX_OS_DEFINES
29460 +#define _GLIBCXX_OS_DEFINES
29462 +#define __off64_t off_t
29464 +#endif
29465 diff -urN gcc-4.8.1/libstdc++-v3/configure gcc-4.8.1.new/libstdc++-v3/configure
29466 --- gcc-4.8.1/libstdc++-v3/configure 2012-07-22 12:46:02.000000000 -0400
29467 +++ gcc-4.8.1.new/libstdc++-v3/configure 2013-12-02 20:22:15.956776384 -0500
29468 @@ -5288,12 +5288,12 @@
29471 # Libtool setup.
29472 -if test "x${with_newlib}" != "xyes"; then
29473 - enable_dlopen=yes
29478 +#if test "x${with_newlib}" != "xyes"; then
29479 +# AC_LIBTOOL_DLOPEN
29483 +#fi
29484 case `pwd` in
29485 *\ * | *\ *)
29486 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
29487 @@ -7990,6 +7987,8 @@
29491 + enable_dlopen=no
29494 enable_win32_dll=no
29496 @@ -18131,6 +18130,7 @@
29498 struct iovec iov[2];
29499 writev(0, iov, 0);
29500 +#error be sure to fail
29502 return 0;
29504 @@ -18153,6 +18153,7 @@
29506 struct iovec iov[2];
29507 writev(0, iov, 0);
29508 +#error be sure to fail
29510 return 0;
29512 @@ -26562,6 +26563,58 @@
29514 # Base decisions on target environment.
29515 case "${host}" in
29516 + *-aros*)
29517 + for ac_header in nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
29518 + machine/param.h sys/machine.h sys/types.h fp.h locale.h float.h inttypes.h
29519 +do :
29520 + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
29521 +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
29522 +eval as_val=\$$as_ac_Header
29523 + if test "x$as_val" = x""yes; then :
29524 + cat >>confdefs.h <<_ACEOF
29525 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
29526 +_ACEOF
29530 +done
29533 + GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
29534 + GLIBCXX_CHECK_WCHAR_T_SUPPORT
29536 + $as_echo "#define HAVE_FINITE 1" >>confdefs.h
29538 + $as_echo "#define HAVE_FINITEF 1" >>confdefs.h
29540 + $as_echo "#define HAVE_FREXPF 1" >>confdefs.h
29542 + $as_echo "#define HAVE_HYPOTF 1" >>confdefs.h
29544 + $as_echo "#define HAVE_ISINF 1" >>confdefs.h
29546 + $as_echo "#define HAVE_ISINFF 1" >>confdefs.h
29548 + $as_echo "#define HAVE_ISNAN 1" >>confdefs.h
29550 + $as_echo "#define HAVE_ISNANF 1" >>confdefs.h
29552 + $as_echo "#define HAVE_SINCOS 1" >>confdefs.h
29554 + $as_echo "#define HAVE_SINCOSF 1" >>confdefs.h
29556 + if test x"long_double_math_on_this_cpu" = x"yes"; then
29557 + $as_echo "#define HAVE_FINITEL 1" >>confdefs.h
29559 + $as_echo "#define HAVE_HYPOTL 1" >>confdefs.h
29561 + $as_echo "#define HAVE_ISINFL 1" >>confdefs.h
29563 + $as_echo "#define HAVE_ISNANL 1" >>confdefs.h
29565 + fi
29566 + ;;
29568 arm*-*-symbianelf*)
29569 # This is a freestanding configuration; there is nothing to do here.
29571 diff -urN gcc-4.8.1/libstdc++-v3/configure.ac gcc-4.8.1.new/libstdc++-v3/configure.ac
29572 --- gcc-4.8.1/libstdc++-v3/configure.ac 2012-07-22 12:46:02.000000000 -0400
29573 +++ gcc-4.8.1.new/libstdc++-v3/configure.ac 2013-12-02 20:22:15.956776384 -0500
29574 @@ -88,10 +88,10 @@
29575 # up critical shell variables.
29576 GLIBCXX_CONFIGURE
29578 # Libtool setup.
29579 -if test "x${with_newlib}" != "xyes"; then
29580 - AC_LIBTOOL_DLOPEN
29582 +#if test "x${with_newlib}" != "xyes"; then
29583 +# AC_LIBTOOL_DLOPEN
29584 +#fi
29585 AM_PROG_LIBTOOL
29586 ACX_LT_HOST_FLAGS
29587 AC_SUBST(enable_shared)
29588 diff -urN gcc-4.8.1/libstdc++-v3/configure.host gcc-4.8.1.new/libstdc++-v3/configure.host
29589 --- gcc-4.8.1/libstdc++-v3/configure.host 2010-12-05 19:50:04.000000000 -0500
29590 +++ gcc-4.8.1.new/libstdc++-v3/configure.host 2013-12-02 20:22:15.956776384 -0500
29591 @@ -203,6 +203,9 @@
29592 os_include_dir="os/generic"
29593 atomicity_dir="cpu/generic"
29595 + aros*)
29596 + os_include_dir="os/aros"
29597 + ;;
29598 bsd*)
29599 # Plain BSD attempts to share FreeBSD files.
29600 os_include_dir="os/bsd/freebsd"
29601 diff -urN gcc-4.8.1/libstdc++-v3/crossconfig.m4 gcc-4.8.1.new/libstdc++-v3/crossconfig.m4
29602 --- gcc-4.8.1/libstdc++-v3/crossconfig.m4 2011-02-04 02:26:57.000000000 -0500
29603 +++ gcc-4.8.1.new/libstdc++-v3/crossconfig.m4 2013-12-02 20:22:15.956776384 -0500
29604 @@ -5,6 +5,31 @@
29605 AC_DEFUN([GLIBCXX_CROSSCONFIG],[
29606 # Base decisions on target environment.
29607 case "${host}" in
29608 + *-aros*)
29609 + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
29610 + machine/param.h sys/machine.h sys/types.h fp.h locale.h float.h inttypes.h])
29612 + GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
29613 + GLIBCXX_CHECK_WCHAR_T_SUPPORT
29615 + AC_DEFINE(HAVE_FINITE)
29616 + AC_DEFINE(HAVE_FINITEF)
29617 + AC_DEFINE(HAVE_FREXPF)
29618 + AC_DEFINE(HAVE_HYPOTF)
29619 + AC_DEFINE(HAVE_ISINF)
29620 + AC_DEFINE(HAVE_ISINFF)
29621 + AC_DEFINE(HAVE_ISNAN)
29622 + AC_DEFINE(HAVE_ISNANF)
29623 + AC_DEFINE(HAVE_SINCOS)
29624 + AC_DEFINE(HAVE_SINCOSF)
29625 + if test x"long_double_math_on_this_cpu" = x"yes"; then
29626 + AC_DEFINE(HAVE_FINITEL)
29627 + AC_DEFINE(HAVE_HYPOTL)
29628 + AC_DEFINE(HAVE_ISINFL)
29629 + AC_DEFINE(HAVE_ISNANL)
29630 + fi
29631 + ;;
29633 arm*-*-symbianelf*)
29634 # This is a freestanding configuration; there is nothing to do here.