<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;
]>

<sect1 id="ch-cross-tools-binutils" role="wrap">
  <?dbhtml filename="binutils.html"?>

  <title>Cross Binutils-&binutils-version;</title>

  <indexterm zone="ch-cross-tools-binutils">
    <primary sortas="a-Binutils">Binutils</primary>
    <secondary>cross tools</secondary>
  </indexterm>

  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
  href="../../final-system/common/binutils.xml"
  xpointer="xpointer(//*[@role='package'])"/>

  <sect2 role="installation">
    <title>Installation of Cross Binutils</title>

    <para os="ba">To make sure that the proper syntax is used for a couple of
    tools, apply the following patch:</para>

<screen os="bb"><userinput>patch -Np1 -i ../&binutils-posix-patch;</userinput></screen>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/binutils.xml"
    xpointer="xpointer(//*[@os='g'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/binutils.xml"
    xpointer="xpointer(//*[@os='h'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/binutils.xml"
    xpointer="xpointer(//*[@os='i'])"/>

<screen os="bc"><userinput>../binutils-&binutils-version;/configure --prefix=/cross-tools \
   --host=${LFS_HOST} --target=${LFS_TARGET} --with-lib-path=/tools/lib \
   --disable-nls --enable-shared --disable-multilib</userinput></screen>

    <variablelist os="bd">
      <title>The meaning of the configure options:</title>

      <varlistentry os="bd1">
        <term><parameter>--prefix=/cross-tools</parameter></term>
        <listitem>
          <para>This tells the configure script to prepare to install the
          package in the <filename class="directory">/cross-tools</filename>
          directory.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="bd2">
        <term><parameter>--host=${LFS_HOST}</parameter></term>
        <listitem>
          <para>When used with --target, this creates a cross-architecture
          executable that creates files for ${LFS_TARGET} but runs on ${LFS_HOST).</para>
        </listitem>
      </varlistentry>

      <varlistentry os="bd3">
        <term><parameter>--target=${LFS_TARGET}</parameter></term>
        <listitem>
          <para>When used with --host, this creates a cross-architecture
          executable that creates files for ${LFS_TARGET} but runs on ${LFS_HOST).</para>
        </listitem>
      </varlistentry>

      <varlistentry os="bd4">
        <term><parameter>--with-lib-path=/tools/lib</parameter></term>
        <listitem>
          <para>This tells the configure script to specify the library
          search path during the compilation of Binutils, resulting in
          <filename class="directory">/tools/lib</filename> being passed
          to the linker. This prevents the linker from searching through
          library directories on the host.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="bd5">
        <term><parameter>--disable-nls</parameter></term>
        <listitem>
          <para>This disables internationalization as i18n is not needed for the
          cross-compile tools.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="bd6">
        <term><parameter>--enable-shared</parameter></term>
        <listitem>
          <para>Enable the creation of the shared libraries.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="bd7">
        <term><parameter>--disable-multilib</parameter></term>
        <listitem>
          <para>This option disables the building of a multilib
          capable binutils.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para os="be">Compile the package:</para>

<screen os="bf"><userinput>make configure-host
make</userinput></screen>

    <variablelist os="bg">
      <title>The meaning of the make options:</title>

      <varlistentry os="bg1">
        <term><parameter>configure-host</parameter></term>
        <listitem>
          <para>This checks the host environment and makes sure all the
          necessary tools are available to compile binutils.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para os="bh">Install the package:</para>

<screen os="bi"><userinput>make install</userinput></screen>

    <para os="bj">Copy the <filename class="headerfile">libiberty.h</filename> file to
    <filename class="directory">/tools/include</filename> directory:</para>

<screen os="bk"><userinput>cp ../binutils-&binutils-version;/include/libiberty.h /tools/include</userinput></screen>

  </sect2>

  <sect2 role="content">
    <title/>

    <para>Details on this package are located in <xref
    linkend="contents-binutils" role="."/></para>

  </sect2>

</sect1>
