mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 18:51:27 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -127,15 +127,20 @@ function extract_kernel_tree {
|
||||
|
||||
# Patch a kernel tree where $1 is the kernel version.
|
||||
function patch_kernel {
|
||||
case "$k" in
|
||||
case "$1" in
|
||||
*^*)
|
||||
# RHEL / CentOS.
|
||||
;;
|
||||
2.*|3.*)
|
||||
# Tell the kernel that we are using gcc 4.6 since older kernel
|
||||
# versions do not support recent gcc versions.
|
||||
KCFLAGS="-U__GNUC__ -U__GNUC_MINOR__ -D__GNUC__=4 -D__GNUC_MINOR__=6"
|
||||
patch -p1 <<'EOF'
|
||||
*)
|
||||
# See also commit f153b82121b0 ("Sanitize gcc version header
|
||||
# includes") # v2.6.29. See also commit 71458cfc782e ("kernel: add
|
||||
# support for gcc 5") # v3.18. See also commit cb984d101b30
|
||||
# ("compiler-gcc: integrate the various compiler-gcc[345].h
|
||||
# files") # v4.2.
|
||||
if kernel_version_le 2.6.29 $1 && kernel_version_lt $1 4.2; then
|
||||
# Tell the kernel that we are using gcc 4.6 since older kernel
|
||||
# versions do not support recent gcc versions.
|
||||
patch -f -s -p1 <<'EOF' ||
|
||||
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
|
||||
index 02ae99e8e6d3..47e12c19c965 100644
|
||||
--- a/include/linux/compiler-gcc.h
|
||||
@@ -150,6 +155,60 @@ index 02ae99e8e6d3..47e12c19c965 100644
|
||||
#if !defined(__noclone)
|
||||
#define __noclone /* not needed */
|
||||
EOF
|
||||
patch -f -s -p1 <<'EOF'
|
||||
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
|
||||
index a3ed7cb8ca34..c5a6b8b52db4 100644
|
||||
--- a/include/linux/compiler-gcc.h
|
||||
+++ b/include/linux/compiler-gcc.h
|
||||
@@ -83,4 +83,4 @@
|
||||
#define __gcc_header(x) #x
|
||||
#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
|
||||
#define gcc_header(x) _gcc_header(x)
|
||||
-#include gcc_header(__GNUC__)
|
||||
+#include "linux/compiler-gcc4.h"
|
||||
EOF
|
||||
patch -f -s -p1 <<'EOF' ||
|
||||
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
|
||||
index 769e19864632..2ec6c7a11502 100644
|
||||
--- a/include/linux/compiler-gcc4.h
|
||||
+++ b/include/linux/compiler-gcc4.h
|
||||
@@ -2,13 +2,6 @@
|
||||
#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
|
||||
#endif
|
||||
|
||||
-/* GCC 4.1.[01] miscompiles __weak */
|
||||
-#ifdef __KERNEL__
|
||||
-# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
|
||||
-# error Your version of gcc miscompiles the __weak directive
|
||||
-# endif
|
||||
-#endif
|
||||
-
|
||||
#define __used __attribute__((__used__))
|
||||
#define __must_check __attribute__((warn_unused_result))
|
||||
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
|
||||
EOF
|
||||
patch -f -s -p1 <<'EOF'
|
||||
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
|
||||
index 412bc6c2b023..901ca31be7f8 100644
|
||||
--- a/include/linux/compiler-gcc4.h
|
||||
+++ b/include/linux/compiler-gcc4.h
|
||||
@@ -2,13 +2,6 @@
|
||||
#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
|
||||
#endif
|
||||
|
||||
-/* GCC 4.1.[01] miscompiles __weak */
|
||||
-#ifdef __KERNEL__
|
||||
-# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
|
||||
-# error Your version of gcc miscompiles the __weak directive
|
||||
-# endif
|
||||
-#endif
|
||||
-
|
||||
#define __used __attribute__((__used__))
|
||||
#define __must_check __attribute__((warn_unused_result))
|
||||
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$1" = "2.6.29" ] || [ "$1" = "2.6.29.1" ] || [ "$1" = "2.6.29.2" ] ||
|
||||
@@ -362,9 +421,8 @@ index d6d65537b0d9..6aad8308a0ac 100644
|
||||
EOF
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
2.6.3[6-9]*|3.[0-9]|3.[0-9].*|3.1[01345]|3.1[01345].*|3.1[789]|3.1[789].*|4.[023567]|4.[023567].*)
|
||||
patch -p1 <<'EOF'
|
||||
if kernel_version_le 2.6.36 $1 && kernel_version_lt $1 4.8; then
|
||||
patch -f -s -p1 <<'EOF'
|
||||
From c6a385539175ebc603da53aafb7753d39089f32e Mon Sep 17 00:00:00 2001
|
||||
From: Borislav Petkov <bp@suse.de>
|
||||
Date: Mon, 14 Nov 2016 19:41:31 +0100
|
||||
@@ -426,10 +484,11 @@ index 0ed6ce300543..c324b43712f0 100644
|
||||
KBUILD_CFLAGS_MODULE := -DMODULE
|
||||
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
|
||||
EOF
|
||||
;;
|
||||
# CentOS 6.x.
|
||||
2.6.32-*)
|
||||
patch -p1 <<'EOF'
|
||||
else
|
||||
case "$1" in
|
||||
# CentOS 6.x.
|
||||
2.6.32-*)
|
||||
patch -f -s -p1 <<'EOF'
|
||||
--- linux-2.6.32-754.29.1.el6/Makefile.orig 2020-05-13 14:09:18.448503420 -0700
|
||||
+++ linux-2.6.32-754.29.1.el6/Makefile 2020-05-13 14:11:24.265441790 -0700
|
||||
@@ -355,7 +355,8 @@
|
||||
@@ -452,9 +511,9 @@ EOF
|
||||
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
||||
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
||||
EOF
|
||||
;;
|
||||
2.6.3[1-5]*)
|
||||
patch -p1 <<'EOF'
|
||||
;;
|
||||
2.6.3[1-5]*)
|
||||
patch -f -s -p1 <<'EOF'
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 141da26fda4b..343ec388ae2e 100644
|
||||
--- a/Makefile
|
||||
@@ -477,11 +536,12 @@ index 141da26fda4b..343ec388ae2e 100644
|
||||
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
4.18.0-*) # CentOS 8.x
|
||||
patch -p1 <<'EOF'
|
||||
patch -f -s -p1 <<'EOF'
|
||||
From a6e60d84989fa0e91db7f236eda40453b0e44afa Mon Sep 17 00:00:00 2001
|
||||
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
|
||||
Date: Sat, 19 Jan 2019 20:59:34 +0100
|
||||
@@ -560,8 +620,8 @@ index 8fa38d3e7538..f5bc4c046461 100644
|
||||
|
||||
EOF
|
||||
;;
|
||||
2.6.32-*|3.10.0-*) # CentOS 6.x and 7.x
|
||||
patch -p1 <<'EOF'
|
||||
2.*|3.*)
|
||||
patch -f -s -p1 <<'EOF'
|
||||
--- linux-3.10.0-1127.el7/include/linux/init.h.orig 2020-05-09 20:55:48.638956513 -0700
|
||||
+++ linux-3.10.0-1127.el7/include/linux/init.h 2020-05-09 20:56:46.947612445 -0700
|
||||
@@ -309,13 +309,15 @@
|
||||
@@ -586,6 +646,101 @@ EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
if kernel_version_le 3.2 $1 && kernel_version_lt $1 3.18; then
|
||||
patch -f -s -p1 <<'EOF'
|
||||
From eeeda4cd06e828b331b15741a204ff9f5874d28d Mon Sep 17 00:00:00 2001
|
||||
From: Ben Hutchings <ben@decadent.org.uk>
|
||||
Date: Wed, 24 Sep 2014 13:30:12 +0100
|
||||
Subject: [PATCH] x86/relocs: Make per_cpu_load_addr static
|
||||
|
||||
per_cpu_load_addr is only used for 64-bit relocations, but is
|
||||
declared in both configurations of relocs.c - with different
|
||||
types. This has undefined behaviour in general. GNU ld is
|
||||
documented to use the larger size in this case, but other tools
|
||||
may differ and some warn about this.
|
||||
|
||||
References: https://bugs.debian.org/748577
|
||||
Reported-by: Michael Tautschnig <mt@debian.org>
|
||||
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
Cc: 748577@bugs.debian.org
|
||||
Cc: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Link: http://lkml.kernel.org/r/1411561812.3659.23.camel@decadent.org.uk
|
||||
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
||||
---
|
||||
arch/x86/tools/relocs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
|
||||
index bbb1d2259ecf..a5efb21d5228 100644
|
||||
--- a/arch/x86/tools/relocs.c
|
||||
+++ b/arch/x86/tools/relocs.c
|
||||
@@ -695,7 +695,7 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
|
||||
*
|
||||
*/
|
||||
static int per_cpu_shndx = -1;
|
||||
-Elf_Addr per_cpu_load_addr;
|
||||
+static Elf_Addr per_cpu_load_addr;
|
||||
|
||||
static void percpu_init(void)
|
||||
{
|
||||
EOF
|
||||
fi
|
||||
|
||||
# See also commit e33a814e772c ("scripts/dtc: Remove redundant YYLOC global
|
||||
# declaration") # v5.6~10^2.
|
||||
if kernel_version_lt $1 5.6; then
|
||||
patch -p1 -f -s <<'EOF'
|
||||
From e33a814e772cdc36436c8c188d8c42d019fda639 Mon Sep 17 00:00:00 2001
|
||||
From: Dirk Mueller <dmueller@suse.com>
|
||||
Date: Tue, 14 Jan 2020 18:53:41 +0100
|
||||
Subject: [PATCH] scripts/dtc: Remove redundant YYLOC global declaration
|
||||
|
||||
gcc 10 will default to -fno-common, which causes this error at link
|
||||
time:
|
||||
|
||||
(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
|
||||
|
||||
This is because both dtc-lexer as well as dtc-parser define the same
|
||||
global symbol yyloc. Before with -fcommon those were merged into one
|
||||
defintion. The proper solution would be to to mark this as "extern",
|
||||
however that leads to:
|
||||
|
||||
dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
|
||||
26 | extern YYLTYPE yylloc;
|
||||
| ^~~~~~
|
||||
In file included from dtc-lexer.l:24:
|
||||
dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
|
||||
127 | extern YYLTYPE yylloc;
|
||||
| ^~~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
|
||||
which means the declaration is completely redundant and can just be
|
||||
dropped.
|
||||
|
||||
Signed-off-by: Dirk Mueller <dmueller@suse.com>
|
||||
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
||||
[robh: cherry-pick from upstream]
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Rob Herring <robh@kernel.org>
|
||||
---
|
||||
scripts/dtc/dtc-lexer.l | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
|
||||
index 5c6c3fd557d7..b3b7270300de 100644
|
||||
--- a/scripts/dtc/dtc-lexer.l
|
||||
+++ b/scripts/dtc/dtc-lexer.l
|
||||
@@ -23,7 +23,6 @@ LINECOMMENT "//".*\n
|
||||
#include "srcpos.h"
|
||||
#include "dtc-parser.tab.h"
|
||||
|
||||
-YYLTYPE yylloc;
|
||||
extern bool treesource_error;
|
||||
|
||||
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Use sed to patch the ____ilog2_NaN() prototype.
|
||||
sed -i 's/__attribute__((const, noreturn))/__attribute__((noreturn))/' \
|
||||
include/linux/log2.h tools/include/linux/log2.h 2>/dev/null
|
||||
|
||||
@@ -677,17 +677,7 @@ do
|
||||
generate_kernel_patch "$k" "${generate_kernel_patch_options}" || continue
|
||||
(
|
||||
cd "${outputdir}" &&
|
||||
download_and_extract_kernel_tree "$k" &&
|
||||
k="${k/^*}" &&
|
||||
cd "linux-$k/include/linux" &&
|
||||
if [ ! -e compiler-gcc6.h ]; then
|
||||
for f in compiler-gcc5.h compiler-gcc4.h; do
|
||||
if [ -e "$f" ]; then
|
||||
cp "$f" compiler-gcc6.h
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
download_and_extract_kernel_tree "$k"
|
||||
) ||
|
||||
continue
|
||||
k="${k/^*}"
|
||||
|
||||
@@ -66,7 +66,7 @@ function evaluate(stmnt, pattern, arg, op, result) {
|
||||
|
||||
gsub("defined\\(REGISTER_MAD_AGENT_HAS_FLAGS_ARG\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || " \
|
||||
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt)
|
||||
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 9)", stmnt)
|
||||
|
||||
gsub("SOCK_RECVMSG_HAS_FOUR_ARGS",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))", stmnt)
|
||||
@@ -131,7 +131,7 @@ function evaluate(stmnt, pattern, arg, op, result) {
|
||||
|
||||
gsub("defined\\(HAVE_IB_EVENT_GID_CHANGE\\)",
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) || " \
|
||||
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt)
|
||||
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 9)", stmnt)
|
||||
|
||||
gsub("defined\\(HAVE_IB_QUERY_DEVICE\\)",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) \\&\\& " \
|
||||
@@ -153,7 +153,8 @@ function evaluate(stmnt, pattern, arg, op, result) {
|
||||
"(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt)
|
||||
|
||||
gsub("HAVE_IB_SG_DMA_LEN",
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0))", stmnt)
|
||||
"(LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) \\&\\& " \
|
||||
"RHEL_RELEASE_CODE -0 < 8 * 256 + 2)", stmnt)
|
||||
|
||||
gsub("defined(ENABLE_NPIV)", 0, stmnt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user