Ignore:
Timestamp:
02/28/2024 04:02:53 PM (7 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
xry111/mips64el
Children:
9d92ca9
Parents:
959783e
git-author:
Xi Ruoyao <xry111@…> (01/03/2024 09:14:59 AM)
git-committer:
Xi Ruoyao <xry111@…> (02/28/2024 04:02:53 PM)
Message:

mips64el: gcc: Add --with-nan=2008 if needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter05/gcc-pass1.xml

    r959783e r2469049  
    7575cd       build</userinput></screen>
    7676
     77    <para>Probe the NaN encoding of the CPU:</para>
     78
     79<screen><userinput remap="pre">cat > nan2008.c &lt;&lt; \EOF
     80<literal>#include &lt;stdio.h&gt;
     81int main()
     82{
     83  int x;
     84  asm("cfc1\t%0,$31":"=r"(x));
     85  return !(x &amp; 1 &lt;&lt; 18);
     86}</literal>
     87EOF
     88gcc nan2008.c -o nan2008
     89if ./nan2008; then
     90  NAN_SWITCH=--with-nan=2008
     91fi</userinput></screen>
     92
    7793    <para>Prepare GCC for compilation:</para>
    7894
     
    8096    --target=$LFS_TGT         \
    8197    --prefix=$LFS/tools       \
     98    --with-arch=mips64r2      \
    8299    --with-glibc-version=&glibc-version; \
    83100    --with-sysroot=$LFS       \
     
    96113    --disable-libvtv          \
    97114    --disable-libstdcxx       \
    98     --enable-languages=c,c++</userinput></screen>
     115    --enable-languages=c,c++  \
     116    $NAN_SWITCH</userinput></screen>
    99117    <variablelist>
    100118      <title>The meaning of the configure options:</title>
     119
     120      <varlistentry>
     121        <term><parameter>--with-arch=mips64r2</parameter></term>
     122        <listitem>
     123          <para>Set the default value of <option>-march=</option> to
     124          mips64r2.  Most distros use it as the baseline for the MIPS port,
     125          so we are doing the same.  You may change it if your CPU is not
     126          compatible with mips64r2 (for example, mips3 or mips64r6), or
     127          your CPU is stronger than mips64r2 and you don't care about the
     128          compatibility with mips64r2, but we've not tested any setting
     129          other than mips64r2.</para>
     130        </listitem>
     131      </varlistentry>
    101132
    102133      <varlistentry>
     
    179210          <para>This option ensures that only the C and C++ compilers are built.
    180211          These are the only languages needed now.</para>
     212        </listitem>
     213      </varlistentry>
     214
     215      <varlistentry>
     216        <term><parameter>$NAN_SWITCH</parameter></term>
     217        <listitem>
     218          <para>If the CPU encodes NaN (Not a Number) values following
     219          IEEE 754-2008 (indicated by the 16th bit of FCSR), this variable
     220          will be set to <option>--with-nan=2008</option> so GCC will be
     221          configured to use the IEEE 754-2008 encoding for NaN values as
     222                  the default.  If this option is not properly set to match the CPU,
     223                  many Glibc and Python tests will fail because of the wrong NaN
     224                  encoding.</para>
    181225        </listitem>
    182226      </varlistentry>
Note: See TracChangeset for help on using the changeset viewer.