Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810AbdFWKhk (ORCPT ); Fri, 23 Jun 2017 06:37:40 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:33149 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754789AbdFWKhi (ORCPT ); Fri, 23 Jun 2017 06:37:38 -0400 From: Marcin Nowakowski To: Shuah Khan CC: , , Marcin Nowakowski Subject: [PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries Date: Fri, 23 Jun 2017 12:37:24 +0200 Message-ID: <1498214246-1244-2-git-send-email-marcin.nowakowski@imgtec.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498214246-1244-1-git-send-email-marcin.nowakowski@imgtec.com> References: <1498214246-1244-1-git-send-email-marcin.nowakowski@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.2.5] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2249 Lines: 62 net test fails to link properly due to a missing reference to -lnuma and fails with: reuseport_bpf_numa.c:138: undefined reference to `numa_run_on_node' reuseport_bpf_numa.c:230: undefined reference to `numa_available' reuseport_bpf_numa.c:233: undefined reference to `numa_max_node' collect2: error: ld returned 1 exit status running make -p shows that this is due to a wrong LDFLAGS variable definition which doesn't include the output prefix location: # makefile (from 'Makefile', line 6) reuseport_bpf_numa: LDFLAGS += -lnuma # Not a target: reuseport_bpf_numa: The same issue has been observed in memfd with its references to libfuse. Resolve this by adding a pattern-matching to allow the binary name to be prefixed with an output location. For memfd also replace LDFLAGS with LDLIBS definition to ensure correct ordering of arguments in the make's implicit rules. Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT') Signed-off-by: Marcin Nowakowski --- tools/testing/selftests/memfd/Makefile | 4 ++-- tools/testing/selftests/net/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile index 79891d0..754e92f 100644 --- a/tools/testing/selftests/memfd/Makefile +++ b/tools/testing/selftests/memfd/Makefile @@ -6,8 +6,8 @@ CFLAGS += -I../../../../usr/include/ TEST_PROGS := run_fuse_test.sh TEST_GEN_FILES := memfd_test fuse_mnt fuse_test -fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags) -fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs) +%/fuse_mnt: CFLAGS += $(shell pkg-config fuse --cflags) +%/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs) include ../lib.mk diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 35cbb4c..d7abe8b 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -3,7 +3,7 @@ CFLAGS = -Wall -Wl,--no-as-needed -O2 -g CFLAGS += -I../../../../usr/include/ -reuseport_bpf_numa: LDFLAGS += -lnuma +%/reuseport_bpf_numa: LDFLAGS += -lnuma TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh TEST_GEN_FILES = socket -- 2.7.4