瀏覽代碼

chpater06: Translate Binutils instruction

Xi Ruoyao 7 年之前
父節點
當前提交
a24354b591
共有 1 個文件被更改,包括 75 次插入65 次删除
  1. 75 65
      chapter06/binutils.xml

+ 75 - 65
chapter06/binutils.xml

@@ -23,8 +23,7 @@
   <sect2 role="package">
     <title/>
 
-    <para>The Binutils package contains a linker, an assembler, and other
-    tools for handling object files.</para>
+    <para>Binutils 包含汇编器、链接器以及其他用于处理目标文件的工具。</para>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
@@ -39,26 +38,27 @@
   </sect2>
 
   <sect2 role="installation">
-    <title>安装Binutils</title>
+    <title>安装 Binutils</title>
 
-    <para>Verify that the PTYs are working properly inside the chroot
-    environment by performing a simple test:</para>
+    <para>进行简单测试,确认伪终端(PTY)在 chroot 环境中能正常工作:</para>
 
 <screen><userinput remap="test">expect -c "spawn ls"</userinput></screen>
 
-    <para>This command should output the following:</para>
+    <para>该命令应该输出:</para>
 
 <screen><computeroutput>spawn ls</computeroutput></screen>
 
-    <para>If, instead, the output includes the message below, then the environment
+    <!--para>If, instead, the output includes the message below, then the environment
     is not set up for proper PTY operation.  This issue needs to be resolved before
-    running the test suites for Binutils and GCC:</para>
+    running the test suites for Binutils and GCC:</para-->
+    <para>如果输出不是上面这样,而是下面的消息,就说明环境没有为 PTY
+		的正常工作设置好。
+		在运行 Binutils 和 GCC 的测试套件前必须解决这个问题。</para>
 
 <screen><computeroutput>The system has no more ptys.
 Ask your system administrator to create more.</computeroutput></screen>
 
-    <para>The Binutils documentation recommends building Binutils 
-    in a dedicated build directory:</para>
+    <para>Binutils 文档推荐在一个专用的构建目录中构建 Binutils:</para>
 
 <screen><userinput remap="pre">mkdir -v build
 cd       build</userinput></screen>
@@ -79,39 +79,39 @@ cd       build</userinput></screen>
       <varlistentry>
         <term><parameter>--enable-gold</parameter></term>
         <listitem>
-          <para>Build the gold linker and install it as ld.gold (along side the
-          default linker).</para>
+          <para>构建 gold 链接器,并且将它(和默认链接器一起)安装为
+				ld.gold。
+		  </para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
         <term><parameter>--enable-ld=default</parameter></term>
         <listitem>
-          <para>Build the original bdf linker and install it as both ld (the
-          default linker) and ld.bfd.</para>
+          <para>构建传统的 bfd 链接器,并且将它安装为 ld (默认链接器)
+          和 ld.bfd。</para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
         <term><parameter>--enable-plugins</parameter></term>
         <listitem>
-          <para>Enables plugin support for the linker.</para>
+          <para>启用链接器插件支持。</para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
         <term><parameter>--enable-64-bit-bfd</parameter></term>
         <listitem>
-           <para>Enables 64-bit support (on hosts with narrower word sizes).
-           May not be needed on 64-bit systems, but does no harm.</para>
+           <para>(在字长较小的宿主平台上)启用 64 位支持。
+           在 64 位平台上可能不需要,但无害。</para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
         <term><parameter>--with-system-zlib</parameter></term>
         <listitem>
-          <para>Use the installed zlib library rather than building the
-          included version.</para>
+          <para>使用安装好的 zlib 库,而不是构建附带的版本。</para>
         </listitem>
       </varlistentry>
 
@@ -122,12 +122,12 @@ cd       build</userinput></screen>
 <screen><userinput remap="make">make tooldir=/usr</userinput></screen>
 
     <variablelist>
-      <title>The meaning of the make parameter:</title>
+      <title>make 命令选项的含义:</title>
 
       <varlistentry>
         <term><parameter>tooldir=/usr</parameter></term>
         <listitem>
-          <para>Normally, the tooldir (the directory where the executables will
+          <!--para>Normally, the tooldir (the directory where the executables will
           ultimately be located) is set to <filename
           class="directory">$(exec_prefix)/$(target_alias)</filename>. For
           example, x86_64 machines would expand that to <filename
@@ -137,22 +137,35 @@ cd       build</userinput></screen>
           class="directory">$(exec_prefix)/$(target_alias)</filename> would be
           used if the system was used to cross-compile (for example, compiling a
           package on an Intel machine that generates code that can be executed
-          on PowerPC machines).</para>
+          on PowerPC machines).</para-->
+          <para>一般来说,工具目录(最终存放该软件包中可执行文件的目录)
+			  被设定为
+			  <filename class="directory">$(exec_prefix)/$(target_alias)
+			  </filename>。例如,在 x86_64 机器上,它将展开为
+			  <filename class="directory">/usr/x86_64-unknown-linux-gnu
+			  </filename>。因为 LFS 是定制系统,不需要
+			  <filename class="directory">/usr</filename>
+			  中的特定目标工具目录。如果系统用于交叉编译
+			  (例如,在 Intel 机器上编译软件包,
+			  生成可以在 PowerPC 机器上执行的代码),,
+			  就会使用
+			  <filename class="directory">$(exec_prefix)/$(target_alias)
+			  </filename> 目录。</para>
         </listitem>
       </varlistentry>
 
     </variablelist>
 
     <important>
-      <para>The test suite for Binutils in this section is considered critical.
-      Do not skip it under any circumstances.</para>
+		<para>本节中,Binutils 的测试套件被认为是十分关键的,
+			在任何情况下都不能跳过。</para>
     </important>
 
     <para>测试编译结果:</para>
 
 <screen><userinput remap="test">make -k check</userinput></screen>
 
-    <para>One test, debug_msg.sh, is known to fail.</para>
+    <para>已知一个测试 debug_msg.sh 可能会失败。</para>
 
     <para>安装该软件包:</para>
 
@@ -170,8 +183,8 @@ cd       build</userinput></screen>
 
       <seglistitem>
         <seg>addr2line, ar, as, c++filt, elfedit, gprof, ld, ld.bfd, ld.gold, nm,
-        objcopy, objdump, ranlib, readelf, size, strings, and strip</seg>
-        <seg>libbfd.{a,so} and libopcodes.{a,so}</seg>
+        objcopy, objdump, ranlib, readelf, size, strings, 以及 strip</seg>
+        <seg>libbfd.{a,so}  libopcodes.{a,so}</seg>
         <seg>/usr/lib/ldscripts</seg>
       </seglistitem>
     </segmentedlist>
@@ -184,10 +197,14 @@ cd       build</userinput></screen>
       <varlistentry id="addr2line">
         <term><command>addr2line</command></term>
         <listitem>
-          <para>Translates program addresses to file names and line numbers;
+          <!--para>Translates program addresses to file names and line numbers;
           given an address and the name of an executable, it uses the debugging
           information in the executable to determine which source file and line
-          number are associated with the address</para>
+          number are associated with the address</para-->
+	      <para>将程序中的地址翻译成文件名和行号;
+			  给定一个内存地址以及可执行程序的名字,
+			  该程序使用可执行文件中的调试信息,
+			  确定与该地址相关的源代码文件和行号。</para>
           <indexterm zone="ch-system-binutils addr2line">
             <primary sortas="b-addr2line">addr2line</primary>
           </indexterm>
@@ -197,7 +214,7 @@ cd       build</userinput></screen>
       <varlistentry id="ar">
         <term><command>ar</command></term>
         <listitem>
-          <para>Creates, modifies, and extracts from archives</para>
+          <para>创建、修改、提取档案文件</para>
           <indexterm zone="ch-system-binutils ar">
             <primary sortas="b-ar">ar</primary>
           </indexterm>
@@ -207,8 +224,8 @@ cd       build</userinput></screen>
       <varlistentry id="as">
         <term><command>as</command></term>
         <listitem>
-          <para>An assembler that assembles the output of <command>gcc</command>
-          into object files</para>
+		  <para>一个能够汇编 <command>gcc</command>
+		  	  输出的汇编代码并生成目标文件的汇编器</para>
           <indexterm zone="ch-system-binutils as">
             <primary sortas="b-as">as</primary>
           </indexterm>
@@ -218,8 +235,8 @@ cd       build</userinput></screen>
       <varlistentry id="c-filt">
         <term><command>c++filt</command></term>
         <listitem>
-          <para>Used by the linker to de-mangle C++ and Java symbols and to keep
-          overloaded functions from clashing</para>
+		  <para>被链接器用于 demangle C++ 和 Java 符号,
+		  	  防止重载函数冲突。</para>
           <indexterm zone="ch-system-binutils c-filt">
             <primary sortas="b-c++filt">c++filt</primary>
           </indexterm>
@@ -229,7 +246,7 @@ cd       build</userinput></screen>
       <varlistentry id="elfedit">
         <term><command>elfedit</command></term>
         <listitem>
-          <para>Updates the ELF header of ELF files</para>
+          <para>更改 ELF 文件的 ELF 头</para>
           <indexterm zone="ch-system-binutils elfedit">
             <primary sortas="b-elfedit">elfedit</primary>
           </indexterm>
@@ -239,7 +256,7 @@ cd       build</userinput></screen>
       <varlistentry id="gprof">
         <term><command>gprof</command></term>
         <listitem>
-          <para>Displays call graph profile data</para>
+          <para>显示函数调用图性能分析数据</para>
           <indexterm zone="ch-system-binutils gprof">
             <primary sortas="b-gprof">gprof</primary>
           </indexterm>
@@ -249,9 +266,8 @@ cd       build</userinput></screen>
       <varlistentry id="ld">
         <term><command>ld</command></term>
         <listitem>
-          <para>A linker that combines a number of object and archive files
-          into a single file, relocating their data and tying up symbol
-          references</para>
+          <para>一个链接器,将一些对象文件和档案文件组合为一个单独的文件,
+          重定位它们的数据,并绑定符号引用</para>
           <indexterm zone="ch-system-binutils ld">
             <primary sortas="b-ld">ld</primary>
           </indexterm>
@@ -261,8 +277,7 @@ cd       build</userinput></screen>
       <varlistentry id="ld.gold">
         <term><command>ld.gold</command></term>
         <listitem>
-          <para>A cut down version of ld that only supports the 
-          elf object file format</para>
+          <para>ld 的一个裁减版,只支持 ELF 目标文件格式</para>
           <indexterm zone="ch-system-binutils ld.gold">
             <primary sortas="b-ld.gold">ld.gold</primary>
           </indexterm>
@@ -272,7 +287,7 @@ cd       build</userinput></screen>
       <varlistentry id="ld.bfd">
         <term><command>ld.bfd</command></term>
         <listitem>
-          <para>Hard link to <command>ld</command></para>
+          <para><command>ld</command> 的硬链接</para>
           <indexterm zone="ch-system-binutils ld.bfd">
             <primary sortas="b-ld.bfd">ld.bfd</primary>
           </indexterm>
@@ -282,7 +297,7 @@ cd       build</userinput></screen>
       <varlistentry id="nm">
         <term><command>nm</command></term>
         <listitem>
-          <para>Lists the symbols occurring in a given object file</para>
+          <para>列出给定目标文件中的符号</para>
           <indexterm zone="ch-system-binutils nm">
             <primary sortas="b-nm">nm</primary>
           </indexterm>
@@ -292,7 +307,7 @@ cd       build</userinput></screen>
       <varlistentry id="objcopy">
         <term><command>objcopy</command></term>
         <listitem>
-          <para>Translates one type of object file into another</para>
+          <para>将一种目标文件翻译成另一种</para>
           <indexterm zone="ch-system-binutils objcopy">
             <primary sortas="b-objcopy">objcopy</primary>
           </indexterm>
@@ -302,10 +317,8 @@ cd       build</userinput></screen>
       <varlistentry id="objdump">
         <term><command>objdump</command></term>
         <listitem>
-          <para>Displays information about the given object file, with options
-          controlling the particular information to display; the information
-          shown is useful to programmers who are working on the compilation
-          tools</para>
+          <para>显示给定目标文件的信息,通过命令行选项指定要显示哪些信息;
+          这些信息对开发编译工具的程序员很有用</para>
           <indexterm zone="ch-system-binutils objdump">
             <primary sortas="b-objdump">objdump</primary>
           </indexterm>
@@ -315,9 +328,8 @@ cd       build</userinput></screen>
       <varlistentry id="ranlib">
         <term><command>ranlib</command></term>
         <listitem>
-          <para>Generates an index of the contents of an archive and stores it
-          in the archive; the index lists all of the symbols defined by archive
-          members that are relocatable object files</para>
+          <para>生成档案文件内容的索引,并将索引存入档案文件;
+          索引列出档案文件中所有可重定位目标文件定义的符号</para>
           <indexterm zone="ch-system-binutils ranlib">
             <primary sortas="b-ranlib">ranlib</primary>
           </indexterm>
@@ -327,7 +339,7 @@ cd       build</userinput></screen>
       <varlistentry id="readelf">
         <term><command>readelf</command></term>
         <listitem>
-          <para>Displays information about ELF type binaries</para>
+          <para>显示 ELF 格式二进制文件的信息</para>
           <indexterm zone="ch-system-binutils readelf">
             <primary sortas="b-readelf">readelf</primary>
           </indexterm>
@@ -337,8 +349,7 @@ cd       build</userinput></screen>
       <varlistentry id="size">
         <term><command>size</command></term>
         <listitem>
-          <para>Lists the section sizes and the total size for the given
-          object files</para>
+          <para>列出给定文件各个段的大小和文件总大小</para>
           <indexterm zone="ch-system-binutils size">
             <primary sortas="b-size">size</primary>
           </indexterm>
@@ -348,11 +359,11 @@ cd       build</userinput></screen>
       <varlistentry id="strings">
         <term><command>strings</command></term>
         <listitem>
-          <para>Outputs, for each given file, the sequences of printable
-          characters that are of at least the specified length (defaulting to
-          four); for object files, it prints, by default, only the strings from
-          the initializing and loading sections while for other types of files, it
-          scans the entire file</para>
+          <para>对于每个给定文件,输出其中长度不小于给定长度
+			  (默认是 4)的可打印字符序列;对于目标文件,
+			  它默认只输出可加载的已初始化数据段中的字符串,
+			  对于其他文件,它扫描整个文件
+		  </para>
           <indexterm zone="ch-system-binutils strings">
             <primary sortas="b-strings">strings</primary>
           </indexterm>
@@ -362,7 +373,7 @@ cd       build</userinput></screen>
       <varlistentry id="strip">
         <term><command>strip</command></term>
         <listitem>
-          <para>Discards symbols from object files</para>
+          <para>移除目标文件中的符号</para>
           <indexterm zone="ch-system-binutils strip">
             <primary sortas="b-strip">strip</primary>
           </indexterm>
@@ -372,7 +383,7 @@ cd       build</userinput></screen>
       <varlistentry id="libbfd">
         <term><filename class="libraryfile">libbfd</filename></term>
         <listitem>
-          <para>The Binary File Descriptor library</para>
+          <para>二进制文件描述符库</para>
           <indexterm zone="ch-system-binutils libbfd">
             <primary sortas="c-libbfd">libbfd</primary>
           </indexterm>
@@ -382,10 +393,9 @@ cd       build</userinput></screen>
       <varlistentry id="libopcodes">
         <term><filename class="libraryfile">libopcodes</filename></term>
         <listitem>
-          <para>A library for dealing with opcodes&mdash;the <quote>readable
-          text</quote> versions of instructions for the processor;
-          it is used for building utilities like
-          <command>objdump</command></para>
+		  <para>一个用于处理操作码 —— 处理器指令的
+			  <quote>可读文本</quote>版本的库;
+			  它被 <command>objdump</command> 等构建工具所使用</para>
           <indexterm zone="ch-system-binutils libopcodes">
             <primary sortas="c-libopcodes">libopcodes</primary>
           </indexterm>