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

[Xen-devel] [PATCH] x86emul/test: don't use *_len symbols



... as they don't work as intended with -fPIC.

I did prefer them over *_end ones at the time because older gcc would
cause .L* symbols to be public, due to issuing .globl for all
referenced externals. And labels at the end of instructions collide
with the ones at the start of the next instruction, making disassembly
harder to grok. Luckily recent gcc no longer issues those .globl
directives, and hence .L* labels, staying local by default, no longer
get in the way.

Reported-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -885,17 +885,16 @@ int main(int argc, char **argv)
     }
     printf("okay\n");
 
-#define decl_insn(which) extern const unsigned char which[], which##_len[]
+#define decl_insn(which) extern const unsigned char which[], \
+                         which##_end[] asm ( ".L" #which "_end" )
 #define put_insn(which, insn) ".pushsection .test, \"ax\", @progbits\n" \
                               #which ": " insn "\n"                     \
-                              ".equ " #which "_len, .-" #which "\n"     \
+                              ".L" #which "_end:\n"                     \
                               ".popsection"
 #define set_insn(which) (regs.eip = (unsigned long)(which))
 #define valid_eip(which) (regs.eip >= (unsigned long)(which) && \
-                          regs.eip < (unsigned long)(which) + \
-                                      (unsigned long)which##_len)
-#define check_eip(which) (regs.eip == (unsigned long)(which) + \
-                                      (unsigned long)which##_len)
+                          regs.eip < (unsigned long)which##_end)
+#define check_eip(which) (regs.eip == (unsigned long)which##_end)
 
     printf("%-40s", "Testing andn (%edx),%ecx,%ebx...");
     if ( stack_exec && cpu_has_bmi1 )



Attachment: x86emul-test-no-len.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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