Support for testing link-time optimizations#
Tests for link-time optimizations usually require multiple source files that are compiled separately, perhaps with different sets of options. There are several special-purpose test directives used for these tests.
dg-lto-do {do-what-keyword }do-what-keywordspecifies how the test is compiled and whether it is executed. It is one of:assembleCompile with
-cto produce a relocatable object file.linkCompile, assemble, and link to produce an executable file.
runProduce and run an executable file, which is expected to return an exit code of 0.
The default is
assemble. That can be overridden for a set of tests by redefiningdg-do-what-defaultwithin the.expfile for those tests.Unlike
dg-do,dg-lto-dodoes not support an optionaltargetorxfaillist. Usedg-skip-if,dg-xfail-if, ordg-xfail-run-if.dg-lto-options { { {options } [ {options }] } [ target {selector }]}This directive provides a list of one or more sets of compiler options to override
LTO_OPTIONS. Each test will be compiled and run with each of these sets of options.dg-extra-ld-options {options [ target {selector }]}This directive adds
optionsto the linker options used.dg-suppress-ld-options {options [ target {selector }]}This directive removes
optionsfrom the set of linker options used.