mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Tesarik <ptesarik@suse.cz>
To: linux-kernel@vger.kernel.org, linux-x86_64@vger.kernel.org,
	mingo@elte.hu, andi@firstfloor.org
Cc: zwane@arm.linux.org.uk, roland@redhat.com,
	Petr Tesarik <ptesarik@suse.cz>
Subject: [PATCH 1/4] x86: Use vdso*-syms.h instead of vdso*-syms.lds
Date: Thu, 14 May 2009 15:06:18 +0200	[thread overview]
Message-ID: <f249c3f58a699ce72b6cb416ddff98811848ff6f.1242299014.git.ptesarik@suse.cz> (raw)
In-Reply-To: <cover.1242299014.git.ptesarik@suse.cz>
In-Reply-To: <cover.1242299014.git.ptesarik@suse.cz>

Since we post-process the object file anyway, we can define the
constants with pre-processor directives instead of special symbols
at link time. This approach makes it possible to use the include
files with other tools than the linker.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
 arch/x86/include/asm/vdso.h  |   14 ++------------
 arch/x86/vdso/.gitignore     |   10 +++++-----
 arch/x86/vdso/Makefile       |   16 ++++++++--------
 arch/x86/vdso/vdso32-setup.c |    2 ++
 arch/x86/vdso/vma.c          |    1 +
 5 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
index 9064052..a959ac9 100644
--- a/arch/x86/include/asm/vdso.h
+++ b/arch/x86/include/asm/vdso.h
@@ -2,31 +2,21 @@
 #define _ASM_X86_VDSO_H
 
 #ifdef CONFIG_X86_64
-extern const char VDSO64_PRELINK[];
-
 /*
  * Given a pointer to the vDSO image, find the pointer to VDSO64_name
  * as that symbol is defined in the vDSO sources or linker script.
  */
 #define VDSO64_SYMBOL(base, name)					\
-({									\
-	extern const char VDSO64_##name[];				\
-	(void *)(VDSO64_##name - VDSO64_PRELINK + (unsigned long)(base)); \
-})
+	((void *)(VDSO64_##name - VDSO64_PRELINK + (unsigned long)(base)))
 #endif
 
 #if defined CONFIG_X86_32 || defined CONFIG_COMPAT
-extern const char VDSO32_PRELINK[];
-
 /*
  * Given a pointer to the vDSO image, find the pointer to VDSO32_name
  * as that symbol is defined in the vDSO sources or linker script.
  */
 #define VDSO32_SYMBOL(base, name)					\
-({									\
-	extern const char VDSO32_##name[];				\
-	(void *)(VDSO32_##name - VDSO32_PRELINK + (unsigned long)(base)); \
-})
+	((void *)(VDSO32_##name - VDSO32_PRELINK + (unsigned long)(base)))
 #endif
 
 /*
diff --git a/arch/x86/vdso/.gitignore b/arch/x86/vdso/.gitignore
index 60274d5..6ac0a86 100644
--- a/arch/x86/vdso/.gitignore
+++ b/arch/x86/vdso/.gitignore
@@ -1,6 +1,6 @@
 vdso.lds
-vdso-syms.lds
-vdso32-syms.lds
-vdso32-syscall-syms.lds
-vdso32-sysenter-syms.lds
-vdso32-int80-syms.lds
+vdso-syms.h
+vdso32-syms.h
+vdso32-syscall-syms.h
+vdso32-sysenter-syms.h
+vdso32-int80-syms.h
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 16a9020..550dca0 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -42,26 +42,25 @@ CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
 
 $(vobjs): KBUILD_CFLAGS += $(CFL)
 
-targets += vdso-syms.lds
-obj-$(VDSO64-y)			+= vdso-syms.lds
+targets += vdso-syms.h
+$(obj)/vma.o: $(obj)/vdso-syms.h
 
 #
 # Match symbols in the DSO that look like VDSO*; produce a file of constants.
 #
 sed-vdsosym := -e 's/^00*/0/' \
-	-e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
+	-e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\#define \2 0x\1/p'
 quiet_cmd_vdsosym = VDSOSYM $@
 define cmd_vdsosym
 	$(NM) $< | LC_ALL=C sed -n $(sed-vdsosym) | LC_ALL=C sort > $@
 endef
 
-$(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
+$(obj)/%-syms.h: $(obj)/%.so.dbg FORCE
 	$(call if_changed,vdsosym)
 
 #
 # Build multiple 32-bit vDSO images to choose from at boot time.
 #
-obj-$(VDSO32-y)			+= vdso32-syms.lds
 vdso32.so-$(VDSO32-y)		+= int80
 vdso32.so-$(CONFIG_COMPAT)	+= syscall
 vdso32.so-$(VDSO32-y)		+= sysenter
@@ -93,10 +92,11 @@ $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
 				 $(obj)/vdso32/%.o
 	$(call if_changed,vdso)
 
-# Make vdso32-*-syms.lds from each image, and then make sure they match.
+# Make vdso32-*-syms.h from each image, and then make sure they match.
 # The only difference should be that some do not define VDSO32_SYSENTER_RETURN.
 
-targets += vdso32-syms.lds $(vdso32.so-y:%=vdso32-%-syms.lds)
+targets += vdso32-syms.h $(vdso32.so-y:%=vdso32-%-syms.h)
+$(obj)/vdso32-setup.o: $(obj)/vdso32-syms.h
 
 quiet_cmd_vdso32sym = VDSOSYM $@
 define cmd_vdso32sym
@@ -111,7 +111,7 @@ define cmd_vdso32sym
 	fi
 endef
 
-$(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
+$(obj)/vdso32-syms.h: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.h) FORCE
 	$(call if_changed,vdso32sym)
 
 #
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 1241f11..7f39b89 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -26,6 +26,8 @@
 #include <asm/vdso.h>
 #include <asm/proto.h>
 
+#include "vdso32-syms.h"
+
 enum {
 	VDSO_DISABLED = 0,
 	VDSO_ENABLED = 1,
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 7133cdf..289d410 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -13,6 +13,7 @@
 #include <asm/proto.h>
 #include <asm/vdso.h>
 
+#include "vdso-syms.h"
 #include "vextern.h"		/* Just for VMAGIC.  */
 #undef VEXTERN
 
-- 
1.6.0.2



  parent reply	other threads:[~2009-05-14 13:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 13:06 [PATCH 0/4] x86-64: fix vclock_gettime() Petr Tesarik
2009-05-14 12:58 ` Andi Kleen
2009-05-14 13:01   ` Petr Tesarik
2009-05-14 14:02     ` Andi Kleen
2009-05-14 14:27       ` Petr Tesarik
2009-05-14 13:06 ` Petr Tesarik [this message]
2009-05-14 13:06   ` [PATCH 2/4] x86: Cleanup vdso-layout.lds.S Petr Tesarik
2009-05-14 13:06     ` [PATCH 3/4] x86-64: link vDSO into the kernel with relocations Petr Tesarik
2009-05-14 13:07       ` [PATCH 4/4] x86: add rdtsc_barrier() to vgetns() Petr Tesarik
2009-05-14 13:17 ` [PATCH 0/4] x86-64: fix vclock_gettime() Petr Tesarik

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=f249c3f58a699ce72b6cb416ddff98811848ff6f.1242299014.git.ptesarik@suse.cz \
    --to=ptesarik@suse.cz \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-x86_64@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=zwane@arm.linux.org.uk \
    /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®