Illegal instruction on m68k nommu

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Thu Apr 16 20:03:51 UTC 2009


On Thu, Apr 16, 2009 at 12:11:37PM -0400, Lennart Sorensen wrote:
> Can anyone tell me where the function pointer _fini being put on the
> stack in m68k/crt1.S comes from.  Is it uclibc or gcc or what?  once I
> find it, I might actually be able to find out what it is causing an
> illegal instruction to happen.

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.

-- 
Len Sorensen


More information about the uClibc mailing list