[packages/kernel-tools] - fix building on x32
baggins
baggins at pld-linux.org
Sat Apr 11 12:56:35 CEST 2015
commit bedc6c438287466eefa1f7690700beafbb1041a2
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sat Apr 11 12:56:23 2015 +0200
- fix building on x32
kernel-tools.spec | 29 ++++++----
x32.patch | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 173 insertions(+), 10 deletions(-)
---
diff --git a/kernel-tools.spec b/kernel-tools.spec
index 0a02610..f879495 100644
--- a/kernel-tools.spec
+++ b/kernel-tools.spec
@@ -26,13 +26,17 @@ License: GPL v2
Group: Applications/System
Source0: https://www.kernel.org/pub/linux/kernel/v3.x/linux-%{basever}.tar.xz
# Source0-md5: d3fc8316d4d4d04b65cbc2d70799e763
+Source1: cpupower.service
+Source2: cpupower.config
%if "%{postver}" != ".0"
Patch0: https://www.kernel.org/pub/linux/kernel/v3.x/patch-%{version}.xz
# Patch0-md5: 1fec75551b2f55fced43df8394b1fd9a
%endif
-Source1: cpupower.service
-Source2: cpupower.config
+Patch1: x32.patch
URL: http://www.kernel.org/
+%ifarch %{x8664}
+BuildRequries: gcc-multilib-x32
+%endif
BuildRequires: gettext-tools
BuildRequires: pciutils-devel
BuildRequires: rpmbuild(macros) >= 1.647
@@ -198,6 +202,8 @@ cd linux-%{basever}
%patch0 -p1
%endif
+%patch1 -p1
+
sed -i -e 's#libexec/perf-core#%{_datadir}/perf-core#g' tools/perf/config/Makefile
%build
@@ -213,19 +219,19 @@ cd linux-%{basever}
OPTIMIZATION="%{rpmcflags}" \
STRIPCMD=true
-%ifarch %{ix86}
+%ifarch %{ix86} x32
%{__make} -C tools/power/cpupower/debug/i386 centrino-decode powernow-k8-decode \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
%endif
-%ifarch %{x8664}
+%ifarch %{x8664} x32
%{__make} -C tools/power/cpupower/debug/x86_64 centrino-decode powernow-k8-decode \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
%endif
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
%{__make} -C tools/power/x86/x86_energy_perf_policy \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
@@ -276,10 +282,10 @@ install -d $RPM_BUILD_ROOT{/etc/sysconfig,%{systemdunitdir}}
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/cpupower.service
cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/cpupower
-%ifarch %{ix86}
+%ifarch %{ix86} x32
install -p tools/power/cpupower/debug/i386/{centrino,powernow-k8}-decode $RPM_BUILD_ROOT%{_bindir}
%endif
-%ifarch %{x8664}
+%ifarch %{x8664} x32
install -p tools/power/cpupower/debug/x86_64/{centrino,powernow-k8}-decode $RPM_BUILD_ROOT%{_bindir}
%endif
@@ -287,7 +293,7 @@ install -p tools/vm/slabinfo $RPM_BUILD_ROOT%{_bindir}
install -p tools/vm/page-types $RPM_BUILD_ROOT%{_sbindir}
install -p dslm $RPM_BUILD_ROOT%{_sbindir}
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
install -d $RPM_BUILD_ROOT%{_mandir}/man8
# broken makefile, install manually
%if 0
@@ -359,11 +365,11 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_bindir}/slabinfo
%attr(755,root,root) %{_sbindir}/dslm
%attr(755,root,root) %{_sbindir}/page-types
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/centrino-decode
%attr(755,root,root) %{_bindir}/powernow-k8-decode
%endif
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/turbostat
%attr(755,root,root) %{_bindir}/x86_energy_perf_policy
%{_mandir}/man8/turbostat.8*
@@ -391,7 +397,10 @@ rm -rf $RPM_BUILD_ROOT
%files perf
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/perf
+%ifarch %{x8664}
%attr(755,root,root) %{_bindir}/perf-read-vdso32
+%attr(755,root,root) %{_bindir}/perf-read-vdsox32
+%endif
%attr(755,root,root) %{_bindir}/trace
%{_mandir}/man1/perf*.1*
%dir %{_datadir}/perf-core
diff --git a/x32.patch b/x32.patch
new file mode 100644
index 0000000..5c06254
--- /dev/null
+++ b/x32.patch
@@ -0,0 +1,154 @@
+--- linux-3.19/tools/perf/config/Makefile.arch~ 2015-02-09 03:54:22.000000000 +0100
++++ linux-3.19/tools/perf/config/Makefile.arch 2015-04-11 12:17:45.107911011 +0200
+@@ -24,8 +24,14 @@
+ ARCH ?= $(RAW_ARCH)
+
+ LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
++ILP32 := $(shell echo __ILP32__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+ ifeq ($(LP64), 1)
+ IS_64_BIT := 1
+ else
+ IS_64_BIT := 0
+ endif
++ifeq ($(ILP32), 1)
++ IS_X32_BIT := 1
++else
++ IS_X32_BIT := 0
++endif
+--- linux-3.19/tools/perf/config/Makefile~ 2015-04-11 12:12:31.000000000 +0200
++++ linux-3.19/tools/perf/config/Makefile 2015-04-11 12:19:05.011244885 +0200
+@@ -28,6 +28,9 @@
+ LIBUNWIND_LIBS = -lunwind -lunwind-x86
+ endif
+ NO_PERF_REGS := 0
++ ifeq (${IS_X32_BIT}, 1)
++ CFLAGS += -DHAVE_ARCH_X32_SUPPORT
++ 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)
+ #else
+ ENTRY(perf_regs_load)
+- push %edi
++#ifdef HAVE_ARCH_X32_SUPPORT
++#else
++ pushl %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)
+- pop %eax
++#ifdef HAVE_ARCH_X32_SUPPORT
++#else
++ popl %eax
++#endif
+ movl %eax, DI(%edi)
+ movl %ebp, BP(%edi)
+
+--- linux-3.19/arch/x86/include/uapi/asm/bitsperlong.h~ 2015-02-09 03:54:22.000000000 +0100
++++ linux-3.19/arch/x86/include/uapi/asm/bitsperlong.h 2015-04-11 12:31:26.051249909 +0200
+@@ -1,7 +1,7 @@
+ #ifndef __ASM_X86_BITSPERLONG_H
+ #define __ASM_X86_BITSPERLONG_H
+
+-#ifdef __x86_64__
++#if defined(__x86_64__) && !defined(__ILP32__)
+ # define __BITS_PER_LONG 64
+ #else
+ # define __BITS_PER_LONG 32
+--- 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 @@
+ 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: %llu.%03llu [sec]\n", "Total time",
++ diff.tv_sec,
++ (unsigned long long) (diff.tv_usec/1000));
++#endif
+ 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
+ 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;
+ 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: %llu.%03llu [sec]\n\n", "Total time",
++ diff.tv_sec,
++ (unsigned long long) (diff.tv_usec/1000));
++#endif
+
+ printf(" %14lf usecs/op\n",
+ (double)result_usec / (double)loops);
+@@ -168,9 +174,15 @@
+ 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
+ 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 @@
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ diff_timespec(&rs, &ts, &ref_time);
++#if defined(__x86_64__) && !defined(__ILP32__)
+ sprintf(prefix, "%6lu.%09lu%s", rs.tv_sec, rs.tv_nsec, csv_sep);
++#else
++ sprintf(prefix, "%6llu.%09llu%s", rs.tv_sec, rs.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 @@
+ 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
+ } else
+ pr_info("00:00:00.000000");
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/kernel-tools.git/commitdiff/bedc6c438287466eefa1f7690700beafbb1041a2
More information about the pld-cvs-commit
mailing list