summaryrefslogtreecommitdiff
path: root/gcc/doc/gcj.1
blob: 0d20410a48521d8c2a428823ed40e559fd729bc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "GCJ 1"
.TH GCJ 1 "2013-04-12" "gcc-4.6.4" "GNU"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
gcj \- Ahead\-of\-time compiler for the Java language
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
gcj [\fB\-I\fR\fIdir\fR...] [\fB\-d\fR \fIdir\fR...]
    [\fB\-\-CLASSPATH\fR=\fIpath\fR] [\fB\-\-classpath\fR=\fIpath\fR]
    [\fB\-f\fR\fIoption\fR...] [\fB\-\-encoding\fR=\fIname\fR]
    [\fB\-\-main\fR=\fIclassname\fR] [\fB\-D\fR\fIname\fR[=\fIvalue\fR]...]
    [\fB\-C\fR] [\fB\-\-resource\fR \fIresource-name\fR] [\fB\-d\fR \fIdirectory\fR]
    [\fB\-W\fR\fIwarn\fR...]
    \fIsourcefile\fR...
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
As \fBgcj\fR is just another front end to \fBgcc\fR, it supports many
of the same options as gcc.    This manual only documents the
options specific to \fBgcj\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.SS "Input and output files"
.IX Subsection "Input and output files"
A \fBgcj\fR command is like a \fBgcc\fR command, in that it
consists of a number of options and file names.  The following kinds
of input file names are supported:
.IP "\fIfile\fR\fB.java\fR" 4
.IX Item "file.java"
Java source files.
.IP "\fIfile\fR\fB.class\fR" 4
.IX Item "file.class"
Java bytecode files.
.IP "\fIfile\fR\fB.zip\fR" 4
.IX Item "file.zip"
.PD 0
.IP "\fIfile\fR\fB.jar\fR" 4
.IX Item "file.jar"
.PD
An archive containing one or more \f(CW\*(C`.class\*(C'\fR files, all of
which are compiled.  The archive may be compressed.  Files in
an archive which don't end with \fB.class\fR are treated as
resource files; they are compiled into the resulting object file
as \fBcore:\fR URLs.
.IP "\fB@\fR\fIfile\fR" 4
.IX Item "@file"
A file containing a whitespace-separated list of input file names.
(Currently, these must all be \f(CW\*(C`.java\*(C'\fR source files, but that
may change.)
Each named file is compiled, just as if it had been on the command line.
.IP "\fIlibrary\fR\fB.a\fR" 4
.IX Item "library.a"
.PD 0
.IP "\fIlibrary\fR\fB.so\fR" 4
.IX Item "library.so"
.IP "\fB\-l\fR\fIlibname\fR" 4
.IX Item "-llibname"
.PD
Libraries to use when linking.  See the \fBgcc\fR manual.
.PP
You can specify more than one input file on the \fBgcj\fR command line,
in which case they will all be compiled.  If you specify a
\&\f(CW\*(C`\-o \f(CIFILENAME\f(CW\*(C'\fR
option, all the input files will be compiled together, producing a
single output file, named \fI\s-1FILENAME\s0\fR.
This is allowed even when using \f(CW\*(C`\-S\*(C'\fR or \f(CW\*(C`\-c\*(C'\fR,
but not when using \f(CW\*(C`\-C\*(C'\fR or \f(CW\*(C`\-\-resource\*(C'\fR.
(This is an extension beyond the what plain \fBgcc\fR allows.)
(If more than one input file is specified, all must currently
be \f(CW\*(C`.java\*(C'\fR files, though we hope to fix this.)
.SS "Input Options"
.IX Subsection "Input Options"
\&\fBgcj\fR has options to control where it looks to find files it needs.
For instance, \fBgcj\fR might need to load a class that is referenced
by the file it has been asked to compile.  Like other compilers for the
Java language, \fBgcj\fR has a notion of a \fIclass path\fR.  There are
several options and environment variables which can be used to
manipulate the class path.  When \fBgcj\fR looks for a given class, it
searches the class path looking for matching \fI.class\fR or
\&\fI.java\fR file.  \fBgcj\fR comes with a built-in class path which
points at the installed \fIlibgcj.jar\fR, a file which contains all the
standard classes.
.PP
In the text below, a directory or path component can refer either to an
actual directory on the filesystem, or to a \fI.zip\fR or \fI.jar\fR
file, which \fBgcj\fR will search as if it is a directory.
.IP "\fB\-I\fR\fIdir\fR" 4
.IX Item "-Idir"
All directories specified by \f(CW\*(C`\-I\*(C'\fR are kept in order and prepended
to the class path constructed from all the other options.  Unless
compatibility with tools like \f(CW\*(C`javac\*(C'\fR is important, we recommend
always using \f(CW\*(C`\-I\*(C'\fR instead of the other options for manipulating the
class path.
.IP "\fB\-\-classpath=\fR\fIpath\fR" 4
.IX Item "--classpath=path"
This sets the class path to \fIpath\fR, a colon-separated list of paths
(on Windows-based systems, a semicolon-separate list of paths).
This does not override the builtin (\*(L"boot\*(R") search path.
.IP "\fB\-\-CLASSPATH=\fR\fIpath\fR" 4
.IX Item "--CLASSPATH=path"
Deprecated synonym for \f(CW\*(C`\-\-classpath\*(C'\fR.
.IP "\fB\-\-bootclasspath=\fR\fIpath\fR" 4
.IX Item "--bootclasspath=path"
Where to find the standard builtin classes, such as \f(CW\*(C`java.lang.String\*(C'\fR.
.IP "\fB\-\-extdirs=\fR\fIpath\fR" 4
.IX Item "--extdirs=path"
For each directory in the \fIpath\fR, place the contents of that
directory at the end of the class path.
.IP "\fB\s-1CLASSPATH\s0\fR" 4
.IX Item "CLASSPATH"
This is an environment variable which holds a list of paths.
.PP
The final class path is constructed like so:
.IP "\(bu" 4
First come all directories specified via \f(CW\*(C`\-I\*(C'\fR.
.IP "\(bu" 4
If \fB\-\-classpath\fR is specified, its value is appended.
Otherwise, if the \f(CW\*(C`CLASSPATH\*(C'\fR environment variable is specified,
then its value is appended.
Otherwise, the current directory (\f(CW"."\fR) is appended.
.IP "\(bu" 4
If \f(CW\*(C`\-\-bootclasspath\*(C'\fR was specified, append its value.
Otherwise, append the built-in system directory, \fIlibgcj.jar\fR.
.IP "\(bu" 4
Finally, if \f(CW\*(C`\-\-extdirs\*(C'\fR was specified, append the contents of the
specified directories at the end of the class path.  Otherwise, append
the contents of the built-in extdirs at \f(CW\*(C`$(prefix)/share/java/ext\*(C'\fR.
.PP
The classfile built by \fBgcj\fR for the class \f(CW\*(C`java.lang.Object\*(C'\fR
(and placed in \f(CW\*(C`libgcj.jar\*(C'\fR) contains a special zero length
attribute \f(CW\*(C`gnu.gcj.gcj\-compiled\*(C'\fR. The compiler looks for this
attribute when loading \f(CW\*(C`java.lang.Object\*(C'\fR and will report an error
if it isn't found, unless it compiles to bytecode (the option
\&\f(CW\*(C`\-fforce\-classes\-archive\-check\*(C'\fR can be used to override this
behavior in this particular case.)
.IP "\fB\-fforce\-classes\-archive\-check\fR" 4
.IX Item "-fforce-classes-archive-check"
This forces the compiler to always check for the special zero length
attribute \f(CW\*(C`gnu.gcj.gcj\-compiled\*(C'\fR in \f(CW\*(C`java.lang.Object\*(C'\fR and
issue an error if it isn't found.
.IP "\fB\-fsource=\fR\fI\s-1VERSION\s0\fR" 4
.IX Item "-fsource=VERSION"
This option is used to choose the source version accepted by
\&\fBgcj\fR.  The default is \fB1.5\fR.
.SS "Encodings"
.IX Subsection "Encodings"
The Java programming language uses Unicode throughout.  In an effort to
integrate well with other locales, \fBgcj\fR allows \fI.java\fR files
to be written using almost any encoding.  \fBgcj\fR knows how to
convert these encodings into its internal encoding at compile time.
.PP
You can use the \f(CW\*(C`\-\-encoding=\f(CINAME\f(CW\*(C'\fR option to specify an
encoding (of a particular character set) to use for source files.  If
this is not specified, the default encoding comes from your current
locale.  If your host system has insufficient locale support, then
\&\fBgcj\fR assumes the default encoding to be the \fB\s-1UTF\-8\s0\fR encoding
of Unicode.
.PP
To implement \f(CW\*(C`\-\-encoding\*(C'\fR, \fBgcj\fR simply uses the host
platform's \f(CW\*(C`iconv\*(C'\fR conversion routine.  This means that in practice
\&\fBgcj\fR is limited by the capabilities of the host platform.
.PP
The names allowed for the argument \f(CW\*(C`\-\-encoding\*(C'\fR vary from platform
to platform (since they are not standardized anywhere).  However,
\&\fBgcj\fR implements the encoding named \fB\s-1UTF\-8\s0\fR internally, so if
you choose to use this for your source files you can be assured that it
will work on every host.
.SS "Warnings"
.IX Subsection "Warnings"
\&\fBgcj\fR implements several warnings.  As with other generic
\&\fBgcc\fR warnings, if an option of the form \f(CW\*(C`\-Wfoo\*(C'\fR enables a
warning, then \f(CW\*(C`\-Wno\-foo\*(C'\fR will disable it.  Here we've chosen to
document the form of the warning which will have an effect \*(-- the
default being the opposite of what is listed.
.IP "\fB\-Wredundant\-modifiers\fR" 4
.IX Item "-Wredundant-modifiers"
With this flag, \fBgcj\fR will warn about redundant modifiers.  For
instance, it will warn if an interface method is declared \f(CW\*(C`public\*(C'\fR.
.IP "\fB\-Wextraneous\-semicolon\fR" 4
.IX Item "-Wextraneous-semicolon"
This causes \fBgcj\fR to warn about empty statements.  Empty statements
have been deprecated.
.IP "\fB\-Wno\-out\-of\-date\fR" 4
.IX Item "-Wno-out-of-date"
This option will cause \fBgcj\fR not to warn when a source file is
newer than its matching class file.  By default \fBgcj\fR will warn
about this.
.IP "\fB\-Wno\-deprecated\fR" 4
.IX Item "-Wno-deprecated"
Warn if a deprecated class, method, or field is referred to.
.IP "\fB\-Wunused\fR" 4
.IX Item "-Wunused"
This is the same as \fBgcc\fR's \f(CW\*(C`\-Wunused\*(C'\fR.
.IP "\fB\-Wall\fR" 4
.IX Item "-Wall"
This is the same as \f(CW\*(C`\-Wredundant\-modifiers \-Wextraneous\-semicolon
\&\-Wunused\*(C'\fR.
.SS "Linking"
.IX Subsection "Linking"
To turn a Java application into an executable program,
you need to link it with the needed libraries, just as for C or \*(C+.
The linker by default looks for a global function named \f(CW\*(C`main\*(C'\fR.
Since Java does not have global functions, and a
collection of Java classes may have more than one class with a
\&\f(CW\*(C`main\*(C'\fR method, you need to let the linker know which of those
\&\f(CW\*(C`main\*(C'\fR methods it should invoke when starting the application.
You can do that in any of these ways:
.IP "\(bu" 4
Specify the class containing the desired \f(CW\*(C`main\*(C'\fR method
when you link the application, using the \f(CW\*(C`\-\-main\*(C'\fR flag,
described below.
.IP "\(bu" 4
Link the Java package(s) into a shared library (dll) rather than an
executable.  Then invoke the application using the \f(CW\*(C`gij\*(C'\fR program,
making sure that \f(CW\*(C`gij\*(C'\fR can find the libraries it needs.
.IP "\(bu" 4
Link the Java packages(s) with the flag \f(CW\*(C`\-lgij\*(C'\fR, which links
in the \f(CW\*(C`main\*(C'\fR routine from the \f(CW\*(C`gij\*(C'\fR command.
This allows you to select the class whose \f(CW\*(C`main\*(C'\fR method you
want to run when you run the application.  You can also use
other \f(CW\*(C`gij\*(C'\fR flags, such as \f(CW\*(C`\-D\*(C'\fR flags to set properties.
Using the \f(CW\*(C`\-lgij\*(C'\fR library (rather than the \f(CW\*(C`gij\*(C'\fR program
of the previous mechanism) has some advantages: it is compatible with
static linking, and does not require configuring or installing libraries.
.PP
These \f(CW\*(C`gij\*(C'\fR options relate to linking an executable:
.IP "\fB\-\-main=\fR\fI\s-1CLASSNAME\s0\fR" 4
.IX Item "--main=CLASSNAME"
This option is used when linking to specify the name of the class whose
\&\f(CW\*(C`main\*(C'\fR method should be invoked when the resulting executable is
run.
.IP "\fB\-D\fR\fIname\fR\fB[=\fR\fIvalue\fR\fB]\fR" 4
.IX Item "-Dname[=value]"
This option can only be used with \f(CW\*(C`\-\-main\*(C'\fR.  It defines a system
property named \fIname\fR with value \fIvalue\fR.  If \fIvalue\fR is not
specified then it defaults to the empty string.  These system properties
are initialized at the program's startup and can be retrieved at runtime
using the \f(CW\*(C`java.lang.System.getProperty\*(C'\fR method.
.IP "\fB\-lgij\fR" 4
.IX Item "-lgij"
Create an application whose command-line processing is that
of the \f(CW\*(C`gij\*(C'\fR command.
.Sp
This option is an alternative to using \f(CW\*(C`\-\-main\*(C'\fR; you cannot use both.
.IP "\fB\-static\-libgcj\fR" 4
.IX Item "-static-libgcj"
This option causes linking to be done against a static version of the
libgcj runtime library.  This option is only available if
corresponding linker support exists.
.Sp
\&\fBCaution:\fR Static linking of libgcj may cause essential parts
of libgcj to be omitted.  Some parts of libgcj use reflection to load
classes at runtime.  Since the linker does not see these references at
link time, it can omit the referred to classes.  The result is usually
(but not always) a \f(CW\*(C`ClassNotFoundException\*(C'\fR being thrown at
runtime. Caution must be used when using this option.  For more
details see:
<\fBhttp://gcc.gnu.org/wiki/Statically%20linking%20libgcj\fR>
.SS "Code Generation"
.IX Subsection "Code Generation"
In addition to the many \fBgcc\fR options controlling code generation,
\&\fBgcj\fR has several options specific to itself.
.IP "\fB\-C\fR" 4
.IX Item "-C"
This option is used to tell \fBgcj\fR to generate bytecode
(\fI.class\fR files) rather than object code.
.IP "\fB\-\-resource\fR \fIresource-name\fR" 4
.IX Item "--resource resource-name"
This option is used to tell \fBgcj\fR to compile the contents of a
given file to object code so it may be accessed at runtime with the core
protocol handler as \fBcore:/\fR\fIresource-name\fR.  Note that
\&\fIresource-name\fR is the name of the resource as found at runtime; for
instance, it could be used in a call to \f(CW\*(C`ResourceBundle.getBundle\*(C'\fR.
The actual file name to be compiled this way must be specified
separately.
.IP "\fB\-ftarget=\fR\fI\s-1VERSION\s0\fR" 4
.IX Item "-ftarget=VERSION"
This can be used with \fB\-C\fR to choose the version of bytecode
emitted by \fBgcj\fR.  The default is \fB1.5\fR.  When not
generating bytecode, this option has no effect.
.IP "\fB\-d\fR \fIdirectory\fR" 4
.IX Item "-d directory"
When used with \f(CW\*(C`\-C\*(C'\fR, this causes all generated \fI.class\fR files
to be put in the appropriate subdirectory of \fIdirectory\fR.  By
default they will be put in subdirectories of the current working
directory.
.IP "\fB\-fno\-bounds\-check\fR" 4
.IX Item "-fno-bounds-check"
By default, \fBgcj\fR generates code which checks the bounds of all
array indexing operations.  With this option, these checks are omitted, which
can improve performance for code that uses arrays extensively.  Note that this 
can result in unpredictable behavior if the code in question actually does 
violate array bounds constraints.  It is safe to use this option if you are 
sure that your code will never throw an \f(CW\*(C`ArrayIndexOutOfBoundsException\*(C'\fR.
.IP "\fB\-fno\-store\-check\fR" 4
.IX Item "-fno-store-check"
Don't generate array store checks.  When storing objects into arrays, a runtime
check is normally generated in order to ensure that the object is assignment
compatible with the component type of the array (which may not be known
at compile-time).  With this option, these checks are omitted.  This can 
improve performance for code which stores objects into arrays frequently.
It is safe to use this option if you are sure your code will never throw an 
\&\f(CW\*(C`ArrayStoreException\*(C'\fR.
.IP "\fB\-fjni\fR" 4
.IX Item "-fjni"
With \fBgcj\fR there are two options for writing native methods: \s-1CNI\s0
and \s-1JNI\s0.  By default \fBgcj\fR assumes you are using \s-1CNI\s0.  If you are
compiling a class with native methods, and these methods are implemented
using \s-1JNI\s0, then you must use \f(CW\*(C`\-fjni\*(C'\fR.  This option causes
\&\fBgcj\fR to generate stubs which will invoke the underlying \s-1JNI\s0
methods.
.IP "\fB\-fno\-assert\fR" 4
.IX Item "-fno-assert"
Don't recognize the \f(CW\*(C`assert\*(C'\fR keyword.  This is for compatibility
with older versions of the language specification.
.IP "\fB\-fno\-optimize\-static\-class\-initialization\fR" 4
.IX Item "-fno-optimize-static-class-initialization"
When the optimization level is greater or equal to \f(CW\*(C`\-O2\*(C'\fR,
\&\fBgcj\fR will try to optimize the way calls into the runtime are made
to initialize static classes upon their first use (this optimization
isn't carried out if \f(CW\*(C`\-C\*(C'\fR was specified.) When compiling to native
code, \f(CW\*(C`\-fno\-optimize\-static\-class\-initialization\*(C'\fR will turn this
optimization off, regardless of the optimization level in use.
.IP "\fB\-\-disable\-assertions[=\fR\fIclass-or-package\fR\fB]\fR" 4
.IX Item "--disable-assertions[=class-or-package]"
Don't include code for checking assertions in the compiled code.
If \f(CW\*(C`=\f(CIclass\-or\-package\f(CW\*(C'\fR is missing disables assertion code
generation for all classes, unless overridden by a more
specific \f(CW\*(C`\-\-enable\-assertions\*(C'\fR flag.
If \fIclass-or-package\fR is a class name, only disables generating
assertion checks within the named class or its inner classes.
If \fIclass-or-package\fR is a package name, disables generating
assertion checks within the named package or a subpackage.
.Sp
By default, assertions are enabled when generating class files
or when not optimizing, and disabled when generating optimized binaries.
.IP "\fB\-\-enable\-assertions[=\fR\fIclass-or-package\fR\fB]\fR" 4
.IX Item "--enable-assertions[=class-or-package]"
Generates code to check assertions.  The option is perhaps misnamed,
as you still need to turn on assertion checking at run-time,
and we don't support any easy way to do that.
So this flag isn't very useful yet, except to partially override
\&\f(CW\*(C`\-\-disable\-assertions\*(C'\fR.
.IP "\fB\-findirect\-dispatch\fR" 4
.IX Item "-findirect-dispatch"
\&\fBgcj\fR has a special binary compatibility \s-1ABI\s0, which is enabled
by the \f(CW\*(C`\-findirect\-dispatch\*(C'\fR option.  In this mode, the code
generated by \fBgcj\fR honors the binary compatibility guarantees
in the Java Language Specification, and the resulting object files do
not need to be directly linked against their dependencies.  Instead,
all dependencies are looked up at runtime.  This allows free mixing of
interpreted and compiled code.
.Sp
Note that, at present, \f(CW\*(C`\-findirect\-dispatch\*(C'\fR can only be used
when compiling \fI.class\fR files.  It will not work when compiling
from source.  \s-1CNI\s0 also does not yet work with the binary compatibility
\&\s-1ABI\s0.  These restrictions will be lifted in some future release.
.Sp
However, if you compile \s-1CNI\s0 code with the standard \s-1ABI\s0, you can call
it from code built with the binary compatibility \s-1ABI\s0.
.IP "\fB\-fbootstrap\-classes\fR" 4
.IX Item "-fbootstrap-classes"
This option can be use to tell \f(CW\*(C`libgcj\*(C'\fR that the compiled classes
should be loaded by the bootstrap loader, not the system class loader.
By default, if you compile a class and link it into an executable, it
will be treated as if it was loaded using the system class loader.
This is convenient, as it means that things like
\&\f(CW\*(C`Class.forName()\*(C'\fR will search \fB\s-1CLASSPATH\s0\fR to find the
desired class.
.IP "\fB\-freduced\-reflection\fR" 4
.IX Item "-freduced-reflection"
This option causes the code generated by \fBgcj\fR to contain a
reduced amount of the class meta-data used to support runtime
reflection. The cost of this savings is the loss of
the ability to use certain reflection capabilities of the standard
Java runtime environment. When set all meta-data except for that
which is needed to obtain correct runtime semantics is eliminated.
.Sp
For code that does not use reflection (i.e. serialization, \s-1RMI\s0, \s-1CORBA\s0
or call methods in the \f(CW\*(C`java.lang.reflect\*(C'\fR package),
\&\f(CW\*(C`\-freduced\-reflection\*(C'\fR will result in proper operation with a
savings in executable code size.
.Sp
\&\s-1JNI\s0 (\f(CW\*(C`\-fjni\*(C'\fR) and the binary compatibility \s-1ABI\s0
(\f(CW\*(C`\-findirect\-dispatch\*(C'\fR) do not work properly without full
reflection meta-data.  Because of this, it is an error to use these options
with \f(CW\*(C`\-freduced\-reflection\*(C'\fR.
.Sp
\&\fBCaution:\fR If there is no reflection meta-data, code that uses
a \f(CW\*(C`SecurityManager\*(C'\fR may not work properly.  Also calling
\&\f(CW\*(C`Class.forName()\*(C'\fR may fail if the calling method has no
reflection meta-data.
.SS "Configure-time Options"
.IX Subsection "Configure-time Options"
Some \fBgcj\fR code generations options affect the resulting \s-1ABI\s0, and
so can only be meaningfully given when \f(CW\*(C`libgcj\*(C'\fR, the runtime
package, is configured.  \f(CW\*(C`libgcj\*(C'\fR puts the appropriate options from
this group into a \fBspec\fR file which is read by \fBgcj\fR.  These
options are listed here for completeness; if you are using \f(CW\*(C`libgcj\*(C'\fR
then you won't want to touch these options.
.IP "\fB\-fuse\-boehm\-gc\fR" 4
.IX Item "-fuse-boehm-gc"
This enables the use of the Boehm \s-1GC\s0 bitmap marking code.  In particular
this causes \fBgcj\fR to put an object marking descriptor into each
vtable.
.IP "\fB\-fhash\-synchronization\fR" 4
.IX Item "-fhash-synchronization"
By default, synchronization data (the data used for \f(CW\*(C`synchronize\*(C'\fR,
\&\f(CW\*(C`wait\*(C'\fR, and \f(CW\*(C`notify\*(C'\fR) is pointed to by a word in each object.
With this option \fBgcj\fR assumes that this information is stored in a
hash table and not in the object itself.
.IP "\fB\-fuse\-divide\-subroutine\fR" 4
.IX Item "-fuse-divide-subroutine"
On some systems, a library routine is called to perform integer
division.  This is required to get exception handling correct when
dividing by zero.
.IP "\fB\-fcheck\-references\fR" 4
.IX Item "-fcheck-references"
On some systems it's necessary to insert inline checks whenever
accessing an object via a reference.  On other systems you won't need
this because null pointer accesses are caught automatically by the
processor.
.IP "\fB\-fuse\-atomic\-builtins\fR" 4
.IX Item "-fuse-atomic-builtins"
On some systems, gcc can generate code for built-in atomic operations.
Use this option to force gcj to use these builtins when compiling Java
code.  Where this capability is present it should be automatically
detected, so you won't usually need to use this option.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIgcc\fR\|(1), \fIgcjh\fR\|(1), \fIgjnih\fR\|(1), \fIgij\fR\|(1), \fIjcf\-dump\fR\|(1), \fIgfdl\fR\|(7),
and the Info entries for \fIgcj\fR and \fIgcc\fR.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
.PP
Permission is granted to copy, distribute and/or modify this document
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, the Front-Cover Texts being (a) (see below), and
with the Back-Cover Texts being (b) (see below).
A copy of the license is included in the
man page \fIgfdl\fR\|(7).
.PP
(a) The \s-1FSF\s0's Front-Cover Text is:
.PP
.Vb 1
\&     A GNU Manual
.Ve
.PP
(b) The \s-1FSF\s0's Back-Cover Text is:
.PP
.Vb 3
\&     You have freedom to copy and modify this GNU Manual, like GNU
\&     software.  Copies published by the Free Software Foundation raise
\&     funds for GNU development.
.Ve