x86 UEFI: Fix broken build for UEFI

UEFI loads EFI applications to dynamic runtime addresses, so it requires
all applications to be compiled as PIC (position independent code).

The new introduced single-step #DB tests series bring some compile time
absolute address, fixed it with RIP relative address.

Fixes: 9734b4236294 ("x86/debug: Add framework for single-step #DB tests")
Fixes: 6bfb9572ec04 ("x86/debug: Test IN instead of RDMSR for single-step #DB emulation test")
Fixes: bc0dd8bdc627 ("x86/debug: Add single-step #DB + STI/MOVSS blocking tests")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Message-Id: <20220210092044.18808-1-zhenzhong.duan@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/x86/debug.c b/x86/debug.c
index fd0234d..b66bf04 100644
--- a/x86/debug.c
+++ b/x86/debug.c
@@ -145,7 +145,7 @@
 		"and $~(1<<8),%%rax\n\t"
 		"1:push %%rax\n\t"
 		"popf\n\t"
-		"lea 1b, %0\n\t"
+		"lea 1b(%%rip), %0\n\t"
 		: "=r" (start) : : "rax"
 	);
 	return start;
@@ -186,7 +186,7 @@
 		"movl $0x3fd, %%edx\n\t"
 		"inb %%dx, %%al\n\t"
 		"popf\n\t"
-		"lea 1b,%0\n\t"
+		"lea 1b(%%rip),%0\n\t"
 		: "=r" (start) : : "rax", "ebx", "ecx", "edx"
 	);
 	return start;
@@ -223,7 +223,7 @@
 		"1:and $~(1<<8),%%rax\n\t"
 		"push %%rax\n\t"
 		"popf\n\t"
-		"lea 1b,%0\n\t"
+		"lea 1b(%%rip),%0\n\t"
 		: "=r" (start_rip) : : "rax"
 	);
 	return start_rip;
@@ -259,7 +259,7 @@
 		"and $~(1<<8),%%rax\n\t"
 		"1: push %%rax\n\t"
 		"popf\n\t"
-		"lea 1b,%0\n\t"
+		"lea 1b(%%rip),%0\n\t"
 		: "=r" (start_rip) : : "rax"
 	);
 	return start_rip;
@@ -302,7 +302,7 @@
 		"1:and $~(1<<8),%%rax\n\t"
 		"push %%rax\n\t"
 		"popf\n\t"
-		"lea 1b,%0\n\t"
+		"lea 1b(%%rip),%0\n\t"
 		: "=r" (start) : : "rax"
 	);
 	return start;
@@ -346,7 +346,7 @@
 		"and $~(1<<8),%%rax\n\t"
 		"push %%rax\n\t"
 		"popf\n\t"
-		"lea 1b,%0\n\t"
+		"lea 1b(%%rip),%0\n\t"
 		: "=r" (start_rip) : : "rax"
 	);
 	return start_rip;