| Newsgroups |
gmane.linux.lfs.book |
| Message-ID |
<[email protected]> |
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch xry111/mips64el
in repository lfs.
commit 4f878a8639db32da251a50fc3f0b33db89593c5d
Author: Xi Ruoyao <[email protected]>
AuthorDate: Mon Feb 2 18:06:12 2026 +0800
mips64el: hack pass 2 libstdc++.so to use libgcc_s.so
I'm still not so sure about why this is only needed for MIPS. For the
record: if an application links to both libgcc_s.so and a "LFS GCC
pass2" libstdc++.so (using libgcc_eh.a instead of libgcc_s.so), there
will be two copies of some data structures used for unwinding, one in
libgcc_s.so and another in libstdc++.so (linked from libgcc_eh.a). On
MIPS it seems only the copy in libgcc_s.so is initialized (at program
startup), thus when the C++ exception handling code in libstdc++.so
starts to unwind, it will crash immediately. Somehow this issue does
not show up on all other architectures where I've tried LFS.
---
chapter06/gcc-pass2.xml | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml
index 6ef3d7c8b..6c16cbca7 100644
--- a/chapter06/gcc-pass2.xml
+++ b/chapter06/gcc-pass2.xml
@@ -157,6 +157,34 @@ cd build</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
+ <!-- The GCC manual actually states if the application needs to throw
+ and catch exceptions across different shared libraries, libgcc_s
+ must be used. Thus it seems on all architectures we should link
+ libstdc++ against libgcc_s. But on all other architectures I've
+ tested, the exception handling seems fine even with the static
+ libgcc and libgcc_eh libraries (as long as they are from GCC pass 2
+ instead of pass 1, see LDFLAGS_FOR_TARGET). Maybe this is actually
+ some sort of bug in the MIPS toolchain or an inhernet limitation
+ of the MIPS ABI (a spaghetti with some aspects traceable to SGI
+ IRIX). -->
+ <para>The <command>libtool</command> copy for building the C++ runtime
+ library was configured with GCC pass 1 as the compiler. GCC pass 1
+ lacks the shared GCC runtime library
+ (<filename class='libraryfile'>libgcc_s.so</filename>), so the
+ <command>libtool</command> copy has linked the C++ runtime library
+ against the static libraries
+ <filename class='libraryfile'>libgcc.a</filename> and
+ <filename class='libraryfile'>libgcc_eh.a</filename> instead. The
+ result is insufficiant for the correct exception handling on MIPS,
+ causing glibc tests to fail. To allow testing glibc, edit the
+ <command>libtool</command> copy and rebuild the C++ runtime library with
+ <filename class='libraryfile'>libgcc_s.so</filename> instead of the
+ static libraries:</para>
+
+<screen><userinput>sed '/postdeps=/s/-lgcc/&_s/g' -i $LFS_TGT/libstdc++-v3/libtool
+rm $LFS_TGT/libstdc++-v3/src/libstdc++.la
+make -C $LFS_TGT/libstdc++-v3 src/libstdc++.la</userinput></screen>
+
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
--
http://lists.linuxfromscratch.org/sympa/info/lfs-book
Unsubscribe: See the above information page