[uClibc] ldso 0.9.21, libstdc++ crashes on PowerPC GCC 3.3.1

Richard_Theil at dadebehring.com Richard_Theil at dadebehring.com
Wed Sep 17 08:12:57 UTC 2003


Hello everyone,

we will possibly deploy uClibC on an embedded device
based on the PowerPC 8250; as of now I got
an embedded Linux with uclibc 0.9.20 more or less
running. Because we're short on embedded boards
I use my trusty Powerbook G3 under Yellow Dog Linux
for target tests (and it has a nice display, too).
libc.so.0 does not conflict with /lib, but for
libstdc++ I had to resort to LD_LIBRARY_PATH to keep
the libs local.

However, dynamic linking against libstdc++
does not work (and neither does on the embedded board
with all the libs in /lib). I hoped it would work with
the later 0.9.21 and GCC 3.3.1, but things actually
got worse.

First, I got the already mentioned crash in ldso.
Reverting just the ldso link in /lib to point to the
0.9.20 file worked around this. I tried to apply the
suggested "static char[]" fix. To no avail. It turned
out that the toolchain build just ignores changes and
merrily outputs what it already built before. So I
fed in a modified tarball with CVS readelflib1.c and
set the DODEBUG to SUPPORT_LD_DEBUG_EARLY flags for
the build. That crashed even worse on startup
(due to trying to output debug messages?!). To
save the build time, I went into the uclibc build dir
and changed .config to not include the LD_DEBUGs,
made clean and made. The resulting ldso now DOES work
on the target as good as before. Alas, the C++ dynamic
link still breaks (-static works fine).

Any ideas why it does? (I did verify that the
gcc-810-libstd++-locale.patch was properly applied,
because the backtrace says something about "locale").

C++ Program in question:

#include <iostream> // ::std::cout
#include <ostream>  // <<
int main()
{
        ::std::cout << "Hallo!" << '\n';
}

Backtrace generated with stock YDL gdb:

Program received signal SIGSEGV, Segmentation fault.
0x30048e20 in std::locale::operator=(std::locale const&) ()
   from /home/rich/target/lib//libstdc++.so.5
(gdb) bt
#0  0x30048e20 in std::locale::operator=(std::locale const&) ()
   from /home/rich/target/lib//libstdc++.so.5
#1  0x3004464c in std::ios_base::_M_init() ()
   from /home/rich/target/lib//libstdc++.so.5
#2  0x30043964 in std::basic_ios<char, std::char_traits<char> 
>::init(std::basic_streambuf<char, std::char_traits<char> >*) ()
   from /home/rich/target/lib//libstdc++.so.5
#3  0x30044240 in std::ios_base::Init::_S_ios_create(bool) ()
   from /home/rich/target/lib//libstdc++.so.5
#4  0x30044384 in std::ios_base::Init::Init() ()
   from /home/rich/target/lib//libstdc++.so.5
#5  0x30043dd0 in std::iostream::~iostream() ()
   from /home/rich/target/lib//libstdc++.so.5
#6  0x30073ae8 in __cxa_dyn_string_eq ()
   from /home/rich/target/lib//libstdc++.so.5
#7  0x3003bdb0 in _SDA_BASE_ () from /home/rich/target/lib//libstdc++.so.5
#8  0x3000299c in _dl_parse_copy_information () from /lib/ld-uClibc.so.0
#9  0x30001ce4 in _dl_parse_copy_information () from /lib/ld-uClibc.so.0
#10 0x30000cfc in _dl_boot () from /lib/ld-uClibc.so.0

strace (if it helps):

[rich at localhost lib]$ strace ./hellopp
execve("./hellopp", ["./hellopp"], [/* 34 vars */]) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 
0x30005000
readlink("/lib/ld-uClibc.so.0", "ld-uClibc-0.9.21.so", 1024) = 19
open("/home/rich/target/lib//libstdc++.so.5", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\2m\300"..., 
4096) = 4096
mmap(NULL, 544768, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x30015000
mmap(0x30015000, 410076, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x30015000
mmap(0x30089000, 42732, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED, 3, 0x64000) = 0x30089000
mmap(0x30094000, 21600, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x30094000
close(3)                                = 0
open("/home/rich/target/lib//libm.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\000"..., 4096) 
= 4096
mmap(NULL, 139264, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x3009a000
mmap(0x3009a000, 67480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) 
= 0x3009a000
mmap(0x300ba000, 5104, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED, 3, 0x10000) = 0x300ba000
close(3)                                = 0
open("/home/rich/target/lib//libgcc_s.so.0.9.9", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\0\31"..., 
4096) = 4096
mmap(NULL, 118784, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x300bc000
mmap(0x300bc000, 46380, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) 
= 0x300bc000
mmap(0x300d7000, 3612, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED, 3, 0xb000) = 0x300d7000
mmap(0x300d8000, 156, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x300d8000
close(3)                                = 0
open("/home/rich/target/lib//libc.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\0\370"..., 
4096) = 4096
mmap(NULL, 385024, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x300d9000
mmap(0x300d9000, 294376, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) 
= 0x300d9000
mmap(0x30130000, 8816, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED, 3, 0x47000) = 0x30130000
mmap(0x30133000, 13384, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x30133000
close(3)                                = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(0x10013e88)                         = 0x10013e88
brk(0x10014000)                         = 0x10014000
brk(0x10015000)                         = 0x10015000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20030917/a9f7de2e/attachment-0002.htm 


More information about the uClibc mailing list