Skip to content

Instantly share code, notes, and snippets.

@goyox86
Created July 30, 2014 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goyox86/6411b3e77dab2a93c9ba to your computer and use it in GitHub Desktop.
Save goyox86/6411b3e77dab2a93c9ba to your computer and use it in GitHub Desktop.
GCC 4.9 Patch for OS X 10.10
--- file_not_specified_in_diff
+++ file_not_specified_in_diff
@@ -, +, @@
--- a/gcc/config/darwin-c.c
+++ a/gcc/config/darwin-c.c
@@ -572,20 +572,31 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp)
/* Return the value of darwin_macosx_version_min suitable for the
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
- so '10.4.2' becomes 1040. The lowest digit is always zero.
- Print a warning if the version number can't be understood. */
+ so '10.4.2' becomes 1040 and '10.10.0' becomes 101000. The lowest
+ digit is always zero. Print a warning if the version number
+ can't be understood. */
static const char *
version_as_macro (void)
{
- static char result[] = "1000";
+ static char result[7] = "1000";
+ int minorDigitIdx;
if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
goto fail;
if (! ISDIGIT (darwin_macosx_version_min[3]))
goto fail;
- result[2] = darwin_macosx_version_min[3];
- if (darwin_macosx_version_min[4] != '\0'
- && darwin_macosx_version_min[4] != '.')
+
+ minorDigitIdx = 3;
+ result[2] = darwin_macosx_version_min[minorDigitIdx++];
+ if (ISDIGIT(darwin_macosx_version_min[minorDigitIdx])) {
+ /* Starting with 10.10 numeration for mactro changed */
+ result[3] = darwin_macosx_version_min[minorDigitIdx++];
+ result[4] = '0';
+ result[5] = '0';
+ result[6] = '\0';
+ }
+ if (darwin_macosx_version_min[minorDigitIdx] != '\0'
+ && darwin_macosx_version_min[minorDigitIdx] != '.')
goto fail;
return result;
--- a/gcc/config/darwin-driver.c
+++ a/gcc/config/darwin-driver.c
@@ -57,7 +57,7 @@ darwin_find_version_from_kernel (char *new_flag)
version_p = osversion + 1;
if (ISDIGIT (*version_p))
major_vers = major_vers * 10 + (*version_p++ - '0');
- if (major_vers > 4 + 9)
+ if (major_vers > 4 + 10)
goto parse_failed;
if (*version_p++ != '.')
goto parse_failed;
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -835,8 +835,10 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
CHECK_SIZE_AND_OFFSET(dirent, d_ino);
-#if SANITIZER_MAC
+#if SANITIZER_MAC && ( !defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T)
CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
+#elif SANITIZER_MAC
+// There is no d_seekoff with non 64-bit ino_t
#else
CHECK_SIZE_AND_OFFSET(dirent, d_off);
#endif
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -275,12 +275,20 @@ namespace __sanitizer {
#endif
#if SANITIZER_MAC
+# if ! defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T
struct __sanitizer_dirent {
unsigned long long d_ino;
unsigned long long d_seekoff;
unsigned short d_reclen;
// more fields that we don't care about
};
+# else
+ struct __sanitizer_dirent {
+ unsigned int d_ino;
+ unsigned short d_reclen;
+ // more fields that we don't care about
+ };
+# endif
#elif SANITIZER_ANDROID || defined(__x86_64__)
struct __sanitizer_dirent {
unsigned long long d_ino;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment