summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-devtools/clang/clang/0037-sanitizer-Remove-include-linux-fs.h-to-resolve-fscon.patch62
-rw-r--r--recipes-devtools/clang/common.inc1
2 files changed, 63 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0037-sanitizer-Remove-include-linux-fs.h-to-resolve-fscon.patch b/recipes-devtools/clang/clang/0037-sanitizer-Remove-include-linux-fs.h-to-resolve-fscon.patch
new file mode 100644
index 0000000..fee7a95
--- /dev/null
+++ b/recipes-devtools/clang/clang/0037-sanitizer-Remove-include-linux-fs.h-to-resolve-fscon.patch
@@ -0,0 +1,62 @@
1From 2095a89e5724866ae20d7f123b1c12b2758b58bd Mon Sep 17 00:00:00 2001
2From: Fangrui Song <i@maskray.me>
3Date: Mon, 11 Jul 2022 12:53:34 -0700
4Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
5 fsconfig_command/mount_attr conflict with glibc 2.36
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10It is generally not a good idea to mix usage of glibc headers and Linux UAPI
11headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
12since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
13defines `fsconfig_command` which conflicts with linux/mount.h:
14
15 .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
16
17Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
18Android sys/mount.h doesn't define BLKBSZGET and it still needs linux/fs.h.
19In the long term we should move Linux specific definitions to sanitizer_platform_limits_linux.cpp
20but this commit is easy to cherry pick into older compiler-rt releases.
21
22Fix https://github.com/llvm/llvm-project/issues/56421
23
24Reviewed By: #sanitizers, vitalybuka, zatrazz
25
26Differential Revision: https://reviews.llvm.org/D129471
27
28Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/9cf13067cb5088626ba7ee1ec4c42ec59c7995a0]
29Signed-off-by: Khem Raj <raj.khem@gmail.com>
30---
31 .../sanitizer_platform_limits_posix.cpp | 10 ++++++----
32 1 file changed, 6 insertions(+), 4 deletions(-)
33
34diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
35index 32b8f47ed633..a29b31a432f0 100644
36--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
37+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
38@@ -73,7 +73,9 @@
39 #include <sys/vt.h>
40 #include <linux/cdrom.h>
41 #include <linux/fd.h>
42+#if SANITIZER_ANDROID
43 #include <linux/fs.h>
44+#endif
45 #include <linux/hdreg.h>
46 #include <linux/input.h>
47 #include <linux/ioctl.h>
48@@ -857,10 +859,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
49 unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
50 unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
51 #endif
52- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
53- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
54- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
55- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
56+ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
57+ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
58+ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
59+ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
60 unsigned IOCTL_GIO_CMAP = GIO_CMAP;
61 unsigned IOCTL_GIO_FONT = GIO_FONT;
62 unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc
index 7cbd7f4..77d7142 100644
--- a/recipes-devtools/clang/common.inc
+++ b/recipes-devtools/clang/common.inc
@@ -46,6 +46,7 @@ SRC_URI = "\
46 file://0034-clang-exclude-openembedded-distributions-from-settin.patch \ 46 file://0034-clang-exclude-openembedded-distributions-from-settin.patch \
47 file://0035-compiler-rt-Enable-__int128-for-ppc32.patch \ 47 file://0035-compiler-rt-Enable-__int128-for-ppc32.patch \
48 file://0036-compiler-rt-builtins-Move-DMB-definition-to-syn-opsh.patch \ 48 file://0036-compiler-rt-builtins-Move-DMB-definition-to-syn-opsh.patch \
49 file://0037-sanitizer-Remove-include-linux-fs.h-to-resolve-fscon.patch \
49 " 50 "
50# Fallback to no-PIE if not set 51# Fallback to no-PIE if not set
51GCCPIE ??= "" 52GCCPIE ??= ""