Skip to contentSkip to conversation

mm: Apply the section attribute to the variable, not its type

PATCH New [email protected] 2 participants 2 messages Sep 5, 2014 – Sep 9, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Apply the section attribute to the variable, not its type

From: Jan-Simon Möller <[email protected]>

This fixes a compilation error in clang in that a linker section attribute can't be added to a type.

arch/x86/mm/mmap.c:34:8: error: '__section__' attribute only applies to functions and global variables

struct __read_mostly va_alignment va_align = {
       ^
arch/x86/include/asm/cache.h:10:38: note: expanded from macro '__read_mostly'
#define __read_mostly __attribute__((__section__(".data..read_mostly")))
                                     ^

1 error generated.

By moving the section attribute to the variable declaration, the desired effect is acheived.

---
 arch/x86/mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/mmap.c +1 -1
index 25e7e13..919b912 100644
@@ -31,7 +31,7 @@
 #include <linux/sched.h>
 #include <asm/elf.h>
 
-struct __read_mostly va_alignment va_align = {
+struct va_alignment __read_mostly va_align = {
 	.flags = -1,
 };
 
Signature · 1 line
1.9.1
#1 lore raw

[tip:x86/urgent] x86/mm: Apply the section attribute to the variable, not its type

x86/mm: Apply the section attribute to the variable, not its type
Commit-ID:  cc99535eb4049c730cac421d403d079593cb31ae
Gitweb:     http://git.kernel.org/tip/cc99535eb4049c730cac421d403d079593cb31ae
Author:     Jan-Simon Möller <[email protected]>
AuthorDate: Fri, 5 Sep 2014 16:16:45 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 9 Sep 2014 07:13:39 +0200

x86/mm: Apply the section attribute to the variable, not its type

This fixes a compilation error in clang in that a linker section attribute can't be added to a type:

arch/x86/mm/mmap.c:34:8: error: '__section__' attribute only applies to functions and global variables struct __read_mostly
...

By moving the section attribute to the variable declaration, the desired effect is achieved.

---
 arch/x86/mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/mmap.c +1 -1
index 25e7e13..919b912 100644
@@ -31,7 +31,7 @@
 #include <linux/sched.h>
 #include <asm/elf.h>
 
-struct __read_mostly va_alignment va_align = {
+struct va_alignment __read_mostly va_align = {
 	.flags = -1,
 };