summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/darwin-options.html
blob: a2a633dcacc7e526edaf94dd576a8e6270b106cf (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
<div class="subsection-level-extent" id="Darwin-Options"> <div class="nav-panel"> <p> Next: <a href="dec-alpha-options" accesskey="n" rel="next">DEC Alpha Options</a>, Previous: <a href="c-sky-options" accesskey="p" rel="prev">C-SKY Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div>  <h1 class="subsection" id="Darwin-Options-1"><span>3.19.11 Darwin Options<a class="copiable-link" href="#Darwin-Options-1"> ¶</a></span></h1>  <p>These options are defined for all architectures running the Darwin operating system. </p> <p>FSF GCC on Darwin does not create “fat” object files; it creates an object file for the single architecture that GCC was built to target. Apple’s GCC on Darwin does create “fat” files if multiple <samp class="option">-arch</samp> options are used; it does so by running the compiler or linker multiple times and joining the results together with <samp class="file">lipo</samp>. </p> <p>The subtype of the file created (like ‘<samp class="samp">ppc7400</samp>’ or ‘<samp class="samp">ppc970</samp>’ or ‘<samp class="samp">i686</samp>’) is determined by the flags that specify the ISA that GCC is targeting, like <samp class="option">-mcpu</samp> or <samp class="option">-march</samp>. The <samp class="option">-force_cpusubtype_ALL</samp> option can be used to override this. </p> <p>The Darwin tools vary in their behavior when presented with an ISA mismatch. The assembler, <samp class="file">as</samp>, only permits instructions to be used that are valid for the subtype of the file it is generating, so you cannot put 64-bit instructions in a ‘<samp class="samp">ppc750</samp>’ object file. The linker for shared libraries, <samp class="file">/usr/bin/libtool</samp>, fails and prints an error if asked to create a shared library with a less restrictive subtype than its input files (for instance, trying to put a ‘<samp class="samp">ppc970</samp>’ object file in a ‘<samp class="samp">ppc7400</samp>’ library). The linker for executables, <code class="command">ld</code>, quietly gives the executable the most restrictive subtype of any of its input files. </p> <dl class="table"> <dt>
<span><code class="code">-F<var class="var">dir</var></code><a class="copiable-link" href="#index-F"> ¶</a></span>
</dt> <dd>
<p>Add the framework directory <var class="var">dir</var> to the head of the list of directories to be searched for header files. These directories are interleaved with those specified by <samp class="option">-I</samp> options and are scanned in a left-to-right order. </p> <p>A framework directory is a directory with frameworks in it. A framework is a directory with a <samp class="file">Headers</samp> and/or <samp class="file">PrivateHeaders</samp> directory contained directly in it that ends in <samp class="file">.framework</samp>. The name of a framework is the name of this directory excluding the <samp class="file">.framework</samp>. Headers associated with the framework are found in one of those two directories, with <samp class="file">Headers</samp> being searched first. A subframework is a framework directory that is in a framework’s <samp class="file">Frameworks</samp> directory. Includes of subframework headers can only appear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks are siblings if they occur in the same framework. A subframework should not have the same name as a framework; a warning is issued if this is violated. Currently a subframework cannot have subframeworks; in the future, the mechanism may be extended to support this. The standard frameworks can be found in <samp class="file">/System/Library/Frameworks</samp> and <samp class="file">/Library/Frameworks</samp>. An example include looks like <code class="code">#include &lt;Framework/header.h&gt;</code>, where <samp class="file">Framework</samp> denotes the name of the framework and <samp class="file">header.h</samp> is found in the <samp class="file">PrivateHeaders</samp> or <samp class="file">Headers</samp> directory. </p> </dd> <dt>
<span><code class="code">-iframework<var class="var">dir</var></code><a class="copiable-link" href="#index-iframework"> ¶</a></span>
</dt> <dd>
<p>Like <samp class="option">-F</samp> except the directory is a treated as a system directory. The main difference between this <samp class="option">-iframework</samp> and <samp class="option">-F</samp> is that with <samp class="option">-iframework</samp> the compiler does not warn about constructs contained within header files found via <var class="var">dir</var>. This option is valid only for the C family of languages. </p> </dd> <dt>
<span><code class="code">-gused</code><a class="copiable-link" href="#index-gused"> ¶</a></span>
</dt> <dd>
<p>Emit debugging information for symbols that are used. For stabs debugging format, this enables <samp class="option">-feliminate-unused-debug-symbols</samp>. This is by default ON. </p> </dd> <dt>
<span><code class="code">-gfull</code><a class="copiable-link" href="#index-gfull"> ¶</a></span>
</dt> <dd>
<p>Emit debugging information for all symbols and types. </p> </dd> <dt><code class="code">-mmacosx-version-min=<var class="var">version</var></code></dt> <dd>
<p>The earliest version of MacOS X that this executable will run on is <var class="var">version</var>. Typical values of <var class="var">version</var> include <code class="code">10.1</code>, <code class="code">10.2</code>, and <code class="code">10.3.9</code>. </p> <p>If the compiler was built to use the system’s headers by default, then the default for this option is the system version on which the compiler is running, otherwise the default is to make choices that are compatible with as many systems and code bases as possible. </p> </dd> <dt>
<span><code class="code">-mkernel</code><a class="copiable-link" href="#index-mkernel"> ¶</a></span>
</dt> <dd>
<p>Enable kernel development mode. The <samp class="option">-mkernel</samp> option sets <samp class="option">-static</samp>, <samp class="option">-fno-common</samp>, <samp class="option">-fno-use-cxa-atexit</samp>, <samp class="option">-fno-exceptions</samp>, <samp class="option">-fno-non-call-exceptions</samp>, <samp class="option">-fapple-kext</samp>, <samp class="option">-fno-weak</samp> and <samp class="option">-fno-rtti</samp> where applicable. This mode also sets <samp class="option">-mno-altivec</samp>, <samp class="option">-msoft-float</samp>, <samp class="option">-fno-builtin</samp> and <samp class="option">-mlong-branch</samp> for PowerPC targets. </p> </dd> <dt>
<span><code class="code">-mone-byte-bool</code><a class="copiable-link" href="#index-mone-byte-bool"> ¶</a></span>
</dt> <dd>
<p>Override the defaults for <code class="code">bool</code> so that <code class="code">sizeof(bool)==1</code>. By default <code class="code">sizeof(bool)</code> is <code class="code">4</code> when compiling for Darwin/PowerPC and <code class="code">1</code> when compiling for Darwin/x86, so this option has no effect on x86. </p> <p><strong class="strong">Warning:</strong> The <samp class="option">-mone-byte-bool</samp> switch causes GCC to generate code that is not binary compatible with code generated without that switch. Using this switch may require recompiling all other modules in a program, including system libraries. Use this switch to conform to a non-default data model. </p> </dd> <dt>
  <span><code class="code">-mfix-and-continue</code><a class="copiable-link" href="#index-mfix-and-continue"> ¶</a></span>
</dt> <dt><code class="code">-ffix-and-continue</code></dt> <dt><code class="code">-findirect-data</code></dt> <dd>
<p>Generate code suitable for fast turnaround development, such as to allow GDB to dynamically load <samp class="file">.o</samp> files into already-running programs. <samp class="option">-findirect-data</samp> and <samp class="option">-ffix-and-continue</samp> are provided for backwards compatibility. </p> </dd> <dt>
<span><code class="code">-all_load</code><a class="copiable-link" href="#index-all_005fload"> ¶</a></span>
</dt> <dd>
<p>Loads all members of static archive libraries. See man ld(1) for more information. </p> </dd> <dt>
<span><code class="code">-arch_errors_fatal</code><a class="copiable-link" href="#index-arch_005ferrors_005ffatal"> ¶</a></span>
</dt> <dd>
<p>Cause the errors having to do with files that have the wrong architecture to be fatal. </p> </dd> <dt>
<span><code class="code">-bind_at_load</code><a class="copiable-link" href="#index-bind_005fat_005fload"> ¶</a></span>
</dt> <dd>
<p>Causes the output file to be marked such that the dynamic linker will bind all undefined references when the file is loaded or launched. </p> </dd> <dt>
<span><code class="code">-bundle</code><a class="copiable-link" href="#index-bundle"> ¶</a></span>
</dt> <dd>
<p>Produce a Mach-o bundle format file. See man ld(1) for more information. </p> </dd> <dt>
<span><code class="code">-bundle_loader <var class="var">executable</var></code><a class="copiable-link" href="#index-bundle_005floader"> ¶</a></span>
</dt> <dd>
<p>This option specifies the <var class="var">executable</var> that will load the build output file being linked. See man ld(1) for more information. </p> </dd> <dt>
<span><code class="code">-dynamiclib</code><a class="copiable-link" href="#index-dynamiclib"> ¶</a></span>
</dt> <dd>
<p>When passed this option, GCC produces a dynamic library instead of an executable when linking, using the Darwin <samp class="file">libtool</samp> command. </p> </dd> <dt>
<span><code class="code">-force_cpusubtype_ALL</code><a class="copiable-link" href="#index-force_005fcpusubtype_005fALL"> ¶</a></span>
</dt> <dd>
<p>This causes GCC’s output file to have the ‘<samp class="samp">ALL</samp>’ subtype, instead of one controlled by the <samp class="option">-mcpu</samp> or <samp class="option">-march</samp> option. </p> </dd> <dt>
<span><code class="code">-allowable_client  <var class="var">client_name</var></code><a class="copiable-link" href="#index-allowable_005fclient"> ¶</a></span>
</dt> <dt><code class="code">-client_name</code></dt> <dt><code class="code">-compatibility_version</code></dt> <dt><code class="code">-current_version</code></dt> <dt><code class="code">-dead_strip</code></dt> <dt><code class="code">-dependency-file</code></dt> <dt><code class="code">-dylib_file</code></dt> <dt><code class="code">-dylinker_install_name</code></dt> <dt><code class="code">-dynamic</code></dt> <dt><code class="code">-exported_symbols_list</code></dt> <dt><code class="code">-filelist</code></dt> <dt><code class="code">-flat_namespace</code></dt> <dt><code class="code">-force_flat_namespace</code></dt> <dt><code class="code">-headerpad_max_install_names</code></dt> <dt><code class="code">-image_base</code></dt> <dt><code class="code">-init</code></dt> <dt><code class="code">-install_name</code></dt> <dt><code class="code">-keep_private_externs</code></dt> <dt><code class="code">-multi_module</code></dt> <dt><code class="code">-multiply_defined</code></dt> <dt><code class="code">-multiply_defined_unused</code></dt> <dt><code class="code">-noall_load</code></dt> <dt><code class="code">-no_dead_strip_inits_and_terms</code></dt> <dt><code class="code">-nofixprebinding</code></dt> <dt><code class="code">-nomultidefs</code></dt> <dt><code class="code">-noprebind</code></dt> <dt><code class="code">-noseglinkedit</code></dt> <dt><code class="code">-pagezero_size</code></dt> <dt><code class="code">-prebind</code></dt> <dt><code class="code">-prebind_all_twolevel_modules</code></dt> <dt><code class="code">-private_bundle</code></dt> <dt><code class="code">-read_only_relocs</code></dt> <dt><code class="code">-sectalign</code></dt> <dt><code class="code">-sectobjectsymbols</code></dt> <dt><code class="code">-whyload</code></dt> <dt><code class="code">-seg1addr</code></dt> <dt><code class="code">-sectcreate</code></dt> <dt><code class="code">-sectobjectsymbols</code></dt> <dt><code class="code">-sectorder</code></dt> <dt><code class="code">-segaddr</code></dt> <dt><code class="code">-segs_read_only_addr</code></dt> <dt><code class="code">-segs_read_write_addr</code></dt> <dt><code class="code">-seg_addr_table</code></dt> <dt><code class="code">-seg_addr_table_filename</code></dt> <dt><code class="code">-seglinkedit</code></dt> <dt><code class="code">-segprot</code></dt> <dt><code class="code">-segs_read_only_addr</code></dt> <dt><code class="code">-segs_read_write_addr</code></dt> <dt><code class="code">-single_module</code></dt> <dt><code class="code">-static</code></dt> <dt><code class="code">-sub_library</code></dt>                                                          <dt><code class="code">-sub_umbrella</code></dt> <dt><code class="code">-twolevel_namespace</code></dt> <dt><code class="code">-umbrella</code></dt> <dt><code class="code">-undefined</code></dt> <dt><code class="code">-unexported_symbols_list</code></dt> <dt><code class="code">-weak_reference_mismatches</code></dt> <dt><code class="code">-whatsloaded</code></dt> <dd><p>These options are passed to the Darwin linker. The Darwin linker man page describes them in detail. </p></dd> </dl> </div>  <div class="nav-panel"> <p> Next: <a href="dec-alpha-options">DEC Alpha Options</a>, Previous: <a href="c-sky-options">C-SKY Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
    <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Options.html</a>
  </p>
</div>