From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29363 invoked by alias); 22 Jun 2006 17:30:29 -0000 Received: (qmail 28822 invoked by uid 22791); 22 Jun 2006 17:30:29 -0000 X-Spam-Check-By: sourceware.org Received: from corp-mail04.sungard.com (HELO us-voo-smtp03.internal.sungard.corp) (216.83.166.42) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 22 Jun 2006 17:30:26 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Segmentation faults with static linking Date: Thu, 22 Jun 2006 17:30:00 -0000 Message-ID: From: To: Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg00177.txt.bz2 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 #include 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.=20=20 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=3D) 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