Commit 03df4f6e authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Andi Kleen

[PATCH] i386: Clean up ELF note generation

Three cleanups:

1: ELF notes are never mapped, so there's no need to have any access
flags in their phdr.

2: When generating them from asm, tell the assembler to use a SHT_NOTE
section type.  There doesn't seem to be a way to do this from C.

3: Use ANSI rather than traditional cpp behaviour to stringify the
macro argument.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
parent 21564fd2
...@@ -30,7 +30,7 @@ jiffies = jiffies_64; ...@@ -30,7 +30,7 @@ jiffies = jiffies_64;
PHDRS { PHDRS {
text PT_LOAD FLAGS(5); /* R_E */ text PT_LOAD FLAGS(5); /* R_E */
data PT_LOAD FLAGS(7); /* RWE */ data PT_LOAD FLAGS(7); /* RWE */
note PT_NOTE FLAGS(4); /* R__ */ note PT_NOTE FLAGS(0); /* ___ */
} }
SECTIONS SECTIONS
{ {
......
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
} }
#define NOTES \ #define NOTES \
.notes : { *(.note.*) } :note .notes : { *(.note.*) } :note
#define INITCALLS \ #define INITCALLS \
*(.initcall0.init) \ *(.initcall0.init) \
......
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
* ELFNOTE(XYZCo, 12, .long, 0xdeadbeef) * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
*/ */
#define ELFNOTE(name, type, desctype, descdata) \ #define ELFNOTE(name, type, desctype, descdata) \
.pushsection .note.name ; \ .pushsection .note.name, "",@note ; \
.align 4 ; \ .align 4 ; \
.long 2f - 1f /* namesz */ ; \ .long 2f - 1f /* namesz */ ; \
.long 4f - 3f /* descsz */ ; \ .long 4f - 3f /* descsz */ ; \
.long type ; \ .long type ; \
1:.asciz "name" ; \ 1:.asciz #name ; \
2:.align 4 ; \ 2:.align 4 ; \
3:desctype descdata ; \ 3:desctype descdata ; \
4:.align 4 ; \ 4:.align 4 ; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment