Hi,

This is patch for v 2.6.36 to fix problem that was obtained for UML with mem=512.

There is a problem with relocatable symbols.
If module is compiled with -mcmodel=kerenel then a lot of entries with type
R_X86_64_32S are generation by gcc in relocation section. As a result when module is loaded at address higher than 2Gb this doesn't work.

Therefore, suggested way to fix this problem is to don't make any assumption about addresses at which modules can be loaded.

However, when -mcmodel=large is used, gcc doesn't understand %c in "asm" instruction. So, arch/x86/include/asm/bug.h has been updated as well.

Perhaps, patch should be separated into two patches.

BR/ Yury
>From d4311ee7c147925976b671a037c0c218059d7788 Mon Sep 17 00:00:00 2001
From: Yury Kirpichev <_kirpich...@mail.ru>
Date: Fri, 19 Nov 2010 00:03:54 +0300
Subject: [PATCH] This patch changes flags used for compilation of modules for ARCH=um
 SUBARCH=x86_64. -mcmodel=large has been added as default in order to avoid problem with
 relocation seqtions.

---
 arch/um/Makefile-x86_64    |    2 ++
 arch/x86/include/asm/bug.h |    6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index a9cd7e7..88a9125 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -17,6 +17,8 @@ ELF_ARCH := i386:x86-64
 ELF_FORMAT := elf64-x86-64
 HEADER_ARCH := x86
 
+CFLAGS_MODULE += -mcmodel=large
+
 # Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
 
 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index f654d1b..f4ec5ed 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -9,7 +9,7 @@
 #ifdef CONFIG_X86_32
 # define __BUG_C0	"2:\t.long 1b, %c0\n"
 #else
-# define __BUG_C0	"2:\t.long 1b - 2b, %c0 - 2b\n"
+# define __BUG_C0	"2:\t.long 1b - 2b, %P0 - 2b\n"
 #endif
 
 #define BUG()							\
@@ -17,8 +17,8 @@ do {								\
 	asm volatile("1:\tud2\n"				\
 		     ".pushsection __bug_table,\"a\"\n"		\
 		     __BUG_C0					\
-		     "\t.word %c1, 0\n"				\
-		     "\t.org 2b+%c2\n"				\
+		     "\t.word %P1, 0\n"				\
+		     "\t.org 2b+%P2\n"				\
 		     ".popsection"				\
 		     : : "i" (__FILE__), "i" (__LINE__),	\
 		     "i" (sizeof(struct bug_entry)));		\
-- 
1.7.1

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to