Patchwork [toolchain-layer] gcc-4.5: Backport cpp honor sysroot patch

login
register
mail settings
Submitter Khem Raj
Date April 19, 2012, 2:24 a.m.
Message ID <1334802250-23079-1-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/26145/
State Accepted
Commit 643a5268eb934fc994a8fa88c181a63f2394eacd
Headers show

Comments

Khem Raj - April 19, 2012, 2:24 a.m.
This patch is well vetted on gcc-4.6

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 toolchain-layer/recipes-devtools/gcc/gcc-4.5.inc   |    3 +-
 .../gcc/gcc-4.5/cpp-honour-sysroot.patch           |   36 ++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 toolchain-layer/recipes-devtools/gcc/gcc-4.5/cpp-honour-sysroot.patch

Patch

diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.5.inc b/toolchain-layer/recipes-devtools/gcc/gcc-4.5.inc
index ee4a434..8fabf30 100644
--- a/toolchain-layer/recipes-devtools/gcc/gcc-4.5.inc
+++ b/toolchain-layer/recipes-devtools/gcc/gcc-4.5.inc
@@ -14,7 +14,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
 
 
 PV = "4.5"
-PR = "r48"
+PR = "r49"
 
 # BINV should be incremented after updating to a revision
 # after a minor gcc release (e.g. 4.5.1 or 4.5.2) has been made
@@ -38,6 +38,7 @@  SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH};proto=http \
        file://gcc-armv4-pass-fix-v4bx-to-ld.patch \
        file://sh4-multilib.patch \
        file://arm-lib1funcs.as-fix-mismatch-between-conditions-of-an-IT-block.patch \
+       file://cpp-honour-sysroot.patch \
        \
        file://linaro/gcc-4.5-linaro-r99297.patch \
        file://linaro/gcc-4.5-linaro-r99298.patch \
diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.5/cpp-honour-sysroot.patch b/toolchain-layer/recipes-devtools/gcc/gcc-4.5/cpp-honour-sysroot.patch
new file mode 100644
index 0000000..cf4c77c
--- /dev/null
+++ b/toolchain-layer/recipes-devtools/gcc/gcc-4.5/cpp-honour-sysroot.patch
@@ -0,0 +1,36 @@ 
+Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
+preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location 
+rather than the --sysroot option specified on the commandline. If access to that directory is 
+permission denied (unreadable), gcc will error.
+
+This happens when ccache is in use due to the fact it uses preprocessed source files.
+
+The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix, 
+-isystem, -isysroot happen and the correct sysroot is used.
+
+[YOCTO #2074]
+
+Upstream-Status: Pending
+
+RP 2012/04/13
+
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -1106,7 +1106,7 @@ static const struct compiler default_com
+                     %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0},
+   {".i", "@cpp-output", 0, 1, 0},
+   {"@cpp-output",
+-   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0},
++   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0},
+   {".s", "@assembler", 0, 1, 0},
+   {"@assembler",
+    "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0},
+--- a/gcc/cp/lang-specs.h
++++ b/gcc/cp/lang-specs.h
+@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3.
+   {".ii", "@c++-cpp-output", 0, 0, 0},
+   {"@c++-cpp-output",
+    "%{!M:%{!MM:%{!E:\
+-    cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
++    cc1plus -fpreprocessed %i %I %(cc1_options) %2 %{+e*}\
+     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},