dev-lang/swift: backport patch for linux/scc.h

Backports an upstream patch for building LLVM sanitizers on systems
where `<linux/scc.h>` is no longer present.

Signed-off-by: Itai Ferber <itai@itaiferber.net>
This commit is contained in:
Itai Ferber
2026-06-30 09:26:03 -04:00
parent 0caf226210
commit 80fbc4c2ac
12 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# Backports https://github.com/llvm/llvm-project/pull/194116 in order to be able
# to build the sanitizer libs using GCC 16 and newer.
--- a/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -144,16 +144,15 @@ typedef struct user_fpregs elf_fpregset_t;
#if defined(__mips64)
# include <sys/procfs.h>
#endif
-#include <sys/user.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
#include <linux/mroute.h>
#include <linux/mroute6.h>
-#include <linux/scc.h>
#include <linux/serial.h>
-#include <sys/msg.h>
#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/user.h>
#endif // SANITIZER_ANDROID
#include <link.h>
@@ -508,8 +507,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned struct_kbsentry_sz = sizeof(struct kbsentry);
unsigned struct_mtconfiginfo_sz = sizeof(struct mtconfiginfo);
unsigned struct_nr_parms_struct_sz = sizeof(struct nr_parms_struct);
- unsigned struct_scc_modem_sz = sizeof(struct scc_modem);
- unsigned struct_scc_stat_sz = sizeof(struct scc_stat);
unsigned struct_serial_multiport_struct_sz
= sizeof(struct serial_multiport_struct);
unsigned struct_serial_struct_sz = sizeof(struct serial_struct);

View File

@@ -0,0 +1,33 @@
# Backports https://github.com/llvm/llvm-project/pull/194116 in order to be able
# to build the sanitizer libs using GCC 16 and newer.
--- a/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -145,16 +145,15 @@ typedef struct user_fpregs elf_fpregset_t;
#if defined(__mips64)
# include <sys/procfs.h>
#endif
-#include <sys/user.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
#include <linux/mroute.h>
#include <linux/mroute6.h>
-#include <linux/scc.h>
#include <linux/serial.h>
-#include <sys/msg.h>
#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/user.h>
#endif // SANITIZER_ANDROID
#include <link.h>
@@ -520,8 +519,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned struct_kbsentry_sz = sizeof(struct kbsentry);
unsigned struct_mtconfiginfo_sz = sizeof(struct mtconfiginfo);
unsigned struct_nr_parms_struct_sz = sizeof(struct nr_parms_struct);
- unsigned struct_scc_modem_sz = sizeof(struct scc_modem);
- unsigned struct_scc_stat_sz = sizeof(struct scc_stat);
unsigned struct_serial_multiport_struct_sz
= sizeof(struct serial_multiport_struct);
unsigned struct_serial_struct_sz = sizeof(struct serial_struct);

View File

@@ -0,0 +1,33 @@
# Backports https://github.com/llvm/llvm-project/pull/194116 in order to be able
# to build the sanitizer libs using GCC 16 and newer.
--- a/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -151,16 +151,15 @@ typedef struct user_fpregs elf_fpregset_t;
#if defined(__mips64)
# include <sys/procfs.h>
#endif
-#include <sys/user.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
#include <linux/mroute.h>
#include <linux/mroute6.h>
-#include <linux/scc.h>
#include <linux/serial.h>
-#include <sys/msg.h>
#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/user.h>
#endif // SANITIZER_ANDROID
#include <link.h>
@@ -532,8 +531,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned struct_kbsentry_sz = sizeof(struct kbsentry);
unsigned struct_mtconfiginfo_sz = sizeof(struct mtconfiginfo);
unsigned struct_nr_parms_struct_sz = sizeof(struct nr_parms_struct);
- unsigned struct_scc_modem_sz = sizeof(struct scc_modem);
- unsigned struct_scc_stat_sz = sizeof(struct scc_stat);
unsigned struct_serial_multiport_struct_sz
= sizeof(struct serial_multiport_struct);
unsigned struct_serial_struct_sz = sizeof(struct serial_struct);

View File

@@ -0,0 +1 @@
../swift-6.1.3/remove-linux-scc_h.patch

View File

@@ -0,0 +1 @@
../swift-6.1.3/remove-linux-scc_h.patch

View File

@@ -58,6 +58,7 @@ PATCHES=(
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/lldb-cmake-minimum-version.patch" "${FILESDIR}/${PF}/lldb-cmake-minimum-version.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )

View File

@@ -58,6 +58,7 @@ PATCHES=(
"${FILESDIR}/${PF}/indexstoredb-constant.patch" "${FILESDIR}/${PF}/indexstoredb-constant.patch"
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )

View File

@@ -60,6 +60,7 @@ PATCHES=(
"${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch" "${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch"
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )

View File

@@ -61,6 +61,7 @@ PATCHES=(
"${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch" "${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch"
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )

View File

@@ -63,6 +63,7 @@ PATCHES=(
"${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch" "${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch"
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )

View File

@@ -63,6 +63,7 @@ PATCHES=(
"${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch" "${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch"
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )

View File

@@ -63,6 +63,7 @@ PATCHES=(
"${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch" "${FILESDIR}/${PF}/fix-issues-caused-by-build-system-updates.patch"
"${FILESDIR}/${PF}/link-ncurses-tinfo.patch" "${FILESDIR}/${PF}/link-ncurses-tinfo.patch"
"${FILESDIR}/${PF}/link-with-lld.patch" "${FILESDIR}/${PF}/link-with-lld.patch"
"${FILESDIR}/${PF}/remove-linux-scc_h.patch"
"${FILESDIR}/${PF}/respect-c-cxx-flags.patch" "${FILESDIR}/${PF}/respect-c-cxx-flags.patch"
"${FILESDIR}/${PF}/sanitizer-remove-scc.patch" "${FILESDIR}/${PF}/sanitizer-remove-scc.patch"
) )