diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-07-29 12:44:56 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-11-04 13:34:12 -0700 |
commit | 013b5eeb580bc13b156aaf77d0c1175f75b89671 (patch) | |
tree | 9de8ae33d73177ea159fd6789cf8e478f5bc30e7 | |
parent | 5d6c7c189e4abdfc3e4b309f7edadcbddb9236eb (diff) | |
download | meta-clang-013b5eeb580bc13b156aaf77d0c1175f75b89671.tar.gz |
sanitizer: Fix build with glibc 2.36
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | recipes-devtools/clang/clang/0037-sanitizer-Remove-include-linux-fs.h-to-resolve-fscon.patch | 62 | ||||
-rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
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 @@ | |||
1 | From 2095a89e5724866ae20d7f123b1c12b2758b58bd Mon Sep 17 00:00:00 2001 | ||
2 | From: Fangrui Song <i@maskray.me> | ||
3 | Date: Mon, 11 Jul 2022 12:53:34 -0700 | ||
4 | Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve | ||
5 | fsconfig_command/mount_attr conflict with glibc 2.36 | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | It is generally not a good idea to mix usage of glibc headers and Linux UAPI | ||
11 | headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc | ||
12 | since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h | ||
13 | defines `fsconfig_command` which conflicts with linux/mount.h: | ||
14 | |||
15 | .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’ | ||
16 | |||
17 | Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually. | ||
18 | Android sys/mount.h doesn't define BLKBSZGET and it still needs linux/fs.h. | ||
19 | In the long term we should move Linux specific definitions to sanitizer_platform_limits_linux.cpp | ||
20 | but this commit is easy to cherry pick into older compiler-rt releases. | ||
21 | |||
22 | Fix https://github.com/llvm/llvm-project/issues/56421 | ||
23 | |||
24 | Reviewed By: #sanitizers, vitalybuka, zatrazz | ||
25 | |||
26 | Differential Revision: https://reviews.llvm.org/D129471 | ||
27 | |||
28 | Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/9cf13067cb5088626ba7ee1ec4c42ec59c7995a0] | ||
29 | Signed-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 | |||
34 | diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | ||
35 | index 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 |
51 | GCCPIE ??= "" | 52 | GCCPIE ??= "" |