------- Additional Comments From amodra at bigpond dot net dot au 2004-12-22 02:44 ------- On investigating, I'm convinced this is a linker bug. When linking we use: -lgcc --as-needed -lgcc_s --no-as-needed -lc_p -lgcc --as-needed -lgcc_s --no-as-needed.
During the first scan of libgcc_s.so, the linker finds no reason to mark libgcc_s.so as needed, because no symbols in libgcc_s.so are referenced at that point. After linking libc_p.a, the second scan of libgcc_s.so does find referenced symbols. However, the linker sees that these symbols have already been defined, thus the "new" definitions found in the second scan of libgcc_s.so aren't used. (If a symbol is defined in two shared libs, the one from the lib first encountered by the linker is used. As far as the linker is concerned the first libgcc_s.so is a different shared lib from the second libgcc_s.so). Thus the linker decides that the second libgcc_s.so isn't needed, and so doesn't emit a DT_NEEDED tag for libgcc_s.so. With older glibc ld.so, this resulted in segfaults. Current ld.so complains with Inconsistency detected by ld.so: dl-version.c: 230: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17608