patches/gcc/4.2.4/210-libmudflap-susv3-legacy.patch
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Oct 16 20:57:44 2012 +0200 (2012-10-16)
changeset 3079 37831a33e07e
parent 687 b2b6b1d46aa1
permissions -rw-r--r--
kernel/linux: fix using custom location

Currently, extract and patch are skipped as thus:
- using a custom directory of pre-installed headers
- a correctly named directory already exists

Otherwise, extract and patch are done.

The current second condition is wrong, because it allows the following
sequence to happen:
- a non-custom kernel is used
- a previous build only partially extracted the non-custom sources
- that p[revious build broke during extraction (eg. incomplete tarball...)
- a subsequent build will find a properly named directory, and will
thus skip extract and patch, which is wrong

Fix that by following the conditions in this table:

Type | Extract | Patch
----------------------+---------+-------
Pre-installed headers | N | N
custom directory | N | N
custom tarball | Y | N
mainstream tarball | Y | Y

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: David Holsgrove <david.holsgrove@xilinx.com>
     1 diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c
     2 --- gcc-4.2.1.orig/libmudflap/mf-hooks2.c	2005-09-23 23:58:39.000000000 +0200
     3 +++ gcc-4.2.1/libmudflap/mf-hooks2.c	2007-08-03 20:35:09.000000000 +0200
     4 @@ -427,7 +427,7 @@
     5  {
     6    TRACE ("%s\n", __PRETTY_FUNCTION__);
     7    MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
     8 -  bzero (s, n);
     9 +  memset (s, 0, n);
    10  }
    11  
    12  
    13 @@ -437,7 +437,7 @@
    14    TRACE ("%s\n", __PRETTY_FUNCTION__);
    15    MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
    16    MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
    17 -  bcopy (src, dest, n);
    18 +  memmove (dest, src, n);
    19  }
    20  
    21  
    22 @@ -447,7 +447,7 @@
    23    TRACE ("%s\n", __PRETTY_FUNCTION__);
    24    MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
    25    MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
    26 -  return bcmp (s1, s2, n);
    27 +  return n == 0 ? 0 : memcmp (s1, s2, n);
    28  }
    29  
    30  
    31 @@ -456,7 +456,7 @@
    32    size_t n = strlen (s);
    33    TRACE ("%s\n", __PRETTY_FUNCTION__);
    34    MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
    35 -  return index (s, c);
    36 +  return strchr (s, c);
    37  }
    38  
    39  
    40 @@ -465,7 +465,7 @@
    41    size_t n = strlen (s);
    42    TRACE ("%s\n", __PRETTY_FUNCTION__);
    43    MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
    44 -  return rindex (s, c);
    45 +  return strrchr (s, c);
    46  }
    47  
    48  /* XXX:  stpcpy, memccpy */