FIXME: verify x32 ABI support in regs_load.S --- linux-5.11/tools/scripts/Makefile.arch.orig 2021-02-25 19:40:18.181160970 +0100 +++ linux-5.11/tools/scripts/Makefile.arch 2021-02-25 19:46:07.599314457 +0100 @@ -34,8 +34,15 @@ endif LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) +ILP32 := $(shell echo __ILP32__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) +X86_64 := $(shell echo __x86_64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) ifeq ($(LP64), 1) IS_64_BIT := 1 else IS_64_BIT := 0 endif +ifeq ($(X86_64)_$(ILP32), 1_1) + IS_X32_BIT := 1 +else + IS_X32_BIT := 0 +endif --- linux-5.11/tools/perf/Makefile.config.orig 2021-02-25 19:40:18.184494476 +0100 +++ linux-5.11/tools/perf/Makefile.config 2021-02-25 19:48:36.007024754 +0100 @@ -61,6 +61,11 @@ LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind endif NO_PERF_REGS := 0 + ifeq (${IS_X32_BIT}, 1) + CFLAGS += -DHAVE_ARCH_X32_SUPPORT + ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S + LIBUNWIND_LIBS = -lunwind-x86_64 -llzma -lunwind + endif endif ifeq ($(SRCARCH),arm) --- linux-5.11/tools/perf/arch/x86/tests/regs_load.S.orig 2021-02-14 23:32:24.000000000 +0100 +++ linux-5.11/tools/perf/arch/x86/tests/regs_load.S 2021-02-25 21:46:57.425008548 +0100 @@ -62,6 +62,41 @@ ret SYM_FUNC_END(perf_regs_load) #else +#ifdef HAVE_ARCH_X32_SUPPORT +SYM_FUNC_START(perf_regs_load) + movq %rax, AX(%edi) + movq %rbx, BX(%edi) + movq %rcx, CX(%edi) + movq %rdx, DX(%edi) + movq %rsi, SI(%edi) + movq %rdi, DI(%edi) + movq %rbp, BP(%edi) + + leaq 8(%rsp), %rax /* exclude this call. */ + movq %rax, SP(%edi) + + movq 0(%rsp), %rax + movq %rax, IP(%edi) + + movq $0, FLAGS(%edi) + movq $0, CS(%edi) + movq $0, SS(%edi) + movq $0, DS(%edi) + movq $0, ES(%edi) + movq $0, FS(%edi) + movq $0, GS(%edi) + + movq %r8, R8(%edi) + movq %r9, R9(%edi) + movq %r10, R10(%edi) + movq %r11, R11(%edi) + movq %r12, R12(%edi) + movq %r13, R13(%edi) + movq %r14, R14(%edi) + movq %r15, R15(%edi) + ret +SYM_FUNC_END(perf_regs_load) +#else SYM_FUNC_START(perf_regs_load) push %edi movl 8(%esp), %edi @@ -90,6 +125,7 @@ ret SYM_FUNC_END(perf_regs_load) #endif +#endif /* * We need to provide note.GNU-stack section, saying that we want --- linux-3.19/tools/perf/builtin-kvm.c~ 2015-02-09 03:54:22.000000000 +0100 +++ linux-3.19/tools/perf/builtin-kvm.c 2015-04-11 12:36:00.511251770 +0200 @@ -565,7 +565,7 @@ gettimeofday(&tv, NULL); if (localtime_r(&tv.tv_sec, <ime)) { strftime(date, sizeof(date), "%H:%M:%S", <ime); - pr_info("%s.%06ld", date, tv.tv_usec); + pr_info("%s.%06lld", date, (long long) tv.tv_usec); } else pr_info("00:00:00.000000"); --- linux-5.11/tools/perf/arch/x86/util/unwind-libunwind.c.orig 2021-02-25 20:23:15.561804956 +0100 +++ linux-5.11/tools/perf/arch/x86/util/unwind-libunwind.c 2021-02-25 20:39:56.170430285 +0100 @@ -8,7 +8,7 @@ #include "../../util/unwind.h" #endif -#ifdef HAVE_ARCH_X86_64_SUPPORT +#if defined(HAVE_ARCH_X86_64_SUPPORT) || defined(HAVE_ARCH_X32_SUPPORT) int LIBUNWIND__ARCH_REG_ID(int regnum) { int id;