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