[v2] tools/bpf: fix perf build error with uClibc (seen on ARC)
diff mbox series

Message ID 1556812610-27957-1-git-send-email-vgupta@synopsys.com
State New
Headers show
Series
  • [v2] tools/bpf: fix perf build error with uClibc (seen on ARC)
Related show

Commit Message

Vineet Gupta May 2, 2019, 3:56 p.m. UTC
When build perf for ARC recently, there was a build failure due to lack
of __NR_bpf.

| Auto-detecting system features:
|
| ...                     get_cpuid: [ OFF ]
| ...                           bpf: [ on  ]
|
| #  error __NR_bpf not defined. libbpf does not support your arch.
    ^~~~~
| bpf.c: In function 'sys_bpf':
| bpf.c:66:17: error: '__NR_bpf' undeclared (first use in this function)
|  return syscall(__NR_bpf, cmd, attr, size);
|                 ^~~~~~~~
|                 sys_bpf

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
v1 -> v2
  - Only add syscall nr for ARC, as asm-generic won't work with arm/sh [Y Song]
---
 tools/lib/bpf/bpf.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Y Song May 2, 2019, 8:19 p.m. UTC | #1
On Thu, May 2, 2019 at 8:57 AM Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote:
>
> When build perf for ARC recently, there was a build failure due to lack
> of __NR_bpf.
>
> | Auto-detecting system features:
> |
> | ...                     get_cpuid: [ OFF ]
> | ...                           bpf: [ on  ]
> |
> | #  error __NR_bpf not defined. libbpf does not support your arch.
>     ^~~~~
> | bpf.c: In function 'sys_bpf':
> | bpf.c:66:17: error: '__NR_bpf' undeclared (first use in this function)
> |  return syscall(__NR_bpf, cmd, attr, size);
> |                 ^~~~~~~~
> |                 sys_bpf
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

Acked-by: Yonghong Song <yhs@fb.com>

> ---
> v1 -> v2
>   - Only add syscall nr for ARC, as asm-generic won't work with arm/sh [Y Song]
> ---
>  tools/lib/bpf/bpf.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 9cd015574e83..d82edadf7589 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -46,6 +46,8 @@
>  #  define __NR_bpf 349
>  # elif defined(__s390__)
>  #  define __NR_bpf 351
> +# elif defined(__arc__)
> +#  define __NR_bpf 280
>  # else
>  #  error __NR_bpf not defined. libbpf does not support your arch.
>  # endif
> --
> 2.7.4
>
Alexei Starovoitov May 5, 2019, 7:05 a.m. UTC | #2
On Thu, May 2, 2019 at 1:20 PM Y Song <ys114321@gmail.com> wrote:
>
> On Thu, May 2, 2019 at 8:57 AM Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote:
> >
> > When build perf for ARC recently, there was a build failure due to lack
> > of __NR_bpf.
> >
> > | Auto-detecting system features:
> > |
> > | ...                     get_cpuid: [ OFF ]
> > | ...                           bpf: [ on  ]
> > |
> > | #  error __NR_bpf not defined. libbpf does not support your arch.
> >     ^~~~~
> > | bpf.c: In function 'sys_bpf':
> > | bpf.c:66:17: error: '__NR_bpf' undeclared (first use in this function)
> > |  return syscall(__NR_bpf, cmd, attr, size);
> > |                 ^~~~~~~~
> > |                 sys_bpf
> >
> > Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
>
> Acked-by: Yonghong Song <yhs@fb.com>

Applied. Thanks

Patch
diff mbox series

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 9cd015574e83..d82edadf7589 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -46,6 +46,8 @@ 
 #  define __NR_bpf 349
 # elif defined(__s390__)
 #  define __NR_bpf 351
+# elif defined(__arc__)
+#  define __NR_bpf 280
 # else
 #  error __NR_bpf not defined. libbpf does not support your arch.
 # endif