Re: [PATCH v3 26/30] perf clang: Link BPF functions declaration into perf

From: Arnaldo Carvalho de Melo
Date: Wed Nov 30 2016 - 11:13:17 EST


Em Sat, Nov 26, 2016 at 09:40:41AM -0800, Alexei Starovoitov escreveu:
> On Sat, Nov 26, 2016 at 07:03:50AM +0000, Wang Nan wrote:
> > + * } bpf_funcs[] = {
> > + * EOF
> > + * grep '^[[:space:]]BPF_FUNC_[^ ]*,' $KERNEL_DIR/include/uapi/linux/bpf.h | \
> > + * sed -e 's/.*BPF_FUNC_\([^,]*\),.*$/\1/g' | \
> > + * xargs -n 1 sh -c 'echo {.name = \"$1\", .id = BPF_FUNC_$1}, >> '"$MAIN" sh
> > + * cat << EOF >> $MAIN
>
> This is pretty fragile and already broken.
> Please just hardcode them as-is. There is no need to be so fancy.
>
> > +"static void *(*bpf_map_lookup_elem)(void *, void *) = (void *)1;\n"
> > +"static long (*bpf_map_update_elem)(void *, void *, void *, unsigned long) = (void *)2;\n"
> > +"static long (*bpf_map_delete_elem)(void *, void *) = (void *)3;\n"
>
> just hard code this way.

Wang, can you please resend this? I'm trying to process this patchkit,
but will take some time to get to this 26th patch.

- Arnaldo