commit a77aec10ea3917a06a64007f3a5832c82209a045 Author: Tim Biermann <tbier@posteo.de> Date: Mon Aug 29 21:39:57 2022 +0200 rust: fixed build with glibc 2.36 diff --git a/rust/.signature b/rust/.signature index e92828bee..1db93cdee 100644 --- a/rust/.signature +++ b/rust/.signature @@ -1,6 +1,6 @@ untrusted comment: verify with /etc/ports/opt.pub -RWSE3ohX2g5d/SjYTIUpASwTp7N8dRuPhuyXhvyuQs3mMfOnyL+wBqQKAj8XGOOfZ81Gq45Ey6nHLjqxRs73Xih9TKk5zXoghgQ= -SHA256 (Pkgfile) = 9089bbeea5d3b308dd775cf96a97ddb9af196229eced2bb1307577da5e728929 +RWSE3ohX2g5d/fit3IJTJMmnd3pUIDms4XB+8bunFIGNbsm5avI4iKy+N135ciMJBfo3DDvTDj8bYYk6Q1aLZ4LDV6mJgnWO8QI= +SHA256 (Pkgfile) = 88ae65e99b8c1cef868978811efc6f4f1fb8e4a226b6f84874588f21dd08d1f1 SHA256 (.footprint) = 61127f3edf08faf27f567db548c7cfc2fb6a4c3ae3da2e26c2e641272697efe3 SHA256 (rustc-1.63.0-src.tar.xz) = 8f44af6dc44cc4146634a4dd5e4cc5470b3052a2337019b870c0e025e8987e0c SHA256 (rust-std-1.62.0-x86_64-unknown-linux-gnu.tar.xz) = addfae87b6b1b521d98a50fdc5120990888a51bb397100062e9c558267c67c77 @@ -9,3 +9,4 @@ SHA256 (cargo-1.62.0-x86_64-unknown-linux-gnu.tar.xz) = 815c63119a9cf0282ff240c6 SHA256 (0001-bootstrap-Change-libexec-dir.patch) = 60c6dfc100d292284af2187cfefc1d0d928139ca557d27bc6bef88edefccff70 SHA256 (0001-cargo-Change-libexec-dir.patch) = c901a9bb036c29ca092f7dbc8b447efdd9aa1044a902a88f9d024cb22681dc19 SHA256 (0002-compiler-Change-LLVM-targets.patch) = 8dcb566da29a92ecf3eb6afe094d9c7766d08230d90fd666bfd022c018ae676a +SHA256 (remove-include-linux-fs.h.patch) = 34ed866e313e4580130a50118a4410d36fa0159123982521b6ef049439fc32ad diff --git a/rust/Pkgfile b/rust/Pkgfile index 6ce70f67e..b026265df 100644 --- a/rust/Pkgfile +++ b/rust/Pkgfile @@ -9,7 +9,7 @@ version=1.63.0 _date=2022-06-30 _rustc=1.62.0 _cargo=$_rustc -release=1 +release=2 source=(https://static.rust-lang.org/dist/${name}c-$version-src.tar.xz https://static.rust-lang.org/dist/$_date/rust-std-$_rustc-x86_64-unknown-lin... @@ -17,7 +17,8 @@ source=(https://static.rust-lang.org/dist/${name}c-$version-src.tar.xz https://static.rust-lang.org/dist/$_date/cargo-$_cargo-x86_64-unknown-linux-... 0001-bootstrap-Change-libexec-dir.patch 0001-cargo-Change-libexec-dir.patch - 0002-compiler-Change-LLVM-targets.patch) + 0002-compiler-Change-LLVM-targets.patch + remove-include-linux-fs.h.patch) unpack_source() { for file in ${source[@]}; do @@ -69,6 +70,8 @@ build() { # Use our *-pc-linux-gnu targets, making LTO with clang simpler patch -p1 -i $SRC/0002-compiler-Change-LLVM-targets.patch + patch -p1 -d src/llvm-project -i $SRC/remove-include-linux-fs.h.patch + cat <<- EOF > $SRC/config.toml changelog-seen = 2 diff --git a/rust/remove-include-linux-fs.h.patch b/rust/remove-include-linux-fs.h.patch new file mode 100644 index 000000000..bbf0d0e7c --- /dev/null +++ b/rust/remove-include-linux-fs.h.patch @@ -0,0 +1,59 @@ +From 9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 Mon Sep 17 00:00:00 2001 +From: Fangrui Song <i@maskray.me> +Date: Mon, 11 Jul 2022 12:53:34 -0700 +Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve + fsconfig_command/mount_attr conflict with glibc 2.36 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It is generally not a good idea to mix usage of glibc headers and Linux UAPI +headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc +since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h +defines `fsconfig_command` which conflicts with linux/mount.h: + + .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’ + +Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually. +Android sys/mount.h doesn't define BLKBSZGET and it still needs linux/fs.h. +In the long term we should move Linux specific definitions to sanitizer_platform_limits_linux.cpp +but this commit is easy to cherry pick into older compiler-rt releases. + +Fix https://github.com/llvm/llvm-project/issues/56421 + +Reviewed By: #sanitizers, vitalybuka, zatrazz + +Differential Revision: https://reviews.llvm.org/D129471 +--- + .../sanitizer_platform_limits_posix.cpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +index 4bd425435d56..3a94b260686f 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -73,7 +73,9 @@ + #include <sys/vt.h> + #include <linux/cdrom.h> + #include <linux/fd.h> ++#if SANITIZER_ANDROID + #include <linux/fs.h> ++#endif + #include <linux/hdreg.h> + #include <linux/input.h> + #include <linux/ioctl.h> +@@ -876,10 +878,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT; + unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT; + #endif +- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS; +- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION; +- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS; +- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION; ++ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long); ++ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long); ++ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long); ++ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long); + unsigned IOCTL_GIO_CMAP = GIO_CMAP; + unsigned IOCTL_GIO_FONT = GIO_FONT; + unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;