[34] | 1 | diff -pruN ../orig-linux-2.6.18/arch/i386/kernel/vmlinux.lds.S ./arch/i386/kernel/vmlinux.lds.S |
---|
| 2 | --- ../orig-linux-2.6.18/arch/i386/kernel/vmlinux.lds.S 2006-09-20 04:42:06.000000000 +0100 |
---|
| 3 | +++ ./arch/i386/kernel/vmlinux.lds.S 2007-01-12 18:19:44.000000000 +0000 |
---|
| 4 | @@ -13,6 +13,12 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386" |
---|
| 5 | OUTPUT_ARCH(i386) |
---|
| 6 | ENTRY(phys_startup_32) |
---|
| 7 | jiffies = jiffies_64; |
---|
| 8 | + |
---|
| 9 | +PHDRS { |
---|
| 10 | + text PT_LOAD FLAGS(5); /* R_E */ |
---|
| 11 | + data PT_LOAD FLAGS(7); /* RWE */ |
---|
| 12 | + note PT_NOTE FLAGS(4); /* R__ */ |
---|
| 13 | +} |
---|
| 14 | SECTIONS |
---|
| 15 | { |
---|
| 16 | . = __KERNEL_START; |
---|
| 17 | @@ -26,7 +32,7 @@ SECTIONS |
---|
| 18 | KPROBES_TEXT |
---|
| 19 | *(.fixup) |
---|
| 20 | *(.gnu.warning) |
---|
| 21 | - } = 0x9090 |
---|
| 22 | + } :text = 0x9090 |
---|
| 23 | |
---|
| 24 | _etext = .; /* End of text section */ |
---|
| 25 | |
---|
| 26 | @@ -48,7 +54,7 @@ SECTIONS |
---|
| 27 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ |
---|
| 28 | *(.data) |
---|
| 29 | CONSTRUCTORS |
---|
| 30 | - } |
---|
| 31 | + } :data |
---|
| 32 | |
---|
| 33 | . = ALIGN(4096); |
---|
| 34 | __nosave_begin = .; |
---|
| 35 | @@ -184,4 +190,6 @@ SECTIONS |
---|
| 36 | STABS_DEBUG |
---|
| 37 | |
---|
| 38 | DWARF_DEBUG |
---|
| 39 | + |
---|
| 40 | + NOTES |
---|
| 41 | } |
---|
| 42 | diff -pruN ../orig-linux-2.6.18/include/asm-generic/vmlinux.lds.h ./include/asm-generic/vmlinux.lds.h |
---|
| 43 | --- ../orig-linux-2.6.18/include/asm-generic/vmlinux.lds.h 2006-09-20 04:42:06.000000000 +0100 |
---|
| 44 | +++ ./include/asm-generic/vmlinux.lds.h 2007-01-12 18:19:44.000000000 +0000 |
---|
| 45 | @@ -194,3 +194,6 @@ |
---|
| 46 | .stab.index 0 : { *(.stab.index) } \ |
---|
| 47 | .stab.indexstr 0 : { *(.stab.indexstr) } \ |
---|
| 48 | .comment 0 : { *(.comment) } |
---|
| 49 | + |
---|
| 50 | +#define NOTES \ |
---|
| 51 | + .notes : { *(.note.*) } :note |
---|
| 52 | diff -pruN ../orig-linux-2.6.18/include/linux/elfnote.h ./include/linux/elfnote.h |
---|
| 53 | --- ../orig-linux-2.6.18/include/linux/elfnote.h 1970-01-01 01:00:00.000000000 +0100 |
---|
| 54 | +++ ./include/linux/elfnote.h 2007-01-12 18:19:44.000000000 +0000 |
---|
| 55 | @@ -0,0 +1,88 @@ |
---|
| 56 | +#ifndef _LINUX_ELFNOTE_H |
---|
| 57 | +#define _LINUX_ELFNOTE_H |
---|
| 58 | +/* |
---|
| 59 | + * Helper macros to generate ELF Note structures, which are put into a |
---|
| 60 | + * PT_NOTE segment of the final vmlinux image. These are useful for |
---|
| 61 | + * including name-value pairs of metadata into the kernel binary (or |
---|
| 62 | + * modules?) for use by external programs. |
---|
| 63 | + * |
---|
| 64 | + * Each note has three parts: a name, a type and a desc. The name is |
---|
| 65 | + * intended to distinguish the note's originator, so it would be a |
---|
| 66 | + * company, project, subsystem, etc; it must be in a suitable form for |
---|
| 67 | + * use in a section name. The type is an integer which is used to tag |
---|
| 68 | + * the data, and is considered to be within the "name" namespace (so |
---|
| 69 | + * "FooCo"'s type 42 is distinct from "BarProj"'s type 42). The |
---|
| 70 | + * "desc" field is the actual data. There are no constraints on the |
---|
| 71 | + * desc field's contents, though typically they're fairly small. |
---|
| 72 | + * |
---|
| 73 | + * All notes from a given NAME are put into a section named |
---|
| 74 | + * .note.NAME. When the kernel image is finally linked, all the notes |
---|
| 75 | + * are packed into a single .notes section, which is mapped into the |
---|
| 76 | + * PT_NOTE segment. Because notes for a given name are grouped into |
---|
| 77 | + * the same section, they'll all be adjacent the output file. |
---|
| 78 | + * |
---|
| 79 | + * This file defines macros for both C and assembler use. Their |
---|
| 80 | + * syntax is slightly different, but they're semantically similar. |
---|
| 81 | + * |
---|
| 82 | + * See the ELF specification for more detail about ELF notes. |
---|
| 83 | + */ |
---|
| 84 | + |
---|
| 85 | +#ifdef __ASSEMBLER__ |
---|
| 86 | +/* |
---|
| 87 | + * Generate a structure with the same shape as Elf{32,64}_Nhdr (which |
---|
| 88 | + * turn out to be the same size and shape), followed by the name and |
---|
| 89 | + * desc data with appropriate padding. The 'desc' argument includes |
---|
| 90 | + * the assembler pseudo op defining the type of the data: .asciz |
---|
| 91 | + * "hello, world" |
---|
| 92 | + */ |
---|
| 93 | +.macro ELFNOTE name type desc:vararg |
---|
| 94 | +.pushsection ".note.\name" |
---|
| 95 | + .align 4 |
---|
| 96 | + .long 2f - 1f /* namesz */ |
---|
| 97 | + .long 4f - 3f /* descsz */ |
---|
| 98 | + .long \type |
---|
| 99 | +1:.asciz "\name" |
---|
| 100 | +2:.align 4 |
---|
| 101 | +3:\desc |
---|
| 102 | +4:.align 4 |
---|
| 103 | +.popsection |
---|
| 104 | +.endm |
---|
| 105 | +#else /* !__ASSEMBLER__ */ |
---|
| 106 | +#include <linux/elf.h> |
---|
| 107 | +/* |
---|
| 108 | + * Use an anonymous structure which matches the shape of |
---|
| 109 | + * Elf{32,64}_Nhdr, but includes the name and desc data. The size and |
---|
| 110 | + * type of name and desc depend on the macro arguments. "name" must |
---|
| 111 | + * be a literal string, and "desc" must be passed by value. You may |
---|
| 112 | + * only define one note per line, since __LINE__ is used to generate |
---|
| 113 | + * unique symbols. |
---|
| 114 | + */ |
---|
| 115 | +#define _ELFNOTE_PASTE(a,b) a##b |
---|
| 116 | +#define _ELFNOTE(size, name, unique, type, desc) \ |
---|
| 117 | + static const struct { \ |
---|
| 118 | + struct elf##size##_note _nhdr; \ |
---|
| 119 | + unsigned char _name[sizeof(name)] \ |
---|
| 120 | + __attribute__((aligned(sizeof(Elf##size##_Word)))); \ |
---|
| 121 | + typeof(desc) _desc \ |
---|
| 122 | + __attribute__((aligned(sizeof(Elf##size##_Word)))); \ |
---|
| 123 | + } _ELFNOTE_PASTE(_note_, unique) \ |
---|
| 124 | + __attribute_used__ \ |
---|
| 125 | + __attribute__((section(".note." name), \ |
---|
| 126 | + aligned(sizeof(Elf##size##_Word)), \ |
---|
| 127 | + unused)) = { \ |
---|
| 128 | + { \ |
---|
| 129 | + sizeof(name), \ |
---|
| 130 | + sizeof(desc), \ |
---|
| 131 | + type, \ |
---|
| 132 | + }, \ |
---|
| 133 | + name, \ |
---|
| 134 | + desc \ |
---|
| 135 | + } |
---|
| 136 | +#define ELFNOTE(size, name, type, desc) \ |
---|
| 137 | + _ELFNOTE(size, name, __LINE__, type, desc) |
---|
| 138 | + |
---|
| 139 | +#define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc) |
---|
| 140 | +#define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc) |
---|
| 141 | +#endif /* __ASSEMBLER__ */ |
---|
| 142 | + |
---|
| 143 | +#endif /* _LINUX_ELFNOTE_H */ |
---|