diff options
| author | Daniel McGregor <daniel.mcgregor@vecima.com> | 2016-05-09 12:44:11 -0600 |
|---|---|---|
| committer | Daniel McGregor <daniel.mcgregor@vecima.com> | 2016-05-10 08:26:31 -0600 |
| commit | d6f27374415f935103a9a7d045e566d69fc3f8ba (patch) | |
| tree | fcb1174447044eec83dd95b4ca1645b3baa65028 /recipes-devtools | |
| parent | dc6ed678fc55a9e673a56950769a19eb2f0a76f6 (diff) | |
| download | meta-clang-d6f27374415f935103a9a7d045e566d69fc3f8ba.tar.gz | |
clang: backport -I= support
This solves some clang issues. A few recipes rely on gcc's
-I= syntax. This is a backport of the feature to the 3.8
branch. It's already in 3.9.
See https://llvm.org/bugs/show_bug.cgi?id=26965
Signed-off-by: Daniel McGregor <daniel.mcgregor@vecima.com>
Diffstat (limited to 'recipes-devtools')
| -rw-r--r-- | recipes-devtools/clang/clang/0001-Frontend-support-I-path-for-sysroot-expansion.patch | 99 | ||||
| -rw-r--r-- | recipes-devtools/clang/clang_git.bb | 1 |
2 files changed, 100 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0001-Frontend-support-I-path-for-sysroot-expansion.patch b/recipes-devtools/clang/clang/0001-Frontend-support-I-path-for-sysroot-expansion.patch new file mode 100644 index 0000000..76c214a --- /dev/null +++ b/recipes-devtools/clang/clang/0001-Frontend-support-I-path-for-sysroot-expansion.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | Upstream-Status: backport | ||
| 2 | |||
| 3 | From 0632c1bf6c41f6c89f21957e1379232ef7668d4a Mon Sep 17 00:00:00 2001 | ||
| 4 | From: Saleem Abdulrasool <compnerd@compnerd.org> | ||
| 5 | Date: Fri, 6 May 2016 19:13:55 +0000 | ||
| 6 | Subject: [PATCH] Frontend: support -I=path for sysroot expansion | ||
| 7 | |||
| 8 | From the GCC manpage: | ||
| 9 | |||
| 10 | -I dir | ||
| 11 | ... If dir begins with =, then the = will be replaced by the sysroot prefix; | ||
| 12 | see --sysroot and -isysroot. | ||
| 13 | |||
| 14 | Add support to expand the `=` as a prefix of the include path with the sysroot | ||
| 15 | if specified. `-isysroot` takes precedence over `--sysroot` as the normal | ||
| 16 | argument behaviour occurs. The ordering of the `-isysroot` is relevant to the | ||
| 17 | path substituted. If no `--sysroot=` or `-isysroot` option is present, the = is | ||
| 18 | not expanded. | ||
| 19 | |||
| 20 | Resolves PR26965! | ||
| 21 | |||
| 22 | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268777 91177308-0d34-0410-b5e6-96231b3b80d8 | ||
| 23 | --- | ||
| 24 | lib/Frontend/CompilerInvocation.cpp | 16 ++++++++++++++-- | ||
| 25 | test/Preprocessor/sysroot-prefix.c | 28 ++++++++++++++++++++++++++++ | ||
| 26 | 2 files changed, 42 insertions(+), 2 deletions(-) | ||
| 27 | create mode 100644 test/Preprocessor/sysroot-prefix.c | ||
| 28 | |||
| 29 | diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp | ||
| 30 | index 237a447..845dffc 100644 | ||
| 31 | --- a/lib/Frontend/CompilerInvocation.cpp | ||
| 32 | +++ b/lib/Frontend/CompilerInvocation.cpp | ||
| 33 | @@ -1243,6 +1243,8 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { | ||
| 34 | |||
| 35 | // Add -I..., -F..., and -index-header-map options in order. | ||
| 36 | bool IsIndexHeaderMap = false; | ||
| 37 | + bool IsSysrootSpecified = | ||
| 38 | + Args.hasArg(OPT__sysroot_EQ) || Args.hasArg(OPT_isysroot); | ||
| 39 | for (const Arg *A : Args.filtered(OPT_I, OPT_F, OPT_index_header_map)) { | ||
| 40 | if (A->getOption().matches(OPT_index_header_map)) { | ||
| 41 | // -index-header-map applies to the next -I or -F. | ||
| 42 | @@ -1253,8 +1255,18 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { | ||
| 43 | frontend::IncludeDirGroup Group = | ||
| 44 | IsIndexHeaderMap ? frontend::IndexHeaderMap : frontend::Angled; | ||
| 45 | |||
| 46 | - Opts.AddPath(A->getValue(), Group, | ||
| 47 | - /*IsFramework=*/A->getOption().matches(OPT_F), true); | ||
| 48 | + bool IsFramework = A->getOption().matches(OPT_F); | ||
| 49 | + std::string Path = A->getValue(); | ||
| 50 | + | ||
| 51 | + if (IsSysrootSpecified && !IsFramework && A->getValue()[0] == '=') { | ||
| 52 | + SmallString<32> Buffer; | ||
| 53 | + llvm::sys::path::append(Buffer, Opts.Sysroot, | ||
| 54 | + llvm::StringRef(A->getValue()).substr(1)); | ||
| 55 | + Path = Buffer.str(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + Opts.AddPath(Path.c_str(), Group, IsFramework, | ||
| 59 | + /*IgnoreSysroot*/ true); | ||
| 60 | IsIndexHeaderMap = false; | ||
| 61 | } | ||
| 62 | |||
| 63 | diff --git a/test/Preprocessor/sysroot-prefix.c b/test/Preprocessor/sysroot-prefix.c | ||
| 64 | new file mode 100644 | ||
| 65 | index 0000000..feea502 | ||
| 66 | --- /dev/null | ||
| 67 | +++ b/test/Preprocessor/sysroot-prefix.c | ||
| 68 | @@ -0,0 +1,28 @@ | ||
| 69 | +// RUN: %clang_cc1 -v -isysroot /var/empty -I /dev/null -E %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ISYSROOT_NO_SYSROOT %s | ||
| 70 | +// RUN: %clang_cc1 -v -isysroot /var/empty -I =/dev/null -E %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ISYSROOT_SYSROOT_DEV_NULL %s | ||
| 71 | +// RUN: %clang_cc1 -v -I =/dev/null -E %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-NO_ISYSROOT_SYSROOT_DEV_NULL %s | ||
| 72 | +// RUN: %clang_cc1 -v -isysroot /var/empty -I =null -E %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ISYSROOT_SYSROOT_NULL %s | ||
| 73 | +// RUN: %clang_cc1 -v -isysroot /var/empty -isysroot /var/empty/root -I =null -E %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ISYSROOT_ISYSROOT_SYSROOT_NULL %s | ||
| 74 | +// RUN: %clang_cc1 -v -isysroot /var/empty/root -isysroot /var/empty -I =null -E %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ISYSROOT_ISYSROOT_SWAPPED_SYSROOT_NULL %s | ||
| 75 | + | ||
| 76 | +// CHECK-ISYSROOT_NO_SYSROOT: ignoring nonexistent directory "/dev/null" | ||
| 77 | +// CHECK-ISYSROOT_NO_SYSROOT-NOT: ignoring nonexistent directory "/var/empty/dev/null" | ||
| 78 | + | ||
| 79 | +// CHECK-NO_ISYSROOT_SYSROOT_DEV_NULL: ignoring nonexistent directory "=/dev/null" | ||
| 80 | +// CHECK-NO_ISYSROOT_SYSROOT_DEV_NULL-NOT: ignoring nonexistent directory "/dev/null" | ||
| 81 | + | ||
| 82 | +// CHECK-ISYSROOT_SYSROOT_DEV_NULL: ignoring nonexistent directory "/var/empty/dev/null" | ||
| 83 | +// CHECK-ISYSROOT_SYSROOT_DEV_NULL-NOT: ignoring nonexistent directory "/dev/null" | ||
| 84 | + | ||
| 85 | +// CHECK-NO_ISYSROOT_SYSROOT: ignoring nonexistent directory "=/dev/null" | ||
| 86 | +// CHECK-NO_ISYSROOT_SYSROOT-NOT: ignoring nonexistent directory "/var/empty/dev/null" | ||
| 87 | + | ||
| 88 | +// CHECK-ISYSROOT_SYSROOT_NULL: ignoring nonexistent directory "/var/empty/null" | ||
| 89 | +// CHECK-ISYSROOT_SYSROOT_NULL-NOT: ignoring nonexistent directory "=null" | ||
| 90 | + | ||
| 91 | +// CHECK-ISYSROOT_ISYSROOT_SYSROOT_NULL: ignoring nonexistent directory "/var/empty/root/null" | ||
| 92 | +// CHECK-ISYSROOT_ISYSROOT_SYSROOT_NULL-NOT: ignoring nonexistent directory "=null" | ||
| 93 | + | ||
| 94 | +// CHECK-ISYSROOT_ISYSROOT_SWAPPED_SYSROOT_NULL: ignoring nonexistent directory "/var/empty/null" | ||
| 95 | +// CHECK-ISYSROOT_ISYSROOT_SWAPPED_SYSROOT_NULL-NOT: ignoring nonexistent directory "=null" | ||
| 96 | + | ||
| 97 | -- | ||
| 98 | 2.8.2 | ||
| 99 | |||
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index 6b30ee0..4fc2fa7 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
| @@ -21,6 +21,7 @@ SRC_URI = "${LLVM_GIT}/llvm.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};n | |||
| 21 | file://0001-driver-Add-musl-ldso-support.patch;patchdir=tools/clang \ | 21 | file://0001-driver-Add-musl-ldso-support.patch;patchdir=tools/clang \ |
| 22 | file://0001-driver-Use-lib-for-ldso-on-OE.patch;patchdir=tools/clang \ | 22 | file://0001-driver-Use-lib-for-ldso-on-OE.patch;patchdir=tools/clang \ |
| 23 | file://0001-musl-ppc-does-not-support-128-bit-long-double.patch;patchdir=tools/clang \ | 23 | file://0001-musl-ppc-does-not-support-128-bit-long-double.patch;patchdir=tools/clang \ |
| 24 | file://0001-Frontend-support-I-path-for-sysroot-expansion.patch;patchdir=tools/clang \ | ||
| 24 | " | 25 | " |
| 25 | 26 | ||
| 26 | SRC_URI_append_libc-musl_class-target = " file://0001-remove-fopen64-fseeko64-ftello64-tmpfile64-on-musl.patch " | 27 | SRC_URI_append_libc-musl_class-target = " file://0001-remove-fopen64-fseeko64-ftello64-tmpfile64-on-musl.patch " |
