From: <Jon.Barks@sungard.com>
To: <gcc-help@gcc.gnu.org>
Subject: Segmentation faults with static linking
Date: Thu, 22 Jun 2006 17:30:00 -0000 [thread overview]
Message-ID: <D7F0CCD4BF410647BDFBABFBE626A70902582264@VOO-EXCHANGE01.internal.sungard.corp> (raw)
Hi,
I am getting Segmentation faults when statically linking gcc-4.0.2
libraries on AIX 5.1 (RS/6000). Below is the test program that simply
throws exceptions.
#include <cstdlib>
#include <iostream>
void sinser()
{
try {
throw 1;
} catch (int e) {
std::cerr << "Exception caught: " << e;
std::cerr << std::endl;
throw;
}
}
int main()
{
try {
sinser();
} catch (int e) {
std::cerr << "Exception caught: " << e;
std::cerr << std::endl;
}
}
When the program is dynamically linked (g++ -g catch.cc) the executable
works fine.
The ldd output is:
/usr/local/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.3/../../../libgcc_s.a(shr.
o)
/usr/local/lib/gcc/powerpc-ibm-aix5.1.0.0/4.0.3/../../../libstdc++.a(lib
stdc++.so.6)
/usr/lib/libcrypt.a(shr.o)
/usr/lib/libc.a(shr.o)
When the gcc libraries are statically linked, either completely (g++ -g
-static catch.cc) or specifically (g++ -g -nodefaultlibs -Wl,-bdynamic
-lc -lcrypt -Wl,-bnoquiet -Wl,-bstatic -lgcc -lgcc_eh -lstdc++ catch.cc)
a Segmentation Fault occurs. The output is:
terminate called after throwing an instance of 'int'
Segmentation fault (core dumped)
The stack trace is:
Program terminated with signal 11, Segmentation fault.
#0 0x10059f08 in __cxa_begin_catch (exc_obj_in=<incomplete type>)
at ../../../../../gcc-4.0.3/libstdc++-v3/libsupc++/eh_catch.cc:80
80 ../../../../../gcc-4.0.3/libstdc++-v3/libsupc++/eh_catch.cc: A
file or directory in the path name does not exist..
in ../../../../../gcc-4.0.3/libstdc++-v3/libsupc++/eh_catch.cc
Is it possible to create an executable that throws exceptions and
statically links in the gcc libraries without Segmentation faults?
Cheers,
Jon
reply other threads:[~2006-06-22 17:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D7F0CCD4BF410647BDFBABFBE626A70902582264@VOO-EXCHANGE01.internal.sungard.corp \
--to=jon.barks@sungard.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).