Index: gcc/doc/cppopts.texi
===================================================================
--- gcc/doc/cppopts.texi	(revision 193618)
+++ gcc/doc/cppopts.texi	(working copy)
@@ -564,6 +564,10 @@ Accept universal character names in iden
 experimental; in a future version of GCC, it will be enabled by
 default for C99 and C++.
 
+@item -fno-canonical-system-headers
+@opindex fno-canonical-system-headers
+When preprocessing, do not shorten system header paths with canonicalization.
+
 @item -fpreprocessed
 @opindex fpreprocessed
 Indicate to the preprocessor that the input file has already been
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 193618)
+++ gcc/doc/install.texi	(working copy)
@@ -1747,6 +1747,14 @@ and may be disabled using @option{--disa
 See @option{-canonical-prefixes} or @option{-no-canonical-prefixes} for
 more details, including how to override this configuration option when
 compiling.
+
+@item --enable-canonical-system-headers
+@itemx --disable-canonical-system-headers
+Enable system header path canonicalization for @file{libcpp}.  This can
+produce shorter header file paths in diagnostics and dependency output
+files, but these changed header paths may conflict with some compilation
+environments.  Enabled by default, and may be disabled using
+@option{--disable-canonical-system-headers}.
 @end table
 
 @subheading Cross-Compiler-Specific Options
Index: gcc/c-family/ChangeLog.google-integration
===================================================================
--- gcc/c-family/ChangeLog.google-integration	(revision 0)
+++ gcc/c-family/ChangeLog.google-integration	(revision 0)
@@ -0,0 +1,13 @@
+2012-11-16  Simon Baldwin  <simonb@google.com>
+
+	Backport trunk revision 193569.
+
+	* c.opt: Add f[no-]canonical-system-headers.
+	* c-opts.c (c_common_handle_option): Handle
+	OPT_fcanonical_system_headers.
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt	(revision 193618)
+++ gcc/c-family/c.opt	(working copy)
@@ -755,6 +755,10 @@ Recognize built-in functions
 fbuiltin-
 C ObjC C++ ObjC++ Joined
 
+fcanonical-system-headers
+C ObjC C++ ObjC++
+Where shorter, use canonicalized paths to systems headers.
+
 fcheck-new
 C++ ObjC++ Var(flag_check_new)
 Check the return value of new
Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 193618)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -565,6 +565,10 @@ c_common_handle_option (size_t scode, co
       handle_OPT_d (arg);
       break;
 
+    case OPT_fcanonical_system_headers:
+      cpp_opts->canonical_system_headers = value;
+      break;
+
     case OPT_fcond_mismatch:
       if (!c_dialect_cxx ())
 	{
Index: gcc/ChangeLog.google-integration
===================================================================
--- gcc/ChangeLog.google-integration	(revision 193618)
+++ gcc/ChangeLog.google-integration	(working copy)
@@ -1,3 +1,10 @@
+2012-11-19  Simon Baldwin  <simonb@google.com>
+
+	Backport trunk revision 193569.
+
+	* doc/cppopts.texi: Document -f[no-]canonical-system-headers.
+	* doc/install.texi: Document --enable-canonical-system-headers.
+
 2012-10-16   DeLesley Hutchins  <delesley@google.com>
 
 	* common.opt:
Index: libcpp/configure
===================================================================
--- libcpp/configure	(revision 193618)
+++ libcpp/configure	(working copy)
@@ -703,6 +703,7 @@ enable_rpath
 with_libiconv_prefix
 enable_maintainer_mode
 enable_checking
+enable_canonical_system_headers
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1337,6 +1338,8 @@ Optional Features:
   --disable-rpath         do not hardcode runtime library paths
   --enable-maintainer-mode enable rules only needed by maintainers
   --enable-checking      enable expensive run-time checks
+  --enable-canonical-system-headers
+                          enable or disable system headers canonicalization
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -7366,6 +7369,19 @@ $as_echo "#define ENABLE_CHECKING 1" >>c
 
 fi
 
+# Check whether --enable-canonical-system-headers was given.
+if test "${enable_canonical_system_headers+set}" = set; then :
+  enableval=$enable_canonical_system_headers;
+else
+  enable_canonical_system_headers=yes
+fi
+
+if test $enable_canonical_system_headers != no; then
+
+$as_echo "#define ENABLE_CANONICAL_SYSTEM_HEADERS 1" >>confdefs.h
+
+fi
+
 
 case $target in
 	alpha*-*-* | \
Index: libcpp/ChangeLog.google-integration
===================================================================
--- libcpp/ChangeLog.google-integration	(revision 193618)
+++ libcpp/ChangeLog.google-integration	(working copy)
@@ -1,3 +1,15 @@
+2012-11-19  Simon Baldwin  <simonb@google.com>
+
+	Backport trunk revision 193569.
+
+	* include/cpplib.h (struct cpp_options): Add canonical_system_headers.
+	* files.c (find_file_in_dir): Call maybe_shorter_path() only if
+	canonical_system_headers is set.
+	* init.c (cpp_create_reader): Initialize canonical_system_headers.
+	* configure.ac: Add new --enable-canonical-system-headers.
+	* configure: Regenerate.
+	* config.in: Regenerate.
+
 2012-04-23   Ollie Wild  <aaw@google.com>
 
 	* include/cpplib.h (struct cpp_options): Add new field,
Index: libcpp/include/cpplib.h
===================================================================
--- libcpp/include/cpplib.h	(revision 193618)
+++ libcpp/include/cpplib.h	(working copy)
@@ -489,6 +489,9 @@ struct cpp_options
 
   /* True disables tokenization outside of preprocessing directives. */
   bool directives_only;
+
+  /* True enables canonicalization of system header file paths. */
+  bool canonical_system_headers;
 };
 
 /* Callback for header lookup for HEADER, which is the name of a
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 193618)
+++ libcpp/files.c	(working copy)
@@ -385,7 +385,7 @@ find_file_in_dir (cpp_reader *pfile, _cp
       void **pp;
 
       /* We try to canonicalize system headers.  */
-      if (file->dir->sysp)
+      if (CPP_OPTION (pfile, canonical_system_headers) && file->dir->sysp)
 	{
 	  char * canonical_path = maybe_shorter_path (path);
 	  if (canonical_path)
Index: libcpp/init.c
===================================================================
--- libcpp/init.c	(revision 193618)
+++ libcpp/init.c	(working copy)
@@ -28,6 +28,10 @@ along with this program; see the file CO
 #include "localedir.h"
 #include "filenames.h"
 
+#ifndef ENABLE_CANONICAL_SYSTEM_HEADERS
+#define ENABLE_CANONICAL_SYSTEM_HEADERS 0
+#endif
+
 static void init_library (void);
 static void mark_named_operators (cpp_reader *, int);
 static void read_original_filename (cpp_reader *);
Index: libcpp/configure.ac
===================================================================
--- libcpp/configure.ac	(revision 193618)
+++ libcpp/configure.ac	(working copy)
@@ -146,6 +146,16 @@ if test $enable_checking != no ; then
 [Define if you want more run-time sanity checks.])
 fi
 
+AC_ARG_ENABLE(canonical-system-headers,
+[  --enable-canonical-system-headers
+                          enable or disable system headers canonicalization],
+[],
+enable_canonical_system_headers=yes)
+if test $enable_canonical_system_headers != no; then
+  AC_DEFINE(ENABLE_CANONICAL_SYSTEM_HEADERS,
+            1, [Define to enable system headers canonicalization.])
+fi
+
 m4_changequote(,)
 case $target in
 	alpha*-*-* | \
Index: libcpp/config.in
===================================================================
--- libcpp/config.in	(revision 193618)
+++ libcpp/config.in	(working copy)
@@ -11,6 +11,9 @@
 /* Define to 1 if using `alloca.c'. */
 #undef C_ALLOCA
 
+/* Define to enable system headers canonicalization. */
+#undef ENABLE_CANONICAL_SYSTEM_HEADERS
+
 /* Define if you want more run-time sanity checks. */
 #undef ENABLE_CHECKING
 
