[kaffe] Build failure for arm/linux

Dalibor Topic robilad at kaffe.org
Mon Apr 23 11:28:34 PDT 2007

Kiyo Inaba wrote:
> Dalibor wrote:
>> I've added the missing patch from Sascha for kernels >2.6.9 for the jit.
> Thank you to commit the patch posted to the ML (your comit may be based
> on http://www.kaffe.org/pipermail/kaffe/2006-October/104681.html).

That's the one, yeah. The first part is a patch for the kernel, afaict, 
so it doesn't apply to kaffe.

> But, as a matter of fact, this patch does not solve my problem for
> making arm/linux/jit works again. Or even, v1.3 of 'md.c' (not
> using ARM_NR_cacheflush) does not solve it.
> Since Sascha's report indicates (even he does not explicitly say so)
> he tried to make his effort based on 1.1.7, I will try to check
> whether this slightly old version works or not. If it works as
> he reported, I have to step forward to the CVS head.

OK. I've also dug around in glibc-ports-2.5,  but I don't have a 
suitable cross-compiler toolchain atm.

here's what's in glibc-ports-2.5 (suitably cut and paste from two files):

#define LOAD_ARGS_0()
#define ASM_ARGS_0
#define LOAD_ARGS_1(a1)                         \
   _a1 = (int) (a1);                             \
   LOAD_ARGS_0 ()
#define ASM_ARGS_1      ASM_ARGS_0, "r" (_a1)
#define LOAD_ARGS_2(a1, a2)                     \
   register int _a2 asm ("a2") = (int) (a2);     \
   LOAD_ARGS_1 (a1)
#define ASM_ARGS_2      ASM_ARGS_1, "r" (_a2)
#define LOAD_ARGS_3(a1, a2, a3)                 \
   register int _a3 asm ("a3") = (int) (a3);     \
   LOAD_ARGS_2 (a1, a2)
#define ASM_ARGS_3      ASM_ARGS_2, "r" (_a3)

#define INTERNAL_SYSCALL_RAW(name, err, nr, args...)            \
   ({ unsigned int _sys_result;                                  \
      {                                                          \
        register int _a1 asm ("a1");                             \
        LOAD_ARGS_##nr (args)                                    \
        asm volatile ("swi       %1      @ syscall " #name       \
                      : "=r" (_a1)                               \
                      : "i" (name) ASM_ARGS_##nr                 \
                      : "memory");                               \
        _sys_result = _a1;                                       \
      }                                                          \
      (int) _sys_result; })

#define INTERNAL_SYSCALL_ARM(name, err, nr, args...)            \
         INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args)

#define CLEAR_CACHE(BEG,END)                                           \
   INTERNAL_SYSCALL_ARM (cacheflush, , 3, (BEG), (END), 0)

does that build/work?

>> I've looked at this a bit in the parrot source, where I took the routine
>> from, and they are doing it the __sys_1 way. Otoh, there is a mail on
>> the binutils list about a change in ABIs on arm, complete with patches
>> for cache flushing in glibc, that turns up when searching for
>> sys_cacheflush. So I guess the best bet on Linux is to see what globc
>> does, and to copy that.
> Yes, I know that cache flushing will be merged into glibc some day,
> and this is the way to go as like as what happened on m68k/netbsd
> several years ago (see 'm68k/netbsd1/jit-md.h' v1.5 and v1.7).

I wish it was, but so far ... no. And as Debian is stuck on glibc 2.3 
for the next 2 years until the next release, there won't be much one can 
do, other than using libjit or llvm, and delegating the low level jit 
work to them.

dalibor topic

More information about the kaffe mailing list