patches/glibc/ports-2.10.1/170-localedef-fix-trampoline.patch
author Anthony Foiani <anthony.foiani@gmail.com>
Thu May 19 23:06:16 2011 +0200 (2011-05-19)
changeset 2461 ec30b191f0e3
permissions -rw-r--r--
complibs/ppl: build only C and C++ interfaces for PPL

By default, PPL wants to build interfaces for any of a variety of
langauges it finds on the local host (python, java, possibly perl, also
more esoteric languages such as ocaml and prolog).

These extra interfaces can double the compile time for the library. For
single-process builds, I found a savings of more than 40%:

default / j1: 716s total, 143.2s avg, 0.52s stdev
just_c / j1: 406s total, 81.2s avg, 0.33s stdev
just_c_cpp / j1: 413s total, 82.6s avg, 0.22s stdev

And for multi-process builds, it approached 50%:

default / j4: 625s total, 125.0s avg, 0.57s stdev
just_c / j4: 338s total, 67.6s avg, 1.25s stdev
just_c_cpp / j4: 327s total, 65.4s avg, 0.36s stdev

Since the PPL we build within ct-ng is only used by GCC, we only need to
build the C and C++ interfaces.

Signed-Off-By: Anthony Foiani <anthony.foiani@gmail.com>
     1 #! /bin/sh -e
     2 
     3 # DP: Description: Fix localedef segfault when run under exec-shield,
     4 #        PaX or similar. (#231438, #198099)
     5 # DP: Dpatch Author: James Troup <james@nocrew.org>
     6 # DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
     7 # DP: Upstream status: Unknown
     8 # DP: Status Details: Unknown
     9 # DP: Date: 2004-03-16
    10 
    11 if [ $# -ne 2 ]; then
    12     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    13     exit 1
    14 fi
    15 case "$1" in
    16     -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    17     -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    18     *)
    19 	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    20 	exit 1
    21 esac
    22 exit 0
    23 
    24 diff -durN glibc-2.10.1.orig/locale/programs/3level.h glibc-2.10.1/locale/programs/3level.h
    25 --- glibc-2.10.1.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
    26 +++ glibc-2.10.1/locale/programs/3level.h	2009-11-13 00:49:56.000000000 +0100
    27 @@ -203,6 +203,42 @@
    28  	}
    29      }
    30  }
    31 +
    32 +/* GCC ATM seems to do a poor job with pointers to nested functions passed
    33 +   to inlined functions.  Help it a little bit with this hack.  */
    34 +#define wchead_table_iterate(tp, fn) \
    35 +do									      \
    36 +  {									      \
    37 +    struct wchead_table *t = (tp);					      \
    38 +    uint32_t index1;							      \
    39 +    for (index1 = 0; index1 < t->level1_size; index1++)			      \
    40 +      {									      \
    41 +	uint32_t lookup1 = t->level1[index1];				      \
    42 +	if (lookup1 != ((uint32_t) ~0))					      \
    43 +	  {								      \
    44 +	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
    45 +	    uint32_t index2;						      \
    46 +	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
    47 +	      {								      \
    48 +		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
    49 +		if (lookup2 != ((uint32_t) ~0))				      \
    50 +		  {							      \
    51 +		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
    52 +		    uint32_t index3;					      \
    53 +		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
    54 +		      {							      \
    55 +			struct element_t *lookup3			      \
    56 +			  = t->level3[index3 + lookup2_shifted];	      \
    57 +			if (lookup3 != NULL)				      \
    58 +			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
    59 +			      lookup3);					      \
    60 +		      }							      \
    61 +		  }							      \
    62 +	      }								      \
    63 +	  }								      \
    64 +      }									      \
    65 +  } while (0)
    66 +
    67  #endif
    68  
    69  #ifndef NO_FINALIZE