1
0
Эх сурвалжийг харах

chapter06: Translate GCC instruction

Xi Ruoyao 7 жил өмнө
parent
commit
9600edb95f
1 өөрчлөгдсөн 103 нэмэгдсэн , 80 устгасан
  1. 103 80
      chapter06/gcc.xml

+ 103 - 80
chapter06/gcc.xml

@@ -23,8 +23,7 @@
   <sect2 role="package">
     <title/>
 
-    <para>The GCC package contains the GNU compiler collection, which includes
-    the C and C++ compilers.</para>
+    <para>GCC 软件包包含 GNU 编译器集合,其中有 C 和 C++ 编译器。</para>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
@@ -41,8 +40,8 @@
   <sect2 role="installation">
     <title>安装GCC</title>
 
-    <para>If building on x86_64, change the default directory name for 64-bit
-    libraries to <quote>lib</quote>:</para>
+    <para>在 x86_64 上构建时,修改存放 64 位库的默认路径为
+    	<quote>lib</quote>:</para>
 
 <screen><userinput remap="pre">case $(uname -m) in
   x86_64)
@@ -51,12 +50,11 @@
   ;;
 esac</userinput></screen>
 
-    <para>Remove the symlink created earlier as the final gcc includes will be
-    installed here:</para>
+    <para>删除之前创建的符号链接,以便安装最终的 GCC 头文件:</para>
 
 <screen><userinput remap="pre">rm -f /usr/lib/gcc</userinput></screen>
 
-    <para>The GCC documentation recommends building GCC in a dedicated build directory:</para>
+    <para>GCC 文档推荐在专用的构建目录中构建 GCC:</para>
 
 <screen><userinput remap="pre">mkdir -v build
 cd       build</userinput></screen>
@@ -70,27 +68,30 @@ cd       build</userinput></screen>
              --disable-bootstrap      \
              --with-system-zlib</userinput></screen>
 
-    <para>Note that for other languages, there are some prerequisites that
+    <!--para>Note that for other languages, there are some prerequisites that
     are not yet available. See the
     <ulink url="&blfs-book;general/gcc.html">BLFS Book</ulink>
-    for instructions on how to build all of GCC's supported languages.</para>
+    for instructions on how to build all of GCC's supported languages.</para-->
+    <para>请注意,对于其他语言,还有一些尚未满足的依赖项。
+		阅读<ulink url="&blfs-book;general/gcc.html">BLFS 手册</ulink>,
+		以了解如何构建 GCC 支持的所有语言。</para>
 
     <variablelist>
-      <title>The meaning of the new configure parameters:</title>
+      <title>新的配置选项的含义:</title>
 
       <varlistentry>
         <term><envar>SED=sed</envar></term>
         <listitem>
-          <para>Setting this environment variable prevents a hard-coded
-          path to /tools/bin/sed.</para>
+          <para>设定该环境变量,防止路径 /tools/bin/sed
+          	  被硬编码到编译结果中。</para>
         </listitem>
       </varlistentry>
  
       <varlistentry>
         <term><parameter>--with-system-zlib</parameter></term>
         <listitem>
-          <para>This switch tells GCC to link to the system installed copy of
-          the Zlib library, rather than its own internal copy.</para>
+          <para>该选项使得 GCC 链接到系统安装的 Zlib 库,而不是它自带的
+          Zlib 副本。</para>
         </listitem>
       </varlistentry>
     </variablelist>
@@ -100,70 +101,79 @@ cd       build</userinput></screen>
 <screen><userinput remap="make">make</userinput></screen>
 
     <important>
-      <para>In this section, the test suite for GCC is considered
-      critical. Do not skip it under any circumstance.</para>
+      <para>本节中 GCC 的测试套件被认为是关键的,无论如何不能跳过。</para>
     </important>
 
-   <para>One set of tests in the GCC test suite is known to exhaust the stack,
-   so increase the stack size prior to running the tests:</para>
+   <para>已知 GCC 测试套件中的一组测试可能耗尽栈空间,
+   因此运行测试前要增加栈空间:</para>
 
 <screen><userinput remap="test">ulimit -s 32768</userinput></screen>
 
-    <para>Test the results, but do not stop at errors:</para>
+    <para>测试编译结果,但出错时继续执行其他测试:</para>
 
 <screen><userinput remap="test">make -k check</userinput></screen>
 
-    <para>To receive a summary of the test suite results, run:</para>
+    <para>输入以下命令查看测试结果的摘要:</para>
 
 <screen><userinput remap="test">../contrib/test_summary</userinput></screen>
 
-    <para>For only the summaries, pipe the output through
-    <userinput>grep -A7 Summ</userinput>.</para>
+    <para>如果只想看摘要,将输出用管道送至
+    <userinput>grep -A7 Summ</userinput></para>
 
-    <para>Results can be compared with those located at <ulink
-    url="&test-results;"/> and
-    <ulink url="http://gcc.gnu.org/ml/gcc-testresults/"/>.</para>
+    <para>可以将结果与 <ulink
+    url="&test-results;"/> 和
+    <ulink url="http://gcc.gnu.org/ml/gcc-testresults/"/>
+    的结果进行比较。</para>
 
-    <para>A few unexpected failures cannot always be avoided. The GCC developers
+    <!--para>A few unexpected failures cannot always be avoided. The GCC developers
     are usually aware of these issues, but have not resolved them yet.
     In particular, six tests in the libstdc++ test suite are known to fail
     when running as the root user as we do here.
     Unless the test results are vastly different from those at the above URL,
-    it is safe to continue.</para>
+    it is safe to continue.</para-->
+    <para>少量意外的失败有时无法避免,GCC 开发者一般知道这类问题,
+		但尚未解决它们。特别地, libstdc++ 测试套件中有 6 个测试在以
+		root 身份运行时(我们现在就是这样做)会失败。
+		我们可以继续安全地构建系统,除非测试结果和以上 URL 的结果截然不同。
+	</para>
 
     <note><para>
-      On some combinations of kernel configuration and AMD processors
+      <!--On some combinations of kernel configuration and AMD processors
       there may be more than 1100 failures in the gcc.target/i386/mpx
       tests (which are designed to test the MPX option on recent
       Intel processors). These can safely be ignored on AMD
-      processors.
+	  processors.-->
+	  在某些 AMD 处理器上,一些特定的内核配置可以导致 gcc.target/i386/mpx
+	  中的 1100 多个失败(它们被设计为在较新的 Intel 处理器上测试 MPX
+	  选项)。在 AMD 处理器上可以安全地忽略这些失败。
     </para></note>
 
     <para>安装该软件包:</para>
 
 <screen><userinput remap="install">make install</userinput></screen>
 
-    <para>Create a symlink required by the <ulink
+    <para>创建一个 <ulink
     url="http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s09.html">FHS</ulink>
-    for "historical" reasons.</para>
+    因 <quote>历史原因</quote> 要求的符号链接:</para>
 
 <screen><userinput remap="install">ln -sv ../usr/bin/cpp /lib</userinput></screen>
 
-    <para>Many packages use the name <command>cc</command> to call the C
-    compiler. To satisfy those packages, create a symlink:</para>
+    <para>许多软件包使用 <command>cc</command> 调用 C 编译器。为了满足它们,
+    创建一个符号链接:</para>
 
 <screen><userinput remap="install">ln -sv gcc /usr/bin/cc</userinput></screen>
 
-    <para>Add a compatibility symlink to enable building programs with
-    Link Time Optimization (LTO):</para> 
+    <para>创建一个兼容性符号链接,以支持在构建程序时使用链接时优化(LTO):
+    </para> 
 
 <screen><userinput remap="install">install -v -dm755 /usr/lib/bfd-plugins
 ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \
         /usr/lib/bfd-plugins/</userinput></screen>
 
-    <para>Now that our final toolchain is in place, it is important to again ensure
-    that compiling and linking will work as expected. We do this by performing
-    the same sanity checks as we did earlier in the chapter:</para>
+    <para>现在最终的工具链已经就位,
+		重要的是再次确认编译和链接像我们期望的一样正常工作。
+		再一次执行之前进行过的完整性检查:
+	</para>
 
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
     href="adjusting.xml"
@@ -193,12 +203,17 @@ ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \
 /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded
 /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crtn.o succeeded</computeroutput></screen>
 
-  <para>Depending on your machine architecture, the above may differ slightly,
+  <!--para>Depending on your machine architecture, the above may differ slightly,
   the difference usually being the name of the directory
   after <filename class="directory">/usr/lib/gcc</filename>. The important
   thing to look for here is that <command>gcc</command> has found all three
   <filename>crt*.o</filename> files under the
-  <filename class="directory">/usr/lib</filename> directory.</para>
+  <filename class="directory">/usr/lib</filename> directory.</para-->
+  <para>以上结果可能随您的机器体系结构不同而略微不同,
+	  区别一般是 <filename class="directory">/usr/lib/gcc</filename>
+	  之后的目录名。我们关注的重点是, <command>gcc</command> 应该在
+	  <filename class="directory">/usr/lib</filename> 目录中找到所有三个
+	  <filename>crt*.o</filename> 文件。</para>
 
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
     href="adjusting.xml"
@@ -216,8 +231,10 @@ ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \
  /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed
  /usr/include</computeroutput></screen>
 
-   <para>Again, note that the directory named after your target triplet may be
-   different than the above, depending on your architecture.</para>
+   <!--para>Again, note that the directory named after your target triplet may be
+   different than the above, depending on your architecture.</para-->
+   <para>同样要注意以您的目标三元组命名的目录根据您体系结构的不同,
+	   可能和以上不同。</para>
 
 <!--  This appears to be obsolete
 
@@ -248,8 +265,8 @@ SEARCH_DIR("/usr/local/lib")
 SEARCH_DIR("/lib")
 SEARCH_DIR("/usr/lib");</computeroutput></screen>
 
-   <para>A 32-bit system may see a few different directories. For example, here
-   is the output from an i686 machine:</para>
+   <para>在 32 位系统上可能显示一些不同的目录,例如下面是 i686
+   	   机器上的输出:</para>
 
 <screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
 SEARCH_DIR("/usr/local/lib32")
@@ -304,7 +321,7 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
     href="adjusting.xml"
     xpointer="xpointer(//*[@os='v'])"/>
 
-    <para>Finally, move a misplaced file:</para>
+    <para>最后移动一个位置不正确的文件:</para>
 
 <screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
 mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
@@ -320,16 +337,16 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <segtitle>安装的目录</segtitle>
 
       <seglistitem>
-        <seg>c++, cc (link to gcc), cpp, g++, gcc,
-        gcc-ar, gcc-nm, gcc-ranlib, and gcov</seg>
+        <seg>c++, cc (到 gcc 的链接), cpp, g++, gcc,
+        gcc-ar, gcc-nm, gcc-ranlib, 以及 gcov</seg>
 
         <seg>libasan.{a,so}, libatomic.{a,so}, libgcc.a, libgcc_eh.a, 
         libgcc_s.so, libgcov.a, libgomp.{a,so}, libiberty.a, libitm.{a,so},
         liblto_plugin.so, 
         libquadmath.{a,so}, libssp.{a,so},
-        libssp_nonshared.a, libstdc++.{a,so}, libsupc++.a, and libtsan.{a,so}</seg>
+        libssp_nonshared.a, libstdc++.{a,so}, libsupc++.a, 以及 libtsan.{a,so}</seg>
 
-        <seg>/usr/include/c++, /usr/lib/gcc, /usr/libexec/gcc, and 
+        <seg>/usr/include/c++, /usr/lib/gcc, /usr/libexec/gcc, 以及
         /usr/share/gcc-&gcc-version;</seg>
       </seglistitem>
     </segmentedlist>
@@ -342,7 +359,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="c">
         <term><command>c++</command></term>
         <listitem>
-          <para>The C++ compiler</para>
+          <para>C++ 编译器</para>
           <indexterm zone="ch-system-gcc c">
             <primary sortas="b-c++">c++</primary>
           </indexterm>
@@ -352,7 +369,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="cc">
         <term><command>cc</command></term>
         <listitem>
-          <para>The C compiler</para>
+          <para>C 编译器</para>
           <indexterm zone="ch-system-gcc cc">
             <primary sortas="b-cc">cc</primary>
           </indexterm>
@@ -362,8 +379,8 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="cpp">
         <term><command>cpp</command></term>
         <listitem>
-          <para>The C preprocessor; it is used by the compiler to expand the
-          #include, #define, and similar statements in the source files</para>
+          <para>C 预处理器,编译器使用它展开源文件中的 #include、#define
+          及类似指令</para>
           <indexterm zone="ch-system-gcc cpp">
             <primary sortas="b-cpp">cpp</primary>
           </indexterm>
@@ -373,7 +390,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="g">
         <term><command>g++</command></term>
         <listitem>
-          <para>The C++ compiler</para>
+          <para>C++ 编译器</para>
           <indexterm zone="ch-system-gcc g">
             <primary sortas="b-g++">g++</primary>
           </indexterm>
@@ -383,7 +400,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="gcc">
         <term><command>gcc</command></term>
         <listitem>
-          <para>The C compiler</para>
+          <para>C 编译器</para>
           <indexterm zone="ch-system-gcc gcc">
             <primary sortas="b-gcc">gcc</primary>
           </indexterm>
@@ -393,10 +410,13 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="gcc-ar">
         <term><command>gcc-ar</command></term>
         <listitem>
-          <para>A wrapper around <command>ar</command> that adds a
+          <!--para>A wrapper around <command>ar</command> that adds a
           plugin to the command line. This program is only used
           to add "link time optimization" and is not useful with the
-          default build options</para>
+          default build options</para-->
+	      <para><command>ar</command> 的一个包装器,
+			  它在命令行中添加一个插件。这个程序只被用于提供链接时优化功能,
+			  对于默认的构建选项来说没有作用。</para>
           <indexterm zone="ch-system-gcc gcc-ar">
             <primary sortas="b-gcc-ar">gc-ar</primary>
           </indexterm>
@@ -406,10 +426,13 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="gcc-nm">
         <term><command>gcc-nm</command></term>
         <listitem>
-          <para>A wrapper around <command>nm</command> that adds a
+          <!--para>A wrapper around <command>nm</command> that adds a
           plugin to the command line. This program is only used
           to add "link time optimization" and is not useful with the
-          default build options</para>
+          default build options</para-->
+	      <para><command>nm</command> 的一个包装器,
+			  它在命令行中添加一个插件。这个程序只被用于提供链接时优化功能,
+			  对于默认的构建选项来说没有作用。</para>
           <indexterm zone="ch-system-gcc gcc-nm">
             <primary sortas="b-gcc-nm">gc-nm</primary>
           </indexterm>
@@ -419,10 +442,13 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="gcc-ranlib">
         <term><command>gcc-ranlib</command></term>
         <listitem>
-          <para>A wrapper around <command>ranlib</command> that adds a
+          <!--para>A wrapper around <command>ranlib</command> that adds a
           plugin to the command line. This program is only used
           to add "link time optimization" and is not useful with the
-          default build options</para>
+          default build options</para-->
+	      <para><command>ranlib</command> 的一个包装器,
+			  它在命令行中添加一个插件。这个程序只被用于提供链接时优化功能,
+			  对于默认的构建选项来说没有作用。</para>
           <indexterm zone="ch-system-gcc gcc-ranlib">
             <primary sortas="b-gcc-ranlib">gc-ranlib</primary>
           </indexterm>
@@ -432,8 +458,8 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="gcov">
         <term><command>gcov</command></term>
         <listitem>
-          <para>A coverage testing tool; it is used to analyze programs to
-          determine where optimizations will have the most effect</para>
+		  <para>一个覆盖率测试工具;
+			  用于分析程序并确定在哪里优化最有效</para>
           <indexterm zone="ch-system-gcc gcov">
             <primary sortas="b-gcov">gcov</primary>
           </indexterm>
@@ -441,9 +467,9 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       </varlistentry>
 
       <varlistentry id="libasan">
-        <term><command>libasan</command></term>
+        <term><filename class="libraryfile">libasan</filename></term>
         <listitem>
-          <para>The Address Sanitizer runtime library</para>
+          <para>地址完整性检查库</para>
           <indexterm zone="ch-system-gcc libasan">
             <primary sortas="b-libasan">libasan</primary>
           </indexterm>
@@ -453,7 +479,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libgcc">
         <term><filename class="libraryfile">libgcc</filename></term>
         <listitem>
-          <para>Contains run-time support for <command>gcc</command></para>
+          <para>包含 <command>gcc</command> 的运行时支持</para>
           <indexterm zone="ch-system-gcc libgcc">
             <primary sortas="c-libgcc">libgcc</primary>
           </indexterm>
@@ -463,8 +489,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libgcov">
         <term><filename class="libraryfile">libgcov</filename></term>
         <listitem>
-          <para>This library is linked in to a program when GCC is instructed
-          to enable profiling</para>
+          <para>在 GCC 被指示启动性能剖析时,这个库被链接到程序中</para>
           <indexterm zone="ch-system-gcc libgcov">
             <primary sortas="c-libgcov">libgcov</primary>
           </indexterm>
@@ -474,8 +499,8 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libgomp">
         <term><filename class="libraryfile">libgomp</filename></term>
         <listitem>
-          <para>GNU implementation of the OpenMP API for multi-platform
-          shared-memory parallel programming in C/C++ and Fortran</para>
+          <para>OpenMP API 的 GNU 实现,用于 C/C++ 和 Fortran
+          	  的跨平台共享内存并行编程</para>
           <indexterm zone="ch-system-gcc libgomp">
             <primary sortas="c-libgomp">libgomp</primary>
           </indexterm>
@@ -485,7 +510,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libiberty">
         <term><filename class="libraryfile">libiberty</filename></term>
         <listitem>
-          <para>Contains routines used by various GNU programs, including
+          <para>包含若干 GNU 程序使用的子程序,如 
           <command>getopt</command>, <command>obstack</command>,
           <command>strerror</command>, <command>strtol</command>, and
           <command>strtoul</command></para>
@@ -498,8 +523,8 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="liblto_plugin">
         <term><filename class="libraryfile">liblto_plugin</filename></term>
         <listitem>
-          <para>GCC's Link Time Optimization (LTO) plugin allows GCC to perform
-          optimizations across compilation units</para>
+		  <para>GCC 的链接时优化 (LTO) 插件,
+			  使得 GCC 可以进行跨越编译单元的优化</para>
           <indexterm zone="ch-system-gcc liblto_plugin">
             <primary sortas="c-liblto_plugin">liblto_plugin</primary>
           </indexterm>
@@ -509,7 +534,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libquadmath">
         <term><filename class="libraryfile">libquadmath</filename></term>
         <listitem>
-          <para>GCC Quad Precision Math Library API</para>
+          <para>GCC 四精度数学 API 库</para>
           <indexterm zone="ch-system-gcc libquadmath">
             <primary sortas="c-libquadmath">libquadmath</primary>
           </indexterm>
@@ -519,8 +544,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libssp">
         <term><filename class="libraryfile">libssp</filename></term>
         <listitem>
-          <para>Contains routines supporting GCC's stack-smashing protection
-          functionality</para>
+          <para>包含 GCC 的栈溢出保护功能支持子程序</para>
           <indexterm zone="ch-system-gcc libssp">
             <primary sortas="c-libssp">libssp</primary>
           </indexterm>
@@ -530,7 +554,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libstdc">
         <term><filename class="libraryfile">libstdc++</filename></term>
         <listitem>
-          <para>The standard C++ library</para>
+          <para>C++ 标准库</para>
           <indexterm zone="ch-system-gcc libstdc">
             <primary sortas="c-libstdc++">libstdc++</primary>
           </indexterm>
@@ -540,8 +564,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libsupc">
         <term><filename class="libraryfile">libsupc++</filename></term>
         <listitem>
-          <para>Provides supporting routines for the C++ programming
-          language</para>
+          <para>包含 C++ 编程语言支持子程序</para>
           <indexterm zone="ch-system-gcc libsupc">
             <primary sortas="c-libsupc++">libsupc++</primary>
           </indexterm>
@@ -551,7 +574,7 @@ mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
       <varlistentry id="libtsan">
         <term><filename class="libraryfile">libtsan</filename></term>
         <listitem>
-          <para>The Thread Sanitizer runtime library</para>
+          <para>线程完整性检查库</para>
           <indexterm zone="ch-system-gcc libtsan">
             <primary sortas="c-libtsan">libtsan</primary>
           </indexterm>