From: akpm@osdl.org
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, roland@redhat.com
Subject: [patch 065/198] i386 vDSO: add PT_NOTE segment
Date: Tue, 12 Apr 2005 03:31:37 -0700 [thread overview]
Message-ID: <200504121031.j3CAVhiF005387@shell0.pdx.osdl.net> (raw)
From: Roland McGrath <roland@redhat.com>
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>
---
25-akpm/arch/i386/kernel/Makefile | 6 ++++--
25-akpm/arch/i386/kernel/vsyscall-note.S | 25 +++++++++++++++++++++++++
25-akpm/arch/i386/kernel/vsyscall.lds.S | 3 ++-
3 files changed, 31 insertions(+), 3 deletions(-)
diff -puN arch/i386/kernel/Makefile~i386-vdso-add-pt_note-segment arch/i386/kernel/Makefile
--- 25/arch/i386/kernel/Makefile~i386-vdso-add-pt_note-segment 2005-04-12 03:21:18.982251160 -0700
+++ 25-akpm/arch/i386/kernel/Makefile 2005-04-12 03:21:18.986250552 -0700
@@ -56,7 +56,8 @@ SYSCFLAGS_vsyscall-sysenter.so = $(vsysc
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: $(obj)/vsyscall-syms.
$(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)
diff -puN arch/i386/kernel/vsyscall.lds.S~i386-vdso-add-pt_note-segment arch/i386/kernel/vsyscall.lds.S
--- 25/arch/i386/kernel/vsyscall.lds.S~i386-vdso-add-pt_note-segment 2005-04-12 03:21:18.983251008 -0700
+++ 25-akpm/arch/i386/kernel/vsyscall.lds.S 2005-04-12 03:21:18.987250400 -0700
@@ -23,7 +23,7 @@ SECTIONS
. = 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 @@ PHDRS
{
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 */
}
diff -puN /dev/null arch/i386/kernel/vsyscall-note.S
--- /dev/null 2003-09-15 06:40:47.000000000 -0700
+++ 25-akpm/arch/i386/kernel/vsyscall-note.S 2005-04-12 03:21:18.987250400 -0700
@@ -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
_
reply other threads:[~2005-04-12 19:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200504121031.j3CAVhiF005387@shell0.pdx.osdl.net \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®