[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] preprocess vsyscall linker script



This removes the hardcoded vsyscall linker script and replaces it with
the normal vsyscall.lds.S version which will be properly preprocessed.
That brings vsyscall.lds.S inline with normal i386.  Proper preprocessing
allows Gerd's PAE patch to work without having to edit the linker script.

Signed-off-by: Chris Wright <chrisw@xxxxxxxx>
---

 linux-2.6.11-xen-sparse/arch/xen/Makefile                   |    8 +
 linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile       |    7 -
 linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds   |   69 ------------
 linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds.S |   65 +++++++++++
 4 files changed, 77 insertions(+), 72 deletions(-)

===== linux-2.6.11-xen-sparse/arch/xen/Makefile 1.22 vs edited =====
--- 1.22/linux-2.6.11-xen-sparse/arch/xen/Makefile      2005-03-09 13:38:05 
-08:00
+++ edited/linux-2.6.11-xen-sparse/arch/xen/Makefile    2005-04-20 14:43:21 
-07:00
@@ -37,8 +37,14 @@ arch/xen/arch:
        @rm -f $@
        @ln -fsn $(XENARCH) $@
 
+arch/$(XENARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
+                                  include/config/MARKER
+
+include/asm-$(ARCH)/asm_offsets.h: arch/$(XENARCH)/kernel/asm-offsets.s
+       $(call filechk,gen-asm-offsets)
+
 prepare: include/.asm-ignore include/asm-xen/asm \
-       arch/xen/arch ;
+       arch/xen/arch  include/asm-$(ARCH)/asm_offsets.h ;
 
 all: vmlinuz
 
===== linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile 1.18 vs edited =====
--- 1.18/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile  2005-03-24 
14:02:54 -08:00
+++ edited/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile        
2005-04-20 15:52:20 -07:00
@@ -52,18 +52,21 @@ c-obj-$(CONFIG_SCx200)              += scx200.o
 # Note: kbuild does not track this dependency due to usage of .incbin
 $(obj)/vsyscall.o: $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so
 targets += $(foreach F,int80 sysenter,vsyscall-$F.o vsyscall-$F.so)
+targets += vsyscall.lds
 
 # The DSO images are built using a special linker script.
 quiet_cmd_syscall = SYSCALL $@
       cmd_syscall = $(CC) -nostdlib -m32 $(SYSCFLAGS_$(@F)) \
                          -Wl,-T,$(filter-out FORCE,$^) -o $@
 
+export CPPFLAGS_vsyscall.lds += -P -C -U$(ARCH)
+
 vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1
 SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags)
 SYSCFLAGS_vsyscall-int80.so    = $(vsyscall-flags)
 
 $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
-$(obj)/vsyscall-%.so: $(obj)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
+$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
        $(call if_changed,syscall)
 
 # We also create a special relocatable object that should mirror the symbol
@@ -74,7 +77,7 @@ $(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: $(obj)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE
+$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE
        $(call if_changed,syscall)
 
 c-link := init_task.o
===== linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds 1.7 vs ? 
(writable without lock!)  =====
--- 1.7/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds       
2005-03-09 13:38:05 -08:00
+++ edited/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds    
1969-12-31 16:00:00.000000000 -0800
@@ -1,69 +0,0 @@
-/*
- * Linker script for vsyscall DSO.  The vsyscall page is an ELF shared
- * object prelinked to its virtual address, and with only one read-only
- * segment (that fits in one page).  This script controls its layout.
- */
-
-/* This must match <asm/fixmap.h>.  */
-/* = FIXADDR_TOP - PAGE_SIZE
-   = HYPERVISOR_VIRT_START - 2 * PAGE_SIZE - PAGE_SIZE */
-VSYSCALL_BASE = 0xfbffd000;
-
-SECTIONS
-{
-  . = VSYSCALL_BASE + SIZEOF_HEADERS;
-
-  .hash           : { *(.hash) }               :text
-  .dynsym         : { *(.dynsym) }
-  .dynstr         : { *(.dynstr) }
-  .gnu.version    : { *(.gnu.version) }
-  .gnu.version_d  : { *(.gnu.version_d) }
-  .gnu.version_r  : { *(.gnu.version_r) }
-
-  /* This linker script is used both with -r and with -shared.
-     For the layouts to match, we need to skip more than enough
-     space for the dynamic symbol table et al.  If this amount
-     is insufficient, ld -shared will barf.  Just increase it here.  */
-  . = VSYSCALL_BASE + 0x400;
-
-  .text           : { *(.text) }               :text =0x90909090
-
-  .eh_frame_hdr   : { *(.eh_frame_hdr) }       :text :eh_frame_hdr
-  .eh_frame       : { KEEP (*(.eh_frame)) }    :text
-  .dynamic        : { *(.dynamic) }            :text :dynamic
-  .useless        : {
-       *(.got.plt) *(.got)
-       *(.data .data.* .gnu.linkonce.d.*)
-       *(.dynbss)
-       *(.bss .bss.* .gnu.linkonce.b.*)
-  }                                            :text
-}
-
-/*
- * We must supply the ELF program headers explicitly to get just one
- * PT_LOAD segment, and set the flags explicitly to make segments read-only.
- */
-PHDRS
-{
-  text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
-  dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
-  eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
-}
-
-/*
- * This controls what symbols we export from the DSO.
- */
-VERSION
-{
-  LINUX_2.5 {
-    global:
-       __kernel_vsyscall;
-       __kernel_sigreturn;
-       __kernel_rt_sigreturn;
-
-    local: *;
-  };
-}
-
-/* The ELF entry point can be used to set the AT_SYSINFO value.  */
-ENTRY(__kernel_vsyscall);
--- 1.1/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds.S     
1969-12-31 16:00:00.000000000 -0800
+++ edited/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/vsyscall.lds.S  
2005-03-09 13:38:05 -08:00
@@ -0,0 +1,65 @@
+/*
+ * Linker script for vsyscall DSO.  The vsyscall page is an ELF shared
+ * object prelinked to its virtual address, and with only one read-only
+ * segment (that fits in one page).  This script controls its layout.
+ */
+#include <asm/asm_offsets.h>
+
+SECTIONS
+{
+  . = VSYSCALL_BASE + SIZEOF_HEADERS;
+
+  .hash           : { *(.hash) }               :text
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .gnu.version    : { *(.gnu.version) }
+  .gnu.version_d  : { *(.gnu.version_d) }
+  .gnu.version_r  : { *(.gnu.version_r) }
+
+  /* This linker script is used both with -r and with -shared.
+     For the layouts to match, we need to skip more than enough
+     space for the dynamic symbol table et al.  If this amount
+     is insufficient, ld -shared will barf.  Just increase it here.  */
+  . = VSYSCALL_BASE + 0x400;
+
+  .text           : { *(.text) }               :text =0x90909090
+
+  .eh_frame_hdr   : { *(.eh_frame_hdr) }       :text :eh_frame_hdr
+  .eh_frame       : { KEEP (*(.eh_frame)) }    :text
+  .dynamic        : { *(.dynamic) }            :text :dynamic
+  .useless        : {
+       *(.got.plt) *(.got)
+       *(.data .data.* .gnu.linkonce.d.*)
+       *(.dynbss)
+       *(.bss .bss.* .gnu.linkonce.b.*)
+  }                                            :text
+}
+
+/*
+ * We must supply the ELF program headers explicitly to get just one
+ * PT_LOAD segment, and set the flags explicitly to make segments read-only.
+ */
+PHDRS
+{
+  text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
+  dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
+  eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
+}
+
+/*
+ * This controls what symbols we export from the DSO.
+ */
+VERSION
+{
+  LINUX_2.5 {
+    global:
+       __kernel_vsyscall;
+       __kernel_sigreturn;
+       __kernel_rt_sigreturn;
+
+    local: *;
+  };
+}
+
+/* The ELF entry point can be used to set the AT_SYSINFO value.  */
+ENTRY(__kernel_vsyscall);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.