Illegal instruction on m68k nommu
Lennart Sorensen
lsorense at csclub.uwaterloo.ca
Thu Apr 16 20:27:16 UTC 2009
On Thu, Apr 16, 2009 at 04:03:51PM -0400, Lennart Sorensen wrote:
> So I have traced it down to a call in crtstuff.c in gcc 4.3.3:
>
> {
> /* Safer version that makes sure only .dtors function pointers are
> called even if the static variable is maliciously changed. */
> extern func_ptr __DTOR_END__[] __attribute__((visibility ("hidden")));
> static size_t dtor_idx;
> const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
> func_ptr f;
>
> while (dtor_idx < max_idx)
> {
> f = __DTOR_LIST__[++dtor_idx];
> f ();
> }
> }
>
> The call to 'f ();' is where it hits the illegal instruction.
>
> How do I add print statements or something else that I can use to debug
> code in this area.
>
> I have suspicions about the calculation of max_idx, since it seems to want
> to calculate the number of entries, yet I think it is using addresses
> in it's calculation, which seems like it ought to give a larger value
> than intended.
I also see in the objdump of my test program:
00000460 l O .data 00000000 __DTOR_LIST__
0000046c l O .data 00000000 .hidden __DTOR_END__
So they seem to be 3 addresses apart, while the code looks like it
assumes they are sequential. I doubt there are any actual destructors
called in my 'return 42' test program.
--
Len Sorensen
More information about the uClibc
mailing list