aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2005-04-16 18:24:48 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:24:48 -0400
commitc97db4a0a7d4d5be8c64a8d649a4425ee195b05c (patch)
treee310d0f9918d7a47359872fa519e2abe10b5d522 /arch
parentecd02dddd1d5bfc2141cbd0e205a53fb9d849c9e (diff)
[PATCH] i386 vDSO: add PT_NOTE segment
This patch adds an ELF note to the vDSO giving the LINUX_VERSION_CODE value. Having this in the vDSO lets the dynamic linker avoid the `uname' syscall it now always does at startup to ascertain the kernel ABI available. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/Makefile6
-rw-r--r--arch/i386/kernel/vsyscall-note.S25
-rw-r--r--arch/i386/kernel/vsyscall.lds.S3
3 files changed, 31 insertions, 3 deletions
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 933787a46b4c..aacdae6f372d 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -56,7 +56,8 @@ SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags)
56SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags) 56SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags)
57 57
58$(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \ 58$(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
59$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE 59$(obj)/vsyscall-%.so: $(src)/vsyscall.lds \
60 $(obj)/vsyscall-%.o $(obj)/vsyscall-note.o FORCE
60 $(call if_changed,syscall) 61 $(call if_changed,syscall)
61 62
62# We also create a special relocatable object that should mirror the symbol 63# We also create a special relocatable object that should mirror the symbol
@@ -67,5 +68,6 @@ $(obj)/built-in.o: $(obj)/vsyscall-syms.o
67$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o 68$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
68 69
69SYSCFLAGS_vsyscall-syms.o = -r 70SYSCFLAGS_vsyscall-syms.o = -r
70$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE 71$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
72 $(obj)/vsyscall-sysenter.o $(obj)/vsyscall-note.o FORCE
71 $(call if_changed,syscall) 73 $(call if_changed,syscall)
diff --git a/arch/i386/kernel/vsyscall-note.S b/arch/i386/kernel/vsyscall-note.S
new file mode 100644
index 000000000000..d4b5be4f3d5f
--- /dev/null
+++ b/arch/i386/kernel/vsyscall-note.S
@@ -0,0 +1,25 @@
1/*
2 * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
3 * Here we can supply some information useful to userland.
4 */
5
6#include <linux/uts.h>
7#include <linux/version.h>
8
9#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \
10 .section name, flags; \
11 .balign 4; \
12 .long 1f - 0f; /* name length */ \
13 .long 3f - 2f; /* data length */ \
14 .long type; /* note type */ \
150: .asciz vendor; /* vendor name */ \
161: .balign 4; \
172:
18
19#define ASM_ELF_NOTE_END \
203: .balign 4; /* pad out section */ \
21 .previous
22
23 ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0)
24 .long LINUX_VERSION_CODE
25 ASM_ELF_NOTE_END
diff --git a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S
index 3a8329d6536e..a7977707c8e5 100644
--- a/arch/i386/kernel/vsyscall.lds.S
+++ b/arch/i386/kernel/vsyscall.lds.S
@@ -23,7 +23,7 @@ SECTIONS
23 . = VSYSCALL_BASE + 0x400; 23 . = VSYSCALL_BASE + 0x400;
24 24
25 .text : { *(.text) } :text =0x90909090 25 .text : { *(.text) } :text =0x90909090
26 26 .note : { *(.note.*) } :text :note
27 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 27 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
28 .eh_frame : { KEEP (*(.eh_frame)) } :text 28 .eh_frame : { KEEP (*(.eh_frame)) } :text
29 .dynamic : { *(.dynamic) } :text :dynamic 29 .dynamic : { *(.dynamic) } :text :dynamic
@@ -43,6 +43,7 @@ PHDRS
43{ 43{
44 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 44 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
45 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 45 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
46 note PT_NOTE FLAGS(4); /* PF_R */
46 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ 47 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
47} 48}
48 49