Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _LINUX_LINKAGE_H |
2 | #define _LINUX_LINKAGE_H | |
3 | ||
a7bf0bd5 | 4 | #include <linux/compiler.h> |
1da177e4 LT |
5 | #include <asm/linkage.h> |
6 | ||
7 | #ifdef __cplusplus | |
8 | #define CPP_ASMLINKAGE extern "C" | |
9 | #else | |
10 | #define CPP_ASMLINKAGE | |
11 | #endif | |
12 | ||
13 | #ifndef asmlinkage | |
14 | #define asmlinkage CPP_ASMLINKAGE | |
15 | #endif | |
16 | ||
d50efc6c IM |
17 | #ifndef asmregparm |
18 | # define asmregparm | |
19 | #endif | |
20 | ||
a7bf0bd5 JF |
21 | #define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE) |
22 | #define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE) | |
23 | ||
d2af12ae TA |
24 | /* |
25 | * For assembly routines. | |
26 | * | |
27 | * Note when using these that you must specify the appropriate | |
28 | * alignment directives yourself | |
29 | */ | |
30 | #define __PAGE_ALIGNED_DATA .section ".data.page_aligned", "aw" | |
31 | #define __PAGE_ALIGNED_BSS .section ".bss.page_aligned", "aw" | |
32 | ||
d10d89ec LT |
33 | /* |
34 | * This is used by architectures to keep arguments on the stack | |
35 | * untouched by the compiler by keeping them live until the end. | |
36 | * The argument stack may be owned by the assembly-language | |
37 | * caller, not the callee, and gcc doesn't always understand | |
38 | * that. | |
39 | * | |
40 | * We have the return value, and a maximum of six arguments. | |
41 | * | |
42 | * This should always be followed by a "return ret" for the | |
43 | * protection to work (ie no more work that the compiler might | |
44 | * end up needing stack temporaries for). | |
45 | */ | |
b0fac023 HC |
46 | /* Assembly files may be compiled with -traditional .. */ |
47 | #ifndef __ASSEMBLY__ | |
54a01510 RM |
48 | #ifndef asmlinkage_protect |
49 | # define asmlinkage_protect(n, ret, args...) do { } while (0) | |
1da177e4 | 50 | #endif |
b0fac023 | 51 | #endif |
1da177e4 LT |
52 | |
53 | #ifndef __ALIGN | |
54 | #define __ALIGN .align 4,0x90 | |
55 | #define __ALIGN_STR ".align 4,0x90" | |
56 | #endif | |
57 | ||
58 | #ifdef __ASSEMBLY__ | |
59 | ||
42f29a25 | 60 | #ifndef LINKER_SCRIPT |
1da177e4 LT |
61 | #define ALIGN __ALIGN |
62 | #define ALIGN_STR __ALIGN_STR | |
63 | ||
ab7efcc9 | 64 | #ifndef ENTRY |
1da177e4 LT |
65 | #define ENTRY(name) \ |
66 | .globl name; \ | |
67 | ALIGN; \ | |
68 | name: | |
ab7efcc9 | 69 | #endif |
42f29a25 | 70 | #endif /* LINKER_SCRIPT */ |
1da177e4 | 71 | |
214541d1 RR |
72 | #ifndef WEAK |
73 | #define WEAK(name) \ | |
74 | .weak name; \ | |
75 | name: | |
76 | #endif | |
77 | ||
ab7efcc9 JB |
78 | #ifndef END |
79 | #define END(name) \ | |
80 | .size name, .-name | |
81 | #endif | |
82 | ||
6b8be6df JR |
83 | /* If symbol 'name' is treated as a subroutine (gets called, and returns) |
84 | * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of | |
85 | * static analysis tools such as stack depth analyzer. | |
86 | */ | |
ab7efcc9 JB |
87 | #ifndef ENDPROC |
88 | #define ENDPROC(name) \ | |
89 | .type name, @function; \ | |
90 | END(name) | |
91 | #endif | |
d0aaff97 | 92 | |
1da177e4 LT |
93 | #endif |
94 | ||
95 | #define NORET_TYPE /**/ | |
96 | #define ATTRIB_NORET __attribute__((noreturn)) | |
97 | #define NORET_AND noreturn, | |
98 | ||
1da177e4 | 99 | #endif |