Ignore:
Timestamp:
03/02/2022 01:15:18 PM (2 years ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
xry111/clfs-ng
Children:
727617d
Parents:
a5da281 (diff), 6cad449 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'trunk' into xry111/clfs-ng

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter06/gcc-pass2.xml

    ra5da281 r964103c  
    6363    -i.orig gcc/config/i386/t-linux64</userinput></screen>
    6464
    65 <!--
    66     <para>Fix an issue with GCC-10.1 when building with a cross
    67     compiler:</para>
     65    <!-- https://gcc.gnu.org/PR100017 -->
     66    <para>Fix an issue causing failure cross-compiling libstdc++:</para>
    6867
    69 <screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
    70 -->
     68<screen><userinput remap="pre">sed 's/gnu++17/&amp; -nostdinc++/' \
     69    -i libstdc++-v3/src/c++17/Makefile.in</userinput></screen>
     70
     71    <para>Override the building rule of libgcc and libstdc++ headers, to
     72    allow building these libraries with POSIX threads support:</para>
     73
     74<screen><userinput remap="pre">sed '/thread_header =/s/@.*@/gthr-posix.h/' \
     75    -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in</userinput></screen>
     76
    7177    <para>Create a separate build directory again:</para>
    7278
    7379<screen><userinput remap="pre">mkdir -v build
    7480cd       build</userinput></screen>
    75 
    76     <para>Create a symlink that allows libgcc to be built with posix threads
    77     support:</para>
    78 
    79 <screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
    80 ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
    8181
    8282    <para>Before starting to build GCC, remember to unset any environment
     
    8888    --build=$(../config.guess)                     \
    8989    --host=$LFS_TGT                                \
     90    --target=$LFS_TGT                              \
     91    LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc      \
    9092    --prefix=/usr                                  \
    91     CC_FOR_TARGET=$LFS_TGT-gcc                     \
    9293    --with-build-sysroot=$LFS                      \
    9394    --enable-initfini-array                        \
     
    100101    --disable-libssp                               \
    101102    --disable-libvtv                               \
    102     --disable-libstdcxx                            \
    103103    --enable-languages=c,c++</userinput></screen>
    104104
     
    107107
    108108      <varlistentry>
    109         <term><parameter>-with-build-sysroot=$LFS</parameter></term>
     109        <term><parameter>--with-build-sysroot=$LFS</parameter></term>
    110110        <listitem>
    111111          <para>Normally, using <parameter>--host</parameter> ensures that
     
    116116          needed to have them find the needed files in <filename
    117117          class="directory">$LFS</filename>, and not on the host.</para>
     118        </listitem>
     119      </varlistentry>
     120
     121      <varlistentry>
     122        <term><parameter>--target=$LFS_TGT</parameter></term>
     123        <listitem>
     124          <para>As we are cross-compiling GCC, it's impossible to build
     125          target libraries (<filename class="libraryfile">libgcc</filename>
     126          and <filename class="libraryfile">libstdc++</filename>) with the
     127          compiled GCC binaries because these binaries won't run on the
     128          host distro.  GCC building system will attempt to use the
     129          C and C++ compilers on the host distro as a workaround by default.
     130          It's not supported to build GCC target libraries with a different
     131          version of GCC, so using host compilers may cause building
     132          failure.  This parameter ensures to build the libraries with GCC
     133          pass 1 and prevent the issue.</para>
     134        </listitem>
     135      </varlistentry>
     136
     137      <varlistentry>
     138        <term><parameter>LDFLAGS_FOR_TARGET=...</parameter></term>
     139        <listitem>
     140          <para>Allow <filename class="libraryfile">libstdc++</filename> to
     141          use shared <filename class="libraryfile">libgcc</filename> being
     142          built in this pass, instead of the static version built in GCC
     143          pass 1. This is needed for supporting C++ exception
     144          handling.</para>
    118145        </listitem>
    119146      </varlistentry>
Note: See TracChangeset for help on using the changeset viewer.