[7152faa] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[6a82dd9] | 7 |
|
---|
[81fd230] | 8 | <sect1 id="ch-system-gcc" role="wrap">
|
---|
[6a82dd9] | 9 | <?dbhtml filename="gcc.html"?>
|
---|
| 10 |
|
---|
[e747759] | 11 | <sect1info condition="script">
|
---|
| 12 | <productname>gcc</productname>
|
---|
| 13 | <productnumber>&gcc-version;</productnumber>
|
---|
| 14 | <address>&gcc-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
[6a82dd9] | 17 | <title>GCC-&gcc-version;</title>
|
---|
| 18 |
|
---|
| 19 | <indexterm zone="ch-system-gcc">
|
---|
| 20 | <primary sortas="a-GCC">GCC</primary>
|
---|
| 21 | </indexterm>
|
---|
| 22 |
|
---|
| 23 | <sect2 role="package">
|
---|
| 24 | <title/>
|
---|
[6370fa6] | 25 |
|
---|
[6a82dd9] | 26 | <para>The GCC package contains the GNU compiler collection, which includes
|
---|
| 27 | the C and C++ compilers.</para>
|
---|
[673b0d8] | 28 |
|
---|
[6a82dd9] | 29 | <segmentedlist>
|
---|
| 30 | <segtitle>&buildtime;</segtitle>
|
---|
| 31 | <segtitle>&diskspace;</segtitle>
|
---|
[5888299] | 32 |
|
---|
[6a82dd9] | 33 | <seglistitem>
|
---|
[6dfcfecc] | 34 | <seg>&gcc-fin-sbu;</seg>
|
---|
| 35 | <seg>&gcc-fin-du;</seg>
|
---|
[6a82dd9] | 36 | </seglistitem>
|
---|
| 37 | </segmentedlist>
|
---|
[3554fa3a] | 38 |
|
---|
[6a82dd9] | 39 | </sect2>
|
---|
| 40 |
|
---|
| 41 | <sect2 role="installation">
|
---|
| 42 | <title>Installation of GCC</title>
|
---|
[1b11115] | 43 |
|
---|
[ed3be61] | 44 | <para>If building on x86_64, change the default directory name for 64-bit
|
---|
[6dfcfecc] | 45 | libraries to <quote>lib</quote>:</para>
|
---|
[be3d9f3] | 46 |
|
---|
[b3f1ebb3] | 47 | <screen arch="default"><userinput remap="pre">case $(uname -m) in
|
---|
[be3d9f3] | 48 | x86_64)
|
---|
| 49 | sed -e '/m64=/s/lib64/lib/' \
|
---|
| 50 | -i.orig gcc/config/i386/t-linux64
|
---|
| 51 | ;;
|
---|
| 52 | esac</userinput></screen>
|
---|
| 53 |
|
---|
[fd48baa] | 54 | <para arch="ml_32,ml_x32,ml_all">Change the default directory name for 64-bit
|
---|
[b3f1ebb3] | 55 | libraries to <quote>lib</quote>:</para>
|
---|
| 56 |
|
---|
[6dfcfecc] | 57 | <screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
|
---|
[0ebda11] | 58 | -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \
|
---|
[9c0c3a0] | 59 | -i.orig gcc/config/i386/t-linux64</userinput></screen>
|
---|
[b3f1ebb3] | 60 |
|
---|
[f1dd547] | 61 | <para>The GCC documentation recommends building GCC in a dedicated build directory:</para>
|
---|
[73aedd1d] | 62 |
|
---|
[f1dd547] | 63 | <screen><userinput remap="pre">mkdir -v build
|
---|
| 64 | cd build</userinput></screen>
|
---|
[73aedd1d] | 65 |
|
---|
[6a82dd9] | 66 | <para>Prepare GCC for compilation:</para>
|
---|
[73aedd1d] | 67 |
|
---|
[6dfcfecc] | 68 | <screen arch="default"><userinput remap="configure">../configure --prefix=/usr \
|
---|
| 69 | LD=ld \
|
---|
[f1dd547] | 70 | --enable-languages=c,c++ \
|
---|
[0611f706] | 71 | --enable-default-pie \
|
---|
| 72 | --enable-default-ssp \
|
---|
[340e17a] | 73 | --enable-host-pie \
|
---|
[6dfcfecc] | 74 | --disable-multilib \
|
---|
[f1dd547] | 75 | --disable-bootstrap \
|
---|
[53363494] | 76 | --disable-fixincludes \
|
---|
[6dfcfecc] | 77 | --with-system-zlib</userinput></screen>
|
---|
| 78 | <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure"
|
---|
| 79 | arch="ml_32" >mlist=m64,m32</userinput><userinput remap="configure"
|
---|
| 80 | arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure"
|
---|
| 81 | arch="ml_all">mlist=m64,m32,mx32</userinput>
|
---|
| 82 | <userinput remap="configure">../configure --prefix=/usr \
|
---|
| 83 | LD=ld \
|
---|
| 84 | --enable-languages=c,c++ \
|
---|
[1835fca] | 85 | --enable-default-pie \
|
---|
| 86 | --enable-default-ssp \
|
---|
[1d599b9] | 87 | --enable-host-pie \
|
---|
[6dfcfecc] | 88 | --enable-multilib \
|
---|
| 89 | --with-multilib-list=$mlist \
|
---|
| 90 | --disable-bootstrap \
|
---|
[5c9689c] | 91 | --disable-fixincludes \
|
---|
[6dfcfecc] | 92 | --with-system-zlib</userinput></screen>
|
---|
| 93 |
|
---|
[30f3041] | 94 | <para>GCC supports seven different computer languages, but the
|
---|
| 95 | prerequisites for most of them have not yet been installed. See the
|
---|
[6dfcfecc] | 96 | <ulink url="&blfs-book;general/gcc.html">BLFS Book GCC page</ulink>
|
---|
[93756f6] | 97 | for instructions on how to build all of GCC's supported languages.</para>
|
---|
[182d5d3] | 98 |
|
---|
[ae4d45a] | 99 | <variablelist>
|
---|
[0cba512d] | 100 | <title>The meaning of the new configure parameters:</title>
|
---|
[cde2ae7] | 101 |
|
---|
[ff0f063] | 102 | <varlistentry>
|
---|
[6dfcfecc] | 103 | <term><parameter>LD=ld</parameter></term>
|
---|
[ff0f063] | 104 | <listitem>
|
---|
[30f3041] | 105 | <para>This parameter makes the configure script use the ld program installed
|
---|
| 106 | by the Binutils package built earlier in this chapter, rather than
|
---|
[6dfcfecc] | 107 | the cross-built version which would otherwise be used.</para>
|
---|
[ff0f063] | 108 | </listitem>
|
---|
| 109 | </varlistentry>
|
---|
[6dfcfecc] | 110 |
|
---|
[9781ec5] | 111 | <varlistentry>
|
---|
| 112 | <term><parameter>--disable-fixincludes</parameter></term>
|
---|
| 113 | <listitem>
|
---|
| 114 | <para>By default, during the installation of GCC some system
|
---|
| 115 | headers would be <quote>fixed</quote> to be used with GCC. This
|
---|
[fb5f62b] | 116 | is not necessary for a modern Linux system, and potentially
|
---|
[9781ec5] | 117 | harmful if a package is reinstalled after installing GCC. This
|
---|
| 118 | switch prevents GCC from <quote>fixing</quote> the headers.</para>
|
---|
| 119 | </listitem>
|
---|
| 120 | </varlistentry>
|
---|
| 121 |
|
---|
[ae4d45a] | 122 | <varlistentry>
|
---|
| 123 | <term><parameter>--with-system-zlib</parameter></term>
|
---|
| 124 | <listitem>
|
---|
| 125 | <para>This switch tells GCC to link to the system installed copy of
|
---|
[30f3041] | 126 | the Zlib library, rather than its own internal copy.</para>
|
---|
[ae4d45a] | 127 | </listitem>
|
---|
| 128 | </varlistentry>
|
---|
| 129 | </variablelist>
|
---|
| 130 |
|
---|
[c10a327] | 131 | <note>
|
---|
| 132 | <anchor id="pie-ssp-info" xreflabel="note on PIE and SSP"/>
|
---|
[1bade3f] | 133 | <para>
|
---|
[30f3041] | 134 | PIE (position-independent executables) are
|
---|
[e502de1] | 135 | binary programs that can be loaded anywhere in memory. Without PIE,
|
---|
| 136 | the security feature named ASLR (Address Space Layout Randomization)
|
---|
[30f3041] | 137 | can be applied for the shared libraries, but not for the executables
|
---|
| 138 | themselves. Enabling PIE allows ASLR for the executables in addition to
|
---|
[e502de1] | 139 | the shared libraries, and mitigates some attacks based on fixed
|
---|
| 140 | addresses of sensitive code or data in the executables.
|
---|
[1bade3f] | 141 | </para>
|
---|
| 142 | <para>
|
---|
| 143 | SSP (Stack Smashing Protection) is a technique to ensure
|
---|
[30f3041] | 144 | that the parameter stack is not corrupted. Stack corruption can,
|
---|
| 145 | for example, alter the return address of a subroutine,
|
---|
| 146 | thus transferring control to some dangerous code
|
---|
[e502de1] | 147 | (existing in the program or shared libraries, or injected by the
|
---|
[30f3041] | 148 | attacker somehow).
|
---|
[1bade3f] | 149 | </para>
|
---|
| 150 | </note>
|
---|
| 151 |
|
---|
[6a82dd9] | 152 | <para>Compile the package:</para>
|
---|
[73aedd1d] | 153 |
|
---|
[0445a3d] | 154 | <screen><userinput remap="make">make</userinput></screen>
|
---|
[73aedd1d] | 155 |
|
---|
[6a82dd9] | 156 | <important>
|
---|
| 157 | <para>In this section, the test suite for GCC is considered
|
---|
[30f3041] | 158 | important, but it takes a long time. First-time builders are
|
---|
| 159 | encouraged to run the test suite. The time to run the tests can be
|
---|
[340e17a] | 160 | reduced significantly by adding -jx to the <command>make -k check</command>
|
---|
| 161 | command below, where x is the number of CPU cores on your system.</para>
|
---|
[6a82dd9] | 162 | </important>
|
---|
[81fd230] | 163 |
|
---|
[2ca7fca7] | 164 | <para>GCC may need more stack space compiling some extremely complex
|
---|
| 165 | code patterns. As a precaution for the host distros with a tight stack
|
---|
| 166 | limit, explicitly set the stack size hard limit to infinite.
|
---|
| 167 | On most host distros (and the final LFS system) the hard limit is
|
---|
[2b76c89] | 168 | infinite by default, but there is no harm done by setting it explicitly.
|
---|
| 169 | It's not necessary to change the stack size soft limit because GCC will
|
---|
[2ca7fca7] | 170 | automatically set it to an appropriate value, as long as the value does
|
---|
| 171 | not exceed the hard limit:</para>
|
---|
| 172 |
|
---|
| 173 | <screen><userinput remap="test">ulimit -s -H unlimited</userinput></screen>
|
---|
[4e48f56e] | 174 |
|
---|
[340e17a] | 175 | <para>Now remove/fix several known test failures:</para>
|
---|
| 176 |
|
---|
| 177 | <screen><userinput remap="test">sed -e '/cpython/d' -i ../gcc/testsuite/gcc.dg/plugin/plugin.exp
|
---|
| 178 | sed -e 's/no-pic /&-no-pie /' -i ../gcc/testsuite/gcc.target/i386/pr113689-1.c
|
---|
| 179 | sed -e 's/300000/(1|300000)/' -i ../libgomp/testsuite/libgomp.c-c++-common/pr109062.c
|
---|
| 180 | sed -e 's/{ target nonpic } //' \
|
---|
| 181 | -e '/GOTPCREL/d' -i ../gcc/testsuite/gcc.target/i386/fentryname3.c</userinput></screen>
|
---|
| 182 |
|
---|
[76db8d6] | 183 | <para>Test the results as a non-privileged user, but do not stop at errors:</para>
|
---|
| 184 |
|
---|
[9c73d911] | 185 | <screen><userinput remap="test">chown -R tester .
|
---|
[8d4f212] | 186 | su tester -c "PATH=$PATH make -k check"</userinput></screen>
|
---|
[73aedd1d] | 187 |
|
---|
[30f3041] | 188 | <para>To extract a summary of the test suite results, run:</para>
|
---|
[9278974d] | 189 |
|
---|
[f1dd547] | 190 | <screen><userinput remap="test">../contrib/test_summary</userinput></screen>
|
---|
[9278974d] | 191 |
|
---|
[30f3041] | 192 | <para>To filter out only the summaries, pipe the output through
|
---|
[9278974d] | 193 | <userinput>grep -A7 Summ</userinput>.</para>
|
---|
| 194 |
|
---|
| 195 | <para>Results can be compared with those located at <ulink
|
---|
[98e7ac4] | 196 | url="&test-results;"/> and
|
---|
[b30de8f] | 197 | <ulink url="https://gcc.gnu.org/ml/gcc-testresults/"/>.</para>
|
---|
[340e17a] | 198 | <!--
|
---|
[5f2ba8c] | 199 | <para>
|
---|
| 200 | Eight gcc tests (out of over 185,000):
|
---|
[340e17a] | 201 | <!- - https://gcc.gnu.org/PR106375 - -><filename>pr56837.c</filename>
|
---|
[5f2ba8c] | 202 | and seven tests in the <filename class='directory'>analyzer</filename>
|
---|
| 203 | directory are known to fail.
|
---|
[28614cdd] | 204 |
|
---|
[340e17a] | 205 | <!- - https://gcc.gnu.org/PR109353 - ->
|
---|
[5f2ba8c] | 206 | One libstdc++ test (out of over 15000), <filename>copy.cc</filename>, is
|
---|
| 207 | known to fail.
|
---|
[28614cdd] | 208 |
|
---|
[5f2ba8c] | 209 | For g++, 21 tests (out of approximately 250,000): 14
|
---|
| 210 | <quote>AddressSanitizer*</quote>
|
---|
| 211 | tests and 7 <filename>interception-malloc-test-1.C</filename> tests, are
|
---|
| 212 | known to fail.
|
---|
[28614cdd] | 213 |
|
---|
[6d4ba5f] | 214 | Additionally, several tests in the
|
---|
| 215 | <filename class='directory'>vect</filename> directory are known to fail
|
---|
| 216 | if the hardware does not support AVX.</para>
|
---|
[340e17a] | 217 | -->
|
---|
| 218 | <para>A few unexpected failures cannot always be avoided. In some cases
|
---|
| 219 | test failures depend on the specific hardware of the system.<!--The GCC developers
|
---|
| 220 | are usually aware of these issues, but have not resolved them yet.-->
|
---|
[9278974d] | 221 | Unless the test results are vastly different from those at the above URL,
|
---|
| 222 | it is safe to continue.</para>
|
---|
[73aedd1d] | 223 |
|
---|
[3a72ffa] | 224 | <para>Install the package:</para>
|
---|
[73aedd1d] | 225 |
|
---|
[3a72ffa] | 226 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
[1daca67] | 227 |
|
---|
| 228 | <para>The GCC build directory is owned by <systemitem class="username">
|
---|
[30f3041] | 229 | tester</systemitem> now, and the ownership of the installed header
|
---|
| 230 | directory (and its content) is incorrect. Change the ownership to the
|
---|
[1daca67] | 231 | <systemitem class="username">root</systemitem> user and group:</para>
|
---|
| 232 |
|
---|
| 233 | <screen><userinput remap="install">chown -v -R root:root \
|
---|
[9c43803] | 234 | /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include{,-fixed}</userinput></screen>
|
---|
[73aedd1d] | 235 |
|
---|
[60b23a6f] | 236 | <para>Create a symlink required by the <ulink
|
---|
[b30de8f] | 237 | url="https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s09.html">FHS</ulink>
|
---|
[60b23a6f] | 238 | for "historical" reasons.</para>
|
---|
[73aedd1d] | 239 |
|
---|
[9c3ce2a] | 240 | <screen><userinput remap="install">ln -svr /usr/bin/cpp /usr/lib</userinput></screen>
|
---|
[0fe3bb0] | 241 |
|
---|
[6a82dd9] | 242 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
[0fe3bb0] | 243 | compiler. We've already created <command>cc</command> as a symlink in
|
---|
| 244 | <xref linkend='ch-tools-gcc-pass2'/>, create its man page as a symlink
|
---|
| 245 | as well:</para>
|
---|
| 246 |
|
---|
| 247 | <screen><userinput remap="install">ln -sv gcc.1 /usr/share/man/man1/cc.1</userinput></screen>
|
---|
[1ba726f] | 248 |
|
---|
[6206f72] | 249 | <para>Add a compatibility symlink to enable building programs with
|
---|
[d672ab7] | 250 | Link Time Optimization (LTO):</para>
|
---|
[6206f72] | 251 |
|
---|
[9da9d014] | 252 | <screen><userinput remap="install">ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \
|
---|
[040ecb6] | 253 | /usr/lib/bfd-plugins/</userinput></screen>
|
---|
[6206f72] | 254 |
|
---|
[09f1daf] | 255 | <para>Now that our final toolchain is in place, it is important to again ensure
|
---|
| 256 | that compiling and linking will work as expected. We do this by performing
|
---|
[6dfcfecc] | 257 | some sanity checks:</para>
|
---|
[09f1daf] | 258 |
|
---|
[a4f63e4] | 259 | <screen><userinput>echo 'int main(){}' > dummy.c
|
---|
| 260 | cc dummy.c -v -Wl,--verbose &> dummy.log
|
---|
| 261 | readelf -l a.out | grep ': /lib'</userinput></screen>
|
---|
[09f1daf] | 262 |
|
---|
[a4f63e4] | 263 | <para>There should be no errors,
|
---|
| 264 | and the output of the last command will be (allowing for
|
---|
| 265 | platform-specific differences in the dynamic linker name):</para>
|
---|
[09f1daf] | 266 |
|
---|
[a4f63e4] | 267 | <screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
|
---|
[09f1daf] | 268 |
|
---|
[30f3041] | 269 | <para>Now make sure that we're set up to use the correct start files:</para>
|
---|
[09f1daf] | 270 |
|
---|
[0d487e0] | 271 | <screen><userinput>grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log</userinput></screen>
|
---|
[09f1daf] | 272 |
|
---|
[a4f63e4] | 273 | <para>The output of the last command should be:</para>
|
---|
[09f1daf] | 274 |
|
---|
[0d487e0] | 275 | <screen><computeroutput>/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/Scrt1.o succeeded
|
---|
[98e7ac4] | 276 | /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded
|
---|
| 277 | /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crtn.o succeeded</computeroutput></screen>
|
---|
[09f1daf] | 278 |
|
---|
[6dfcfecc] | 279 | <para>Depending on your machine architecture, the above may differ slightly.
|
---|
| 280 | The difference will be the name of the directory
|
---|
[be3d9f3] | 281 | after <filename class="directory">/usr/lib/gcc</filename>. The important
|
---|
| 282 | thing to look for here is that <command>gcc</command> has found all three
|
---|
[5f7456b] | 283 | <filename>crt*.o</filename> files under the
|
---|
| 284 | <filename class="directory">/usr/lib</filename> directory.</para>
|
---|
[6e88633] | 285 |
|
---|
[a4f63e4] | 286 | <para>Verify that the compiler is searching for the correct header
|
---|
| 287 | files:</para>
|
---|
[09f1daf] | 288 |
|
---|
[041c8f67] | 289 | <screen><userinput>grep -B4 '^ /usr/include' dummy.log</userinput></screen>
|
---|
[e9a652b] | 290 |
|
---|
[a4f63e4] | 291 | <para>This command should return the following output:</para>
|
---|
[09f1daf] | 292 |
|
---|
[e9a652b] | 293 | <screen><computeroutput>#include <...> search starts here:
|
---|
[98e7ac4] | 294 | /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include
|
---|
[c528e3a] | 295 | /usr/local/include
|
---|
[98e7ac4] | 296 | /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed
|
---|
[e9a652b] | 297 | /usr/include</computeroutput></screen>
|
---|
| 298 |
|
---|
[6dfcfecc] | 299 | <para>Again, the directory named after your target triplet may be
|
---|
| 300 | different than the above, depending on your system architecture.</para>
|
---|
[3f39abf3] | 301 |
|
---|
[a4f63e4] | 302 | <para>Next, verify that the new linker is being used with the correct search paths:</para>
|
---|
[09f1daf] | 303 |
|
---|
[a4f63e4] | 304 | <screen><userinput>grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'</userinput></screen>
|
---|
[09f1daf] | 305 |
|
---|
[a4f63e4] | 306 | <para>References to paths that have components with '-linux-gnu' should
|
---|
| 307 | be ignored, but otherwise the output of the last command should be:</para>
|
---|
[09f1daf] | 308 |
|
---|
[98e7ac4] | 309 | <screen><computeroutput>SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64")
|
---|
| 310 | SEARCH_DIR("/usr/local/lib64")
|
---|
| 311 | SEARCH_DIR("/lib64")
|
---|
| 312 | SEARCH_DIR("/usr/lib64")
|
---|
| 313 | SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib")
|
---|
[e9a652b] | 314 | SEARCH_DIR("/usr/local/lib")
|
---|
| 315 | SEARCH_DIR("/lib")
|
---|
[6e88633] | 316 | SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
---|
| 317 |
|
---|
[f0cbef54] | 318 | <para arch="default">A 32-bit system may use a few other directories. For example, here
|
---|
[6dfcfecc] | 319 | is the output from an i686 machine:</para>
|
---|
[6e88633] | 320 |
|
---|
[6dfcfecc] | 321 | <!-- not using entities here as the dir names has nothing to do with multilib -->
|
---|
[b3f1ebb3] | 322 | <screen arch="default"><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
|
---|
[98e7ac4] | 323 | SEARCH_DIR("/usr/local/lib32")
|
---|
| 324 | SEARCH_DIR("/lib32")
|
---|
| 325 | SEARCH_DIR("/usr/lib32")
|
---|
| 326 | SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
|
---|
[6e88633] | 327 | SEARCH_DIR("/usr/local/lib")
|
---|
| 328 | SEARCH_DIR("/lib")
|
---|
[e9a652b] | 329 | SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
---|
| 330 |
|
---|
[a4f63e4] | 331 | <para>Next make sure that we're using the correct libc:</para>
|
---|
[09f1daf] | 332 |
|
---|
[a4f63e4] | 333 | <screen><userinput>grep "/lib.*/libc.so.6 " dummy.log</userinput></screen>
|
---|
[09f1daf] | 334 |
|
---|
[a4f63e4] | 335 | <para>The output of the last command should be:</para>
|
---|
[09f1daf] | 336 |
|
---|
[a4f63e4] | 337 | <screen><computeroutput>attempt to open /usr/lib/libc.so.6 succeeded</computeroutput></screen>
|
---|
[09f1daf] | 338 |
|
---|
[a4f63e4] | 339 | <para>Make sure GCC is using the correct dynamic linker:</para>
|
---|
[09f1daf] | 340 |
|
---|
[a4f63e4] | 341 | <screen><userinput>grep found dummy.log</userinput></screen>
|
---|
[09f1daf] | 342 |
|
---|
[a4f63e4] | 343 | <para>The output of the last command should be (allowing for
|
---|
| 344 | platform-specific differences in dynamic linker name):</para>
|
---|
[09f1daf] | 345 |
|
---|
[a4f63e4] | 346 | <screen><computeroutput>found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2</computeroutput></screen>
|
---|
[09f1daf] | 347 |
|
---|
[a4f63e4] | 348 | <para>If the output does not appear as shown above or is not received
|
---|
| 349 | at all, then something is seriously wrong. Investigate and retrace the
|
---|
| 350 | steps to find out where the problem is and correct it. <!--The most likely
|
---|
| 351 | reason is that something went wrong with the specs file adjustment.--> Any
|
---|
[30f3041] | 352 | issues should be resolved before continuing with the process.</para>
|
---|
[6a82dd9] | 353 |
|
---|
[a4f63e4] | 354 | <para>Once everything is working correctly, clean up the test files:</para>
|
---|
[e9a652b] | 355 |
|
---|
[a4f63e4] | 356 | <screen><userinput>rm -v dummy.c a.out dummy.log</userinput></screen>
|
---|
[e9a652b] | 357 |
|
---|
[970a126] | 358 | <para>Finally, move a misplaced file:</para>
|
---|
[39ec01c] | 359 |
|
---|
[970a126] | 360 | <screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
|
---|
[6dfcfecc] | 361 | mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
|
---|
[39ec01c] | 362 |
|
---|
[6a82dd9] | 363 | </sect2>
|
---|
| 364 |
|
---|
| 365 | <sect2 id="contents-gcc" role="content">
|
---|
| 366 | <title>Contents of GCC</title>
|
---|
| 367 |
|
---|
| 368 | <segmentedlist>
|
---|
| 369 | <segtitle>Installed programs</segtitle>
|
---|
| 370 | <segtitle>Installed libraries</segtitle>
|
---|
[fe05b08] | 371 | <segtitle>Installed directories</segtitle>
|
---|
[6a82dd9] | 372 |
|
---|
| 373 | <seglistitem>
|
---|
[2ca8941] | 374 | <seg>c++, cc (link to gcc), cpp, g++, gcc,
|
---|
[e5b4b3f] | 375 | gcc-ar, gcc-nm, gcc-ranlib, gcov, gcov-dump, gcov-tool,
|
---|
| 376 | and lto-dump</seg>
|
---|
[e0901b3] | 377 |
|
---|
[78cc3be] | 378 | <seg>libasan.{a,so}, libatomic.{a,so}, libcc1.so, libgcc.a, libgcc_eh.a,
|
---|
[465ada7] | 379 | libgcc_s.so, libgcov.a, libgomp.{a,so}, libhwasan.{a,so}, libitm.{a,so},
|
---|
[78cc3be] | 380 | liblsan.{a,so}, liblto_plugin.so,
|
---|
| 381 | libquadmath.{a,so}, libssp.{a,so}, libssp_nonshared.a,
|
---|
[465ada7] | 382 | libstdc++.{a,so}, libstdc++exp.a, libstdc++fs.a, libsupc++.a, libtsan.{a,so},
|
---|
[78cc3be] | 383 | and libubsan.{a,so}</seg>
|
---|
[2ca8941] | 384 |
|
---|
[d672ab7] | 385 | <seg>/usr/include/c++, /usr/lib/gcc, /usr/libexec/gcc, and
|
---|
[4e8a532] | 386 | /usr/share/gcc-&gcc-version;</seg>
|
---|
[6a82dd9] | 387 | </seglistitem>
|
---|
| 388 | </segmentedlist>
|
---|
| 389 |
|
---|
| 390 | <variablelist>
|
---|
| 391 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 392 | <?dbfo list-presentation="list"?>
|
---|
| 393 | <?dbhtml list-presentation="table"?>
|
---|
| 394 |
|
---|
[75128571] | 395 | <varlistentry id="c">
|
---|
| 396 | <term><command>c++</command></term>
|
---|
| 397 | <listitem>
|
---|
| 398 | <para>The C++ compiler</para>
|
---|
| 399 | <indexterm zone="ch-system-gcc c">
|
---|
| 400 | <primary sortas="b-c++">c++</primary>
|
---|
| 401 | </indexterm>
|
---|
| 402 | </listitem>
|
---|
| 403 | </varlistentry>
|
---|
| 404 |
|
---|
[6a82dd9] | 405 | <varlistentry id="cc">
|
---|
| 406 | <term><command>cc</command></term>
|
---|
| 407 | <listitem>
|
---|
| 408 | <para>The C compiler</para>
|
---|
| 409 | <indexterm zone="ch-system-gcc cc">
|
---|
| 410 | <primary sortas="b-cc">cc</primary>
|
---|
| 411 | </indexterm>
|
---|
| 412 | </listitem>
|
---|
| 413 | </varlistentry>
|
---|
| 414 |
|
---|
| 415 | <varlistentry id="cpp">
|
---|
| 416 | <term><command>cpp</command></term>
|
---|
| 417 | <listitem>
|
---|
| 418 | <para>The C preprocessor; it is used by the compiler to expand the
|
---|
[30f3041] | 419 | #include, #define, and similar directives in the source files</para>
|
---|
[6a82dd9] | 420 | <indexterm zone="ch-system-gcc cpp">
|
---|
| 421 | <primary sortas="b-cpp">cpp</primary>
|
---|
| 422 | </indexterm>
|
---|
| 423 | </listitem>
|
---|
| 424 | </varlistentry>
|
---|
| 425 |
|
---|
| 426 | <varlistentry id="g">
|
---|
| 427 | <term><command>g++</command></term>
|
---|
| 428 | <listitem>
|
---|
| 429 | <para>The C++ compiler</para>
|
---|
| 430 | <indexterm zone="ch-system-gcc g">
|
---|
| 431 | <primary sortas="b-g++">g++</primary>
|
---|
| 432 | </indexterm>
|
---|
| 433 | </listitem>
|
---|
| 434 | </varlistentry>
|
---|
| 435 |
|
---|
| 436 | <varlistentry id="gcc">
|
---|
| 437 | <term><command>gcc</command></term>
|
---|
| 438 | <listitem>
|
---|
| 439 | <para>The C compiler</para>
|
---|
| 440 | <indexterm zone="ch-system-gcc gcc">
|
---|
| 441 | <primary sortas="b-gcc">gcc</primary>
|
---|
| 442 | </indexterm>
|
---|
| 443 | </listitem>
|
---|
| 444 | </varlistentry>
|
---|
| 445 |
|
---|
[e0901b3] | 446 | <varlistentry id="gcc-ar">
|
---|
| 447 | <term><command>gcc-ar</command></term>
|
---|
| 448 | <listitem>
|
---|
| 449 | <para>A wrapper around <command>ar</command> that adds a
|
---|
[afba93b] | 450 | plugin to the command line. This program is only used
|
---|
[edbeeb5] | 451 | to add "link time optimization" and is not useful with the
|
---|
[30f3041] | 452 | default build options.</para>
|
---|
[e0901b3] | 453 | <indexterm zone="ch-system-gcc gcc-ar">
|
---|
| 454 | <primary sortas="b-gcc-ar">gc-ar</primary>
|
---|
| 455 | </indexterm>
|
---|
| 456 | </listitem>
|
---|
| 457 | </varlistentry>
|
---|
| 458 |
|
---|
| 459 | <varlistentry id="gcc-nm">
|
---|
| 460 | <term><command>gcc-nm</command></term>
|
---|
| 461 | <listitem>
|
---|
| 462 | <para>A wrapper around <command>nm</command> that adds a
|
---|
[afba93b] | 463 | plugin to the command line. This program is only used
|
---|
[a885478] | 464 | to add "link time optimization" and is not useful with the
|
---|
[30f3041] | 465 | default build options.</para>
|
---|
[e0901b3] | 466 | <indexterm zone="ch-system-gcc gcc-nm">
|
---|
| 467 | <primary sortas="b-gcc-nm">gc-nm</primary>
|
---|
| 468 | </indexterm>
|
---|
| 469 | </listitem>
|
---|
| 470 | </varlistentry>
|
---|
| 471 |
|
---|
| 472 | <varlistentry id="gcc-ranlib">
|
---|
| 473 | <term><command>gcc-ranlib</command></term>
|
---|
| 474 | <listitem>
|
---|
| 475 | <para>A wrapper around <command>ranlib</command> that adds a
|
---|
[afba93b] | 476 | plugin to the command line. This program is only used
|
---|
[a885478] | 477 | to add "link time optimization" and is not useful with the
|
---|
[30f3041] | 478 | default build options.</para>
|
---|
[e0901b3] | 479 | <indexterm zone="ch-system-gcc gcc-ranlib">
|
---|
| 480 | <primary sortas="b-gcc-ranlib">gc-ranlib</primary>
|
---|
| 481 | </indexterm>
|
---|
| 482 | </listitem>
|
---|
| 483 | </varlistentry>
|
---|
[6a82dd9] | 484 |
|
---|
| 485 | <varlistentry id="gcov">
|
---|
| 486 | <term><command>gcov</command></term>
|
---|
| 487 | <listitem>
|
---|
| 488 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
[30f3041] | 489 | determine where optimizations will have the greatest effect</para>
|
---|
[6a82dd9] | 490 | <indexterm zone="ch-system-gcc gcov">
|
---|
| 491 | <primary sortas="b-gcov">gcov</primary>
|
---|
| 492 | </indexterm>
|
---|
[4783efe] | 493 | </listitem>
|
---|
| 494 | </varlistentry>
|
---|
| 495 |
|
---|
[78cc3be] | 496 | <varlistentry id="gcov-dump">
|
---|
| 497 | <term><command>gcov-dump</command></term>
|
---|
| 498 | <listitem>
|
---|
| 499 | <para>Offline gcda and gcno profile dump tool</para>
|
---|
| 500 | <indexterm zone="ch-system-gcc gcov-dump">
|
---|
| 501 | <primary sortas="b-gcov-dump">gcov-dump</primary>
|
---|
| 502 | </indexterm>
|
---|
| 503 | </listitem>
|
---|
| 504 | </varlistentry>
|
---|
| 505 |
|
---|
| 506 | <varlistentry id="gcov-tool">
|
---|
| 507 | <term><command>gcov-tool</command></term>
|
---|
| 508 | <listitem>
|
---|
| 509 | <para>Offline gcda profile processing tool</para>
|
---|
| 510 | <indexterm zone="ch-system-gcc gcov-tool">
|
---|
| 511 | <primary sortas="b-gcov-tool">gcov-tool</primary>
|
---|
| 512 | </indexterm>
|
---|
| 513 | </listitem>
|
---|
| 514 | </varlistentry>
|
---|
| 515 |
|
---|
[e5b4b3f] | 516 | <varlistentry id="lto-dump">
|
---|
| 517 | <term><command>lto-dump</command></term>
|
---|
| 518 | <listitem>
|
---|
| 519 | <para>Tool for dumping object files produced by GCC with LTO
|
---|
| 520 | enabled</para>
|
---|
| 521 | <indexterm zone="ch-system-gcc lto-dump">
|
---|
| 522 | <primary sortas="b-lto-dump">lto-dump</primary>
|
---|
| 523 | </indexterm>
|
---|
| 524 | </listitem>
|
---|
| 525 | </varlistentry>
|
---|
| 526 |
|
---|
[4783efe] | 527 | <varlistentry id="libasan">
|
---|
[78cc3be] | 528 | <term><filename class="libraryfile">libasan</filename></term>
|
---|
[4783efe] | 529 | <listitem>
|
---|
| 530 | <para>The Address Sanitizer runtime library</para>
|
---|
| 531 | <indexterm zone="ch-system-gcc libasan">
|
---|
| 532 | <primary sortas="b-libasan">libasan</primary>
|
---|
| 533 | </indexterm>
|
---|
[6a82dd9] | 534 | </listitem>
|
---|
| 535 | </varlistentry>
|
---|
| 536 |
|
---|
[78cc3be] | 537 | <varlistentry id="libatomic">
|
---|
| 538 | <term><filename class="libraryfile">libatomic</filename></term>
|
---|
| 539 | <listitem>
|
---|
| 540 | <para>GCC atomic built-in runtime library</para>
|
---|
| 541 | <indexterm zone="ch-system-gcc libatomic">
|
---|
| 542 | <primary sortas="b-libatomic">libatomic</primary>
|
---|
| 543 | </indexterm>
|
---|
| 544 | </listitem>
|
---|
| 545 | </varlistentry>
|
---|
| 546 |
|
---|
| 547 | <varlistentry id="libcc1">
|
---|
| 548 | <term><filename class="libraryfile">libcc1</filename></term>
|
---|
| 549 | <listitem>
|
---|
[46b5c6b] | 550 | <para>A library that allows GDB to make use of GCC</para>
|
---|
[78cc3be] | 551 | <indexterm zone="ch-system-gcc libcc1">
|
---|
| 552 | <primary sortas="b-libcc1">libcc1</primary>
|
---|
| 553 | </indexterm>
|
---|
| 554 | </listitem>
|
---|
| 555 | </varlistentry>
|
---|
| 556 |
|
---|
[6a82dd9] | 557 | <varlistentry id="libgcc">
|
---|
| 558 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
| 559 | <listitem>
|
---|
| 560 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
| 561 | <indexterm zone="ch-system-gcc libgcc">
|
---|
[afba93b] | 562 | <primary sortas="c-libgcc">libgcc</primary>
|
---|
[6a82dd9] | 563 | </indexterm>
|
---|
| 564 | </listitem>
|
---|
| 565 | </varlistentry>
|
---|
| 566 |
|
---|
[90aae6b] | 567 | <varlistentry id="libgcov">
|
---|
| 568 | <term><filename class="libraryfile">libgcov</filename></term>
|
---|
| 569 | <listitem>
|
---|
[30f3041] | 570 | <para>This library is linked into a program when GCC is instructed
|
---|
[90aae6b] | 571 | to enable profiling</para>
|
---|
| 572 | <indexterm zone="ch-system-gcc libgcov">
|
---|
| 573 | <primary sortas="c-libgcov">libgcov</primary>
|
---|
| 574 | </indexterm>
|
---|
| 575 | </listitem>
|
---|
| 576 | </varlistentry>
|
---|
| 577 |
|
---|
| 578 | <varlistentry id="libgomp">
|
---|
| 579 | <term><filename class="libraryfile">libgomp</filename></term>
|
---|
| 580 | <listitem>
|
---|
| 581 | <para>GNU implementation of the OpenMP API for multi-platform
|
---|
| 582 | shared-memory parallel programming in C/C++ and Fortran</para>
|
---|
| 583 | <indexterm zone="ch-system-gcc libgomp">
|
---|
| 584 | <primary sortas="c-libgomp">libgomp</primary>
|
---|
| 585 | </indexterm>
|
---|
| 586 | </listitem>
|
---|
| 587 | </varlistentry>
|
---|
| 588 |
|
---|
[465ada7] | 589 | <varlistentry id="libhwasan">
|
---|
| 590 | <term><filename class="libraryfile">libhwasan</filename></term>
|
---|
| 591 | <listitem>
|
---|
| 592 | <para>The Hardware-assisted Address Sanitizer runtime library</para>
|
---|
| 593 | <indexterm zone="ch-system-gcc libhwasan">
|
---|
| 594 | <primary sortas="c-libhwasan">libhwasan</primary>
|
---|
| 595 | </indexterm>
|
---|
| 596 | </listitem>
|
---|
| 597 | </varlistentry>
|
---|
| 598 |
|
---|
[e5b4b3f] | 599 | <varlistentry id="libitm">
|
---|
| 600 | <term><filename class="libraryfile">libitm</filename></term>
|
---|
| 601 | <listitem>
|
---|
| 602 | <para>The GNU transactional memory library</para>
|
---|
| 603 | <indexterm zone="ch-system-gcc libitm">
|
---|
| 604 | <primary sortas="c-libitm">libitm</primary>
|
---|
| 605 | </indexterm>
|
---|
| 606 | </listitem>
|
---|
| 607 | </varlistentry>
|
---|
| 608 |
|
---|
[78cc3be] | 609 | <varlistentry id="liblsan">
|
---|
| 610 | <term><filename class="libraryfile">liblsan</filename></term>
|
---|
[b755562] | 611 | <listitem>
|
---|
[78cc3be] | 612 | <para>The Leak Sanitizer runtime library</para>
|
---|
| 613 | <indexterm zone="ch-system-gcc liblsan">
|
---|
| 614 | <primary sortas="c-liblsan">liblsan</primary>
|
---|
[b755562] | 615 | </indexterm>
|
---|
| 616 | </listitem>
|
---|
| 617 | </varlistentry>
|
---|
| 618 |
|
---|
[3119ddc] | 619 | <varlistentry id="liblto_plugin">
|
---|
| 620 | <term><filename class="libraryfile">liblto_plugin</filename></term>
|
---|
| 621 | <listitem>
|
---|
[30f3041] | 622 | <para>GCC's LTO plugin allows Binutils to process object files
|
---|
[e5b4b3f] | 623 | produced by GCC with LTO enabled</para>
|
---|
[3119ddc] | 624 | <indexterm zone="ch-system-gcc liblto_plugin">
|
---|
[afba93b] | 625 | <primary sortas="c-liblto_plugin">liblto_plugin</primary>
|
---|
[3119ddc] | 626 | </indexterm>
|
---|
| 627 | </listitem>
|
---|
| 628 | </varlistentry>
|
---|
[7bb9fda] | 629 |
|
---|
[3119ddc] | 630 | <varlistentry id="libquadmath">
|
---|
| 631 | <term><filename class="libraryfile">libquadmath</filename></term>
|
---|
| 632 | <listitem>
|
---|
| 633 | <para>GCC Quad Precision Math Library API</para>
|
---|
| 634 | <indexterm zone="ch-system-gcc libquadmath">
|
---|
[afba93b] | 635 | <primary sortas="c-libquadmath">libquadmath</primary>
|
---|
[3119ddc] | 636 | </indexterm>
|
---|
| 637 | </listitem>
|
---|
| 638 | </varlistentry>
|
---|
| 639 |
|
---|
[2791a8e] | 640 | <varlistentry id="libssp">
|
---|
| 641 | <term><filename class="libraryfile">libssp</filename></term>
|
---|
| 642 | <listitem>
|
---|
| 643 | <para>Contains routines supporting GCC's stack-smashing protection
|
---|
[30f3041] | 644 | functionality. Normally it is not used, because Glibc also provides
|
---|
| 645 | those routines.</para>
|
---|
[2791a8e] | 646 | <indexterm zone="ch-system-gcc libssp">
|
---|
[afba93b] | 647 | <primary sortas="c-libssp">libssp</primary>
|
---|
[2791a8e] | 648 | </indexterm>
|
---|
| 649 | </listitem>
|
---|
| 650 | </varlistentry>
|
---|
| 651 |
|
---|
[6a82dd9] | 652 | <varlistentry id="libstdc">
|
---|
| 653 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
| 654 | <listitem>
|
---|
| 655 | <para>The standard C++ library</para>
|
---|
| 656 | <indexterm zone="ch-system-gcc libstdc">
|
---|
| 657 | <primary sortas="c-libstdc++">libstdc++</primary>
|
---|
| 658 | </indexterm>
|
---|
| 659 | </listitem>
|
---|
| 660 | </varlistentry>
|
---|
| 661 |
|
---|
[465ada7] | 662 | <varlistentry id="libstdcexp">
|
---|
| 663 | <term><filename class="libraryfile">libstdc++exp</filename></term>
|
---|
| 664 | <listitem>
|
---|
| 665 | <para>Experimental C++ Contracts library</para>
|
---|
| 666 | <indexterm zone="ch-system-gcc libstdcexp">
|
---|
| 667 | <primary sortas="c-libstdc++exp">libstdc++exp</primary>
|
---|
| 668 | </indexterm>
|
---|
| 669 | </listitem>
|
---|
| 670 | </varlistentry>
|
---|
| 671 |
|
---|
[78cc3be] | 672 | <varlistentry id="libstdcfs">
|
---|
| 673 | <term><filename class="libraryfile">libstdc++fs</filename></term>
|
---|
| 674 | <listitem>
|
---|
| 675 | <para>ISO/IEC TS 18822:2015 Filesystem library</para>
|
---|
| 676 | <indexterm zone="ch-system-gcc libstdcfs">
|
---|
| 677 | <primary sortas="c-libstdc++fs">libstdc++fs</primary>
|
---|
| 678 | </indexterm>
|
---|
| 679 | </listitem>
|
---|
| 680 | </varlistentry>
|
---|
| 681 |
|
---|
[6a82dd9] | 682 | <varlistentry id="libsupc">
|
---|
| 683 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
| 684 | <listitem>
|
---|
| 685 | <para>Provides supporting routines for the C++ programming
|
---|
| 686 | language</para>
|
---|
| 687 | <indexterm zone="ch-system-gcc libsupc">
|
---|
| 688 | <primary sortas="c-libsupc++">libsupc++</primary>
|
---|
| 689 | </indexterm>
|
---|
| 690 | </listitem>
|
---|
| 691 | </varlistentry>
|
---|
| 692 |
|
---|
[f6b1d91] | 693 | <varlistentry id="libtsan">
|
---|
| 694 | <term><filename class="libraryfile">libtsan</filename></term>
|
---|
| 695 | <listitem>
|
---|
| 696 | <para>The Thread Sanitizer runtime library</para>
|
---|
| 697 | <indexterm zone="ch-system-gcc libtsan">
|
---|
| 698 | <primary sortas="c-libtsan">libtsan</primary>
|
---|
| 699 | </indexterm>
|
---|
| 700 | </listitem>
|
---|
| 701 | </varlistentry>
|
---|
| 702 |
|
---|
[78cc3be] | 703 | <varlistentry id="libubsan">
|
---|
| 704 | <term><filename class="libraryfile">libubsan</filename></term>
|
---|
| 705 | <listitem>
|
---|
| 706 | <para>The Undefined Behavior Sanitizer runtime library</para>
|
---|
| 707 | <indexterm zone="ch-system-gcc libubsan">
|
---|
| 708 | <primary sortas="c-libubsan">libubsan</primary>
|
---|
| 709 | </indexterm>
|
---|
| 710 | </listitem>
|
---|
| 711 | </varlistentry>
|
---|
| 712 |
|
---|
[6a82dd9] | 713 | </variablelist>
|
---|
| 714 |
|
---|
| 715 | </sect2>
|
---|
[673b0d8] | 716 |
|
---|
| 717 | </sect1>
|
---|