diff options
Diffstat (limited to 'recipes-kernel')
3 files changed, 270 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-fslc-imx/0001-compiler-attributes-add-support-for-copy-gcc-9.patch b/recipes-kernel/linux/linux-fslc-imx/0001-compiler-attributes-add-support-for-copy-gcc-9.patch new file mode 100644 index 00000000..a234c0c3 --- /dev/null +++ b/recipes-kernel/linux/linux-fslc-imx/0001-compiler-attributes-add-support-for-copy-gcc-9.patch | |||
@@ -0,0 +1,132 @@ | |||
1 | From mboxrd@z Thu Jan 1 00:00:00 1970 | ||
2 | Return-Path: <SRS0=AQQw=UD=vger.kernel.org=stable-owner@kernel.org> | ||
3 | X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on | ||
4 | aws-us-west-2-korg-lkml-1.web.codeaurora.org | ||
5 | X-Spam-Level: | ||
6 | X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, | ||
7 | DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, | ||
8 | SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT | ||
9 | autolearn=ham autolearn_force=no version=3.4.0 | ||
10 | Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) | ||
11 | by smtp.lore.kernel.org (Postfix) with ESMTP id 354C8C282CE | ||
12 | for <stable@archiver.kernel.org>; Tue, 4 Jun 2019 13:25:01 +0000 (UTC) | ||
13 | Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) | ||
14 | by mail.kernel.org (Postfix) with ESMTP id 0D01C24291 | ||
15 | for <stable@archiver.kernel.org>; Tue, 4 Jun 2019 13:25:01 +0000 (UTC) | ||
16 | Authentication-Results: mail.kernel.org; | ||
17 | dkim=pass (1024-bit key) header.d=agner.ch header.i=@agner.ch header.b="HG5nfXC5" | ||
18 | Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand | ||
19 | id S1727392AbfFDNZA (ORCPT <rfc822;stable@archiver.kernel.org>); | ||
20 | Tue, 4 Jun 2019 09:25:00 -0400 | ||
21 | Received: from mail.kmu-office.ch ([178.209.48.109]:48336 "EHLO | ||
22 | mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org | ||
23 | with ESMTP id S1727340AbfFDNZA (ORCPT | ||
24 | <rfc822;stable@vger.kernel.org>); Tue, 4 Jun 2019 09:25:00 -0400 | ||
25 | Received: from trochilidae.toradex.int (unknown [46.140.72.82]) | ||
26 | by mail.kmu-office.ch (Postfix) with ESMTPSA id 8BE845C2138; | ||
27 | Tue, 4 Jun 2019 15:24:55 +0200 (CEST) | ||
28 | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; | ||
29 | t=1559654695; | ||
30 | h=from:from:reply-to:subject:subject:date:date:message-id:message-id: | ||
31 | to:to:cc:cc:mime-version:mime-version:content-type:content-type: | ||
32 | content-transfer-encoding:content-transfer-encoding:in-reply-to: | ||
33 | references; bh=2lQNwDLO9/HfsHTvSmLn5csGG1S09yt0LuSYqXeE0y0=; | ||
34 | b=HG5nfXC5qPZvu4E7tM2iveXY8wtjralMObB8KMvD1S6NWkkOwkeLjXonm495Hz+G+geOig | ||
35 | NlbMrAg5b6wYCzvMgqUeSBmGkYCjB/7IFlotEiTcUNmOCorD2pTasqUOcpObuc6WqBkEjM | ||
36 | 3seyrLJVs51y9A3weXf9CMO3OMOXwRA= | ||
37 | From: Stefan Agner <stefan@agner.ch> | ||
38 | To: gregkh@linuxfoundation.org | ||
39 | Cc: stable@vger.kernel.org, | ||
40 | Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>, | ||
41 | Martin Sebor <msebor@gcc.gnu.org>, | ||
42 | Nick Desaulniers <ndesaulniers@google.com>, | ||
43 | Stefan Agner <stefan@agner.ch> | ||
44 | Subject: [PATCH BACKPORT 4.19 1/2] Compiler Attributes: add support for __copy (gcc >= 9) | ||
45 | Date: Tue, 4 Jun 2019 15:24:40 +0200 | ||
46 | Message-Id: <20190604132441.15383-1-stefan@agner.ch> | ||
47 | X-Mailer: git-send-email 2.21.0 | ||
48 | MIME-Version: 1.0 | ||
49 | Content-Type: text/plain; charset=UTF-8 | ||
50 | Content-Transfer-Encoding: 8bit | ||
51 | Sender: stable-owner@vger.kernel.org | ||
52 | Precedence: bulk | ||
53 | List-ID: <stable.vger.kernel.org> | ||
54 | X-Mailing-List: stable@vger.kernel.org | ||
55 | Archived-At: <https://lore.kernel.org/stable/20190604132441.15383-1-stefan@agner.ch/> | ||
56 | List-Archive: <https://lore.kernel.org/stable/> | ||
57 | List-Post: <mailto:stable@vger.kernel.org> | ||
58 | |||
59 | From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | ||
60 | |||
61 | [ Upstream commit c0d9782f5b6d7157635ae2fd782a4b27d55a6013 ] | ||
62 | |||
63 | >From the GCC manual: | ||
64 | |||
65 | copy | ||
66 | copy(function) | ||
67 | |||
68 | The copy attribute applies the set of attributes with which function | ||
69 | has been declared to the declaration of the function to which | ||
70 | the attribute is applied. The attribute is designed for libraries | ||
71 | that define aliases or function resolvers that are expected | ||
72 | to specify the same set of attributes as their targets. The copy | ||
73 | attribute can be used with functions, variables, or types. However, | ||
74 | the kind of symbol to which the attribute is applied (either | ||
75 | function or variable) must match the kind of symbol to which | ||
76 | the argument refers. The copy attribute copies only syntactic and | ||
77 | semantic attributes but not attributes that affect a symbol’s | ||
78 | linkage or visibility such as alias, visibility, or weak. | ||
79 | The deprecated attribute is also not copied. | ||
80 | |||
81 | https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html | ||
82 | |||
83 | The upcoming GCC 9 release extends the -Wmissing-attributes warnings | ||
84 | (enabled by -Wall) to C and aliases: it warns when particular function | ||
85 | attributes are missing in the aliases but not in their target, e.g.: | ||
86 | |||
87 | void __cold f(void) {} | ||
88 | void __alias("f") g(void); | ||
89 | |||
90 | diagnoses: | ||
91 | |||
92 | warning: 'g' specifies less restrictive attribute than | ||
93 | its target 'f': 'cold' [-Wmissing-attributes] | ||
94 | |||
95 | Using __copy(f) we can copy the __cold attribute from f to g: | ||
96 | |||
97 | void __cold f(void) {} | ||
98 | void __copy(f) __alias("f") g(void); | ||
99 | |||
100 | This attribute is most useful to deal with situations where an alias | ||
101 | is declared but we don't know the exact attributes the target has. | ||
102 | |||
103 | For instance, in the kernel, the widely used module_init/exit macros | ||
104 | define the init/cleanup_module aliases, but those cannot be marked | ||
105 | always as __init/__exit since some modules do not have their | ||
106 | functions marked as such. | ||
107 | |||
108 | Cc: <stable@vger.kernel.org> # 4.14+ | ||
109 | Suggested-by: Martin Sebor <msebor@gcc.gnu.org> | ||
110 | Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> | ||
111 | Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | ||
112 | Signed-off-by: Stefan Agner <stefan@agner.ch> | ||
113 | --- | ||
114 | include/linux/compiler-gcc.h | 4 ++++ | ||
115 | include/linux/compiler_types.h | 4 ++++ | ||
116 | 2 files changed, 8 insertions(+) | ||
117 | |||
118 | Index: git/include/linux/compiler-gcc.h | ||
119 | =================================================================== | ||
120 | --- git.orig/include/linux/compiler-gcc.h | ||
121 | +++ git/include/linux/compiler-gcc.h | ||
122 | @@ -282,6 +282,10 @@ | ||
123 | |||
124 | #endif /* gcc version >= 40000 specific checks */ | ||
125 | |||
126 | +#if GCC_VERSION >= 90100 | ||
127 | +#define __copy(symbol) __attribute__((__copy__(symbol))) | ||
128 | +#endif | ||
129 | + | ||
130 | #if !defined(__noclone) | ||
131 | #define __noclone /* not needed */ | ||
132 | #endif | ||
diff --git a/recipes-kernel/linux/linux-fslc-imx/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch b/recipes-kernel/linux/linux-fslc-imx/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch new file mode 100644 index 00000000..758a8a07 --- /dev/null +++ b/recipes-kernel/linux/linux-fslc-imx/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch | |||
@@ -0,0 +1,135 @@ | |||
1 | From mboxrd@z Thu Jan 1 00:00:00 1970 | ||
2 | Return-Path: <SRS0=AQQw=UD=vger.kernel.org=stable-owner@kernel.org> | ||
3 | X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on | ||
4 | aws-us-west-2-korg-lkml-1.web.codeaurora.org | ||
5 | X-Spam-Level: | ||
6 | X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, | ||
7 | DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, | ||
8 | SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT | ||
9 | autolearn=ham autolearn_force=no version=3.4.0 | ||
10 | Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) | ||
11 | by smtp.lore.kernel.org (Postfix) with ESMTP id 63BF0C46470 | ||
12 | for <stable@archiver.kernel.org>; Tue, 4 Jun 2019 13:25:01 +0000 (UTC) | ||
13 | Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) | ||
14 | by mail.kernel.org (Postfix) with ESMTP id 3D9B223D29 | ||
15 | for <stable@archiver.kernel.org>; Tue, 4 Jun 2019 13:25:01 +0000 (UTC) | ||
16 | Authentication-Results: mail.kernel.org; | ||
17 | dkim=pass (1024-bit key) header.d=agner.ch header.i=@agner.ch header.b="QWkQ/3jN" | ||
18 | Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand | ||
19 | id S1727340AbfFDNZA (ORCPT <rfc822;stable@archiver.kernel.org>); | ||
20 | Tue, 4 Jun 2019 09:25:00 -0400 | ||
21 | Received: from mail.kmu-office.ch ([178.209.48.109]:48348 "EHLO | ||
22 | mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org | ||
23 | with ESMTP id S1727343AbfFDNZA (ORCPT | ||
24 | <rfc822;stable@vger.kernel.org>); Tue, 4 Jun 2019 09:25:00 -0400 | ||
25 | Received: from trochilidae.toradex.int (unknown [46.140.72.82]) | ||
26 | by mail.kmu-office.ch (Postfix) with ESMTPSA id A3CC45C1F29; | ||
27 | Tue, 4 Jun 2019 15:24:57 +0200 (CEST) | ||
28 | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; | ||
29 | t=1559654697; | ||
30 | h=from:from:reply-to:subject:subject:date:date:message-id:message-id: | ||
31 | to:to:cc:cc:mime-version:mime-version:content-type: | ||
32 | content-transfer-encoding:content-transfer-encoding: | ||
33 | in-reply-to:in-reply-to:references:references; | ||
34 | bh=tc6JvYRo2QJoJQVnFd/oGDG0/z6TF30OxAP+nBfruDc=; | ||
35 | b=QWkQ/3jNBkysiiD5SMb2UF+0YtSMCbOyP2/dUXeDQChYIal8jUex+QvYHjBh6l4Gff6WwG | ||
36 | 3Zd44X6jE/KqxygBkoglOSb/dHwZ5AS8B8vpUM8vh2CzhrW4fD9eguoEIImOJJZ9RHgx0b | ||
37 | Gwno+ZPPhuPOcFbSrBwNsKK6mZLGttY= | ||
38 | From: Stefan Agner <stefan@agner.ch> | ||
39 | To: gregkh@linuxfoundation.org | ||
40 | Cc: stable@vger.kernel.org, | ||
41 | Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>, | ||
42 | Martin Sebor <msebor@gcc.gnu.org>, | ||
43 | Jessica Yu <jeyu@kernel.org>, Stefan Agner <stefan@agner.ch> | ||
44 | Subject: [PATCH BACKPORT 4.19 2/2] include/linux/module.h: copy __init/__exit attrs to init/cleanup_module | ||
45 | Date: Tue, 4 Jun 2019 15:24:41 +0200 | ||
46 | Message-Id: <20190604132441.15383-2-stefan@agner.ch> | ||
47 | X-Mailer: git-send-email 2.21.0 | ||
48 | In-Reply-To: <20190604132441.15383-1-stefan@agner.ch> | ||
49 | References: <20190604132441.15383-1-stefan@agner.ch> | ||
50 | MIME-Version: 1.0 | ||
51 | Content-Transfer-Encoding: 8bit | ||
52 | Sender: stable-owner@vger.kernel.org | ||
53 | Precedence: bulk | ||
54 | List-ID: <stable.vger.kernel.org> | ||
55 | X-Mailing-List: stable@vger.kernel.org | ||
56 | Archived-At: <https://lore.kernel.org/stable/20190604132441.15383-2-stefan@agner.ch/> | ||
57 | List-Archive: <https://lore.kernel.org/stable/> | ||
58 | List-Post: <mailto:stable@vger.kernel.org> | ||
59 | |||
60 | From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | ||
61 | |||
62 | [ Upstream commit a6e60d84989fa0e91db7f236eda40453b0e44afa ] | ||
63 | |||
64 | The upcoming GCC 9 release extends the -Wmissing-attributes warnings | ||
65 | (enabled by -Wall) to C and aliases: it warns when particular function | ||
66 | attributes are missing in the aliases but not in their target. | ||
67 | |||
68 | In particular, it triggers for all the init/cleanup_module | ||
69 | aliases in the kernel (defined by the module_init/exit macros), | ||
70 | ending up being very noisy. | ||
71 | |||
72 | These aliases point to the __init/__exit functions of a module, | ||
73 | which are defined as __cold (among other attributes). However, | ||
74 | the aliases themselves do not have the __cold attribute. | ||
75 | |||
76 | Since the compiler behaves differently when compiling a __cold | ||
77 | function as well as when compiling paths leading to calls | ||
78 | to __cold functions, the warning is trying to point out | ||
79 | the possibly-forgotten attribute in the alias. | ||
80 | |||
81 | In order to keep the warning enabled, we decided to silence | ||
82 | this case. Ideally, we would mark the aliases directly | ||
83 | as __init/__exit. However, there are currently around 132 modules | ||
84 | in the kernel which are missing __init/__exit in their init/cleanup | ||
85 | functions (either because they are missing, or for other reasons, | ||
86 | e.g. the functions being called from somewhere else); and | ||
87 | a section mismatch is a hard error. | ||
88 | |||
89 | A conservative alternative was to mark the aliases as __cold only. | ||
90 | However, since we would like to eventually enforce __init/__exit | ||
91 | to be always marked, we chose to use the new __copy function | ||
92 | attribute (introduced by GCC 9 as well to deal with this). | ||
93 | With it, we copy the attributes used by the target functions | ||
94 | into the aliases. This way, functions that were not marked | ||
95 | as __init/__exit won't have their aliases marked either, | ||
96 | and therefore there won't be a section mismatch. | ||
97 | |||
98 | Note that the warning would go away marking either the extern | ||
99 | declaration, the definition, or both. However, we only mark | ||
100 | the definition of the alias, since we do not want callers | ||
101 | (which only see the declaration) to be compiled as if the function | ||
102 | was __cold (and therefore the paths leading to those calls | ||
103 | would be assumed to be unlikely). | ||
104 | |||
105 | Cc: <stable@vger.kernel.org> # 4.14+ | ||
106 | Link: https://lore.kernel.org/lkml/20190123173707.GA16603@gmail.com/ | ||
107 | Link: https://lore.kernel.org/lkml/20190206175627.GA20399@gmail.com/ | ||
108 | Suggested-by: Martin Sebor <msebor@gcc.gnu.org> | ||
109 | Acked-by: Jessica Yu <jeyu@kernel.org> | ||
110 | Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | ||
111 | Signed-off-by: Stefan Agner <stefan@agner.ch> | ||
112 | --- | ||
113 | include/linux/module.h | 4 ++-- | ||
114 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
115 | |||
116 | Index: git/include/linux/module.h | ||
117 | =================================================================== | ||
118 | --- git.orig/include/linux/module.h | ||
119 | +++ git/include/linux/module.h | ||
120 | @@ -129,13 +129,13 @@ extern void cleanup_module(void); | ||
121 | #define module_init(initfn) \ | ||
122 | static inline initcall_t __inittest(void) \ | ||
123 | { return initfn; } \ | ||
124 | - int init_module(void) __attribute__((alias(#initfn))); | ||
125 | + int init_module(void) __copy(initfn) __attribute__((alias(#initfn))); | ||
126 | |||
127 | /* This is only required if you want to be unloadable. */ | ||
128 | #define module_exit(exitfn) \ | ||
129 | static inline exitcall_t __exittest(void) \ | ||
130 | { return exitfn; } \ | ||
131 | - void cleanup_module(void) __attribute__((alias(#exitfn))); | ||
132 | + void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn))); | ||
133 | |||
134 | #endif | ||
135 | |||
diff --git a/recipes-kernel/linux/linux-fslc-imx_4.9-1.0.x.bb b/recipes-kernel/linux/linux-fslc-imx_4.9-1.0.x.bb index aff27bbf..3f4371d3 100644 --- a/recipes-kernel/linux/linux-fslc-imx_4.9-1.0.x.bb +++ b/recipes-kernel/linux/linux-fslc-imx_4.9-1.0.x.bb | |||
@@ -12,5 +12,8 @@ PV .= "+git${SRCPV}" | |||
12 | 12 | ||
13 | SRCBRANCH = "4.9-1.0.x-imx" | 13 | SRCBRANCH = "4.9-1.0.x-imx" |
14 | SRCREV = "953c6e30c9701fda69ef08e2476c541dc4fb1453" | 14 | SRCREV = "953c6e30c9701fda69ef08e2476c541dc4fb1453" |
15 | SRC_URI += "file://0001-compiler-attributes-add-support-for-copy-gcc-9.patch \ | ||
16 | file://0002-include-linux-module.h-copy-init-exit-attrs-to-.patch \ | ||
17 | " | ||
15 | 18 | ||
16 | COMPATIBLE_MACHINE = "(mx6|mx7)" | 19 | COMPATIBLE_MACHINE = "(mx6|mx7)" |