diff mbox

[net-next,2/2] bpf: Fix test_obj_id.c for llvm 5.0

Message ID 20170609053017.2909855-2-kafai@fb.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Martin KaFai Lau June 9, 2017, 5:30 a.m. UTC
llvm 5.0 does not like the section name and the function name
to be the same:

clang -I. -I./include/uapi -I../../../include/uapi \
	-I../../../../samples/bpf/ \
	-Wno-compare-distinct-pointer-types \
	-O2 -target bpf -c \
	linux/tools/testing/selftests/bpf/test_obj_id.c -o \
	linux/tools/testing/selftests/bpf/test_obj_id.o
fatal error: error in backend: 'test_prog_id' label emitted multiple times to
assembly file
clang-5.0: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 5.0.0 (trunk 304326) (llvm/trunk 304329)

This patch makes changes to the section name and the function name.

Fixes: 95b9afd3987f ("bpf: Test for bpf ID")
Reported-by: Alexei Starovoitov <ast@fb.com>
Reported-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
 tools/testing/selftests/bpf/test_obj_id.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Borkmann June 9, 2017, 10:06 a.m. UTC | #1
On 06/09/2017 07:30 AM, Martin KaFai Lau wrote:
> llvm 5.0 does not like the section name and the function name
> to be the same:
>
> clang -I. -I./include/uapi -I../../../include/uapi \
> 	-I../../../../samples/bpf/ \
> 	-Wno-compare-distinct-pointer-types \
> 	-O2 -target bpf -c \
> 	linux/tools/testing/selftests/bpf/test_obj_id.c -o \
> 	linux/tools/testing/selftests/bpf/test_obj_id.o
> fatal error: error in backend: 'test_prog_id' label emitted multiple times to
> assembly file
> clang-5.0: error: clang frontend command failed with exit code 70 (use -v to
> see invocation)
> clang version 5.0.0 (trunk 304326) (llvm/trunk 304329)
>
> This patch makes changes to the section name and the function name.
>
> Fixes: 95b9afd3987f ("bpf: Test for bpf ID")
> Reported-by: Alexei Starovoitov <ast@fb.com>
> Reported-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Yonghong Song June 9, 2017, 3:40 p.m. UTC | #2
On 6/8/17 10:30 PM, Martin KaFai Lau wrote:
> llvm 5.0 does not like the section name and the function name
> to be the same:
> 
> clang -I. -I./include/uapi -I../../../include/uapi \
> 	-I../../../../samples/bpf/ \
> 	-Wno-compare-distinct-pointer-types \
> 	-O2 -target bpf -c \
> 	linux/tools/testing/selftests/bpf/test_obj_id.c -o \
> 	linux/tools/testing/selftests/bpf/test_obj_id.o
> fatal error: error in backend: 'test_prog_id' label emitted multiple times to
> assembly file
> clang-5.0: error: clang frontend command failed with exit code 70 (use -v to
> see invocation)
> clang version 5.0.0 (trunk 304326) (llvm/trunk 304329)
> 
> This patch makes changes to the section name and the function name.
> 
> Fixes: 95b9afd3987f ("bpf: Test for bpf ID")
> Reported-by: Alexei Starovoitov <ast@fb.com>
> Reported-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---
>   tools/testing/selftests/bpf/test_obj_id.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_obj_id.c b/tools/testing/selftests/bpf/test_obj_id.c
> index d8723aaf827a..880d2963b472 100644
> --- a/tools/testing/selftests/bpf/test_obj_id.c
> +++ b/tools/testing/selftests/bpf/test_obj_id.c
> @@ -23,8 +23,8 @@ struct bpf_map_def SEC("maps") test_map_id = {
>   	.max_entries = 1,
>   };
>   
> -SEC("test_prog_id")
> -int test_prog_id(struct __sk_buff *skb)
> +SEC("test_obj_id_dummy")
> +int test_obj_id(struct __sk_buff *skb)
>   {
>   	__u32 key = 0;
>   	__u64 *value;
> 
Acked-by: Yonghong Song <yhs@fb.com>
David Miller June 9, 2017, 7:15 p.m. UTC | #3
From: Martin KaFai Lau <kafai@fb.com>
Date: Thu, 8 Jun 2017 22:30:17 -0700

> llvm 5.0 does not like the section name and the function name
> to be the same:
> 
> clang -I. -I./include/uapi -I../../../include/uapi \
> 	-I../../../../samples/bpf/ \
> 	-Wno-compare-distinct-pointer-types \
> 	-O2 -target bpf -c \
> 	linux/tools/testing/selftests/bpf/test_obj_id.c -o \
> 	linux/tools/testing/selftests/bpf/test_obj_id.o
> fatal error: error in backend: 'test_prog_id' label emitted multiple times to
> assembly file
> clang-5.0: error: clang frontend command failed with exit code 70 (use -v to
> see invocation)
> clang version 5.0.0 (trunk 304326) (llvm/trunk 304329)
> 
> This patch makes changes to the section name and the function name.
> 
> Fixes: 95b9afd3987f ("bpf: Test for bpf ID")
> Reported-by: Alexei Starovoitov <ast@fb.com>
> Reported-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Applied.
diff mbox

Patch

diff --git a/tools/testing/selftests/bpf/test_obj_id.c b/tools/testing/selftests/bpf/test_obj_id.c
index d8723aaf827a..880d2963b472 100644
--- a/tools/testing/selftests/bpf/test_obj_id.c
+++ b/tools/testing/selftests/bpf/test_obj_id.c
@@ -23,8 +23,8 @@  struct bpf_map_def SEC("maps") test_map_id = {
 	.max_entries = 1,
 };
 
-SEC("test_prog_id")
-int test_prog_id(struct __sk_buff *skb)
+SEC("test_obj_id_dummy")
+int test_obj_id(struct __sk_buff *skb)
 {
 	__u32 key = 0;
 	__u64 *value;