This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/5166: Segfault when using global std::string from dlopen


On Fri 2002-04-05, bkoz@gcc.gnu.org wrote:
[...]
>     See libstdc++/6062. I'd appreciate it if you'd try this with the gcc-3.1 toolchain. 
[...]
>     I think this is either a gcc-on-HPUX specific problem, or a problem with the HPUX dynamic linker. Thoughts on how to proceed?

I think you're right, it does work just fine on Linux and on Solaris.
But on HP-UX it still crashes on me; I just tried with the latest gcc 3.1.
(Test is identical to the one attached to this PR, except that I removed the
unneeded -lpthread from Makefile)
I'll be happy to provide more details, etc. Or if someone can tell me what
obvious mistake (FAQ?) I made, please do :-)
BTW, to be sure, I tested a similar scenario with pure C code, and that doesn't
crash. Also, if someone with access to an HP machine could confirm this, it
would be helpful.

Thanks

Below are shell commands with the details:


$ make
g++ -fPIC -Wall -g -c mydll.cc -o mydll.o
g++ -fPIC -shared -o libmydll.sl mydll.o -fPIC -g
g++ -fPIC -Wall -g -c main.cc -o main.o
g++ -o main main.o -fPIC -g -ldld


$ ./main 
hello
Segmentation fault (core dumped)


$ gcc -v
Reading specs from /users/chris/big/install-test31/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.1/specs
Configured with: /users/chris/big/gcc-20020401/configure --prefix=/users/chris/big/install-test31 --with-gnu-as --with-as=/test/gnu/bin/as --enable-languages=c++
Thread model: single
gcc version 3.1 20020401 (prerelease)


$ gdb main core
HP gdb 2.1
Copyright 1986 - 1999 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 2.1 (based on GDB 5.0-hpwdb-20000630)
Wildebeest is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under certain
conditions.  Type "show copying" to see the conditions.  There is
absolutely no warranty for Wildebeest.  Type "show warranty" for details.
Wildebeest was built for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00.
.
Core was generated by `main'.
Program terminated with signal 11, Segmentation fault.

warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the program.

#0  _ZNSsaSEPKc (this=<incomplete type>, __s=0x7f7ae0f4 "")
    at /users/chris/big/build-31/hppa2.0w-hp-hpux11.00/libstdc++-v3/include/bits/basic_string.h:153
153     /users/chris/big/build-31/hppa2.0w-hp-hpux11.00/libstdc++-v3/include/bits/basic_string.h: No such file or directory.
(gdb) where
#0  _ZNSsaSEPKc (this=<incomplete type>, __s=0x7f7ae0f4 "")
    at /users/chris/big/build-31/hppa2.0w-hp-hpux11.00/libstdc++-v3/include/bits/basic_string.h:153
#1  0xc04a2bc8 in func () at mydll.cc:10
#2  0x2d70 in main () at main.cc:20


$ gcc -rdynamic
gcc: unrecognized option `-rdynamic'
gcc: no input files


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]