From patchwork Thu Jun 29 07:24:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fathi Boudra X-Patchwork-Id: 106612 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp780856qge; Thu, 29 Jun 2017 00:26:31 -0700 (PDT) X-Received: by 10.84.217.15 with SMTP id o15mr16605266pli.31.1498721191328; Thu, 29 Jun 2017 00:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498721191; cv=none; d=google.com; s=arc-20160816; b=OHzrmysjyOibRzrXrd4zHK/qRhBL/TE61Vj3eW6m8QACHpcqn4/0YLuuHZ6/BiU7Gy zJTboLGYXiBaGibdu7F1VGZWyuUQJKVfvAbYXAW3X4kVssW2+Eb0EXQY//e3/oUZLsO5 pItUWJQGQaXyi4UHpepZrLdvUCe2Q2kmDVvvwHDWQcU+IDQ5a7thac3JfGG2V6mo2hU/ rxlIkFw/+7pUnG9STGKiXiK14LXRytI3n9VOfb3jW/j/+00lKkobtyqo8rOoCxv1Ugd0 30vxNrDp38Dn3n4Vem7wfucpTbezzA8cP+n/fB/YPYe2n1Q1aDSZlufMtEttySqvsUFa N6YA== 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:arc-authentication-results; bh=gacpqjIJuHX/DK3Cm360uMxix7GtDJXe5o/zOKCEQk4=; b=liH+dKkFI9GITEScvq3I9VljtqCRyogi68vUy0EHPvidCumcsZ9rW+mTKdzBYFcgp/ +nRmhuztDo5uGQ0/yA4wY4rv+uOi8iOlEaJv2MpTqqM+wFnd8juJMHmydu20Iot/IPKo 5KwEhEWOxGBs4u7iWFiiPuip37g6Vy/gAtXZwaxhc7sHYS6gzLsIlWgkhDiqK9RfZ0w2 wAnhv2RB5OfdSjEZT0KqSt1daPKdkDdSb0YX/T14MpWCAs85cqEjmQQK6YjklQ+Qc40W vhwAo+sWKS8WzSmj69XNa9rxANHR0c7ZPZ68VzVa7KALOCl0jzMEAHFIbgs7OAFV1R8l +JSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=HNcfJi6i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 b124si3071460pgc.307.2017.06.29.00.26.31; Thu, 29 Jun 2017 00:26:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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.b=HNcfJi6i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1752498AbdF2H0M (ORCPT + 25 others); Thu, 29 Jun 2017 03:26:12 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:36688 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbdF2HZD (ORCPT ); Thu, 29 Jun 2017 03:25:03 -0400 Received: by mail-lf0-f41.google.com with SMTP id h22so47512266lfk.3 for ; Thu, 29 Jun 2017 00:25:03 -0700 (PDT) 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=gacpqjIJuHX/DK3Cm360uMxix7GtDJXe5o/zOKCEQk4=; b=HNcfJi6ikAyauwBzSBQhDNBHbZWhpx0NnVS5wgK+2zeao9hjjSWAcjaBCGD76Pu70c DGVhjj/6QiOBYD7t/8MzKsnWTe6wcHvhKjkHJXdBV/1DrTevKNcx5Ezh+tyVnGHC2+PX J0PpvrBA6MbQ57r2LNzm96Cs1jguAks0jasDE= 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=gacpqjIJuHX/DK3Cm360uMxix7GtDJXe5o/zOKCEQk4=; b=TVg+cQvNlXj6g5OPFOEdusx6tEbkUlSVX4mdDZJ5qLfsXI+lt5ftcx6T1rb60TEq/s qmYUrJSCJbncBF+gKfWKxM4E60yDaK3J5fRuuAa2j3kk/28BRrdaLbuWdDmw5/VwT3/O vxhauvKyEE9Sjpgmr86uZ2GpXAbOBHtYFs+K7eXaesH/ooyFtDw1HS06tBCL381C+qn+ 25SM3aj7g+DBa+RF+SpHkfpLkqEOl1X+FSVFGixjBsMJCs1h/JuzgPdJxbGtmejN4ugM 0uU9sczrPzI9uiUMjLK+ETQ1IkSn5k2q67AwP2GVDTZU9522WB/JKrg6gQJS9bq2ZCTd vWCw== X-Gm-Message-State: AKS2vOwyk8L5vL+wuQGHEWmNjycY20Mm5UxTDDLygfvnIazyaXRydSwU hf18ne6PCc4iCJYvtQZgAA== X-Received: by 10.25.19.201 with SMTP id 70mr4383015lft.17.1498721102190; Thu, 29 Jun 2017 00:25:02 -0700 (PDT) Received: from localhost.localdomain (a91-156-68-101.elisa-laajakaista.fi. [91.156.68.101]) by smtp.gmail.com with ESMTPSA id m27sm1082006lfi.50.2017.06.29.00.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 00:25:00 -0700 (PDT) From: Fathi Boudra To: linux-kselftest@vger.kernel.org, Shuah Khan Cc: linux-kernel@vger.kernel.org, John Stultz , Denys Dmytriyenko , SeongJae Park , Fathi Boudra Subject: [PATCH v2 1/3] selftests: net: use LDLIBS instead of LDFLAGS Date: Thu, 29 Jun 2017 10:24:57 +0300 Message-Id: <20170629072459.30741-2-fathi.boudra@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170629072459.30741-1-fathi.boudra@linaro.org> References: <20170629072459.30741-1-fathi.boudra@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.13.0 diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index f6c9dbf478f8..7236427d083e 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -11,4 +11,4 @@ TEST_GEN_FILES += reuseport_dualstack include ../lib.mk -$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma +$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma