Skip to content

Commit d0df00e

Browse files
aurel32palmer-dabbelt
authored andcommitted
tools uapi: fix RISC-V 64-bit support
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 <aurelien@aurel32.net> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
1 parent 22e6a2e commit d0df00e

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (C) 2012 ARM Ltd.
3+
* Copyright (C) 2015 Regents of the University of California
4+
*
5+
* This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License version 2 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
19+
#define _UAPI_ASM_RISCV_BITSPERLONG_H
20+
21+
#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
22+
23+
#include <asm-generic/bitsperlong.h>
24+
25+
#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */

‎tools/include/uapi/asm/bitsperlong.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "../../arch/mips/include/uapi/asm/bitsperlong.h"
1414
#elif defined(__ia64__)
1515
#include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
16+
#elif defined(__riscv)
17+
#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
1618
#else
1719
#include <asm-generic/bitsperlong.h>
1820
#endif

0 commit comments

Comments
 (0)