Skip to contentSkip to conversation

UML: Fixes problem with relocation sections under X86_64

PATCH New ykirpichev 1 participant 1 message Nov 18, 2010

Subsystems (2)
lore
Share & tools
lore

ykirpichev

author
#0 lore raw

PATCH 1/1 UML: Fixes problem with relocation sections under X86_64

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

Quoted 1 line
Quoted 1 line

From d4311ee7c147925976b671a037c0c218059d7788 Mon Sep 17 00:00:00 2001

From: Yury Kirpichev <[email protected]>
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(-)
arch/um/Makefile-x86_64 +2 -0
index a9cd7e7..88a9125 100644
@@ -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
arch/x86/include/asm/bug.h +3 -3
index f654d1b..f4ec5ed 100644
@@ -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)));		\
Signature · 1 line
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel