Changeset 6e88633 for chapter05


Ignore:
Timestamp:
12/03/2008 10:46:04 PM (15 years ago)
Author:
Jeremy Huntwork <jhuntwork@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
4e82d47
Parents:
b0e1dc8
Message:

Initial addition of support for x86_64

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8754 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Location:
chapter05
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • chapter05/adjusting.xml

    rb0e1dc8 r6e88633  
    3333  dumping GCC's <quote>specs</quote> file to a location where GCC will look for it
    3434  by default. A simple <command>sed</command> substitution then alters the
    35   dynamic linker that GCC will use.</para>
     35  dynamic linker that GCC will use. The principle here is to find all references
     36  to the dynamic linker file in <filename class="directory">/lib</filename>
     37  or possibly <filename class="directory">/lib64</filename> if the host system
     38  is 64-bit capable, and adjust them to point to the new location in
     39  <filename class="directory">/tools</filename>.</para>
    3640
    3741  <para>For the sake of accuracy, it is recommended to use a copy-and-paste
    3842  method when issuing the following command. Be sure to visually inspect the
    39   specs file and verify that all occurrences of <quote>/lib/ld-linux.so.2</quote>
    40   have been replaced with <quote>/tools/lib/ld-linux.so.2</quote>:</para>
    41 
    42   <important>
    43     <para>If working on a platform where the name of the dynamic linker is
    44     something other than <filename class="libraryfile">ld-linux.so.2</filename>,
    45     replace <quote>ld-linux.so.2</quote> with the name of the platform's
    46     dynamic linker in the following commands. Refer to <xref
    47     linkend="ch-tools-toolchaintechnotes" role=","/> if necessary.</para>
    48   </important>
     43  specs file to verify that it has properly adjusted all references to the
     44  dynamic linker location. Refer to <xref
     45    linkend="ch-tools-toolchaintechnotes" role=","/> for the default name
     46  of the dynamic linker, if necessary.</para>
    4947
    5048<!-- Ampersands are needed to allow copy and paste -->
    51 <screen><userinput>gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&amp;@g' &gt; \
     49<screen><userinput>gcc -dumpspecs | sed 's@/lib\(64\)\?/ld@/tools&amp;@g' &gt; \
    5250  `dirname $(gcc -print-libgcc-file-name)`/specs</userinput></screen>
    5351
     
    8785    /tools/lib/ld-linux.so.2]</computeroutput></screen>
    8886
    89     <para>Note that <filename class="directory">/tools/lib</filename>
     87    <para>Note that <filename class="directory">/tools/lib</filename>, or
     88    <filename class="directory">/tools/lib64</filename> for 64-bit machines
    9089    appears as the prefix of the dynamic linker.</para>
    9190
  • chapter05/binutils-pass1.xml

    rb0e1dc8 r6e88633  
    125125    first pass will soon be replaced by those from the second.</para>
    126126
     127    <para>Create a symlink to ensure the sanity of our toolchain:</para>
     128
     129<screen><userinput remap="install">mkdir -v /tools/lib
     130ln -sv lib /tools/lib64</userinput></screen>
     131
    127132    <para>Install the package:</para>
    128133
    129134<screen><userinput remap="install">make install</userinput></screen>
    130135
    131     <para>Next, prepare the linker for the <quote>Adjusting</quote> phase
     136    <para>Finally, prepare the linker for the <quote>Adjusting</quote> phase
    132137    later on:</para>
    133138
  • chapter05/gcc-pass1.xml

    rb0e1dc8 r6e88633  
    6363<screen><userinput remap="configure">CC="gcc -B/usr/bin/" ../gcc-&gcc-version;/configure --prefix=/tools \
    6464    --with-local-prefix=/tools --disable-nls --disable-shared --disable-libssp \
    65     --enable-languages=c</userinput></screen>
     65    --disable-multilib --enable-languages=c</userinput></screen>
    6666
    6767    <variablelist>
     
    112112          <para>This option ensures that only the C compiler is built.
    113113          This is the only language needed now.</para>
     114        </listitem>
     115      </varlistentry>
     116
     117      <varlistentry>
     118        <term><parameter>--disable-multilib</parameter></term>
     119        <listitem>
     120          <para>We currently only want to build support for 64-bit libraries.</para>
    114121        </listitem>
    115122      </varlistentry>
  • chapter05/gcc-pass2.xml

    rb0e1dc8 r6e88633  
    100100    against the new Glibc. Issue:</para>
    101101
    102 <screen><userinput remap="pre">for file in $(find gcc/config -name linux64.h -o -name linux.h)
     102<screen><userinput remap="pre">for file in \
     103 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
    103104do
    104105  cp -uv $file{,.orig}
     
    113114    <para>In case the above seems hard to follow, let's break it down a bit.
    114115    First we find all the files under the gcc/config directory that are named
    115     either <filename>linux.h</filename> or <filename>linux64.h</filename>.
     116    either <filename>linux.h</filename>, <filename>linux64.h</filename> or
     117    <filename>sysv4.h</filename>.
    116118    For each file found, we copy it to a file of the same name but with an added
    117119    suffix of <quote>.orig</quote>. Then the first sed expression prepends
     
    125127    </para>
    126128
     129    <para>Unsetting the multlib spec for GCC ensures that it
     130    won't attempt to link against libraries on the host:</para>
     131
     132<screen><userinput remap="pre">for file in $(find gcc/config -name t-linux64) ; do \
     133   cp -v $file{,.orig}
     134   sed '/MULTILIB_OSDIRNAMES/d' $file.orig &gt; $file
     135done</userinput></screen>
     136
    127137    <para>As in the first build of GCC it requires the GMP and MPFR packages.
    128138    Unpack the tarballs and move them into the required directory names:</para>
     
    147157    --enable-shared --enable-threads=posix \
    148158    --enable-__cxa_atexit --enable-languages=c,c++ \
    149     --disable-libstdcxx-pch --disable-bootstrap</userinput></screen>
     159    --disable-libstdcxx-pch --disable-multilib \
     160    --disable-bootstrap</userinput></screen>
    150161
    151162    <variablelist>
  • chapter05/glibc.xml

    rb0e1dc8 r6e88633  
    6565    that is changed when setting -march.</para>
    6666
    67 <screen><userinput remap="configure">echo "CFLAGS += -march=i486 -mtune=native" &gt; configparms</userinput></screen>
     67<screen><userinput remap="configure">case `uname -m` in
     68  i?86) echo "CFLAGS += -march=i486 -mtune=native" &gt; configparms ;;
     69esac</userinput></screen>
    6870
    6971    <para>Next, prepare Glibc for compilation:</para>
  • chapter05/toolchaintechnotes.xml

    rb0e1dc8 r6e88633  
    2828  <important>
    2929    <para>Before continuing, be aware of the name of the working platform,
    30     often referred to as the target triplet. Many times, the target
    31     triplet will probably be <emphasis>i686-pc-linux-gnu</emphasis>. A
    32     simple way to determine the name of the target triplet is to run the
    33     <command>config.guess</command> script that comes with the source for
    34     many packages. Unpack the Binutils sources and run the script:
    35     <userinput>./config.guess</userinput> and note the output.</para>
     30    often referred to as the target triplet. A simple way to determine the
     31    name of the target triplet is to run the <command>config.guess</command>
     32    script that comes with the source for many packages. Unpack the Binutils
     33    sources and run the script: <userinput>./config.guess</userinput> and note
     34    the output. For example, for a modern 32-bit Intel processor the
     35    output will likely be <emphasis>i686-pc-linux-gnu</emphasis>.</para>
    3636
    3737    <para>Also be aware of the name of the platform's dynamic linker, often
     
    4040    provided by Glibc finds and loads the shared libraries needed by a program,
    4141    prepares the program to run, and then runs it. The name of the dynamic
    42     linker will usually be <filename class="libraryfile">ld-linux.so.2</filename>.
    43     On platforms that are less prevalent, the name might be <filename
    44     class="libraryfile">ld.so.1</filename>, and newer 64 bit platforms might
    45     be named something else entirely. The name of the platform's dynamic linker
    46     can be determined by looking in the <filename class="directory">/lib</filename>
    47     directory on the host system. A sure-fire way to determine the name is to
     42    linker for a 32-bit Intel machine will be
     43    <filename class="libraryfile">ld-linux.so.2</filename>.
     44    A sure-fire way to determine the name of the dynamic linker is to
    4845    inspect a random binary from the host system by running:
    4946    <userinput>readelf -l &lt;name of binary&gt; | grep interpreter</userinput>
Note: See TracChangeset for help on using the changeset viewer.