Ticket #45449: llvm-gcc42-yosemite.patch

File llvm-gcc42-yosemite.patch, 9.6 KB (added by jhowarth@…, 10 years ago)

patch to solve llvm-gcc42 build problems on 10.10

  • gcc/config/darwin-c.c

    diff -uNr llvmgcc42-2336.11.orig/gcc/config/darwin-c.c llvmgcc42-2336.11/gcc/config/darwin-c.c
    old new  
    817817}
    818818
    819819/* Return the value of darwin_macosx_version_min suitable for the
    820    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
    821    so '10.4.2' becomes 1042.
     820   __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2'
     821   becomes 1040 and '10.10.0' becomes 101000.  The lowest digit is
     822   always zero, as is the second lowest for '10.10.x' and above.
    822823   Print a warning if the version number is not known.  */
    823824static const char *
    824825/* APPLE LOCAL ARM 5683689 */
    825826macosx_version_as_macro (void)
    826827{
    827   static char result[] = "1000";
     828  static char result[7] = "1000";
     829  int minorDigitIdx;
    828830
    829831  if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
    830832    goto fail;
    831833  if (! ISDIGIT (darwin_macosx_version_min[3]))
    832834    goto fail;
    833   result[2] = darwin_macosx_version_min[3];
    834   if (darwin_macosx_version_min[4] != '\0')
    835     {
    836       if (darwin_macosx_version_min[4] != '.')
    837         goto fail;
    838       if (! ISDIGIT (darwin_macosx_version_min[5]))
    839         goto fail;
    840       if (darwin_macosx_version_min[6] != '\0')
     835
     836  minorDigitIdx = 3;
     837  result[2] = darwin_macosx_version_min[minorDigitIdx++];
     838  if (ISDIGIT (darwin_macosx_version_min[minorDigitIdx]))
     839  {
     840    /* Starting with OS X 10.10, the macro ends '00' rather than '0',
     841       i.e. 10.10.x becomes 101000 rather than 10100.  */
     842    result[3] = darwin_macosx_version_min[minorDigitIdx++];
     843    result[4] = '0';
     844    result[5] = '0';
     845    result[6] = '\0';
     846  }
     847  if (darwin_macosx_version_min[minorDigitIdx] != '\0'
     848      && darwin_macosx_version_min[minorDigitIdx] != '.')
    841849        goto fail;
    842       result[3] = darwin_macosx_version_min[5];
    843     }
    844   else
    845     result[3] = '0';
    846850
    847851  return result;
    848852
  • gcc/config/darwin-driver.c

    diff -uNr llvmgcc42-2336.11.orig/gcc/config/darwin-driver.c llvmgcc42-2336.11/gcc/config/darwin-driver.c
    old new  
    174174  version_p = osversion + 1;
    175175  if (ISDIGIT (*version_p))
    176176    major_vers = major_vers * 10 + (*version_p++ - '0');
    177   if (major_vers > 4 + 9)
    178     goto parse_failed;
    179177  if (*version_p++ != '.')
    180178    goto parse_failed;
    181179  version_pend = strchr(version_p, '.');
  • gcc/testsuite/gcc.dg/darwin-minversion-1.c

    diff -uNr llvmgcc42-2336.11.orig/gcc/testsuite/gcc.dg/darwin-minversion-1.c llvmgcc42-2336.11/gcc/testsuite/gcc.dg/darwin-minversion-1.c
    old new  
    44/* { dg-options "-mmacosx-version-min=10.1 -m32" } */
    55/* { dg-do run { target powerpc*-*-darwin* i?86*-*-darwin* } } */
    66
    7 int main(void)
     7int
     8main ()
    89{
    910#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010
    1011  fail me;
  • gcc/testsuite/gcc.dg/darwin-minversion-2.c

    diff -uNr llvmgcc42-2336.11.orig/gcc/testsuite/gcc.dg/darwin-minversion-2.c llvmgcc42-2336.11/gcc/testsuite/gcc.dg/darwin-minversion-2.c
    old new  
    44/* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.3 -m32" } */
    55/* { dg-do run { target powerpc*-*-darwin* i?86*-*-darwin* } } */
    66
    7 int main(void)
     7int
     8main ()
    89{
    910#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030
    1011  fail me;
  • llvmgcc42-2336.11/llvmCore/Makefile.rules

    old new  
    557557ifeq ($(HOST_OS),Darwin)
    558558  DARWIN_VERSION := `sw_vers -productVersion`
    559559  # Strip a number like 10.4.7 to 10.4
    560   DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
     560  DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9][0-9]).*/\1/')
    561561  # Get "4" out of 10.4 for later pieces in the makefile.
    562   DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
     562  DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9][0-9]).*/\1/')
    563563
    564564  SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress \
    565565                    -dynamiclib
  • llvmgcc42-2336.11/

    old new  
    50925092};
    50935093/* LLVM LOCAL end */
    50945094
     5095fix = {
     5096    hackname  = yosemite_fix;
     5097    files     = xpc/base.h;
     5098    sed       = "s/__has_extension(attribute_unavailable_with_message)/0/g";
     5099    sed       = "s/__has_feature(objc_arc)/0/g";
     5100    test_text =
     5101    "__has_extension(attribute_unavailable_with_message)"
     5102    "__has_feature(objc_arc)";
     5103}; 
     5104
    50955105/*EOF*/
  • llvmgcc42-2336.11/

    old new  
    11/*  -*- buffer-read-only: t -*- vi: set ro:
    2  * 
     2 *
    33 * DO NOT EDIT THIS FILE   (fixincl.x)
    4  * 
    5  * It has been AutoGen-ed  Friday July 17, 2009 at 11:13:21 AM CEST
     4 *
     5 * It has been AutoGen-ed  October 22, 2014 at 11:05:07 AM by AutoGen 5.18.2
    66 * From the definitions    inclhack.def
    77 * and the template file   fixincl
    88 */
    9 /* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jul 17 11:13:21 CEST 2009
     9/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Oct 22 11:05:07 EDT 2014
    1010 *
    1111 * You must regenerate it.  Use the ./genfixes script.
    1212 *
     
    1515 * certain ANSI-incompatible system header files which are fixed to work
    1616 * correctly with ANSI C and placed in a directory that GNU C will search.
    1717 *
    18  * This file contains 217 fixup descriptions.
     18 * This file contains 218 fixup descriptions.
    1919 *
    2020 * See README for more information.
    2121 *
    2222 *  inclhack copyright (c) 1998, 1999, 2000, 2001
    2323 *  The Free Software Foundation, Inc.
    2424 *
    25   *  inclhack is free software.
    26  * 
    27  *  You may redistribute it and/or modify it under the terms of the
    28  *  GNU General Public License, as published by the Free Software
    29  *  Foundation; either version 2, or (at your option) any later version.
    30  * 
    31  *  inclhack is distributed in the hope that it will be useful,
    32  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     25  *  inclhack is free software: you can redistribute it and/or modify it
     26 *  under the terms of the GNU General Public License as published by the
     27 *  Free Software Foundation, either version 3 of the License, or
     28 *  (at your option) any later version.
     29 *
     30 *  inclhack is distributed in the hope that it will be useful, but
     31 *  WITHOUT ANY WARRANTY; without even the implied warranty of
    3332 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    3433 *  See the GNU General Public License for more details.
    35  * 
    36  *  You should have received a copy of the GNU General Public License
    37  *  along with inclhack.  See the file "COPYING".  If not,
    38  *  write to:  The Free Software Foundation, Inc.,
    39  *             59 Temple Place - Suite 330,
    40  *             Boston,  MA  02111-1307, USA.
     34 *
     35 *  You should have received a copy of the GNU General Public License along
     36 *  with this program.  If not, see <http://www.gnu.org/licenses/>.
    4137 */
    4238
    4339/* * * * * * * * * * * * * * * * * * * * * * * * * *
     
    46524648 */
    46534649tSCC zMath_ExceptionBypass0[] =
    46544650       "We have a problem when using C\\+\\+|for C\\+\\+, _[a-z0-9A-Z_]+_exception; for C, exception";
    4655 tSCC zMath_ExceptionBypass1[] =
    4656        "defined __cplusplus";
    46574651
    46584652#define    MATH_EXCEPTION_TEST_CT  2
    46594653static tTestDesc aMath_ExceptionTests[] = {
    46604654  { TT_NEGREP,   zMath_ExceptionBypass0, (regex_t*)NULL },
    4661   { TT_NEGREP,   zMath_ExceptionBypass1, (regex_t*)NULL },
    46624655  { TT_EGREP,    zMath_ExceptionSelect0, (regex_t*)NULL }, };
    46634656
    46644657/*
     
    88378830    "-e", "s/int __d0, __d1;/__intptr_t __d0, __d1;/g",
    88388831    (char*)NULL };
    88398832
     8833/* * * * * * * * * * * * * * * * * * * * * * * * * *
     8834 *
     8835 *  Description of Yosemite_Fix fix
     8836 */
     8837tSCC zYosemite_FixName[] =
     8838     "yosemite_fix";
     8839
     8840/*
     8841 *  File name selection pattern
     8842 */
     8843tSCC zYosemite_FixList[] =
     8844  "xpc/base.h\0";
     8845/*
     8846 *  Machine/OS name selection pattern
     8847 */
     8848#define apzYosemite_FixMachs (const char**)NULL
     8849#define YOSEMITE_FIX_TEST_CT  0
     8850#define aYosemite_FixTests   (tTestDesc*)NULL
     8851
     8852/*
     8853 *  Fix Command Arguments for Yosemite_Fix
     8854 */
     8855static const char* apzYosemite_FixPatch[] = { "sed",
     8856    "-e", "s/__has_extension(attribute_unavailable_with_message)/0/g",
     8857    "-e", "s/__has_feature(objc_arc)/0/g",
     8858    (char*)NULL };
     8859
    88408860
    88418861/* * * * * * * * * * * * * * * * * * * * * * * * * *
    88428862 *
     
    88448864 */
    88458865#define REGEX_COUNT          262
    88468866#define MACH_LIST_SIZE_LIMIT 261
    8847 #define FIX_COUNT            217
     8867#define FIX_COUNT            218
    88488868
    88498869/*
    88508870 *  Enumerate the fixes
     
    90669086    X11_CLASS_USAGE_FIXIDX,
    90679087    X11_NEW_FIXIDX,
    90689088    X11_SPRINTF_FIXIDX,
    9069     GLIBC_FDZERO_INLINE_ASM_FIXIDX
     9089    GLIBC_FDZERO_INLINE_ASM_FIXIDX,
     9090    YOSEMITE_FIX_FIXIDX
    90709091} t_fixinc_idx;
    90719092
    90729093tFixDesc fixDescList[ FIX_COUNT ] = {
     
    1015310174  {  zGlibc_Fdzero_Inline_AsmName,    zGlibc_Fdzero_Inline_AsmList,
    1015410175     apzGlibc_Fdzero_Inline_AsmMachs,
    1015510176     GLIBC_FDZERO_INLINE_ASM_TEST_CT, FD_MACH_ONLY,
    10156      aGlibc_Fdzero_Inline_AsmTests,   apzGlibc_Fdzero_Inline_AsmPatch, 0 }
     10177     aGlibc_Fdzero_Inline_AsmTests,   apzGlibc_Fdzero_Inline_AsmPatch, 0 },
     10178
     10179  {  zYosemite_FixName,    zYosemite_FixList,
     10180     apzYosemite_FixMachs,
     10181     YOSEMITE_FIX_TEST_CT, FD_MACH_ONLY,
     10182     aYosemite_FixTests,   apzYosemite_FixPatch, 0 }
    1015710183};