UML - part 1 of 3
PATCH 1/1 UML - part 1 of 3
This a preparatory patch which allows UML to avoid changing linux/linkage.h.
It restructures linkage.h so that all of the arch-specific stuff is in asm-*/linkage.h. linux/linkage.h is now arch independent. It should be functionally unchanged.
Five arches, i386, ia64, sh, m68k, and arm, have non-empty linkage.h files. The other arch linkage.h files are all empty.
Also, __ALIGN_STR is no longer defined independently of __ALIGN. It is now derived by stringizing __ALIGN.
Following a suggestion by Keith Owens, stringify.h was generalized to allow commas in its argument, linkage.h now includes it, and no longer defines its own stringify macros.
Jeff
include/linux/linkage.h +10 -31
@@ -2,6 +2,8 @@#define _LINUX_LINKAGE_H#include <linux/config.h> +#include <linux/stringify.h> +#include <asm/linkage.h> #ifdef __cplusplus#define CPP_ASMLINKAGE extern "C"
@@ -9,36 +11,15 @@#define CPP_ASMLINKAGE #endif -#if defined __i386__ -#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) -#elif defined __ia64__ -#define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage)) -#else +#ifndef asmlinkage#define asmlinkage CPP_ASMLINKAGE#endif -#ifdef __arm__ -#define __ALIGN .align 0 -#define __ALIGN_STR ".align 0" -#else -#ifdef __mc68000__ -#define __ALIGN .align 4 -#define __ALIGN_STR ".align 4" -#else -#ifdef __sh__ -#define __ALIGN .balign 4 -#define __ALIGN_STR ".balign 4" -#else -#if defined(__i386__) && defined(CONFIG_X86_ALIGNMENT_16 ) -#define __ALIGN .align 16,0x90 -#define __ALIGN_STR ".align 16,0x90" -#else +#ifndef __ALIGN#define __ALIGN .align 4,0x90 -#define __ALIGN_STR ".align 4,0x90"#endif -#endif /* __sh__ */ -#endif /* __mc68000__ */ -#endif /* __arm__ */ + +#define __ALIGN_STR __stringify(__ALIGN)#ifdef __ASSEMBLY__
@@ -52,13 +33,11 @@#endif -# define NORET_TYPE /**/ -# define ATTRIB_NORET __attribute__((noreturn)) -# define NORET_AND noreturn, +#define NORET_TYPE /**/ +#define ATTRIB_NORET __attribute__((noreturn)) +#define NORET_AND noreturn, -#ifdef __i386__ -#define FASTCALL (x) x __attribute__((regparm(3))) -#else +#ifndef FASTCALL #define FASTCALL (x) x#endif
include/linux/stringify.h +6 -2
@@ -4,9 +4,13 @@/* Indirect stringification. Doing two levels allows the parameter to be a * macro itself. For example, compile with -DFOO=bar, __stringify(FOO) * converts to "bar". +* +* The "..." is gcc's cpp vararg macro syntax. It is required because __ALIGN, +* in linkage.h, contains a comma, which when expanded, causes it to look +* like two arguments, which breaks the standard non-vararg stringizer. */ -#define __stringify_1 (x) #x -#define __stringify (x) __stringify_1(x) +#define __stringify_1 (...) #__VA_ARGS__ +#define __stringify (...) __stringify_1(__VA_ARGS__)#endif /* !__LINUX_STRINGIFY_H */
include/asm-i386/linkage.h +11 -0
@@ -0,0 +1,11 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) +#define FASTCALL (x) x __attribute__((regparm(3))) + +#ifdef CONFIG_X86_ALIGNMENT_16 +#define __ALIGN .align 16,0x90 +#endif + +#endif
include/asm-arm/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define __ALIGN .align 0 + +#endif
include/asm-ia64/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage)) + +#endif
include/asm-m68k/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define __ALIGN .align 4 + +#endif
include/asm-sh/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define __ALIGN .balign 4 + +#endif
include/asm-alpha/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-cris/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-mips/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-mips64/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-parisc/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-ppc/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-ppc64/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-s390/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-s390x/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-sparc/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-sparc64/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif
include/asm-x86_64/linkage.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* Nothing to see here... */ + +#endif