linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slab: work around clang bug #42570
@ 2019-07-12  9:04 Arnd Bergmann
  2019-07-12 17:30 ` David Rientjes
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-07-12  9:04 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton
  Cc: Arnd Bergmann, Stephen Rothwell, Roman Gushchin, Shakeel Butt,
	Vladimir Davydov, Andrey Konovalov, linux-mm, linux-kernel,
	clang-built-linux

Clang gets rather confused about two variables in the same special
section when one of them is not initialized, leading to an assembler
warning later:

/tmp/slab_common-18f869.s: Assembler messages:
/tmp/slab_common-18f869.s:7526: Warning: ignoring changed section attributes for .data..ro_after_init

Adding an initialization to kmalloc_caches is rather silly here
but does avoid the issue.

Link: https://bugs.llvm.org/show_bug.cgi?id=42570
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
We might decide to wait until this is fixed in clang, but
so far all versions targetting x86 seem to be affected.
---
 mm/slab_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 6c49dbb3769e..807490fe217a 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1028,7 +1028,8 @@ struct kmem_cache *__init create_kmalloc_cache(const char *name,
 }
 
 struct kmem_cache *
-kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1] __ro_after_init;
+kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1] __ro_after_init =
+{ /* initialization for https://bugs.llvm.org/show_bug.cgi?id=42570 */ };
 EXPORT_SYMBOL(kmalloc_caches);
 
 /*
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] slab: work around clang bug #42570
  2019-07-12  9:04 [PATCH] slab: work around clang bug #42570 Arnd Bergmann
@ 2019-07-12 17:30 ` David Rientjes
  0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2019-07-12 17:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Christoph Lameter, Pekka Enberg, Joonsoo Kim, Andrew Morton,
	Stephen Rothwell, Roman Gushchin, Shakeel Butt, Vladimir Davydov,
	Andrey Konovalov, linux-mm, linux-kernel, clang-built-linux

On Fri, 12 Jul 2019, Arnd Bergmann wrote:

> Clang gets rather confused about two variables in the same special
> section when one of them is not initialized, leading to an assembler
> warning later:
> 
> /tmp/slab_common-18f869.s: Assembler messages:
> /tmp/slab_common-18f869.s:7526: Warning: ignoring changed section attributes for .data..ro_after_init
> 
> Adding an initialization to kmalloc_caches is rather silly here
> but does avoid the issue.
> 
> Link: https://bugs.llvm.org/show_bug.cgi?id=42570
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: David Rientjes <rientjes@google.com>

Let me followup on the clang bug as well.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-12 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12  9:04 [PATCH] slab: work around clang bug #42570 Arnd Bergmann
2019-07-12 17:30 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).