tree c216649f3cb02d7e5199a14d66a33c2b992cb7e8
parent b73fcc13a112889e86e4e00c525c030b4a7ee61c
author Roland McGrath <[EMAIL PROTECTED]> Tue Apr 12 08:25:20 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:25:20 2005
[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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Makefile | 6 ++++--
vsyscall-note.S | 25 +++++++++++++++++++++++++
vsyscall.lds.S | 3 ++-
3 files changed, 31 insertions(+), 3 deletions(-)
Index: arch/i386/kernel/Makefile
===================================================================
--- 597c7fbe362c431c40cb8ff4820ce8d6e77c4cdb/arch/i386/kernel/Makefile
(mode:100644 sha1:f84308961f52f312955cbd353cde90257017dff2)
+++ c216649f3cb02d7e5199a14d66a33c2b992cb7e8/arch/i386/kernel/Makefile
(mode:100644 sha1:6116825eedf0ea6af7c0a7ec662744bab02c27e3)
@@ -56,7 +56,8 @@
SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags)
$(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
-$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
+$(obj)/vsyscall-%.so: $(src)/vsyscall.lds \
+ $(obj)/vsyscall-%.o $(obj)/vsyscall-note.o FORCE
$(call if_changed,syscall)
# We also create a special relocatable object that should mirror the symbol
@@ -67,5 +68,6 @@
$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
SYSCFLAGS_vsyscall-syms.o = -r
-$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE
+$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
+ $(obj)/vsyscall-sysenter.o $(obj)/vsyscall-note.o FORCE
$(call if_changed,syscall)
Index: arch/i386/kernel/vsyscall-note.S
===================================================================
--- /dev/null (tree:597c7fbe362c431c40cb8ff4820ce8d6e77c4cdb)
+++ c216649f3cb02d7e5199a14d66a33c2b992cb7e8/arch/i386/kernel/vsyscall-note.S
(mode:100664 sha1:a37bb3b265898734a761c0b8faad377ce592a3dd)
@@ -0,0 +1,25 @@
+/*
+ * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
+ * Here we can supply some information useful to userland.
+ */
+
+#include <linux/uts.h>
+#include <linux/version.h>
+
+#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \
+ .section name, flags; \
+ .balign 4; \
+ .long 1f - 0f; /* name length */ \
+ .long 3f - 2f; /* data length */ \
+ .long type; /* note type */ \
+0: .asciz vendor; /* vendor name */ \
+1: .balign 4; \
+2:
+
+#define ASM_ELF_NOTE_END \
+3: .balign 4; /* pad out section */ \
+ .previous
+
+ ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0)
+ .long LINUX_VERSION_CODE
+ ASM_ELF_NOTE_END
Index: arch/i386/kernel/vsyscall.lds.S
===================================================================
--- 597c7fbe362c431c40cb8ff4820ce8d6e77c4cdb/arch/i386/kernel/vsyscall.lds.S
(mode:100644 sha1:403dd3131a660ac714207646de9128424dd9f562)
+++ c216649f3cb02d7e5199a14d66a33c2b992cb7e8/arch/i386/kernel/vsyscall.lds.S
(mode:100644 sha1:ee6acc4bad99aabae95474c048382a1451e53689)
@@ -23,7 +23,7 @@
. = VSYSCALL_BASE + 0x400;
.text : { *(.text) } :text =0x90909090
-
+ .note : { *(.note.*) } :text :note
.eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
.eh_frame : { KEEP (*(.eh_frame)) } :text
.dynamic : { *(.dynamic) } :text :dynamic
@@ -43,6 +43,7 @@
{
text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
+ note PT_NOTE FLAGS(4); /* PF_R */
eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
}
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html