This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/15940] New: implicit link against libstdc++ fails if -b used
- From: "harri dot pasanen at trema dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jun 2004 12:47:56 -0000
- Subject: [Bug driver/15940] New: implicit link against libstdc++ fails if -b used
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Take a bogus file, say t1.c:
int foob() { return 42; }
and compile it to object.
bash-2.05a$ gcc -fPIC -c t1.c -o t1.o
Now try making a shared library of it:
bash-2.05a$ g++ -fPIC -shared -o t1.sl t1.o
bash-2.05a$ ldd t1.sl
/opt/gcc33/lib/libgcc_s.sl => /opt/gcc33/lib/libgcc_s.sl
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libm.2 => /usr/lib/libm.2
/opt/gcc33/lib/libstdc++.sl.5 => /opt/gcc33/lib/libstdc++.sl.5
/usr/lib/libc.2 => /usr/lib/libc.2
/work/harri/gcc-build/gcc/libgcc_s.sl => /opt/gcc33/lib/./libgcc_s.sl
/usr/lib/libm.2 => /usr/lib/libm.2
It worked, implicitly picking up libstdc++ because g++ was used.
But if I add "-b hppa2.0w-hp-hpux11.00", libstdc++ is no longer picked up:
bash-2.05a$ g++ -b hppa2.0w-hp-hpux11.00 -fPIC -shared -o t1.sl t1.o
bash-2.05a$ ldd t1.sl
/opt/gcc33/lib/libgcc_s.sl => /opt/gcc33/lib/libgcc_s.sl
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
bash-2.05a$
My gcc:
bash-2.05a$ g++ -v
Reading specs from /opt/gcc33/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/opt/gcc33 -with-gnu-as
-with-as=/opt/gcc33/bin/as --enable-threads=posix --enable-languages=c,c++
Thread model: posix
gcc version 3.3.3
binutils 2.15:
bash-2.05a$ as --version
GNU assembler 2.15
This used to work correctly with gcc 3.2 on HP-UX.
--
Summary: implicit link against libstdc++ fails if -b used
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: driver
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: harri dot pasanen at trema dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15940