Index: include/clang/Serialization/ASTReader.h
===================================================================
--- include/clang/Serialization/ASTReader.h	(revision 156555)
+++ include/clang/Serialization/ASTReader.h	(working copy)
@@ -230,10 +230,12 @@
   FileManager &FileMgr;
   DiagnosticsEngine &Diags;
 
+public:	// workaround to grant access to classes nested within ASTDeclReader
   /// \brief The semantic analysis object that will be processing the
   /// AST files and the translation unit that uses it.
   Sema *SemaObj;
 
+private:
   /// \brief The preprocessor that will be loading the source file.
   Preprocessor &PP;
 
@@ -689,6 +691,7 @@
   /// since the last time the declaration chains were linked.
   llvm::SmallPtrSet<Decl *, 16> RedeclsDeserialized;
   
+public:	// workaround to grant access to classes nested within ASTDeclReader
   /// \brief The list of redeclaration chains that still need to be 
   /// reconstructed.
   ///
@@ -700,6 +703,7 @@
   /// \brief Keeps track of the elements added to PendingDeclChains.
   llvm::SmallSet<serialization::DeclID, 16> PendingDeclChainsKnown;
 
+private:
   /// \brief The set of Objective-C categories that have been deserialized
   /// since the last time the declaration chains were linked.
   llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
Index: tools/libclang/CMakeLists.txt
===================================================================
--- tools/libclang/CMakeLists.txt	(revision 156555)
+++ tools/libclang/CMakeLists.txt	(working copy)
@@ -60,8 +60,12 @@
     DEFINE_SYMBOL _CINDEX_LIB_)
 
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+# for system gcc-4.0.1
     set(LIBCLANG_LINK_FLAGS
       "-Wl,-compatibility_version -Wl,1 -Wl,-dead_strip")
+# for gcc-fsf-4.6 only:
+#    set(LIBCLANG_LINK_FLAGS
+#      "-Wl,-dylib_compatibility_version -Wl,1 -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
     set_target_properties(libclang
       PROPERTIES
       LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
Index: tools/libclang/CIndex.cpp
===================================================================
--- tools/libclang/CIndex.cpp	(revision 156555)
+++ tools/libclang/CIndex.cpp	(working copy)
@@ -5899,7 +5899,8 @@
 void clang::setThreadBackgroundPriority() {
   // FIXME: Move to llvm/Support and make it cross-platform.
 #ifdef __APPLE__
-  setpriority(PRIO_DARWIN_THREAD, 0, PRIO_DARWIN_BG);
+// constants are not defined on darwin8
+//  setpriority(PRIO_DARWIN_THREAD, 0, PRIO_DARWIN_BG);
 #endif
 }
 
Index: lib/Frontend/InitHeaderSearch.cpp
===================================================================
--- lib/Frontend/InitHeaderSearch.cpp	(revision 156555)
+++ lib/Frontend/InitHeaderSearch.cpp	(working copy)
@@ -334,28 +334,35 @@
 
     case llvm::Triple::ppc:
     case llvm::Triple::ppc64:
+// This is a local hack-only, do not submit or commit.
+/**
       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
-                                  "powerpc-apple-darwin10", "", "ppc64",
+                                  "powerpc-apple-darwin8", "", "ppc64",
                                   triple);
+**/
       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
-                                  "powerpc-apple-darwin10", "", "ppc64",
+                                  "powerpc-apple-darwin8", "", "ppc64",
                                   triple);
       break;
 
     case llvm::Triple::x86:
     case llvm::Triple::x86_64:
+/**
       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
-                                  "i686-apple-darwin10", "", "x86_64", triple);
+                                  "i686-apple-darwin8", "", "x86_64", triple);
+**/
       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
                                   "i686-apple-darwin8", "", "", triple);
       break;
 
     case llvm::Triple::arm:
     case llvm::Triple::thumb:
+/**
       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
-                                  "arm-apple-darwin10", "v7", "", triple);
+                                  "arm-apple-darwin8", "v7", "", triple);
       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
-                                  "arm-apple-darwin10", "v6", "", triple);
+                                  "arm-apple-darwin8", "v6", "", triple);
+**/
       break;
     }
     return;
Index: lib/AST/ExprConstant.cpp
===================================================================
--- lib/AST/ExprConstant.cpp	(revision 156555)
+++ lib/AST/ExprConstant.cpp	(working copy)
@@ -2775,7 +2775,8 @@
     if (E->isArrow()) {
       if (!EvaluatePointer(E->getBase(), Result, this->Info))
         return false;
-      BaseTy = E->getBase()->getType()->getAs<PointerType>()->getPointeeType();
+      BaseTy = E->getBase()->getType()->template getAs<PointerType>()
+               ->getPointeeType();
     } else if (E->getBase()->isRValue()) {
       assert(E->getBase()->getType()->isRecordType());
       if (!EvaluateTemporary(E->getBase(), Result, this->Info))
Index: lib/Serialization/CMakeLists.txt
===================================================================
--- lib/Serialization/CMakeLists.txt	(revision 156555)
+++ lib/Serialization/CMakeLists.txt	(working copy)
@@ -25,3 +25,10 @@
   ClangDiagnosticSerialization
   ClangDeclNodes
   ClangStmtNodes)
+
+target_link_libraries(clangSerialization
+  clangAST
+  clangBasic
+  clangSema
+  LLVMSupport
+)
