Ticket #14710: boehm_gc-7.2d.p0.diff

File boehm_gc-7.2d.p0.diff, 10.9 KB (added by jpflori, 6 years ago)

Spkg diff, for review only.

  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    66
    77== License ==
    88
    9 Permissive BSD + GPL 2.0+
    10 
    11 == SPKG Maintainers ==
    12 
    13   * William Stein
     9* Permissive BSD + GPL 2.0+
    1410
    1511== Upstream Contact ==
    1612
     
    2319
    2420== Special Update/Build Instructions ==
    2521
    26 None. Sources in src are vanilla.
     22=== Patches ===
     23 * cygwin64.patch: let libgc build on Cygwin64.
    2724
    2825== Changelog ==
    2926
     27=== boehm_gc-7.2d.p0 (Jean-Pierre Flori, 11 June 2013) ===
     28 * #14710: Update to version 7.2d.
     29 * Remove patches integrated upstream.
     30 * Add cygwin64.patch from Cygwin64 libgc package to let it build
     31   on Cygwin64.
     32
    3033=== boehm_gc-7.2.alpha6.p2 (Simon King, Dec 10 2011) ===
    3134 * #12131: Use --libdir, to make the package work on openSUSE
    3235
     
    7578 * clean up spkg-install
    7679 * clean up SPKG.txt
    7780 * add hg repo and .hgignore
    78  
     81
    7982=== boehm_gc-7.1 (Gary Furnish) ===
    8083 * Initial version
    81 
  • new file patches/cygwin64.patch

    diff --git a/patches/cygwin64.patch b/patches/cygwin64.patch
    new file mode 100644
    - +  
     1--- a/include/gc.h      2012-08-09 16:25:13.000000000 -0400
     2+++ b/include/gc.h      2013-04-22 13:10:01.101686000 -0400
     3@@ -1385,7 +1385,14 @@
     4 /* THREAD_LOCAL_ALLOC defined and the initial allocation call is not    */
     5 /* to GC_malloc() or GC_malloc_atomic().                                */
     6 
     7-#ifdef __CYGWIN32__
     8+#ifdef __CYGWIN__
     9+#ifdef __x86_64__
     10+  extern int __data_start__[], __data_end__[], __bss_start__[], __bss_end__[];
     11+#define GC_DATASTART (__data_start__ < __bss_start__ ?\
     12+                      (void *)__data_start__ : (void *)__bss_start__)
     13+#define GC_DATAEND (__data_end__ < __bss_end__ ?\
     14+                      (void *)__data_end__ : (void *)__bss_end__)
     15+#else
     16   /* Similarly gnu-win32 DLLs need explicit initialization from the     */
     17   /* main program, as does AIX.                                         */
     18   extern int _data_start__[], _data_end__[], _bss_start__[], _bss_end__[];
     19@@ -1393,6 +1400,7 @@
     20                        (void *)_data_start__ : (void *)_bss_start__)
     21 # define GC_DATAEND (_data_end__ > _bss_end__ ? \
     22                      (void *)_data_end__ : (void *)_bss_end__)
     23+#endif
     24 # define GC_INIT_CONF_ROOTS GC_add_roots(GC_DATASTART, GC_DATAEND); \
     25                                  GC_gcollect() /* For blacklisting. */
     26         /* Required at least if GC is in a DLL.  And doesn't hurt. */
     27--- a/include/private/gcconfig.h        2012-08-09 16:25:13.000000000 -0400
     28+++ b/include/private/gcconfig.h        2013-04-21 12:52:28.024399600 -0400
     29@@ -432,10 +432,20 @@
     30 #   endif
     31 #   define mach_type_known
     32 # endif
     33-# if defined(__CYGWIN32__) || defined(__CYGWIN__)
     34+# if defined(__CYGWIN32__)
     35 #   define I386
     36 #   define CYGWIN32
     37 #   define mach_type_known
     38+#if defined(__CYGWIN__)
     39+#  if defined(__LP64__)
     40+#    define X86_64
     41+#    define mach_type_known
     42+#  else
     43+#    define I386
     44+#  endif
     45+#  define CYGWIN32
     46+#  define mach_type_known
     47+#endif
     48 # endif
     49 # if defined(__MINGW32__) && !defined(mach_type_known)
     50 #   define I386
     51@@ -502,6 +512,16 @@
     52 #    define mach_type_known
     53 # endif
     54 
     55+#if defined(__CYGWIN__)
     56+#  if defined(__LP64__)
     57+#    define X86_64
     58+#    define mach_type_known
     59+#  else
     60+#    define I386
     61+#  endif
     62+#  define CYGWIN32
     63+#  define mach_type_known
     64+#endif
     65 /* Feel free to add more clauses here */
     66 
     67 /* Or manually define the machine type here.  A machine type is         */
     68@@ -2259,6 +2279,19 @@
     69 #       define GWW_VDB
     70 #       define DATAEND  /* not needed */
     71 #   endif
     72+
     73+#   ifdef CYGWIN32
     74+#       define OS_TYPE "CYGWIN32"
     75+#       define DATASTART ((ptr_t)GC_DATASTART)  /* From gc.h */
     76+#       define DATAEND   ((ptr_t)GC_DATAEND)
     77+#       define ALIGNMENT 8
     78+#       undef STACK_GRAN
     79+#       define STACK_GRAN 0x10000
     80+#       ifdef USE_MMAP
     81+#         define NEED_FIND_LIMIT
     82+#         define USE_MMAP_ANON
     83+#       endif
     84+#   endif
     85 # endif /* X86_64 */
     86 
     87 # ifdef HEXAGON
     88--- a/os_dep.c  2012-08-09 16:25:13.000000000 -0400
     89+++ b/os_dep.c  2013-04-22 12:43:32.202498600 -0400
     90@@ -770,7 +770,14 @@
     91     /* gcc version of boehm-gc).                                        */
     92     GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
     93     {
     94+# ifdef __x86_64__
     95+      PNT_TIB pTib = NtCurrentTeb();
     96+      void * _tlsbase = pTib->StackBase;
     97+      /*void * _tlsbase = NtCurrentTeb()->pTib.StackBase;*/
     98+      /*extern void * _tlsbase __asm__ ("%gs:8");*/
     99+# else
     100       extern void * _tlsbase __asm__ ("%fs:4");
     101+# endif
     102       sb -> mem_base = _tlsbase;
     103       return GC_SUCCESS;
     104     }
  • deleted file patches/x86.patch

    diff --git a/patches/x86.patch b/patches/x86.patch
    deleted file mode 100644
    + -  
    1 --- src/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h  2011-06-03 02:17:00.000000000 -0700
    2 +++ src/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h  2011-09-30 10:18:44.000000000 -0700
    3 @@ -94,26 +94,37 @@
    4  
    5  /* Really only works for 486 and later */
    6  AO_INLINE void
    7 -AO_or_full (volatile AO_t *p, AO_t incr)
    8 +AO_and_full (volatile AO_t *p, AO_t value)
    9 +{
    10 +  __asm__ __volatile__ ("lock; andl %1, %0" :
    11 +                        "=m" (*p) : "r" (value), "m" (*p) : "memory");
    12 +}
    13 +#define AO_HAVE_and_full
    14 +
    15 +AO_INLINE void
    16 +AO_or_full (volatile AO_t *p, AO_t value)
    17  {
    18    __asm__ __volatile__ ("lock; orl %1, %0" :
    19 -                        "=m" (*p) : "r" (incr), "m" (*p) : "memory");
    20 +                        "=m" (*p) : "r" (value), "m" (*p) : "memory");
    21  }
    22  #define AO_HAVE_or_full
    23  
    24 +AO_INLINE void
    25 +AO_xor_full (volatile AO_t *p, AO_t value)
    26 +{
    27 +  __asm__ __volatile__ ("lock; xorl %1, %0" :
    28 +                        "=m" (*p) : "r" (value), "m" (*p) : "memory");
    29 +}
    30 +#define AO_HAVE_xor_full
    31 +
    32  AO_INLINE AO_TS_VAL_t
    33  AO_test_and_set_full(volatile AO_TS_t *addr)
    34  {
    35 -# ifdef AO_XCHGB_RET_WORD
    36 -    /* Workaround for a bug in LLVM v2.7 GAS.   */
    37 -    unsigned oldval;
    38 -# else
    39 -    unsigned char oldval;
    40 -# endif
    41 +  unsigned char oldval;
    42    /* Note: the "xchg" instruction does not need a "lock" prefix */
    43    __asm__ __volatile__("xchgb %0, %1"
    44                  : "=q"(oldval), "=m"(*addr)
    45 -                : "0"(0xff), "m"(*addr) : "memory");
    46 +                : "0"((unsigned char)0xff), "m"(*addr) : "memory");
    47    return (AO_TS_VAL_t)oldval;
    48  }
    49  #define AO_HAVE_test_and_set_full
  • deleted file patches/x86_64.patch

    diff --git a/patches/x86_64.patch b/patches/x86_64.patch
    deleted file mode 100644
    + -  
    1 --- src/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h       2011-06-03 02:17:00.000000000 -0700
    2 +++ src/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h       2011-09-30 10:17:22.000000000 -0700
    3 @@ -91,26 +91,37 @@
    4  #define AO_HAVE_int_fetch_and_add_full
    5  
    6  AO_INLINE void
    7 -AO_or_full (volatile AO_t *p, AO_t incr)
    8 +AO_and_full (volatile AO_t *p, AO_t value)
    9 +{
    10 +  __asm__ __volatile__ ("lock; andq %1, %0" :
    11 +                        "=m" (*p) : "r" (value), "m" (*p) : "memory");
    12 +}
    13 +#define AO_HAVE_and_full
    14 +
    15 +AO_INLINE void
    16 +AO_or_full (volatile AO_t *p, AO_t value)
    17  {
    18    __asm__ __volatile__ ("lock; orq %1, %0" :
    19 -                        "=m" (*p) : "r" (incr), "m" (*p) : "memory");
    20 +                        "=m" (*p) : "r" (value), "m" (*p) : "memory");
    21  }
    22  #define AO_HAVE_or_full
    23  
    24 +AO_INLINE void
    25 +AO_xor_full (volatile AO_t *p, AO_t value)
    26 +{
    27 +  __asm__ __volatile__ ("lock; xorq %1, %0" :
    28 +                        "=m" (*p) : "r" (value), "m" (*p) : "memory");
    29 +}
    30 +#define AO_HAVE_xor_full
    31 +
    32  AO_INLINE AO_TS_VAL_t
    33  AO_test_and_set_full(volatile AO_TS_t *addr)
    34  {
    35 -# ifdef AO_XCHGB_RET_WORD
    36 -    /* Workaround for a bug in LLVM v2.7 GAS.   */
    37 -    unsigned oldval;
    38 -# else
    39 -    unsigned char oldval;
    40 -# endif
    41 +  unsigned char oldval;
    42    /* Note: the "xchg" instruction does not need a "lock" prefix */
    43    __asm__ __volatile__("xchgb %0, %1"
    44                  : "=q"(oldval), "=m"(*addr)
    45 -                : "0"(0xff), "m"(*addr) : "memory");
    46 +                : "0"((unsigned char)0xff), "m"(*addr) : "memory");
    47    return (AO_TS_VAL_t)oldval;
    48  }
    49  #define AO_HAVE_test_and_set_full
  • spkg-check

    diff --git a/spkg-check b/spkg-check
    a b  
    11#!/usr/bin/env bash
    22
    3 if [ "$SAGE_LOCAL" = "" ]; then
    4    echo "SAGE_LOCAL undefined ... exiting";
    5    echo "Maybe run 'sage -sh'?"
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo >&2 "SAGE_LOCAL undefined ... exiting"
     5    echo >&2 "Maybe run 'sage -sh'?"
     6    exit 1
     7fi
     8
     9cd src
     10
     11if [ "$SAGE_DEBUG" = "yes" ]; then
     12    export CFLAGS="-O0 -g $CFLAGS"
     13else
     14    export CFLAGS="-O2 -g $CFLAGS"
     15fi
     16
     17if [ "$SAGE64" = "yes" ]; then
     18    export CFLAGS="-m64 $CFLAGS"
     19fi
     20
     21$MAKE check
     22
     23if [ $? -ne 0 ]; then
     24   echo "Error testing BoehmGC."
    625   exit 1
    726fi
    8 
    9 cd src
    10 make check
    11 
    12 if [ $? -ne 0 ]; then
    13    echo "An error occured while testing BoehmGC."
    14    exit 1
    15 fi
    16 
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    11#!/usr/bin/env bash
    22
    3 if [ "$SAGE_LOCAL" = "" ]; then
    4    echo "SAGE_LOCAL undefined ... exiting";
    5    echo "Maybe run 'sage -sh'?"
    6    exit 1
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo >&2 "SAGE_LOCAL undefined ... exiting"
     5    echo >&2 "Maybe run 'sage -sh'?"
     6    exit 1
    77fi
    88
     9cd src
     10
    911# Apply patches.
    10 for patch in patches/*.patch; do
    11     patch -p0 <"$patch"
     12for patch in ../patches/*.patch; do
     13    [ -r "$patch" ] || continue # Skip non-existing or non-readable patches
     14    patch -p1 < "$patch"
    1215    if [ $? -ne 0 ]; then
    1316        echo >&2 "Error applying '$patch'"
    1417        exit 1
    1518    fi
    1619done
    1720
    18 if [ "$SAGE64" = "yes" ]; then
    19    echo "64 bit build"
    20    CFLAGS="-O2 -g -fPIC -m64 "; export CFLAGS
    21    LDFLAGS="-m64"; export LDFLAGS
     21if [ "$SAGE_DEBUG" = "yes" ]; then
     22    echo "Building a debug version of BoehmGC."
     23    export CFLAGS="-O0 -g $CFLAGS"
     24else
     25    export CFLAGS="-O2 -g $CFLAGS"
    2226fi
    2327
    24 
    25 cd src
    26 
    27 # In order to allow upgrades from older versions of Sage (4.7 or
    28 # earlier), we should not set $RM to "rm".  See
    29 # http://trac.sagemath.org/sage_trac/ticket/3537,
    30 # http://trac.sagemath.org/sage_trac/ticket/11883#comment:13.
    31 if [ "$RM" = 'rm' ]; then
    32    unset RM
     28if [ "$SAGE64" = "yes" ]; then
     29    echo "Building a 64-bit version of BoehmGC."
     30    export CFLAGS="-m64 $CFLAGS"
    3331fi
    3432
    3533./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --enable-large-config
    3634
    37 # See ticket #7336.  We want to set THREADDLLIBS to be nothing.
    38 # Rather than hacking the configure.ac file to do the right thing on
    39 # Cygwin, we just edit the Makefile after configure has been run.
    40 if [ $UNAME = "CYGWIN" ]; then
    41      sed -i -e 's/^THREADDLLIBS = .*/THREADDLLIBS =/' Makefile
    42 fi
    43 
    44 
    4535if [ $? -ne 0 ]; then
    46    echo "Error configuring BoehmGC."
     36   echo >&2 "Error configuring BoehmGC."
    4737   exit 1
    4838fi
    4939
    50 make
     40$MAKE
     41
    5142if [ $? -ne 0 ]; then
    52    echo "Error building BoehmGC."
     43   echo >&2 "Error building BoehmGC."
    5344   exit 1
    5445fi
    5546
    56 make install
     47$MAKE install
     48
    5749if [ $? -ne 0 ]; then
    58    echo "Error installing BoehmGC."
     50   echo >&2 "Error installing BoehmGC."
    5951   exit 1
    6052fi
    61