diff mbox series

[v2] selftests: bpf: fix urandom_read build issue

Message ID 20180608065127.28115-1-anders.roxell@linaro.org
State Accepted
Commit 1c9ca7e9836a4df1518568ea47461c5ef7c2cf8b
Headers show
Series [v2] selftests: bpf: fix urandom_read build issue | expand

Commit Message

Anders Roxell June 8, 2018, 6:51 a.m. UTC
gcc complains that urandom_read gets built twice.

gcc -o tools/testing/selftests/bpf/urandom_read
-static urandom_read.c -Wl,--build-id
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf
-I../../../../include/generated  -I../../../include    urandom_read.c
urandom_read -lcap -lelf -lrt -lpthread -o
tools/testing/selftests/bpf/urandom_read
gcc: fatal error: input file
‘tools/testing/selftests/bpf/urandom_read’ is the
same as output file
compilation terminated.
../lib.mk:110: recipe for target
'tools/testing/selftests/bpf/urandom_read' failed
To fix this issue remove the urandom_read target and so target
TEST_CUSTOM_PROGS gets used.

Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

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

---
 tools/testing/selftests/bpf/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

-- 
2.17.1

Comments

Daniel Borkmann June 11, 2018, 10:58 a.m. UTC | #1
On 06/08/2018 08:51 AM, Anders Roxell wrote:
> gcc complains that urandom_read gets built twice.

> 

> gcc -o tools/testing/selftests/bpf/urandom_read

> -static urandom_read.c -Wl,--build-id

> gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf

> -I../../../../include/generated  -I../../../include    urandom_read.c

> urandom_read -lcap -lelf -lrt -lpthread -o

> tools/testing/selftests/bpf/urandom_read

> gcc: fatal error: input file

> ‘tools/testing/selftests/bpf/urandom_read’ is the

> same as output file

> compilation terminated.

> ../lib.mk:110: recipe for target

> 'tools/testing/selftests/bpf/urandom_read' failed

> To fix this issue remove the urandom_read target and so target

> TEST_CUSTOM_PROGS gets used.

> 

> Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

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


Applied to bpf, thanks Anders!
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 607ed8729c06..7a6214e9ae58 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -16,9 +16,7 @@  LDLIBS += -lcap -lelf -lrt -lpthread
 TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read
 all: $(TEST_CUSTOM_PROGS)
 
-$(TEST_CUSTOM_PROGS): urandom_read
-
-urandom_read: urandom_read.c
+$(TEST_CUSTOM_PROGS): $(OUTPUT)/%: %.c
 	$(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id
 
 # Order correspond to 'make run_tests' order