ia64/xen-unstable

view patches/linux-2.6.18/x86-elfnote-as-preprocessor-macro.patch @ 14131:64d80037e524

Save elfnotes in VM sxpr under image/notes, and load them on restore.
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
author kfraser@localhost.localdomain
date Mon Feb 26 09:59:56 2007 +0000 (2007-02-26)
parents 0a348e9ecedb
children
line source
1 diff -pruN ../orig-linux-2.6.18/include/linux/elfnote.h ./include/linux/elfnote.h
2 --- ../orig-linux-2.6.18/include/linux/elfnote.h 2007-01-12 18:19:44.000000000 +0000
3 +++ ./include/linux/elfnote.h 2007-01-12 18:21:02.000000000 +0000
4 @@ -31,22 +31,38 @@
5 /*
6 * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
7 * turn out to be the same size and shape), followed by the name and
8 - * desc data with appropriate padding. The 'desc' argument includes
9 - * the assembler pseudo op defining the type of the data: .asciz
10 - * "hello, world"
11 + * desc data with appropriate padding. The 'desctype' argument is the
12 + * assembler pseudo op defining the type of the data e.g. .asciz while
13 + * 'descdata' is the data itself e.g. "hello, world".
14 + *
15 + * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
16 + * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
17 */
18 -.macro ELFNOTE name type desc:vararg
19 -.pushsection ".note.\name"
20 - .align 4
21 - .long 2f - 1f /* namesz */
22 - .long 4f - 3f /* descsz */
23 - .long \type
24 -1:.asciz "\name"
25 -2:.align 4
26 -3:\desc
27 -4:.align 4
28 +#ifdef __STDC__
29 +#define ELFNOTE(name, type, desctype, descdata...) \
30 +.pushsection .note.name ; \
31 + .align 4 ; \
32 + .long 2f - 1f /* namesz */ ; \
33 + .long 4f - 3f /* descsz */ ; \
34 + .long type ; \
35 +1:.asciz #name ; \
36 +2:.align 4 ; \
37 +3:desctype descdata ; \
38 +4:.align 4 ; \
39 .popsection
40 -.endm
41 +#else /* !__STDC__, i.e. -traditional */
42 +#define ELFNOTE(name, type, desctype, descdata) \
43 +.pushsection .note.name ; \
44 + .align 4 ; \
45 + .long 2f - 1f /* namesz */ ; \
46 + .long 4f - 3f /* descsz */ ; \
47 + .long type ; \
48 +1:.asciz "name" ; \
49 +2:.align 4 ; \
50 +3:desctype descdata ; \
51 +4:.align 4 ; \
52 +.popsection
53 +#endif /* __STDC__ */
54 #else /* !__ASSEMBLER__ */
55 #include <linux/elf.h>
56 /*