I've done a lot more investigation over the weekend.

The difference between the regular static linking and whole-archive seems
explainable by the different symbols incorporated -- in the regular static
linking, it only seems to call _Unwind_Resume(), but in shared and
whole-archive linking the exception is thrown by _Unwind_RaiseException()
instead of the GCC version.

I've tracked down the problems with shared/whole-archive crash on my system
which you can't reproduce:  the reason is that _get_context() (the internal
function used by _Unwind_Initialize()) does NOT fill out the 'fpregs' field
of the uc_context.uc_mcontext member -- it stays unchanged, pointing to
garbage, and the "fldenv" in the assembly x86_64_setcontext obviously
crashes due to SEGV.

I have a patch that fixes this by using a large hammer:  I first zero out
the whole uc_context stuct using memset(), and then I modified the assembly
to only load the FPU state if it's been filled out (non-zero).

I can send the patch diff -- do you think this kind of solution is
acceptable?

I will test my crashes in chroot with the provided libs and let you know how
it goes -- maybe we're on a bad libc.

I've had a lot of trouble diagnosing the other crash in regular link mode,
however, as I don't know very much about the low-level gcc and libc
internals and I didn't have their source handy (like I did for libunwind).
Do you have any ideas on that?

- Mark


On 2/19/08 10:25 AM, "Arun Sharma" <[EMAIL PROTECTED]> wrote:

> On Feb 15, 2008 6:29 PM, Mark Rabkin <[EMAIL PROTECTED]> wrote:
>> Can you reproduce with the -Wl,--whole-archive or does it then run fine for
>> you like the shared version?
> 
> It runs fine like the shared version. I was testing in this chroot:
> 
> http://www.funtoo.org/linux/amd64/funtoo-amd64-2008.01.05/stage3-amd64-2008.01
> .05.tar.bz2
> 
> gcc-4.1.2/libc-2.6.1.
> 
>  -Arun
>  
> 
> 


_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to