From 130a6a563ba438cf9a07984ec48803bf29e0c7d0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 26 Dec 2018 01:44:33 +0000 Subject: [PATCH] [riscv64] tools uapi: fix RISC-V 64-bit support Apply Aurelien's patch instead of mine. --- debian/changelog | 2 +- ...-bitsperlong.h-add-support-for-riscv.patch | 21 ------ ...tools-uapi-fix-risc-v-64-bit-support.patch | 70 +++++++++++++++++++ debian/patches/series | 2 +- 4 files changed, 72 insertions(+), 23 deletions(-) delete mode 100644 debian/patches/bugfix/riscv/tools-include-bitsperlong.h-add-support-for-riscv.patch create mode 100644 debian/patches/bugfix/riscv/tools-uapi-fix-risc-v-64-bit-support.patch diff --git a/debian/changelog b/debian/changelog index 7ba59ab09..5a3698836 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,7 @@ linux (4.19.12-2) UNRELEASED; urgency=medium [ Ben Hutchings ] * linux-image-*-unsigned: Remove Provides field (Closes: #916927) * [ia64,m68k] libbpf: Don't build on architectures without performance events - * [riscv64] tools/include/.../bitsperlong.h: Add support for riscv + * [riscv64] tools uapi: fix RISC-V 64-bit support * [powerpc,powerpcspe,ppc64] linux-config: Eliminate config.*_bootwrapper.gz files * [powerpcspe] Fix -mcpu= options for SPE-only compiler diff --git a/debian/patches/bugfix/riscv/tools-include-bitsperlong.h-add-support-for-riscv.patch b/debian/patches/bugfix/riscv/tools-include-bitsperlong.h-add-support-for-riscv.patch deleted file mode 100644 index f1e23e481..000000000 --- a/debian/patches/bugfix/riscv/tools-include-bitsperlong.h-add-support-for-riscv.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Ben Hutchings -Date: Tue, 25 Dec 2018 22:38:13 +0000 -Subject: tools/include/.../bitsperlong.h: Add support for riscv - -tools/include/uapi/asm/bitsperlong.h needs to include the right -architecture's for any architecture that may be -64-bit. - -Signed-off-by: Ben Hutchings ---- ---- a/tools/include/uapi/asm/bitsperlong.h -+++ b/tools/include/uapi/asm/bitsperlong.h -@@ -13,6 +13,8 @@ - #include "../../arch/mips/include/uapi/asm/bitsperlong.h" - #elif defined(__ia64__) - #include "../../arch/ia64/include/uapi/asm/bitsperlong.h" -+#elif defined(__riscv) -+#include "../../arch/riscv/include/uapi/asm/bitsperlong.h" - #else - #include - #endif diff --git a/debian/patches/bugfix/riscv/tools-uapi-fix-risc-v-64-bit-support.patch b/debian/patches/bugfix/riscv/tools-uapi-fix-risc-v-64-bit-support.patch new file mode 100644 index 000000000..ab35e9a38 --- /dev/null +++ b/debian/patches/bugfix/riscv/tools-uapi-fix-risc-v-64-bit-support.patch @@ -0,0 +1,70 @@ +From: Aurelien Jarno +Date: Tue, 25 Dec 2018 06:46:24 -0800 +Subject: tools uapi: fix RISC-V 64-bit support +Forwarded: http://lists.infradead.org/pipermail/linux-riscv/2018-December/002622.html + +The BPF library is not built on 64-bit RISC-V, as the BPF feature is +not detected. Looking more in details, feature/test-bpf.c fails to build +with the following error: + +| In file included from /tmp/linux-4.19.12/tools/include/uapi/asm/bitsperlong.h:17, +| from /tmp/linux-4.19.12/tools/include/uapi/asm-generic/unistd.h:2, +| from /usr/include/riscv64-linux-gnu/asm/unistd.h:1, +| from test-bpf.c:2: +| /tmp/linux-4.19.12/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h +| #error Inconsistent word size. Check asm/bitsperlong.h +| ^~~~~ + +The UAPI from the tools directory is missing RISC-V support, therefore +bitsperlong.h from asm-generic is used, defaulting to 32 bits. + +Fix that by adding tools/arch/riscv/include/uapi/asm/bitsperlong.h as +a copy of arch/riscv/include/uapi/asm/bitsperlong.h and by updating +tools/include/uapi/asm/bitsperlong.h. + +Signed-off-by: Aurelien Jarno +--- + .../arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++++++++++++++ + tools/include/uapi/asm/bitsperlong.h | 2 ++ + 2 files changed, 27 insertions(+) + create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h + +--- /dev/null ++++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h +@@ -0,0 +1,25 @@ ++/* ++ * Copyright (C) 2012 ARM Ltd. ++ * Copyright (C) 2015 Regents of the University of California ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H ++#define _UAPI_ASM_RISCV_BITSPERLONG_H ++ ++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8) ++ ++#include ++ ++#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */ +--- a/tools/include/uapi/asm/bitsperlong.h ++++ b/tools/include/uapi/asm/bitsperlong.h +@@ -13,6 +13,8 @@ + #include "../../arch/mips/include/uapi/asm/bitsperlong.h" + #elif defined(__ia64__) + #include "../../arch/ia64/include/uapi/asm/bitsperlong.h" ++#elif defined(__riscv) ++#include "../../arch/riscv/include/uapi/asm/bitsperlong.h" + #else + #include + #endif diff --git a/debian/patches/series b/debian/patches/series index a5a5ec990..d81ed8e9e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -160,7 +160,7 @@ bugfix/x86/tools-x86_energy_perf_policy-fix-uninitialized-varia.patch bugfix/x86/tools-turbostat-Add-checks-for-failure-of-fgets-and-.patch bugfix/all/libbpf-add-soname-to-shared-object.patch bugfix/all/libbpf-link-shared-object-with-libelf.patch -bugfix/riscv/tools-include-bitsperlong.h-add-support-for-riscv.patch +bugfix/riscv/tools-uapi-fix-risc-v-64-bit-support.patch # wireless: Disable regulatory.db direct loading (until we sort out signing) debian/wireless-disable-regulatory.db-direct-loading.patch