History

linkage: Introduce new macros for assembler symbols

Introduce new C macros for annotations of functions and data in assembly. There is a long-standing mess in macros like ENTRY, END, ENDPROC and similar. They are used in different manners and sometimes incorrectly. So introduce macros with clear use to annotate assembly as follows: a) Support macros for the ones below SYM_T_FUNC -- type used by assembler to mark functions SYM_T_OBJECT -- type used by assembler to mark data SYM_T_NONE -- type used by assembler to mark entries of unknown type They are defined as STT_FUNC, STT_OBJECT, and STT_NOTYPE respectively. According to the gas manual, this is the most portable way. I am not sure about other assemblers, so this can be switched back to %function and %object if this turns into a problem. Architectures can also override them by something like ", @function" if they need. SYM_A_ALIGN, SYM_A_NONE -- align the symbol? SYM_L_GLOBAL, SYM_L_WEAK, SYM_L_LOCAL -- linkage of symbols b) Mostly internal annotations, used by the ones below SYM_ENTRY -- use only if you have to (for non-paired symbols) SYM_START -- use only if you have to (for paired symbols) SYM_END -- use only if you have to (for paired symbols) c) Annotations for code SYM_INNER_LABEL_ALIGN -- only for labels in the middle of code SYM_INNER_LABEL -- only for labels in the middle of code SYM_FUNC_START_LOCAL_ALIAS -- use where there are two local names for one function SYM_FUNC_START_ALIAS -- use where there are two global names for one function SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function SYM_FUNC_START -- use for global functions SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment SYM_FUNC_START_LOCAL -- use for local functions SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment SYM_FUNC_START_WEAK -- use for weak functions SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START, SYM_FUNC_START_WEAK, ... For functions with special (non-C) calling conventions: SYM_CODE_START -- use for non-C (special) functions SYM_CODE_START_NOALIGN -- use for non-C (special) functions, w/o alignment SYM_CODE_START_LOCAL -- use for local non-C (special) functions SYM_CODE_START_LOCAL_NOALIGN -- use for local non-C (special) functions, w/o alignment SYM_CODE_END -- the end of SYM_CODE_START_LOCAL or SYM_CODE_START d) For data SYM_DATA_START -- global data symbol SYM_DATA_START_LOCAL -- local data symbol SYM_DATA_END -- the end of the SYM_DATA_START symbol SYM_DATA_END_LABEL -- the labeled end of SYM_DATA_START symbol SYM_DATA -- start+end wrapper around simple global data SYM_DATA_LOCAL -- start+end wrapper around simple local data ========== The macros allow to pair starts and ends of functions and mark functions correctly in the output ELF objects. All users of the old macros in x86 are converted to use these in further patches.

Jiri Slaby committed 7 years ago

Commit ffedeeb1 parent 30a24414 files · +468 −11Browse files

Unified · Split

4 files
  1. Documentation/asm-annotations.rst +216 −0
  2. Documentation/index.rst +8 −0
  3. arch/x86/include/asm/linkage.h +7 −3
  4. include/linux/linkage.h +237 −8
Documentation/asm-annotations.rst+216−0
@@ -0,0 +1,216 @@
1+Assembler Annotations
2+=====================
3+
4+Copyright (c) 2017-2019 Jiri Slaby
5+
6+This document describes the new macros for annotation of data and code in
7+assembly. In particular, it contains information about ``SYM_FUNC_START``,
8+``SYM_FUNC_END``, ``SYM_CODE_START``, and similar.
9+
10+Rationale
11+---------
12+Some code like entries, trampolines, or boot code needs to be written in
13+assembly. The same as in C, such code is grouped into functions and
14+accompanied with data. Standard assemblers do not force users into precisely
15+marking these pieces as code, data, or even specifying their length.
16+Nevertheless, assemblers provide developers with such annotations to aid
17+debuggers throughout assembly. On top of that, developers also want to mark
18+some functions as *global* in order to be visible outside of their translation
19+units.
20+
21+Over time, the Linux kernel has adopted macros from various projects (like
22+``binutils``) to facilitate such annotations. So for historic reasons,
23+developers have been using ``ENTRY``, ``END``, ``ENDPROC``, and other
24+annotations in assembly. Due to the lack of their documentation, the macros
25+are used in rather wrong contexts at some locations. Clearly, ``ENTRY`` was
26+intended to denote the beginning of global symbols (be it data or code).
27+``END`` used to mark the end of data or end of special functions with
28+*non-standard* calling convention. In contrast, ``ENDPROC`` should annotate
29+only ends of *standard* functions.
30+
31+When these macros are used correctly, they help assemblers generate a nice
32+object with both sizes and types set correctly. For example, the result of
33+``arch/x86/lib/putuser.S``::
34+
35+ Num: Value Size Type Bind Vis Ndx Name
36+ 25: 0000000000000000 33 FUNC GLOBAL DEFAULT 1 __put_user_1
37+ 29: 0000000000000030 37 FUNC GLOBAL DEFAULT 1 __put_user_2
38+ 32: 0000000000000060 36 FUNC GLOBAL DEFAULT 1 __put_user_4
39+ 35: 0000000000000090 37 FUNC GLOBAL DEFAULT 1 __put_user_8
40+
41+This is not only important for debugging purposes. When there are properly
42+annotated objects like this, tools can be run on them to generate more useful
43+information. In particular, on properly annotated objects, ``objtool`` can be
44+run to check and fix the object if needed. Currently, ``objtool`` can report
45+missing frame pointer setup/destruction in functions. It can also
46+automatically generate annotations for :doc:`ORC unwinder <x86/orc-unwinder>`
47+for most code. Both of these are especially important to support reliable
48+stack traces which are in turn necessary for :doc:`Kernel live patching
49+<livepatch/livepatch>`.
50+
51+Caveat and Discussion
52+---------------------
53+As one might realize, there were only three macros previously. That is indeed
54+insufficient to cover all the combinations of cases:
55+
56+* standard/non-standard function
57+* code/data
58+* global/local symbol
59+
60+There was a discussion_ and instead of extending the current ``ENTRY/END*``
61+macros, it was decided that brand new macros should be introduced instead::
62+
63+ So how about using macro names that actually show the purpose, instead
64+ of importing all the crappy, historic, essentially randomly chosen
65+ debug symbol macro names from the binutils and older kernels?
66+
67+.. _discussion: https://lkml.kernel.org/r/20170217104757.28588-1-jslaby@suse.cz
68+
69+Macros Description
70+------------------
71+
72+The new macros are prefixed with the ``SYM_`` prefix and can be divided into
73+three main groups:
74+
75+1. ``SYM_FUNC_*`` -- to annotate C-like functions. This means functions with
76+ standard C calling conventions, i.e. the stack contains a return address at
77+ the predefined place and a return from the function can happen in a
78+ standard way. When frame pointers are enabled, save/restore of frame
79+ pointer shall happen at the start/end of a function, respectively, too.
80+
81+ Checking tools like ``objtool`` should ensure such marked functions conform
82+ to these rules. The tools can also easily annotate these functions with
83+ debugging information (like *ORC data*) automatically.
84+
85+2. ``SYM_CODE_*`` -- special functions called with special stack. Be it
86+ interrupt handlers with special stack content, trampolines, or startup
87+ functions.
88+
89+ Checking tools mostly ignore checking of these functions. But some debug
90+ information still can be generated automatically. For correct debug data,
91+ this code needs hints like ``UNWIND_HINT_REGS`` provided by developers.
92+
93+3. ``SYM_DATA*`` -- obviously data belonging to ``.data`` sections and not to
94+ ``.text``. Data do not contain instructions, so they have to be treated
95+ specially by the tools: they should not treat the bytes as instructions,
96+ nor assign any debug information to them.
97+
98+Instruction Macros
99+~~~~~~~~~~~~~~~~~~
100+This section covers ``SYM_FUNC_*`` and ``SYM_CODE_*`` enumerated above.
101+
102+* ``SYM_FUNC_START`` and ``SYM_FUNC_START_LOCAL`` are supposed to be **the
103+ most frequent markings**. They are used for functions with standard calling
104+ conventions -- global and local. Like in C, they both align the functions to
105+ architecture specific ``__ALIGN`` bytes. There are also ``_NOALIGN`` variants
106+ for special cases where developers do not want this implicit alignment.
107+
108+ ``SYM_FUNC_START_WEAK`` and ``SYM_FUNC_START_WEAK_NOALIGN`` markings are
109+ also offered as an assembler counterpart to the *weak* attribute known from
110+ C.
111+
112+ All of these **shall** be coupled with ``SYM_FUNC_END``. First, it marks
113+ the sequence of instructions as a function and computes its size to the
114+ generated object file. Second, it also eases checking and processing such
115+ object files as the tools can trivially find exact function boundaries.
116+
117+ So in most cases, developers should write something like in the following
118+ example, having some asm instructions in between the macros, of course::
119+
120+ SYM_FUNC_START(function_hook)
121+ ... asm insns ...
122+ SYM_FUNC_END(function_hook)
123+
124+ In fact, this kind of annotation corresponds to the now deprecated ``ENTRY``
125+ and ``ENDPROC`` macros.
126+
127+* ``SYM_FUNC_START_ALIAS`` and ``SYM_FUNC_START_LOCAL_ALIAS`` serve for those
128+ who decided to have two or more names for one function. The typical use is::
129+
130+ SYM_FUNC_START_ALIAS(__memset)
131+ SYM_FUNC_START(memset)
132+ ... asm insns ...
133+ SYM_FUNC_END(memset)
134+ SYM_FUNC_END_ALIAS(__memset)
135+
136+ In this example, one can call ``__memset`` or ``memset`` with the same
137+ result, except the debug information for the instructions is generated to
138+ the object file only once -- for the non-``ALIAS`` case.
139+
140+* ``SYM_CODE_START`` and ``SYM_CODE_START_LOCAL`` should be used only in
141+ special cases -- if you know what you are doing. This is used exclusively
142+ for interrupt handlers and similar where the calling convention is not the C
143+ one. ``_NOALIGN`` variants exist too. The use is the same as for the ``FUNC``
144+ category above::
145+
146+ SYM_CODE_START_LOCAL(bad_put_user)
147+ ... asm insns ...
148+ SYM_CODE_END(bad_put_user)
149+
150+ Again, every ``SYM_CODE_START*`` **shall** be coupled by ``SYM_CODE_END``.
151+
152+ To some extent, this category corresponds to deprecated ``ENTRY`` and
153+ ``END``. Except ``END`` had several other meanings too.
154+
155+* ``SYM_INNER_LABEL*`` is used to denote a label inside some
156+ ``SYM_{CODE,FUNC}_START`` and ``SYM_{CODE,FUNC}_END``. They are very similar
157+ to C labels, except they can be made global. An example of use::
158+
159+ SYM_CODE_START(ftrace_caller)
160+ /* save_mcount_regs fills in first two parameters */
161+ ...
162+
163+ SYM_INNER_LABEL(ftrace_caller_op_ptr, SYM_L_GLOBAL)
164+ /* Load the ftrace_ops into the 3rd parameter */
165+ ...
166+
167+ SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
168+ call ftrace_stub
169+ ...
170+ retq
171+ SYM_CODE_END(ftrace_caller)
172+
173+Data Macros
174+~~~~~~~~~~~
175+Similar to instructions, there is a couple of macros to describe data in the
176+assembly.
177+
178+* ``SYM_DATA_START`` and ``SYM_DATA_START_LOCAL`` mark the start of some data
179+ and shall be used in conjunction with either ``SYM_DATA_END``, or
180+ ``SYM_DATA_END_LABEL``. The latter adds also a label to the end, so that
181+ people can use ``lstack`` and (local) ``lstack_end`` in the following
182+ example::
183+
184+ SYM_DATA_START_LOCAL(lstack)
185+ .skip 4096
186+ SYM_DATA_END_LABEL(lstack, SYM_L_LOCAL, lstack_end)
187+
188+* ``SYM_DATA`` and ``SYM_DATA_LOCAL`` are variants for simple, mostly one-line
189+ data::
190+
191+ SYM_DATA(HEAP, .long rm_heap)
192+ SYM_DATA(heap_end, .long rm_stack)
193+
194+ In the end, they expand to ``SYM_DATA_START`` with ``SYM_DATA_END``
195+ internally.
196+
197+Support Macros
198+~~~~~~~~~~~~~~
199+All the above reduce themselves to some invocation of ``SYM_START``,
200+``SYM_END``, or ``SYM_ENTRY`` at last. Normally, developers should avoid using
201+these.
202+
203+Further, in the above examples, one could see ``SYM_L_LOCAL``. There are also
204+``SYM_L_GLOBAL`` and ``SYM_L_WEAK``. All are intended to denote linkage of a
205+symbol marked by them. They are used either in ``_LABEL`` variants of the
206+earlier macros, or in ``SYM_START``.
207+
208+
209+Overriding Macros
210+~~~~~~~~~~~~~~~~~
211+Architecture can also override any of the macros in their own
212+``asm/linkage.h``, including macros specifying the type of a symbol
213+(``SYM_T_FUNC``, ``SYM_T_OBJECT``, and ``SYM_T_NONE``). As every macro
214+described in this file is surrounded by ``#ifdef`` + ``#endif``, it is enough
215+to define the macros differently in the aforementioned architecture-dependent
216+header.
Documentation/index.rst+8−0
@@ -135,6 +135,14 @@ needed). · 134 unmodified lines
135135 mic/index
136136 scheduler/index
137137
138+Architecture-agnostic documentation
139+-----------------------------------
140+
141+.. toctree::
142+ :maxdepth: 2
143+
144+ asm-annotations
145+
138146 Architecture-specific documentation
139147 -----------------------------------
140148
arch/x86/include/asm/linkage.h+7−3
@@ -13,9 +13,13 @@ · 12 unmodified lines
1313
1414 #ifdef __ASSEMBLY__
1515
16−#define GLOBAL(name) \
17− .globl name; \
18− name:
16+/*
17+ * GLOBAL is DEPRECATED
18+ *
19+ * use SYM_DATA_START, SYM_FUNC_START, SYM_INNER_LABEL, SYM_CODE_START, or
20+ * similar
21+ */
22+#define GLOBAL(name) SYM_ENTRY(name, SYM_L_GLOBAL, SYM_A_NONE)
1923
2024 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
2125 #define __ALIGN .p2align 4, 0x90
include/linux/linkage.h+237−8
@@ -75,32 +75,58 @@ · 74 unmodified lines
7575
7676 #ifdef __ASSEMBLY__
7777
78+/* SYM_T_FUNC -- type used by assembler to mark functions */
79+#ifndef SYM_T_FUNC
80+#define SYM_T_FUNC STT_FUNC
81+#endif
82+
83+/* SYM_T_OBJECT -- type used by assembler to mark data */
84+#ifndef SYM_T_OBJECT
85+#define SYM_T_OBJECT STT_OBJECT
86+#endif
87+
88+/* SYM_T_NONE -- type used by assembler to mark entries of unknown type */
89+#ifndef SYM_T_NONE
90+#define SYM_T_NONE STT_NOTYPE
91+#endif
92+
93+/* SYM_A_* -- align the symbol? */
94+#define SYM_A_ALIGN ALIGN
95+#define SYM_A_NONE /* nothing */
96+
97+/* SYM_L_* -- linkage of symbols */
98+#define SYM_L_GLOBAL(name) .globl name
99+#define SYM_L_WEAK(name) .weak name
100+#define SYM_L_LOCAL(name) /* nothing */
101+
78102 #ifndef LINKER_SCRIPT
79103 #define ALIGN __ALIGN
80104 #define ALIGN_STR __ALIGN_STR
81105
106+/* === DEPRECATED annotations === */
107+
82108 #ifndef GLOBAL
109+/* deprecated, use SYM_DATA*, SYM_ENTRY, or similar */
83110 #define GLOBAL(name) \
84111 .globl name ASM_NL \
85112 name:
86113 #endif
87114
88115 #ifndef ENTRY
116+/* deprecated, use SYM_FUNC_START */
89117 #define ENTRY(name) \
90− .globl name ASM_NL \
91− ALIGN ASM_NL \
92− name:
118+ SYM_FUNC_START(name)
93119 #endif
94120 #endif /* LINKER_SCRIPT */
95121
96122 #ifndef WEAK
123+/* deprecated, use SYM_FUNC_START_WEAK* */
97124 #define WEAK(name) \
98− .weak name ASM_NL \
99− ALIGN ASM_NL \
100− name:
125+ SYM_FUNC_START_WEAK(name)
101126 #endif
102127
103128 #ifndef END
129+/* deprecated, use SYM_FUNC_END, SYM_DATA_END, or SYM_END */
104130 #define END(name) \
105131 .size name, .-name
106132 #endif
@@ -110,11 +136,214 @@ · 3 unmodified lines
110136 * static analysis tools such as stack depth analyzer.
111137 */
112138 #ifndef ENDPROC
139+/* deprecated, use SYM_FUNC_END */
113140 #define ENDPROC(name) \
114− .type name, @function ASM_NL \
115− END(name)
141+ SYM_FUNC_END(name)
142+#endif
143+
144+/* === generic annotations === */
145+
146+/* SYM_ENTRY -- use only if you have to for non-paired symbols */
147+#ifndef SYM_ENTRY
148+#define SYM_ENTRY(name, linkage, align...) \
149+ linkage(name) ASM_NL \
150+ align ASM_NL \
151+ name:
152+#endif
153+
154+/* SYM_START -- use only if you have to */
155+#ifndef SYM_START
156+#define SYM_START(name, linkage, align...) \
157+ SYM_ENTRY(name, linkage, align)
158+#endif
159+
160+/* SYM_END -- use only if you have to */
161+#ifndef SYM_END
162+#define SYM_END(name, sym_type) \
163+ .type name sym_type ASM_NL \
164+ .size name, .-name
165+#endif
166+
167+/* === code annotations === */
168+
169+/*
170+ * FUNC -- C-like functions (proper stack frame etc.)
171+ * CODE -- non-C code (e.g. irq handlers with different, special stack etc.)
172+ *
173+ * Objtool validates stack for FUNC, but not for CODE.
174+ * Objtool generates debug info for both FUNC & CODE, but needs special
175+ * annotations for each CODE's start (to describe the actual stack frame).
176+ *
177+ * ALIAS -- does not generate debug info -- the aliased function will
178+ */
179+
180+/* SYM_INNER_LABEL_ALIGN -- only for labels in the middle of code */
181+#ifndef SYM_INNER_LABEL_ALIGN
182+#define SYM_INNER_LABEL_ALIGN(name, linkage) \
183+ .type name SYM_T_NONE ASM_NL \
184+ SYM_ENTRY(name, linkage, SYM_A_ALIGN)
185+#endif
186+
187+/* SYM_INNER_LABEL -- only for labels in the middle of code */
188+#ifndef SYM_INNER_LABEL
189+#define SYM_INNER_LABEL(name, linkage) \
190+ .type name SYM_T_NONE ASM_NL \
191+ SYM_ENTRY(name, linkage, SYM_A_NONE)
192+#endif
193+
194+/*
195+ * SYM_FUNC_START_LOCAL_ALIAS -- use where there are two local names for one
196+ * function
197+ */
198+#ifndef SYM_FUNC_START_LOCAL_ALIAS
199+#define SYM_FUNC_START_LOCAL_ALIAS(name) \
200+ SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
201+#endif
202+
203+/*
204+ * SYM_FUNC_START_ALIAS -- use where there are two global names for one
205+ * function
206+ */
207+#ifndef SYM_FUNC_START_ALIAS
208+#define SYM_FUNC_START_ALIAS(name) \
209+ SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
210+#endif
211+
212+/* SYM_FUNC_START -- use for global functions */
213+#ifndef SYM_FUNC_START
214+/*
215+ * The same as SYM_FUNC_START_ALIAS, but we will need to distinguish these two
216+ * later.
217+ */
218+#define SYM_FUNC_START(name) \
219+ SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
220+#endif
221+
222+/* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */
223+#ifndef SYM_FUNC_START_NOALIGN
224+#define SYM_FUNC_START_NOALIGN(name) \
225+ SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
226+#endif
227+
228+/* SYM_FUNC_START_LOCAL -- use for local functions */
229+#ifndef SYM_FUNC_START_LOCAL
230+/* the same as SYM_FUNC_START_LOCAL_ALIAS, see comment near SYM_FUNC_START */
231+#define SYM_FUNC_START_LOCAL(name) \
232+ SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
116233 #endif
117234
235+/* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */
236+#ifndef SYM_FUNC_START_LOCAL_NOALIGN
237+#define SYM_FUNC_START_LOCAL_NOALIGN(name) \
238+ SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
118239 #endif
119240
241+/* SYM_FUNC_START_WEAK -- use for weak functions */
242+#ifndef SYM_FUNC_START_WEAK
243+#define SYM_FUNC_START_WEAK(name) \
244+ SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)
120245 #endif
246+
247+/* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */
248+#ifndef SYM_FUNC_START_WEAK_NOALIGN
249+#define SYM_FUNC_START_WEAK_NOALIGN(name) \
250+ SYM_START(name, SYM_L_WEAK, SYM_A_NONE)
251+#endif
252+
253+/* SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function */
254+#ifndef SYM_FUNC_END_ALIAS
255+#define SYM_FUNC_END_ALIAS(name) \
256+ SYM_END(name, SYM_T_FUNC)
257+#endif
258+
259+/*
260+ * SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START,
261+ * SYM_FUNC_START_WEAK, ...
262+ */
263+#ifndef SYM_FUNC_END
264+/* the same as SYM_FUNC_END_ALIAS, see comment near SYM_FUNC_START */
265+#define SYM_FUNC_END(name) \
266+ SYM_END(name, SYM_T_FUNC)
267+#endif
268+
269+/* SYM_CODE_START -- use for non-C (special) functions */
270+#ifndef SYM_CODE_START
271+#define SYM_CODE_START(name) \
272+ SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
273+#endif
274+
275+/* SYM_CODE_START_NOALIGN -- use for non-C (special) functions, w/o alignment */
276+#ifndef SYM_CODE_START_NOALIGN
277+#define SYM_CODE_START_NOALIGN(name) \
278+ SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
279+#endif
280+
281+/* SYM_CODE_START_LOCAL -- use for local non-C (special) functions */
282+#ifndef SYM_CODE_START_LOCAL
283+#define SYM_CODE_START_LOCAL(name) \
284+ SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
285+#endif
286+
287+/*
288+ * SYM_CODE_START_LOCAL_NOALIGN -- use for local non-C (special) functions,
289+ * w/o alignment
290+ */
291+#ifndef SYM_CODE_START_LOCAL_NOALIGN
292+#define SYM_CODE_START_LOCAL_NOALIGN(name) \
293+ SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
294+#endif
295+
296+/* SYM_CODE_END -- the end of SYM_CODE_START_LOCAL, SYM_CODE_START, ... */
297+#ifndef SYM_CODE_END
298+#define SYM_CODE_END(name) \
299+ SYM_END(name, SYM_T_NONE)
300+#endif
301+
302+/* === data annotations === */
303+
304+/* SYM_DATA_START -- global data symbol */
305+#ifndef SYM_DATA_START
306+#define SYM_DATA_START(name) \
307+ SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
308+#endif
309+
310+/* SYM_DATA_START -- local data symbol */
311+#ifndef SYM_DATA_START_LOCAL
312+#define SYM_DATA_START_LOCAL(name) \
313+ SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
314+#endif
315+
316+/* SYM_DATA_END -- the end of SYM_DATA_START symbol */
317+#ifndef SYM_DATA_END
318+#define SYM_DATA_END(name) \
319+ SYM_END(name, SYM_T_OBJECT)
320+#endif
321+
322+/* SYM_DATA_END_LABEL -- the labeled end of SYM_DATA_START symbol */
323+#ifndef SYM_DATA_END_LABEL
324+#define SYM_DATA_END_LABEL(name, linkage, label) \
325+ linkage(label) ASM_NL \
326+ .type label SYM_T_OBJECT ASM_NL \
327+ label: \
328+ SYM_END(name, SYM_T_OBJECT)
329+#endif
330+
331+/* SYM_DATA -- start+end wrapper around simple global data */
332+#ifndef SYM_DATA
333+#define SYM_DATA(name, data...) \
334+ SYM_DATA_START(name) ASM_NL \
335+ data ASM_NL \
336+ SYM_DATA_END(name)
337+#endif
338+
339+/* SYM_DATA_LOCAL -- start+end wrapper around simple local data */
340+#ifndef SYM_DATA_LOCAL
341+#define SYM_DATA_LOCAL(name, data...) \
342+ SYM_DATA_START_LOCAL(name) ASM_NL \
343+ data ASM_NL \
344+ SYM_DATA_END(name)
345+#endif
346+
347+#endif /* __ASSEMBLY__ */
348+
349+#endif /* _LINUX_LINKAGE_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t