[PATCH] i386: Clean up ELF note generation
authorJeremy Fitzhardinge <jeremy@goop.org>
Wed, 2 May 2007 17:27:17 +0000 (19:27 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Wed, 2 May 2007 17:27:17 +0000 (19:27 +0200)
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: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
arch/i386/kernel/vmlinux.lds.S
include/asm-generic/vmlinux.lds.h
include/linux/elfnote.h

index 568caca877156d354c3c2e20e43c7f91e756d5d9..23e8614edeee42e10728364f386a49976ced06ff 100644 (file)
@@ -30,7 +30,7 @@ jiffies = jiffies_64;
 PHDRS {
        text PT_LOAD FLAGS(5);  /* R_E */
        data PT_LOAD FLAGS(7);  /* RWE */
-       note PT_NOTE FLAGS(4);  /* R__ */
+       note PT_NOTE FLAGS(0);  /* ___ */
 }
 SECTIONS
 {
index 9fcc8d9fbb14e85250d9e4e610a773bcde39932d..f3806a74c4784c8097d58402fc7e3cbc642888d7 100644 (file)
        }
 
 #define NOTES                                                          \
-               .notes : { *(.note.*) } :note
+       .notes : { *(.note.*) } :note
 
 #define INITCALLS                                                      \
        *(.initcall0.init)                                              \
index 67396db141e8dad1efba423c02996832cf6aad59..9a1e0674e56ce6760d5088718d468981687f3c08 100644 (file)
  *      ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
  */
 #define ELFNOTE(name, type, desctype, descdata)        \
-.pushsection .note.name                        ;       \
+.pushsection .note.name, "",@note      ;       \
   .align 4                             ;       \
   .long 2f - 1f                /* namesz */    ;       \
   .long 4f - 3f                /* descsz */    ;       \
   .long type                           ;       \
-1:.asciz "name"                                ;       \
+1:.asciz #name                         ;       \
 2:.align 4                             ;       \
 3:desctype descdata                    ;       \
 4:.align 4                             ;       \