Re: Static initialization crashing with bad instruction
Re: Static initialization crashing with bad instruction
- Subject: Re: Static initialization crashing with bad instruction
- From: Eric Albert <email@hidden>
- Date: Thu, 29 Dec 2005 17:50:24 -0800
On Dec 29, 2005, at 4:39 PM, Fred Crary wrote:
We are trying to move a Netscape-style plug-in to a universal binary. When the plug-in is loaded, it crashes while running the static initializers. This behavior occurs only on the i386 architecture -- the ppc works fine.
The specific error is a "bad instruction" which seems to be called by a branch into uninitialized memory. We tracked one instance down, replaced it by a singleton, and the problem moved to another static initialization.
Is this a known bug with a known workaround (e.g., a compiler switch)? (I did some searching before I posted this and didn't find anything that seemed pertinent.)
An EXC_BAD_INSTRUCTION crash on Intel is nearly always a misaligned stack. The Mac OS X ABI on Intel requires a 16-byte aligned stack. Most apps don't care about this, but you'll hit it if you're using vector instructions and aren't properly aligning the stack, or if you have inline asm code which misaligns the stack and calls out.
If you're testing your plug-in with Firefox (rather than Safari), I believe there's still at least one case where Firefox doesn't align the stack properly. If you're testing one of Josh Aas' released builds, I'm not sure if they have the fixes that have gone in for additional cases of misaligned stacks.
I'm not aware of any such bugs with Safari, though.
P.S. Is this question better posted on a different list? If so, suggestions would be appreciated.
I'm not sure which list would be best for this, but I suppose this one works. The Developer Transition Kit is under an NDA, so you probably aren't even supposed to ask about it here....
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden