[llvm-commits] [llvm-gcc-4.2] r56071 - /llvm-gcc-4.2/trunk/gcc/c-incpath.c
Devang Patel
dpatel at apple.com
Wed Sep 10 14:48:02 PDT 2008
Author: dpatel
Date: Wed Sep 10 16:48:02 2008
New Revision: 56071
URL: http://llvm.org/viewvc/llvm-project?rev=56071&view=rev
Log:
"Fix" header search path while using Mac OS X 10.5 sdk.
More info. in the comments.
Modified:
llvm-gcc-4.2/trunk/gcc/c-incpath.c
Modified: llvm-gcc-4.2/trunk/gcc/c-incpath.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-incpath.c?rev=56071&r1=56070&r2=56071&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-incpath.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-incpath.c Wed Sep 10 16:48:02 2008
@@ -33,6 +33,9 @@
/* APPLE LOCAL headermaps 3871393 */
#include "errors.h"
+/* LLVM LOCAL fix MacOSX 10.5 SDK */
+extern char * mempcpy (char *dst, const char *src, size_t len);
+
/* Windows does not natively support inodes, and neither does MSDOS.
Cygwin's emulation can generate non-unique inodes, so don't use it.
VMS has non-numeric inodes. */
@@ -131,6 +134,8 @@
{
const struct default_include *p;
size_t len;
+ /* LLVM LOCAL begin fix MacOSX 10.5 SDK */
+ bool SDK10_5 = false;
if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
{
@@ -157,6 +162,9 @@
}
}
+ /* LLVM LOCAL begin fix MacOSX 10.5 SDK */
+ if (sysroot && strstr(sysroot, "MacOSX10.5.sdk") != NULL)
+ SDK10_5 = true;
for (p = cpp_include_defaults; p->fname; p++)
{
if (!p->cplusplus || cxx_stdinc)
@@ -164,8 +172,32 @@
char *str;
/* Should this directory start with the sysroot? */
- if (sysroot && p->add_sysroot)
- str = concat (sysroot, p->fname, NULL);
+ if (sysroot && p->add_sysroot) {
+ if (SDK10_5) {
+ char *d = strstr(p->fname, "apple-darwin");
+ if (d) {
+ /* Released 10.5 SDK uses header paths that include OS version
+ number, for example 9 in
+ .../MacOSX10.5.sdk/.../lib/gcc/i686-apple-darwin9/4.2.1/include
+ However the 9 is constructed based on the host OS version on
+ which the compiler is built. This means, the compiler will
+ not be able to use 10.5 SDK unless it is built on 10.5 system.
+ Fix header path here to make it work.
+
+ The p->fname includes "apple-darwinXYZ/" substring. Replace
+ this substring with "apple-darwin9/". */
+ char *str1;
+ str = XNEWVEC(char, strlen(sysroot) + strlen(p->fname) + 2);
+ str1 = mempcpy(str, sysroot, strlen(sysroot));
+ str1 = mempcpy(str1, p->fname, d - p->fname);
+ str1 = mempcpy(str1, "apple-darwin9", strlen("apple-darwin9"));
+ d = strchr(d, '/');
+ str1 = mempcpy(str1, d, strlen(d));
+ } else
+ str = concat (sysroot, p->fname, NULL);
+ } else
+ str = concat (sysroot, p->fname, NULL);
+ }
else
str = update_path (p->fname, p->component);
@@ -175,6 +207,7 @@
add_path (str, SYSTEM, p->cxx_aware, false);
}
}
+ /* LLVM LOCAL end fix MacOSX 10.5 SDK */
}
More information about the llvm-commits
mailing list