<html lang="en">
<head>
<title>LTO Testing - GNU Compiler Collection (GCC) Internals</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Testsuites.html#Testsuites" title="Testsuites">
<link rel="prev" href="libgcj-Tests.html#libgcj-Tests" title="libgcj Tests">
<link rel="next" href="gcov-Testing.html#gcov-Testing" title="gcov Testing">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2015 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', 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 section entitled
``GNU Free Documentation License''.

(a) The FSF's Front-Cover Text is:

     A GNU Manual

(b) The FSF's Back-Cover Text is:

     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.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="LTO-Testing"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="gcov-Testing.html#gcov-Testing">gcov Testing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="libgcj-Tests.html#libgcj-Tests">libgcj Tests</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Testsuites.html#Testsuites">Testsuites</a>
<hr>
</div>

<h3 class="section">7.6 Support for testing link-time optimizations</h3>

<p>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.

     <dl>
<dt><code>{ dg-lto-do </code><var>do-what-keyword</var><code> }</code><dd><var>do-what-keyword</var> specifies how the test is compiled and whether
it is executed.  It is one of:

          <dl>
<dt><code>assemble</code><dd>Compile with <samp><span class="option">-c</span></samp> to produce a relocatable object file. 
<br><dt><code>link</code><dd>Compile, assemble, and link to produce an executable file. 
<br><dt><code>run</code><dd>Produce and run an executable file, which is expected to return
an exit code of 0. 
</dl>

     <p>The default is <code>assemble</code>.  That can be overridden for a set of
tests by redefining <code>dg-do-what-default</code> within the <code>.exp</code>
file for those tests.

     <p>Unlike <code>dg-do</code>, <code>dg-lto-do</code> does not support an optional
&lsquo;<samp><span class="samp">target</span></samp>&rsquo; or &lsquo;<samp><span class="samp">xfail</span></samp>&rsquo; list.  Use <code>dg-skip-if</code>,
<code>dg-xfail-if</code>, or <code>dg-xfail-run-if</code>.

     <br><dt><code>{ dg-lto-options { { </code><var>options</var><code> } [{ </code><var>options</var><code> }] } [{ target </code><var>selector</var><code> }]}</code><dd>This directive provides a list of one or more sets of compiler options
to override <var>LTO_OPTIONS</var>.  Each test will be compiled and run with
each of these sets of options.

     <br><dt><code>{ dg-extra-ld-options </code><var>options</var><code> [{ target </code><var>selector</var><code> }]}</code><dd>This directive adds <var>options</var> to the linker options used.

     <br><dt><code>{ dg-suppress-ld-options </code><var>options</var><code> [{ target </code><var>selector</var><code> }]}</code><dd>This directive removes <var>options</var> from the set of linker options used. 
</dl>

 </body></html>