OSDN Git Service

5fa3123b42d04d22d1c87c12aeaab68e8092d399
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / lto / README
1 This directory contains tests for link-time optimization (LTO).
2 Tests in this directory may span multiple files, so the naming of
3 the files is significant.
4
5 The name of every file must end with '_N' where N is an integer.
6 All the files with the same name base and different _N suffixes
7 will be compiled separately and linked together to form the final
8 executable.
9
10 By default, each set of files will be compiled with list of
11 options listed in LTO_OPTIONS (../../lib/lto.exp), which can be
12 overwritten in the shell environment or using the 'dg-lto-options'
13 command in the main file of the set (i.e., the file with _0
14 suffix).
15
16 For example, given the files a_0.C a_1.C a_2.C, they will be
17 compiled as:
18
19 $ g++ -c <flags> a_0.C
20 $ g++ -c <flags> a_1.C
21 $ g++ -c <flags> a_2.C
22 $ g++ -o <executable> a_0.o a_1.o a_2.o
23
24 Tests that do not need more than one file are a special case
25 where there is a single file named 'foo_0.C'.
26
27 The only supported dg-lto-do option are 'compile', 'run' and 'link'.
28 Additionally, these can only be used in the main file.  If
29 'compile' is used, only the individual object files are
30 generated.  If 'link' is used, the final executable is generated
31 but not executed (in this case, function main() needs to exist
32 but it does not need to do anything).  If 'run' is used, the
33 final executable is generated and the resulting binary executed.
34
35 The default value for dg-lto-do is 'run'.