[PATCH 2/2] perf x86: fix compilation of push/pop for x32
From: Vincent StehlÃ
Date: Thu Oct 06 2016 - 10:46:31 EST
The x32 ABI (a.k.a AMD64 ILP32) necessitates to push or pop a 64-bit
register even though ILP32 uses 32-bit integers, longs and pointers.
This fixes the following build errors:
arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
Signed-off-by: Vincent Stehlà <vincent.stehle@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/perf/arch/x86/tests/regs_load.S | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 60875d5..4fa7943 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -62,14 +62,22 @@ ENTRY(perf_regs_load)
ENDPROC(perf_regs_load)
#else
ENTRY(perf_regs_load)
+#if defined(__x86_64__) && defined(__ILP32__)
+ pushq %rdi
+#else
push %edi
+#endif
movl 8(%esp), %edi
movl %eax, AX(%edi)
movl %ebx, BX(%edi)
movl %ecx, CX(%edi)
movl %edx, DX(%edi)
movl %esi, SI(%edi)
+#if defined(__x86_64__) && defined(__ILP32__)
+ popq %rax
+#else
pop %eax
+#endif
movl %eax, DI(%edi)
movl %ebp, BP(%edi)
--
2.9.3