Index: chapter05/binutils-pass1.xml
===================================================================
--- chapter05/binutils-pass1.xml	(revision a18957940ced92d374e4e41e7eefb982d5c55749)
+++ chapter05/binutils-pass1.xml	(revision 08dc6a9845b54494472f373fb67710d8a66398d5)
@@ -71,5 +71,5 @@
     <para>Now prepare Binutils for compilation:</para>
 
-    <screen><userinput remap="configure">../configure --prefix=$LFS/tools \
+    <screen arch="default"><userinput remap="configure">../configure --prefix=$LFS/tools \
              --with-sysroot=$LFS \
              --target=$LFS_TGT   \
@@ -79,4 +79,12 @@
              --enable-new-dtags  \
              --enable-default-hash-style=gnu</userinput></screen>
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=$LFS/tools       \
+             --with-sysroot=$LFS \
+             --target=$LFS_TGT   \
+             --disable-nls       \
+             --enable-gprofng=no \
+             --disable-werror    \
+             --enable-default-hash-style=gnu \
+             --enable-multilib</userinput></screen>
 
     <variablelist>
@@ -162,4 +170,11 @@
       </varlistentry>
 
+      <varlistentry arch="ml_32,ml_x32,ml_all">
+        <term><parameter>--enable-multilib</parameter></term>
+        <listitem>
+          <para>Enables multilib support.</para>
+        </listitem>
+      </varlistentry>
+
     </variablelist>
 
Index: chapter05/gcc-pass1.xml
===================================================================
--- chapter05/gcc-pass1.xml	(revision a18957940ced92d374e4e41e7eefb982d5c55749)
+++ chapter05/gcc-pass1.xml	(revision 08dc6a9845b54494472f373fb67710d8a66398d5)
@@ -63,8 +63,8 @@
 mv -v mpc-&mpc-version; mpc</userinput></screen>
 
-    <para>On x86_64 hosts, set the default directory name for
+    <para arch="default">On x86_64 hosts, set the default directory name for
     64-bit libraries to <quote>lib</quote>:</para>
 
-<screen><userinput remap="pre">case $(uname -m) in
+<screen arch="default"><userinput remap="pre">case $(uname -m) in
   x86_64)
     sed -e '/m64=/s/lib64/lib/' \
@@ -73,4 +73,12 @@
 esac</userinput></screen>
 
+    <para arch="ml_32,ml_x32,ml_all">Change the default directory name for
+    libraries:</para>
+
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
+    -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \
+    -i.orig gcc/config/i386/t-linux64
+</userinput></screen>
+
     <para>The GCC documentation recommends building GCC
     in a dedicated build directory:</para>
@@ -81,5 +89,5 @@
     <para>Prepare GCC for compilation:</para>
 
-<screen><userinput remap="configure">../configure                  \
+<screen arch="default"><userinput remap="configure">../configure                  \
     --target=$LFS_TGT         \
     --prefix=$LFS/tools       \
@@ -101,4 +109,31 @@
     --disable-libstdcxx       \
     --enable-languages=c,c++</userinput></screen>
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure" 
+    arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure"
+    arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure"
+    arch="ml_all">mlist=m64,m32,mx32</userinput>
+<userinput remap="configure">../configure                  \
+    --target=$LFS_TGT                              \
+    --prefix=$LFS/tools                            \
+    --with-glibc-version=&glibc-version;                      \
+    --with-sysroot=$LFS                            \
+    --with-newlib                                  \
+    --without-headers                              \
+    --enable-default-pie                           \
+    --enable-default-ssp                           \
+    --enable-initfini-array                        \
+    --disable-nls                                  \
+    --disable-shared                               \
+    --enable-multilib --with-multilib-list=$mlist  \
+    --disable-decimal-float                        \
+    --disable-threads                              \
+    --disable-libatomic                            \
+    --disable-libgomp                              \
+    --disable-libquadmath                          \
+    --disable-libssp                               \
+    --disable-libvtv                               \
+    --disable-libstdcxx                            \
+    --enable-languages=c,c++</userinput></screen>
+
     <variablelist>
       <title>The meaning of the configure options:</title>
@@ -157,9 +192,16 @@
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry arch="default">
         <term><parameter>--disable-multilib</parameter></term>
         <listitem>
           <para>On x86_64, LFS does not support a multilib configuration.
           This switch is harmless for x86.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry arch="ml_32,ml_x32,ml_all">
+        <term><parameter>--enable-multilib --with-multilib-list=...</parameter></term>
+        <listitem>
+          <para>LFS canbe used to support multilib. Which they are is
+          specified in the multilib list.</para>
         </listitem>
       </varlistentry>
Index: chapter05/glibc.xml
===================================================================
--- chapter05/glibc.xml	(revision a18957940ced92d374e4e41e7eefb982d5c55749)
+++ chapter05/glibc.xml	(revision 08dc6a9845b54494472f373fb67710d8a66398d5)
@@ -48,5 +48,5 @@
     operation of the dynamic library loader:</para>
 
-<screen><userinput remap="pre">case $(uname -m) in
+<screen arch="default"><userinput remap="pre">case $(uname -m) in
     i?86)   ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
     ;;
@@ -55,4 +55,7 @@
     ;;
 esac</userinput></screen>
+<!-- no ld-linux.so.2 here as multilib is based on x86_64, not on i686 -->
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
+ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
 
     <note>
@@ -214,5 +217,5 @@
 <screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
 
-      <para>Note that for 32-bit machines, the interpreter name will be
+      <para arch="default">Note that for 32-bit machines, the interpreter name will be
       <filename>/lib/ld-linux.so.2</filename>.</para>
 
@@ -242,4 +245,146 @@
   </sect2>
 
+  <!-- - - - - - - - - - -->
+  <!-- Multilib - 32bit  -->
+  <!-- - - - - - - - - - -->
+  <sect2 arch="ml_32,ml_all">
+    <title>Building Glibc - 32bit</title>
+
+    <para>Now recompile for m32. The extracted source can be
+    reused but needs to be cleaned before installing the m32
+    version of Glibc.</para>
+
+    <para>Clear the build directory and remove artefacts from
+    previous build:</para>
+      
+<screen><userinput remap="pre">make clean
+find .. -name "*.a" -delete</userinput></screen>
+
+    <para>Configure Glibc for m32 with the following commands:</para>
+
+<screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \
+CXX="$LFS_TGT-g++ -m32" \
+../configure                             \
+      --prefix=/usr                      \
+      --host=$LFS_TGT32                  \
+      --build=$(../scripts/config.guess) \
+      --enable-kernel=&min-kernel;                \
+      --with-headers=$LFS/usr/include    \
+      --disable-nscd                     \
+      --libdir=/usr/lib32                \
+      --libexecdir=/usr/lib32            \
+      libc_cv_slibdir=/usr/lib32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -a DESTDIR/usr/lib32 $LFS/usr/
+install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
+               $LFS/usr/include/gnu/
+ln -svf ../lib32/ld-linux.so.2 $LFS/lib/ld-linux.so.2</userinput></screen>
+
+
+    <caution>
+      <para>At this point, it is imperative to stop and ensure that the basic
+      functions (compiling and linking) of the new toolchain are working as
+      expected. To perform a sanity check, run the following commands:</para>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc -m32 dummy.c
+readelf -l a.out | grep '/ld-linux'</userinput></screen>
+
+      <para>If everything is working correctly, there should be no errors,
+      and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
+
+      <para>If the output is not shown as above or there was no output at all,
+      then something is wrong. Investigate and retrace the steps to find out
+      where the problem is and correct it. This issue must be resolved before
+      continuing on.</para>
+
+      <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+    </caution>
+
+  </sect2><!-- m32 -->
+
+  <!-- - - - - - - - - - -->
+  <!-- Multilib - x32bit -->
+  <!-- - - - - - - - - - -->
+  
+  <sect2 arch="ml_x32,ml_all">
+    <title>Building Glibc - x32bit</title>
+
+    <para>Now recompile for mx32. The extracted source can be
+    reused but needs to be cleaned before installing the mx32
+    version of Glibc.</para>
+
+    <para>Clear the build directory and remove artefacts from
+    previous build:</para>
+      
+<screen><userinput remap="pre">make clean
+find .. -name "*.a" -delete</userinput></screen>
+
+    <para>Configure Glibc for mx32 with the following commands:</para>
+
+<screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \
+CXX="$LFS_TGT-g++ -mx32" \
+../configure                             \
+      --prefix=/usr                      \
+      --host=$LFS_TGTX32                 \
+      --build=$(../scripts/config.guess) \
+      --enable-kernel=&min-kernel;                \
+      --with-headers=$LFS/usr/include    \
+      --disable-nscd                     \
+      --libdir=/usr/libx32               \
+      --libexecdir=/usr/libx32           \
+      libc_cv_slibdir=/usr/libx32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -a DESTDIR/usr/libx32 $LFS/usr/
+install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
+               $LFS/usr/include/gnu/
+ln -svf ../libx32/ld-linux-x32.so.2 $LFS/lib/ld-linux-x32.so.2</userinput></screen>
+
+    <caution>
+      <para>At this point, it is imperative to stop and ensure that the basic
+      functions (compiling and linking) of the new toolchain are working as
+      expected. To perform a sanity check, run the following commands:</para>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc -mx32 dummy.c
+readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
+
+      <para>If everything is working correctly, there should be no errors,
+      and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /libx32/ld-linux-x32.so.2]</computeroutput></screen>
+
+      <para>If the output is not shown as above or there was no output at all,
+      then something is wrong. Investigate and retrace the steps to find out
+      where the problem is and correct it. This issue must be resolved before
+      continuing on.</para>
+
+      <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+    </caution>
+
+  </sect2><!-- mx32 -->
+
   <sect2 role="content">
     <title/>
Index: chapter05/libstdc++.xml
===================================================================
--- chapter05/libstdc++.xml	(revision a18957940ced92d374e4e41e7eefb982d5c55749)
+++ chapter05/libstdc++.xml	(revision 08dc6a9845b54494472f373fb67710d8a66398d5)
@@ -61,5 +61,13 @@
     <para>Prepare Libstdc++ for compilation:</para>
 
-<screen><userinput remap="configure">../libstdc++-v3/configure           \
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../libstdc++-v3/configure           \
+    --host=$LFS_TGT                 \
+    --build=$(../config.guess)      \
+    --prefix=/usr                   \
+    --enable-multilib               \
+    --disable-nls                   \
+    --disable-libstdcxx-pch         \
+    --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
+<screen arch="default"><userinput remap="configure">../libstdc++-v3/configure           \
     --host=$LFS_TGT                 \
     --build=$(../config.guess)      \
@@ -79,4 +87,11 @@
           should be used instead of the one in
           <filename>/usr/bin</filename>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry arch="ml_32,ml_x32,ml_all">
+        <term><parameter>--enable-multilib</parameter></term>
+        <listitem>
+          <para>Enable building multilib objects.</para>
         </listitem>
       </varlistentry>
Index: chapter05/libxcrypt.xml
===================================================================
--- chapter05/libxcrypt.xml	(revision 08dc6a9845b54494472f373fb67710d8a66398d5)
+++ chapter05/libxcrypt.xml	(revision 08dc6a9845b54494472f373fb67710d8a66398d5)
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-libxcrypt" role="wrap">
+  <?dbhtml filename="libxcrypt.html"?>
+
+  <sect1info condition="script">
+    <productname>libxcrypt</productname>
+    <productnumber>&libxcrypt-version;</productnumber>
+    <address>&libxcrypt-url;</address>
+  </sect1info>
+
+  <title>Libxcrypt-&libxcrypt-version;</title>
+
+  <indexterm zone="ch-tools-libxcrypt">
+    <primary sortas="a-Libxcrypt">Libxcrypt</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/libxcrypt.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&libxcrypt-fin-sbu;</seg>
+        <seg>&libxcrypt-fin-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Libxcrypt</title>
+
+    <para>Prepare Libxcrypt for compilation:</para>
+
+<screen><userinput remap="configure">./configure --target=$LFS_TGT            \
+            --prefix=/usr                \
+            --enable-hashes=strong,glibc \
+            --enable-obsolete-api=no     \
+            --disable-static             \
+            --disable-failure-tokens</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--enable-hashes=strong,glibc</parameter></term>
+        <listitem>
+          <para>Build strong hash algorithms recommended for security use
+          cases, and the hash algorithms provided by traditional Glibc
+          <systemitem class='library'>libcrypt</systemitem> for
+          compatibility.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-obsolete-api=no</parameter></term>
+        <listitem>
+          <para>Disable obsolete API functions.  They are not needed for
+          a modern Linux system built from source.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-failure-tokens</parameter></term>
+        <listitem>
+          <para>Disable failure token feature.  It's needed for
+          compatibility with the traditional hash libraries of some
+          platforms, but a Linux system based on Glibc does not need
+          it.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <!-- - - - - - - - - - -->
+  <!-- Multilib - 32bit  -->
+  <!-- - - - - - - - - - -->
+  <sect2 arch="ml_32,ml_all" role="installation">
+    <title>Installation of Libxcrypt - 32bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare File for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" \
+./configure --target=$LFS_TGT32          \
+            --prefix=/usr                \
+            --host=i686-pc-linux-gnu     \
+            --libdir=/usr/lib32          \
+            --enable-hashes=strong,glibc \
+            --enable-obsolete-api=glibc  \
+            --disable-static             \
+            --disable-failure-tokens</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">cp -av .libs/libcrypt.so* $LFS/usr/lib32/ &amp;&amp;
+make DESTDIR=$LFS install-pkgconfigDATA &amp;&amp;
+ln -svf libxcrypt.pc $LFS/usr/lib32/pkgconfig/libcrypt.pc</userinput></screen>
+
+  </sect2><!-- m32 -->
+
+  <!-- - - - - - - - - - -->
+  <!-- Multilib - x32bit  -->
+  <!-- - - - - - - - - - -->
+  <sect2 arch="ml_x32,ml_all" role="installation">
+    <title>Installation of Libxcrypt - x32bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare File for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" \
+./configure --target=$LFS_TGT32           \
+            --prefix=/usr                 \
+            --host=x86_64-pc-linux-gnux32 \
+            --libdir=/usr/libx32          \
+            --enable-hashes=strong,glibc  \
+            --enable-obsolete-api=glibc   \
+            --disable-static              \
+            --disable-failure-tokens</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">cp -av .libs/libcrypt.so* $LFS/usr/libx32/ &amp;&amp;
+make DESTDIR=$LFS install-pkgconfigDATA &amp;&amp;
+ln -svf libxcrypt.pc $LFS/usr/libx32/pkgconfig/libcrypt.pc</userinput></screen>
+
+  </sect2><!-- mx32 -->
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-libxcrypt" role="."/></para>
+
+  </sect2>
+</sect1>
