X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=x32.patch;h=5a07e103367a144e72593f4d52d10c22c43ace93;hb=1c16a62dbe752444dc02191f738f8abad86a949c;hp=394a046795526b3b00f1345087457902c632dd3f;hpb=51feff828b5dfa8072ed08e40911ff4a7754d559;p=packages%2Fkernel-tools.git diff --git a/x32.patch b/x32.patch index 394a046..5a07e10 100644 --- a/x32.patch +++ b/x32.patch @@ -1,144 +1,156 @@ -FIXME: regs_load.S need complete x32 ABI support; now it will just compile, but tests won't run properly. ---- linux-4.7/tools/scripts/Makefile.arch~ 2015-02-09 03:54:22.000000000 +0100 -+++ linux-4.7/tools/scripts/Makefile.arch 2015-04-11 12:17:45.107911011 +0200 -@@ -24,8 +24,14 @@ - ARCH ?= $(RAW_ARCH) +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 ($(ILP32), 1) ++ifeq ($(X86_64)_$(ILP32), 1_1) + IS_X32_BIT := 1 +else + IS_X32_BIT := 0 +endif ---- linux-4.8/tools/perf/Makefile.config~ 2015-04-11 12:12:31.000000000 +0200 -+++ linux-4.8/tools/perf/Makefile.config 2015-04-11 12:19:05.011244885 +0200 -@@ -41,6 +41,9 @@ +--- 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 ($(ARCH),arm) ---- linux-3.19/tools/perf/arch/x86/tests/regs_load.S~ 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19/tools/perf/arch/x86/tests/regs_load.S 2015-04-11 12:21:07.717912384 +0200 -@@ -62,14 +62,20 @@ - ENDPROC(perf_regs_load) + 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 - ENTRY(perf_regs_load) -- push %edi -+#ifdef HAVE_ARCH_X32_SUPPORT ++#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 -+ pushl %edi -+#endif + SYM_FUNC_START(perf_regs_load) + push %edi movl 8(%esp), %edi - movl %eax, AX(%edi) - movl %ebx, BX(%edi) - movl %ecx, CX(%edi) - movl %edx, DX(%edi) - movl %esi, SI(%edi) -- pop %eax -+#ifdef HAVE_ARCH_X32_SUPPORT -+#else -+ popl %eax +@@ -90,6 +125,7 @@ + ret + SYM_FUNC_END(perf_regs_load) + #endif +#endif - movl %eax, DI(%edi) - movl %ebp, BP(%edi) + /* + * We need to provide note.GNU-stack section, saying that we want --- linux-3.19/tools/perf/bench/sched-messaging.c~ 2015-02-09 03:54:22.000000000 +0100 +++ linux-3.19/tools/perf/bench/sched-messaging.c 2015-04-11 12:33:22.587917365 +0200 -@@ -310,13 +310,24 @@ +@@ -310,13 +310,13 @@ printf("# %d groups == %d %s run\n\n", num_groups, num_groups * 2 * num_fds, thread_mode ? "threads" : "processes"); -+#if defined(__x86_64__) && !defined(__ILP32__) - printf(" %14s: %lu.%03lu [sec]\n", "Total time", - diff.tv_sec, - (unsigned long) (diff.tv_usec/1000)); -+#else +- printf(" %14s: %lu.%03lu [sec]\n", "Total time", +- diff.tv_sec, +- (unsigned long) (diff.tv_usec / USEC_PER_MSEC)); + printf(" %14s: %llu.%03llu [sec]\n", "Total time", -+ diff.tv_sec, -+ (unsigned long long) (diff.tv_usec/1000)); -+#endif ++ (unsigned long long) diff.tv_sec, ++ (unsigned long long) (diff.tv_usec / USEC_PER_MSEC)); break; case BENCH_FORMAT_SIMPLE: -+#if defined(__x86_64__) && !defined(__ILP32__) - printf("%lu.%03lu\n", diff.tv_sec, - (unsigned long) (diff.tv_usec/1000)); -+#else -+ printf("%llu.%03llu\n", diff.tv_sec, -+ (unsigned long long) (diff.tv_usec/1000)); -+#endif +- printf("%lu.%03lu\n", diff.tv_sec, +- (unsigned long) (diff.tv_usec / USEC_PER_MSEC)); ++ printf("%llu.%03llu\n", (unsigned long long) diff.tv_sec, ++ (unsigned long long) (diff.tv_usec / USEC_PER_MSEC)); break; default: /* reaching here is something disaster */ ---- linux-3.19/tools/perf/bench/sched-pipe.c~ 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19/tools/perf/bench/sched-pipe.c 2015-04-11 12:34:32.727917841 +0200 -@@ -156,9 +156,15 @@ - result_usec = diff.tv_sec * 1000000; +--- linux-5.11/tools/perf/bench/sched-pipe.c.orig 2021-02-14 23:32:24.000000000 +0100 ++++ linux-5.11/tools/perf/bench/sched-pipe.c 2021-02-25 20:38:57.380710973 +0100 +@@ -155,9 +155,9 @@ + result_usec = diff.tv_sec * USEC_PER_SEC; result_usec += diff.tv_usec; -+#if defined(__x86_64__) && !defined(__ILP32__) - printf(" %14s: %lu.%03lu [sec]\n\n", "Total time", - diff.tv_sec, - (unsigned long) (diff.tv_usec/1000)); -+#else +- printf(" %14s: %lu.%03lu [sec]\n\n", "Total time", +- diff.tv_sec, +- (unsigned long) (diff.tv_usec / USEC_PER_MSEC)); + printf(" %14s: %llu.%03llu [sec]\n\n", "Total time", -+ diff.tv_sec, -+ (unsigned long long) (diff.tv_usec/1000)); -+#endif ++ (unsigned long long) diff.tv_sec, ++ (unsigned long long) (diff.tv_usec / USEC_PER_MSEC)); printf(" %14lf usecs/op\n", (double)result_usec / (double)loops); -@@ -168,9 +174,15 @@ +@@ -167,9 +167,9 @@ break; case BENCH_FORMAT_SIMPLE: -+#if defined(__x86_64__) && !defined(__ILP32__) - printf("%lu.%03lu\n", - diff.tv_sec, - (unsigned long) (diff.tv_usec / 1000)); -+#else +- printf("%lu.%03lu\n", +- diff.tv_sec, +- (unsigned long) (diff.tv_usec / USEC_PER_MSEC)); + printf("%llu.%03llu\n", -+ diff.tv_sec, -+ (unsigned long long) (diff.tv_usec / 1000)); -+#endif ++ (unsigned long long) diff.tv_sec, ++ (unsigned long long) (diff.tv_usec / USEC_PER_MSEC)); break; default: ---- linux-3.19/tools/perf/builtin-stat.c~ 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19/tools/perf/builtin-stat.c 2015-04-11 12:35:21.841251509 +0200 -@@ -550,7 +550,11 @@ - { - static int num_print_interval; - -+#if defined(__x86_64__) && !defined(__ILP32__) - sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep); -+#else -+ sprintf(prefix, "%6llu.%09llu%s", ts->tv_sec, ts->tv_nsec, csv_sep); -+#endif - - if (num_print_interval == 0 && !csv_output) { - switch (aggr_mode) { --- 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,11 @@ +@@ -565,7 +565,7 @@ gettimeofday(&tv, NULL); if (localtime_r(&tv.tv_sec, <ime)) { strftime(date, sizeof(date), "%H:%M:%S", <ime); -+#if defined(__x86_64__) && !defined(__ILP32__) - pr_info("%s.%06ld", date, tv.tv_usec); -+#else -+ pr_info("%s.%06lld", date, tv.tv_usec); -+#endif +- 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;