Changeset 136962


Ignore:
Timestamp:
Jun 1, 2015, 5:14:02 AM (3 years ago)
Author:
larryv@…
Message:

llvm-gcc42: Fix build on Yosemite (#45449)

It lives!

  • Remove kernel version check to stop the driver from complaining about Darwin 14 and later.
  • Fix interpretation of OS X and iOS deployment targets by adapting my upstream fix,† which I'm relicensing under GPLv2 for this purpose.
  • Stub out unrecognized macros in /usr/include/xpc/base.h.

https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=rev&rev=223808

Location:
trunk/dports/lang/llvm-gcc42
Files:
2 added
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/dports/lang/llvm-gcc42/Portfile

    r136067 r136962  
    77name                    llvm-gcc42
    88version                 2336.11
    9 revision                1
     9revision                2
    1010set gcc_version         4.2.1
    1111categories              lang
     
    5757# driverdriver-armcheck.patch    : Build fix for the driverdriver when arm support is not available (eg: Tiger)
    5858# deployment_target.patch        : Build fix to correctly get the OS version
     59# remove-kernel-version-check.patch : Don't complain on Yosemite and later
     60# version-min.patch              : Interpret OS X and iOS versions correctly
     61# autogen.patch                  : Update to work with modern autogen (necessary to create fixincludes.patch)
     62# fixincludes.patch              : Stub out unrecognized macros in system headers
    5963
    6064patchfiles-append \
     
    6367        driverdriver-num_infiles.patch \
    6468        driverdriver-armcheck.patch \
    65         deployment_target.patch
    66 
    67 platform darwin {
    68     if {${os.major} >= 14} {
    69         depends_lib
    70         depends_run
    71         pre-fetch {
    72             ui_error "$name is not supported on Yosemite or later."
    73             error "unsupported platform"
    74         }
    75     }
    76 }
     69        deployment_target.patch \
     70        remove-kernel-version-check.patch \
     71        version-min.patch \
     72        autogen.patch \
     73        fixincludes.patch
    7774
    7875post-extract {
  • trunk/dports/lang/llvm-gcc42/files/remove-kernel-version-check.patch

    r136929 r136962  
    99        release.
    1010---
    11 Extracted from upstream r215251.
     11Extracted from upstream r215251. No code added.
    1212
    1313https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407
    1414https://gcc.gnu.org/viewcvs/gcc?view=rev&rev=215251
    1515
    16  gcc/config/darwin-driver.c | 2 --
    17  1 file changed, 2 deletions(-)
    18 
    19 diff --git gcc/config/darwin-driver.c gcc/config/darwin-driver.c
    20 index 48eaf19..5b3991c 100644
    21 --- gcc/config/darwin-driver.c
     16Index: gcc/config/darwin-driver.c
     17===================================================================
     18--- gcc/config/darwin-driver.c.orig
    2219+++ gcc/config/darwin-driver.c
    23 @@ -57,8 +57,6 @@ darwin_find_version_from_kernel (char *new_flag)
     20@@ -174,8 +174,6 @@ darwin_default_min_version (int * argc_p
    2421   version_p = osversion + 1;
    2522   if (ISDIGIT (*version_p))
  • trunk/dports/lang/llvm-gcc42/files/version-min.patch

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/mld-qt-481/dports/lang/gcc47/files/macosx-version-min.patch92720,​92813,​92891,​92963,​93522,​93556,​93699,​93743,​93771-93773,​93806,​93817-93818,​93856
    r136961 r136962  
    4646        * gcc/testsuite/gcc.dg/darwin-minversion-12.c: Ditto.
    4747---
    48 Adapted for GCC 4.7.4 from the upstream trunk fix. The text above is
    49 from my email to the gcc-patches mailing list; some minor details may
    50 not apply to the patch below.
     48Adapted for LLVM-GCC 4.2.1 (2336.11) from my upstream trunk fix.
     49Extended to fix handling of iOS deployment targets.
     50
     51I hereby relicense my upstream contributions under GPLv2 when used by
     52the MacPorts Project, as permitted by the terms of the FSF copyright
     53assignment.
     54
     55The text above is from my email to the gcc-patches mailing list; some
     56minor details may not apply to the patch below.
    5157
    5258https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810
     
    5460https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=rev&rev=223808
    5561
    56  gcc/config/darwin-c.c                       | 155 +++++++++++++++++++++++---
    57  gcc/testsuite/gcc.dg/darwin-minversion-10.c |  16 +++
    58  gcc/testsuite/gcc.dg/darwin-minversion-11.c |  16 +++
    59  gcc/testsuite/gcc.dg/darwin-minversion-12.c |  16 +++
    60  gcc/testsuite/gcc.dg/darwin-minversion-3.c  |   6 +-
    61  gcc/testsuite/gcc.dg/darwin-minversion-4.c  |  12 ++
    62  gcc/testsuite/gcc.dg/darwin-minversion-5.c  |  16 +++
    63  gcc/testsuite/gcc.dg/darwin-minversion-6.c  |  15 +++
    64  gcc/testsuite/gcc.dg/darwin-minversion-7.c  |  15 +++
    65  gcc/testsuite/gcc.dg/darwin-minversion-8.c  |  16 +++
    66  gcc/testsuite/gcc.dg/darwin-minversion-9.c  |  15 +++
    67  11 files changed, 282 insertions(+), 16 deletions(-)
    68 
    69 diff --git gcc/config/darwin-c.c gcc/config/darwin-c.c
    70 index 211d141..3a7e3ee 100644
    71 --- gcc/config/darwin-c.c
     62Index: gcc/config/darwin-c.c
     63===================================================================
     64--- gcc/config/darwin-c.c.orig
    7265+++ gcc/config/darwin-c.c
    73 @@ -570,25 +570,154 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp)
     66@@ -816,35 +816,158 @@ find_subframework_header (cpp_reader *pf
    7467   return 0;
    7568 }
     
    7770-/* Return the value of darwin_macosx_version_min suitable for the
    7871-   __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
    79 -   so '10.4.2' becomes 1040.  The lowest digit is always zero.
    80 -   Print a warning if the version number can't be understood.  */
    81 +/* Given an OS X version VERSION_STR, return it as a statically-allocated array
    82 +   of three integers. If VERSION_STR is invalid, return NULL.
     72-   so '10.4.2' becomes 1042.
     73-   Print a warning if the version number is not known.  */
     74+/* Given an OS X or iOS version VERSION_STR, return it as a statically-allocated
     75+   array of three integers. If VERSION_STR is invalid, return NULL.
    8376+
    8477+   VERSION_STR must consist of one, two, or three tokens, each separated by
     
    147140+   rejected.  */
    148141+
    149  static const char *
    150 -version_as_macro (void)
     142+static const char *
    151143+version_as_legacy_macro (const unsigned long *version)
    152  {
    153 -  static char result[] = "1000";
     144+{
    154145+  unsigned long major, minor, tiny;
    155146+  static char result[5];
     
    170161+  return result;
    171162+}
    172  
    173 -  if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
    174 +/* Given VERSION -- a three-component OS X version represented as an array of
    175 +   non-negative integers -- return a statically-allocated string suitable for
    176 +   the modern __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro.  If VERSION
    177 +   is invalid, return NULL.
    178 +
    179 +   The modern format is a six-character string -- two chars for each component,
    180 +   with zero-padding if necessary (for example, {10,10,1} produces "101001"). If
    181 +   VERSION contains numbers greater than 99, it is rejected.  */
     163+
     164+/* Given VERSION -- a three-component OS X or iOS version represented as an
     165+   array of non-negative integers -- return a statically-allocated string
     166+   suitable for the modern __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro
     167+   or the __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ macro.  If VERSION is
     168+   invalid, return NULL.
     169+
     170+   The modern format is a five or six-character string -- one or two chars for
     171+   the major number and two each for the minor and tiny numbers, with
     172+   zero-padding if necessary (for example, {8,1,0} produces "80100", and
     173+   {10,10,1} produces "101001").  If VERSION contains numbers greater than 99,
     174+   it is rejected.  */
    182175+
    183176+static const char *
     
    194187+    return NULL;
    195188+
    196 +  if (sprintf (result, "%02lu%02lu%02lu", major, minor, tiny) != 6)
     189+  if (sprintf (result, "%lu%02lu%02lu", major, minor, tiny)
     190+      != ((major > 9) ? 6 : 5))
    197191+    return NULL;
    198192+
     
    208202+   form, print a warning and return "1000".  */
    209203+
    210 +static const char *
    211 +macosx_version_as_macro (void)
    212 +{
     204 static const char *
     205-/* APPLE LOCAL ARM 5683689 */
     206 macosx_version_as_macro (void)
     207 {
     208-  static char result[] = "1000";
    213209+  const unsigned long *version_array;
    214210+  const char *version_macro;
    215 +
     211 
     212-  if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
    216213+  version_array = parse_version (darwin_macosx_version_min);
    217214+  if (!version_array)
     
    222219     goto fail;
    223220-  result[2] = darwin_macosx_version_min[3];
    224 -  if (darwin_macosx_version_min[4] != '\0'
    225 -      && darwin_macosx_version_min[4] != '.')
     221-  if (darwin_macosx_version_min[4] != '\0')
     222-    {
     223-      if (darwin_macosx_version_min[4] != '.')
     224-       goto fail;
     225-      if (! ISDIGIT (darwin_macosx_version_min[5]))
     226-       goto fail;
     227-      if (darwin_macosx_version_min[6] != '\0')
     228-       goto fail;
     229-      result[3] = darwin_macosx_version_min[5];
     230-    }
    226231+
    227232+  if (version_array[MINOR] < 10)
    228233+    version_macro = version_as_legacy_macro (version_array);
    229 +  else
     234   else
     235-    result[3] = '0';
    230236+    version_macro = version_as_modern_macro (version_array);
    231 +
     237 
     238-  return result;
     239+  if (!version_macro)
     240+    goto fail;
     241+
     242+  return version_macro;
     243 
     244  fail:
     245   error ("Unknown value %qs of -mmacosx-version-min",
     246@@ -863,62 +986,21 @@ macosx_version_as_macro (void)
     247 static const char *
     248 iphoneos_version_as_macro (void)
     249 {
     250-  static char result[sizeof ("99.99.99") + 1];
     251-  const char *src_ptr = darwin_iphoneos_version_min;
     252-  char *result_ptr = &result[0];
     253+  const unsigned long *version_array;
     254+  const char *version_macro;
     255 
     256-  if (! darwin_iphoneos_version_min)
     257+  version_array = parse_version (darwin_iphoneos_version_min);
     258+  if (!version_array)
     259     goto fail;
     260 
     261-  if (! ISDIGIT (*src_ptr))
     262+  if (version_array[MAJOR] > 9)
     263     goto fail;
     264 
     265-  /* Copy over the major version number.  */
     266-  *result_ptr++ = *src_ptr++;
     267-
     268-  if (ISDIGIT (*src_ptr))
     269-    *result_ptr++ = *src_ptr++;
     270-
     271-  if (*src_ptr != '.')
     272+  version_macro = version_as_modern_macro (version_array);
    232273+  if (!version_macro)
    233274     goto fail;
    234275 
     276-  src_ptr++;
     277-
     278-  /* Start parsing the minor version number.  */
     279-  if (! ISDIGIT (*src_ptr))
     280-    goto fail;
     281-
     282-  /* Zero-pad a single-digit value, or copy a two-digit value.  */
     283-  *result_ptr++ = ISDIGIT (*(src_ptr + 1)) ? *src_ptr++ : '0';
     284-  *result_ptr++ = *src_ptr++;
     285-
     286-  /* Parse the third version number (patch level?)  */
     287-  if (*src_ptr == '\0')
     288-    {
     289-      /* Not present -- default to zeroes.  */
     290-      *result_ptr++ = '0';
     291-      *result_ptr++ = '0';
     292-    }
     293-  else if (*src_ptr == '.')
     294-    {
     295-      src_ptr++;
     296-
     297-      if (! ISDIGIT (*src_ptr))
     298-       goto fail;
     299-
     300-      /* Zero-pad a single-digit value, or copy a two-digit value.  */
     301-      *result_ptr++ = ISDIGIT (*(src_ptr + 1)) ? *src_ptr++ : '0';
     302-      *result_ptr++ = *src_ptr++;
     303-    }
     304-  else
     305-    goto fail;
     306-
     307-  /* Verify and copy the terminating NULL.  */
     308-  if (*src_ptr != '\0')
     309-    goto fail;
     310-
     311-  *result_ptr++ = '\0';
    235312-  return result;
    236313+  return version_macro;
    237  
     314  
    238315  fail:
    239    error ("unknown value %qs of -mmacosx-version-min",
    240 @@ -614,7 +743,7 @@ darwin_cpp_builtins (cpp_reader *pfile)
    241      builtin_define ("__CONSTANT_CFSTRINGS__");
    242  
    243    builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__",
    244 -                            version_as_macro(), false);
    245 +                            macosx_version_as_macro(), false);
    246  
    247    /* Since we do not (at 4.6) support ObjC gc for the NeXT runtime, the
    248       following will cause a syntax error if one tries to compile gc attributed
    249 diff --git gcc/testsuite/gcc.dg/darwin-minversion-10.c gcc/testsuite/gcc.dg/darwin-minversion-10.c
    250 new file mode 100644
    251 index 0000000..bf95d46
     316   error ("Unknown value %qs of -miphoneos-version-min",
     317Index: gcc/testsuite/gcc.dg/darwin-minversion-10.c
     318===================================================================
    252319--- /dev/null
    253320+++ gcc/testsuite/gcc.dg/darwin-minversion-10.c
     
    269336+  return 0;
    270337+}
    271 diff --git gcc/testsuite/gcc.dg/darwin-minversion-11.c gcc/testsuite/gcc.dg/darwin-minversion-11.c
    272 new file mode 100644
    273 index 0000000..a03e707
     338Index: gcc/testsuite/gcc.dg/darwin-minversion-11.c
     339===================================================================
    274340--- /dev/null
    275341+++ gcc/testsuite/gcc.dg/darwin-minversion-11.c
     
    291357+  return 0;
    292358+}
    293 diff --git gcc/testsuite/gcc.dg/darwin-minversion-12.c gcc/testsuite/gcc.dg/darwin-minversion-12.c
    294 new file mode 100644
    295 index 0000000..4c2ce38
     359Index: gcc/testsuite/gcc.dg/darwin-minversion-12.c
     360===================================================================
    296361--- /dev/null
    297362+++ gcc/testsuite/gcc.dg/darwin-minversion-12.c
     
    313378+  return 0;
    314379+}
    315 diff --git gcc/testsuite/gcc.dg/darwin-minversion-3.c gcc/testsuite/gcc.dg/darwin-minversion-3.c
    316 index d0c5934..76886dd 100644
    317 --- gcc/testsuite/gcc.dg/darwin-minversion-3.c
     380Index: gcc/testsuite/gcc.dg/darwin-minversion-3.c
     381===================================================================
     382--- /dev/null
    318383+++ gcc/testsuite/gcc.dg/darwin-minversion-3.c
    319 @@ -1,10 +1,10 @@
    320 -/* Test that most-minor versions greater than 9 work.  */
    321 -/* { dg-options "-mmacosx-version-min=10.4.10" } */
     384@@ -0,0 +1,12 @@
    322385+/* Test that most minor versions less than 10 work.  */
    323386+/* { dg-options "-mmacosx-version-min=10.4.1" } */
    324  /* { dg-do compile { target *-*-darwin* } } */
    325  
    326  int main(void)
    327  {
    328 -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040
     387+/* { dg-do compile { target *-*-darwin* } } */
     388+
     389+int
     390+main ()
     391+{
    329392+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1041
    330    fail me;
    331  #endif
    332    return 0;
    333 diff --git gcc/testsuite/gcc.dg/darwin-minversion-4.c gcc/testsuite/gcc.dg/darwin-minversion-4.c
    334 new file mode 100644
    335 index 0000000..1481aa5
     393+  fail me;
     394+#endif
     395+  return 0;
     396+}
     397Index: gcc/testsuite/gcc.dg/darwin-minversion-4.c
     398===================================================================
    336399--- /dev/null
    337400+++ gcc/testsuite/gcc.dg/darwin-minversion-4.c
     
    349412+  return 0;
    350413+}
    351 diff --git gcc/testsuite/gcc.dg/darwin-minversion-5.c gcc/testsuite/gcc.dg/darwin-minversion-5.c
    352 new file mode 100644
    353 index 0000000..09a9d72
     414Index: gcc/testsuite/gcc.dg/darwin-minversion-5.c
     415===================================================================
    354416--- /dev/null
    355417+++ gcc/testsuite/gcc.dg/darwin-minversion-5.c
     
    371433+  return 0;
    372434+}
    373 diff --git gcc/testsuite/gcc.dg/darwin-minversion-6.c gcc/testsuite/gcc.dg/darwin-minversion-6.c
    374 new file mode 100644
    375 index 0000000..e01fa72
     435Index: gcc/testsuite/gcc.dg/darwin-minversion-6.c
     436===================================================================
    376437--- /dev/null
    377438+++ gcc/testsuite/gcc.dg/darwin-minversion-6.c
     
    392453+  return 0;
    393454+}
    394 diff --git gcc/testsuite/gcc.dg/darwin-minversion-7.c gcc/testsuite/gcc.dg/darwin-minversion-7.c
    395 new file mode 100644
    396 index 0000000..72f495b
     455Index: gcc/testsuite/gcc.dg/darwin-minversion-7.c
     456===================================================================
    397457--- /dev/null
    398458+++ gcc/testsuite/gcc.dg/darwin-minversion-7.c
     
    413473+  return 0;
    414474+}
    415 diff --git gcc/testsuite/gcc.dg/darwin-minversion-8.c gcc/testsuite/gcc.dg/darwin-minversion-8.c
    416 new file mode 100644
    417 index 0000000..5982df5
     475Index: gcc/testsuite/gcc.dg/darwin-minversion-8.c
     476===================================================================
    418477--- /dev/null
    419478+++ gcc/testsuite/gcc.dg/darwin-minversion-8.c
     
    435494+  return 0;
    436495+}
    437 diff --git gcc/testsuite/gcc.dg/darwin-minversion-9.c gcc/testsuite/gcc.dg/darwin-minversion-9.c
    438 new file mode 100644
    439 index 0000000..d781783
     496Index: gcc/testsuite/gcc.dg/darwin-minversion-9.c
     497===================================================================
    440498--- /dev/null
    441499+++ gcc/testsuite/gcc.dg/darwin-minversion-9.c
Note: See TracChangeset for help on using the changeset viewer.