Changeset 2914987b


Ignore:
Timestamp:
01/26/2006 02:45:36 PM (18 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.3, 6.4, 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:
942465e
Parents:
40abfd5
Message:

Adjust chapter 5 binutils to build a static ld-new for use in the chapter 6 readjusting section.
Also add some extended sanity checks. These fixes are adapted from DIY-Linux and Greg Schafer.
Thanks to Dan Nicholson for the report, as well.

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

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chapter01/changelog.xml

    r40abfd5 r2914987b  
    4444          allow test-installation.pl to run.</para>
    4545        </listitem>
     46        <listitem>
     47          <para>[jhuntwork] - Adjust chapter 5 binutils to build a static ld-new
     48          for use in the chapter 6 readjusting section. Also add some extended
     49          sanity checks. These fixes are adapted from DIY-Linux and Greg Schafer.
     50          Thanks to Dan Nicholson for the report, as well.
     51        </listitem>
    4652      </itemizedlist>
    4753    </listitem>
  • chapter05/binutils-pass2.xml

    r40abfd5 r2914987b  
    5050
    5151<screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools \
    52     --disable-nls --enable-shared --with-lib-path=/tools/lib</userinput></screen>
     52    --disable-nls --with-lib-path=/tools/lib</userinput></screen>
    5353
    5454    <variablelist>
     
    8181    <para>Install the package:</para>
    8282
     83    <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
     84    the next chapter:</para>
     85
     86<screen><userinput>make -C ld clean
     87make -C ld LDFLAGS="-s" LIB_PATH=/usr/lib:/lib
     88cp -v ld/ld-new /tools/bin</userinput></screen>
     89
    8390<screen><userinput>make install</userinput></screen>
    8491
  • chapter06/readjusting.xml

    r40abfd5 r2914987b  
    2020directories.</para>
    2121
    22 <para>First, amend the GCC specs file so that it points to the new
     22<para>First, create a symlink to the adjusted linker we created in chapter 5.</para>
     23
     24<screen><userinput>ln -sv /tools/bin/ld-new /usr/bin/ld</userinput></screen>
     25
     26<para>Next, amend the GCC specs file so that it points to the new
    2327dynamic linker. A <command>sed</command> command accomplishes this:</para>
    2428
    2529<screen><userinput>SPECFILE=`dirname $(gcc -print-libgcc-file-name)`/specs &amp;&amp;
    2630gcc -dumpspecs > $SPECFILE &amp;&amp;
    27 sed -i 's@^/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' $SPECFILE &amp;&amp;
     31sed -i -e '/^\*link:$/{n;s,$, -L/usr/lib,}' \
     32       -e 's@^/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' $SPECFILE &amp;&amp;
    2833unset SPECFILE</userinput></screen>
    2934
     
    3944necessary.</para></important>
    4045
    41 <para>Now create temporary wrapper scripts for <filename>gcc</filename> and
    42 <filename>ld</filename>. These scripts will point to their real counterparts
     46<para>Now create a temporary wrapper script for <filename>gcc</filename>.
     47This script will point to the real <filename>gcc</filename>
    4348in <filename class="directory">/tools</filename> but with adjusted parameters
    4449to ensure that GCC in the next section links to our newly installed Glibc.</para>
     
    4651<screen><userinput>cat &gt; /usr/bin/gcc &lt;&lt; "EOF"
    4752#!/bin/bash
    48 /tools/bin/gcc -B/usr/lib $@
     53/tools/bin/gcc -B/usr/lib/ -B/usr/bin/ $@
    4954EOF
    50 cat &gt; /usr/bin/ld &lt;&lt; "EOF"
    51 #!/bin/bash
    52 /tools/bin/ld -nostdlib -L/usr/lib -L/lib $@
    53 EOF
    54 chmod 755 /usr/bin/{ld,gcc}
     55chmod 755 /usr/bin/gcc
    5556ln -s gcc /usr/bin/cc</userinput></screen>
    5657
     
    6162
    6263<screen><userinput>echo 'main(){}' &gt; dummy.c
    63 cc dummy.c
     64cc dummy.c -Wl,--verbose &amp;&gt; dummy.log
    6465readelf -l a.out | grep ': /lib'</userinput></screen>
    6566
     
    7374the prefix of our dynamic linker.</para>
    7475
     76<para>Now make sure that we're setup to use the correct start files:</para>
     77
     78<screen><userinput>grep "/usr/lib/crt.* " dummy.log</userinput></screen>
     79
     80<para>If everything is working correctly, there should be no errors,
     81and the output of the last command will be:</para>
     82
     83<screen><computeroutput>attempt to open /usr/lib/crt1.o succeeded
     84attempt to open /usr/lib/crti.o succeeded
     85attempt to open /usr/lib/crtn.o succeeded</computeroutput></screen>
     86
     87<para>Next make sure that we're using the correct libc:</para>
     88
     89<screen><userinput>grep "/lib/libc.so.6 " dummy.log</userinput></screen>
     90
     91<para>If everything is working correctly, there should be no errors,
     92and the output of the last command will be:</para>
     93
     94<screen><computeroutput>attempt to open /lib/libc.so.6 succeeded</computeroutput></screen>
     95
     96<para>Lastly, make sure GCC is using the correct dynamic linker:</para>
     97
     98<screen><userinput>grep found dummy.log</userinput></screen>
     99
     100<para>If everything is working correctly, there should be no errors,
     101and the output of the last command will be (allowing for
     102platform-specific differences in dynamic linker name):</para>
     103
     104<screen><computeroutput>found ld-linux.so.2 at /lib/ld-linux.so.2</computeroutput></screen>
     105
    75106<para>If the output does not appear as shown above or is not received
    76107at all, then something is seriously wrong. Investigate and retrace the
     
    83114files:</para>
    84115
    85 <screen><userinput>rm -v dummy.c a.out</userinput></screen></caution>
     116<screen><userinput>rm -v dummy.c a.out dummy.log</userinput></screen></caution>
    86117
    87118</sect1>
Note: See TracChangeset for help on using the changeset viewer.