This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: binutils causing crash with exception in static c++ binary


On Thu, Oct 02, 2003 at 07:29:30PM +0200, bert hubert wrote:
> Jakub,
> 
> We are pretty sure that this patch with your name on it ( http://leb.ath.cx/~ijuz/files/ahu/diff_noCVS )
> +	* dw2gencfi.c (EH_FRAME_ALIGNMENT): Define if not defined.
> +	(output_cie): Don't pad.
> +	(output_fde): Add align argument.  Pad to align if not 0.
> +	(cfi_finish): Set .eh_frame alignment to EH_FRAME_ALIGNMENT.
> +	Pad just last FDE to EH_FRAME_ALIGNMENT.

I think this exposed, rather than introduced, the problem.

> 
> 
> Causes this program to crash, when compiled on Debian sid with g++ crash.cc -o crash
> -static:
> 
> #include <syslog.h>
> #include <iostream>
> 
> using namespace std;
> 
> int func()
> {
>   syslog(LOG_INFO,"","");
> }
> 
> int main(int argc, char **argv)
> {
>   try {
>     throw(10);
>   }
>   catch(...) {
>     cout<<"Smells like a 10"<<endl;
>   }
> }
> 
> The backtrace is:
> #0  0x0808c7e0 in get_cie_encoding ()
> #1  0x0808cc3a in classify_object_over_fdes ()
> #2  0x0808daa9 in init_object ()
> #3  0x0808d1e8 in search_object ()
> #4  0x0808d298 in _Unwind_Find_registered_FDE ()
> #5  0x0808d79c in _Unwind_Find_FDE ()
> #6  0x0808b314 in uw_frame_state_for ()
> #7  0x0808b84f in uw_init_context_1 ()
> #8  0x0808bad8 in _Unwind_RaiseException ()
> #9  0x0807d999 in __cxa_throw ()
> #10 0x08048253 in main (argc=1, argv=0xbffffb54) at crash.cc:14
> 
> GNU assembler version 2.14.90.0.6 (i386-linux) using BFD version 2.14.90.0.6
> 20030820 Debian GNU/Linux
> $ ld -V
> GNU ld version 2.14.90.0.6 20030820 Debian GNU/Linux
>   Supported emulations:
>    elf_i386
>    i386linux
>    elf_x86_64
> 
> g++ version is irrelevant, it happens with all of them. glibc 2.3.2.
> 
> This code works statically compiled with:
> 
> glibc as of 2003-07-02T11:06:49-0700 and nptl 0.52 compiled with
> binutils 2003-06-18T09:00:00-0700
> 
> _but_ it segfaults with:
> 
> glibc as of 2003-07-02T11:06:49-0700 and nptl 0.52 compiled with
> binutils 2003-06-18T13:00:00-0700
> 
> Might this problem be related to
> http://sources.redhat.com/ml/binutils/2003-09/msg00473.html ?

Yes, it is.  That was derived from your testcase.

> This issue is holding up the release of PowerDNS 2.9.12, any help would be
> appreciated..
> 
> Thanks!
> 
> -- 
> http://www.PowerDNS.com      Open source, database driven DNS Software 
> http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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