[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libqalculate FTBFS on mips* (ball, rem)



On Mon, 5 Sep 2005, Thiemo Seufer wrote:
[...]
> > Anyway, that problem above is fixed by changing the inline asm for the
> > jump instructions CLN uses to order static object initialization from
> >     __asm__ __volatile__ ("%*j %0" : : "d" ((void*)(addr)))
> > to
> >     __asm__ __volatile__ ("b " #addr)
> > Just out of curiousity: there was an ABI change or why did I have to
> > modify that?
>
> Are you sure this is a fix?

Yes, I'm sure this is a fix, provided the definition is "it works".

>                             "%*j" is no valid mips instruction, which
> poses the question why it ever appeared to work. "b" is, but is it a
> branch with a code offset limit of +- 128k. I think what's really
> wanted in that place for mips is
>
>    __asm__ __volatile__ ("jr %0" : : "r" ((void*)(addr)))
>
> for a jump to an arbitrary address.

That doesn't work.  First: what do you mean with a code offset limit of
+-128k?  Does this mean I cannot jump further?  (What is this limit?
Wordsize * 16 Bit address?)  There is one boundary condition I should've
mentiond: that branch in practice *always* jumps within one object file
from the beginning to the end, so that boundary condition is no problem,
provided I didn't misunderstand you.

I've attached a small testcase package.  Go to the modules.h file where
the CL_JUMP_TO macro is defined in the __mips__ case.  I define two
static objects, one prints an 'A' at construction, one a 'B', main()
prints a newline.  The effect of the code is that the output should always
be "AB\n", never "BA\n":

$ g++ -O -c moda.cc
$ g++ -O -c modb.cc
$ g++ -O main.cc moda.o modb.o && ./a.out
AB
$ g++ -O main.cc modb.o moda.o && ./a.out
AB

Regardless of which one of the three definitions of CL_JUMP_TO I use, the
program works with woody.  With sarge, only the __asm__ __volatile__("br "
#addr) version works, all others segfault (or cause an illegal insn).

Regards
  -richy.
-- 
  .''`.  Richard B. Kreckel
 : :' :  <kreckel@debian.org>
 `. `'   <kreckel@ginac.de>
   `-    <http://www.ginac.de/~kreckel/>

Attachment: module.tgz
Description: module.tgz


Reply to: