This is the mail archive of the gcc@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]

Tracking down source of libgcc_s.so compatibility?


Can somebody suggest a place to start looking for
why the libgcc_s.so built by crosstool's gcc-3.4 can't handle
exceptions from apps built by fc3's gcc-3.4?

The C++ program

#include <iostream>
void foo() throw (int) {
 std::cout << "In foo()" << std::endl;
 throw 1;
}
int main() {
 try {
   foo();
 } catch (int i) {
   std::cout << "Caught " << i << std::endl;
 }
 std::cout << "Finished" << std::endl;
 return 0;
}

works fine when built by FC3's gcc-3.4.
It also works fine when built by crosstool's gcc-3.4.

But when you add the libgcc_s.so built by crosstool into
ld.so.conf, the results are different; apps built
by fc3's gcc-3.4 die when they try to throw exceptions,
but apps built by crosstool's gcc-3.4 keep working.
Help!

Thanks,
Dan

p.s. here's a log of a failure with crosstool's libgcc, and
a success with fc3's libgcc.  It doesn't seem to matter
whether I use gcc-3.4 or gcc-4.0 to build crosstool's libgcc_s.so.
Similar results are obtained with rh9.

$ sudo rpm -i crosstool-gcc-4.0.0-glibc-2.2.2-hdrs-2.6.11.2-i686-libgcc-0.35-1.i386.rpm
$ g++ x.cc
$ ./a.out
In foo()
terminate called after throwing an instance of 'int'
Aborted
$ ldd a.out
        libstdc++.so.6 => /usr/lib/i686-unknown-linux-gnu/libstdc++.so.6 (0xf6f18000)
        libm.so.6 => /lib/tls/libm.so.6 (0x00cb1000)
        libgcc_s.so.1 => /lib/i686-unknown-linux-gnu/libgcc_s.so.1 (0xf6f0c000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00b88000)
        /lib/ld-linux.so.2 (0x00b6f000)

$ sudo rpm -e crosstool-gcc-4.0.0-glibc-2.2.2-hdrs-2.6.11.2-i686-libgcc-0.35-1
$ ./a.out
In foo()
Caught 1
Finished
$ ldd a.out
        libstdc++.so.6 => /usr/lib/i686-unknown-linux-gnu/libstdc++.so.6 (0xf6f18000)
        libm.so.6 => /lib/tls/libm.so.6 (0x00cb1000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x009e4000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00b88000)
        /lib/ld-linux.so.2 (0x00b6f000)


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