From patchwork Wed Jan 16 17:43:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 155739 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp937368jaa; Wed, 16 Jan 2019 09:44:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Qx9ZnCf84vD74RhGIpE8SEdNEMNaAZmI2Fv8+VAFdqfneiuAmI4DE+L2ugoyVpKzgpPiU X-Received: by 2002:a63:3d1:: with SMTP id 200mr10034714pgd.68.1547660667232; Wed, 16 Jan 2019 09:44:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547660667; cv=none; d=google.com; s=arc-20160816; b=H/Zx9LjG3o2H830EIXUMVHKcLl5NgVhlaU1Tko9LZzT/KWMD0Rk6cg7EJR+GYMsHAR J1uLHdMsZjcq5WgP2ei4yevGRWvXM2gauPGq/vXUHivEtzQpl/QipQjKN8B8ZXCUTSyG 8sh6pYQoXTOo/Xy6z51DRuyMp8/pf2lf9nBBXD7mOI5XrZiuXa69YwpOHqu4tCVOs6WF XG8dtU5yDDFXkJeDAJB0kCVS4ooV3o5qN8OWZsM2Eb/jZY1i/HqYfpwpMqQ03m1gUafk jNIDU7XfZ0RFfO8vV9pValUrXPv67MKq1I4wB1g+kvLrL0aRf2aRMisRxQ9RY/FGa/F+ qlhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rjGu5CVIAm8AJWA4l+rx6t8yEPYdDyoeZJtii+mb+X4=; b=Q89qCZ2q+CepB4sIbGLeOJ13r/kAtcqq9pk40dd7Ybuc1UDBqSvd7FEIC91LkoPQUn 52LVvq0MDTgYCjotzwzlipQ90eult/wYKweh9UB+RDMrBGGo+b6UUaEZCgu2V+Ggo83E CrIDdqNbmI252RRhrDVQix+hCqhqY61kQ6nxx/z+s35RvKvdXnNzVnqbBPJV40Yu1Upf hr5i2zVsnqPZn6lEbA8bJ51DbbfOLN/FZG3GHW5dWh8ntd62DAUnhGM6wKMhW5jm06Ox Tgh/wYEFt3sUXTHxOFiIMEFh8GsRD6htcxtj8okjQzVTsWAgdyHlsYFDFwRFrSSNG8kB dJMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="A/+1RsA1"; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si6360558pgz.593.2019.01.16.09.44.26; Wed, 16 Jan 2019 09:44:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="A/+1RsA1"; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbfAPRoZ (ORCPT + 10 others); Wed, 16 Jan 2019 12:44:25 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:37715 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727419AbfAPRoZ (ORCPT ); Wed, 16 Jan 2019 12:44:25 -0500 Received: by mail-ot1-f67.google.com with SMTP id s13so8505691otq.4 for ; Wed, 16 Jan 2019 09:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rjGu5CVIAm8AJWA4l+rx6t8yEPYdDyoeZJtii+mb+X4=; b=A/+1RsA1qWeOGru+NTCbI9tMTbwUCEmxSB6HjSc61ZmqlQhiyu/+VIDtuT/P/BHQ+9 baKb5geW6QYq6avK8c446uHe/xAT7dmtNjp4LZJMHg+ai8IdzziCam8gho5Dya9uffa9 Xa5D2ObyORG/9fqQwnx0m14a1Pk4GKXNrlZEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rjGu5CVIAm8AJWA4l+rx6t8yEPYdDyoeZJtii+mb+X4=; b=buqnvUpvbk1Hv1D7OKn+/GWQkGo6nEPoekG7JHHJmSx2Lyrv9MZ6AfjdgNKAi4yUOy zwfm5OtAkLOi+dBYhNFt0birivG2qlUtXQQrXVQoALC2hD7lIxK7++GMNEd9uvs2VByR GHy680oHyfKwpYs1jIU8UkUX0bqDDZQAZMGqP/wHe8Fam0zx83jxWwwtVKoR+zcjgxM0 FBGfwSm23guwGcauwkiNQ/XQlYJSyFRiOBEWBWBTGEZRXqLOlLObfOJzzQ25zsjVwX/1 chz3H+DqP7sdZXO2Ijp9ok45lJTMK8fr5qzVAwpa1XhM6wB8C8mUgQVREgq9nP5gn79C Irtg== X-Gm-Message-State: AJcUukfmtMUp80dQbxb9mI3CI69qDUGmVHs260YMYyP21meKFzCpStoZ wYHK5Z7I12Ch05a6C3ZSI9DACw== X-Received: by 2002:a9d:4806:: with SMTP id c6mr5894410otf.127.1547660664043; Wed, 16 Jan 2019 09:44:24 -0800 (PST) Received: from alago.cortijodelrio.net (CableLink-189-218-30-19.Hosts.InterCable.net. [189.218.30.19]) by smtp.googlemail.com with ESMTPSA id m129sm3152973oif.50.2019.01.16.09.44.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 09:44:23 -0800 (PST) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuah@kernel.org Cc: Fathi Boudra , "David S. Miller" , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/4] selftests: net: use LDLIBS instead of LDFLAGS Date: Wed, 16 Jan 2019 11:43:18 -0600 Message-Id: <20190116174320.14938-2-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190116174320.14938-1-daniel.diaz@linaro.org> References: <20190116174320.14938-1-daniel.diaz@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fathi Boudra reuseport_bpf_numa fails to build due to undefined reference errors: aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall -Wl,--no-as-needed -O2 -g -I../../../../usr/include/ -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma reuseport_bpf_numa.c -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa /tmp/ccfUuExT.o: In function `send_from_node': /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138: undefined reference to `numa_run_on_node' /tmp/ccfUuExT.o: In function `main': /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230: undefined reference to `numa_available' /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233: undefined reference to `numa_max_node' It's GNU Make and linker specific. The default Makefile rule looks like: $(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS) When linking is done by gcc itself, no issue, but when it needs to be passed to proper ld, only LDLIBS follows and then ld cannot know what libs to link with. More detail: https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html LDFLAGS Extra flags to give to compilers when they are supposed to invoke the linker, ‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable instead. LDLIBS Library flags or names given to compilers when they are supposed to invoke the linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS variable. https://lkml.org/lkml/2010/2/10/362 tools/perf: libraries must come after objects Link order matters, use LDLIBS instead of LDFLAGS to properly link against libnuma. Signed-off-by: Fathi Boudra --- tools/testing/selftests/net/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index f8f3e90700c0..1e6d14d2825c 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -21,6 +21,6 @@ TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls KSFT_KHDR_INSTALL := 1 include ../lib.mk -$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma +$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma $(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread $(OUTPUT)/tcp_inq: LDFLAGS += -lpthread