Boehm-GC with uclibc (Was Re: [kaffe] Patch to allow Kaffe to be builded on uClibc)

Dalibor Topic robilad at kaffe.org
Thu Sep 9 23:26:42 PDT 2004


Gustavo Guillermo Perez wrote:
> Here is the patch tested and attached
> 
> The Changes:
> Allow Kaffe to be builded on uClibc just defining:
> CFGLAGS="-DUCLIBC"
> before ./configure
> enclosing the use of __libc_stack_end, into a preproccessor block.

Thank you very much for the patch. I'll comment below.

> Best Regards for the whole work on Kaffe.

Thanks, and thank you very much for your patches!

> diff -Nuar kaffe/config/i386/linux/md.c kaffe-uc/config/i386/linux/md.c
> --- kaffe/config/i386/linux/md.c	2004-08-30 13:43:44.000000000 +0000
> +++ kaffe-uc/config/i386/linux/md.c	2004-09-07 23:34:05.000000000 +0000
> @@ -27,7 +27,9 @@
>  	mallopt(M_MMAP_MAX, 0);
>  #endif
>  }
> -
> +/* DEFINNING UCLIBC DISALLOW THE USE OF THIS FUNCTION
> +   PRIVATIVE FOR UCLIBC*/
> +#ifndef UCLIBC
>  #if defined(__GLIBC__)
>  extern void * __libc_stack_end;
>  
> @@ -38,3 +40,4 @@
>    return (void *)(((uintp)__libc_stack_end + sz - 1) & (-sz));
>  }
>  #endif
> +#endif

It seems that this code is already commented out by #if 
defined(__GLIBC__) which should not be set on uclibc anyway, right? What 
does the preprocessed code look like?

I'd guess that it is not necessary, per se.

> diff -Nuar kaffe/config/i386/linux/md.h kaffe-uc/config/i386/linux/md.h
> --- kaffe/config/i386/linux/md.h	2004-07-30 22:37:54.000000000 +0000
> +++ kaffe-uc/config/i386/linux/md.h	2004-09-07 23:45:11.000000000 +0000
> @@ -79,10 +79,13 @@
>  
>  #include "kaffe-unix-stack.h"
>  
> +/* DISABLING THIS FUNCTION FOR UCLIBC COMPAT */
> +#ifndef UCLIBC
>  #if defined(__GLIBC__)
>  #define KAFFEMD_STACKEND
>  extern void *mdGetStackEnd(void);
>  #endif
> +#endif

Same as above. :)

> diff -Nuar kaffe/kaffe/kaffevm/boehm-gc/boehm/mach_dep.c kaffe-uc/kaffe/kaffevm/boehm-gc/boehm/mach_dep.c
> --- kaffe/kaffe/kaffevm/boehm-gc/boehm/mach_dep.c	2004-08-02 10:44:57.000000000 +0000
> +++ kaffe-uc/kaffe/kaffevm/boehm-gc/boehm/mach_dep.c	2004-09-08 00:13:12.000000000 +0000

boehm-gc has so far not been ported to uclibc, as far as I know. I've 
cc:ed Hans Boehm, he may know the current state of affairs. And he may 
be interested to hear that Kaffe can use boehm-gc now, too ;)

> @@ -380,6 +380,7 @@
>  #        endif /* !__GNUC__ */
>  #       endif /* M68K/SYSV */
>  
> +#ifndef UCLIBC

I'd recommend using

#if defined(HAVE_FEATURES_H)
#include <features.h>
#endif

in the top of the file, and then using

#if defined(__UCLIBC__)

instead, as uClibc defines that symbol. Then you should be able to drop 
the extra CFLAGS setting completely.

>  #     if defined(PJ)
>  	{
>  	    register int * sp asm ("optop");
> @@ -390,6 +391,7 @@
>  	    /* Isn't this redundant with the code to push the stack? */
>          }
>  #     endif
> +#endif
>  
>        /* other machines... */
>  #       if !defined(HAVE_PUSH_REGS)
> diff -Nuar kaffe/kaffe/kaffevm/boehm-gc/boehm/os_dep.c kaffe-uc/kaffe/kaffevm/boehm-gc/boehm/os_dep.c
> --- kaffe/kaffe/kaffevm/boehm-gc/boehm/os_dep.c	2004-08-02 10:44:57.000000000 +0000
> +++ kaffe-uc/kaffe/kaffevm/boehm-gc/boehm/os_dep.c	2004-09-07 23:58:06.000000000 +0000
> @@ -859,8 +859,11 @@
>  # define STAT_SKIP 27   /* Number of fields preceding startstack	*/
>  			/* field in /proc/self/stat			*/
>  
> +/* ALLOW BUILDING ON UCLIBC */
> +#indef UCLIBC

Same as above. I guess that Hans may have an idea how to deal with those 
missing symbols. I've googled around, but al lI could find were a few 
references on the gcj list that I couldn't really figure out ;)

>  # pragma weak __libc_stack_end
>    extern ptr_t __libc_stack_end;
> +#endif
>  
>  # ifdef IA64
>      /* Try to read the backing store base from /proc/self/maps.	*/
> @@ -930,7 +933,8 @@
>      char c;
>      word result = 0;
>      size_t i, buf_offset = 0;
> -
> +/* Easy Way privative for UCLIBC */
> +#indef UCLIBC

Same as above.

>      /* First try the easy way.  This should work for glibc 2.2	*/
>      /* This fails in a prelinked ("prelink" command) executable */
>      /* since the correct value of __libc_stack_end never	*/
> @@ -948,6 +952,7 @@
>  	  return __libc_stack_end;
>  #	endif
>        }
> +#endif
>      f = open("/proc/self/stat", O_RDONLY);
>      if (f < 0 || STAT_READ(f, stat_buf, STAT_BUF_SIZE) < 2 * STAT_SKIP) {
>  	ABORT("Couldn't read /proc/self/stat");

> diff -Nuar kaffe/libraries/javalib/javax/swing/JDesktopPane.java kaffe-uc/libraries/javalib/javax/swing/JDesktopPane.java
> --- kaffe/libraries/javalib/javax/swing/JDesktopPane.java	2004-08-17 17:55:05.000000000 +0000
> +++ kaffe-uc/libraries/javalib/javax/swing/JDesktopPane.java	2004-09-07 23:01:13.000000000 +0000
> @@ -84,7 +84,7 @@
>    /**
>     * AccessibleJDesktopPane
>     */
> -  protected class AccessibleJDesktopPane extends AccessibleJComponent
> +  protected class AccessibleJDesktopPane extends JComponent.AccessibleJComponent
>    {
>      /** DOCUMENT ME! */
>      private static final long serialVersionUID = 6079388927946077570L;

Thanks again for this one, I've checked in Laszlo's version, as I 
received it a little earlier, and added you as a reporter to the ChangeLog.

cheers,
dalibor topic




More information about the kaffe mailing list