Message ID | 20170628170859.28583-2-fathi.boudra@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp158263qge; Wed, 28 Jun 2017 10:09:30 -0700 (PDT) X-Received: by 10.99.100.68 with SMTP id y65mr11311660pgb.165.1498669770657; Wed, 28 Jun 2017 10:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498669770; cv=none; d=google.com; s=arc-20160816; b=SH3c8myMIIRrejcL0i+57fqbuIX3ZKwNsY7QnO7rucgcXYOMaeP1ihLow/dHe/HSaY ghBhf8pNID0azzLKIPunStfT+Lhmaww1cQ85XrEw+fYEpIrcPQ98C5bSIqe8Your9jxr 7z4S7eEA6yT4VxzfH8pZOayb9MidsVXjEL8y7ot+wsd4bA0gPq2BJtay9xHhIrzlFSWU otKkHZXJe8dBLLqMaPQxUIuVE+d5R8bEywvffpxUouBaA6dU/jed9kWcXNZJ9yFExugl uUsSUZtBWSG3V8slmoDTMP2Xok4ryL3xS9V3xR21ZD+Uhi9DYBx7dL3tSIkTLgKLQ8FZ M2Zw== 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=hPmSI1cKsQL4o9b9KONHRjP+HQ5us908gKZWu7yjiW+pEKtBk63KRdBXqLIdS7kOKT +gW+kpHi/jWOwC0AWrT3MiYlDLqY6GWhH60gfTZ/i8bXlZBkde5QbXbqvMuwuO/Hjj3M R63bHTKR4h1gv1uLHj9VeZbPGbS9l5Oh0uF5w8BZ5vNvcLz+D1+2zU/9tmrnPkh7BYKz XY3S8wOsrm6IEKeF2NPTy/UKPrbOv/bhEM4YRJ2AtSoyCi4Dp1hFOlyUakyTM5O1nQmh qKHKf5T5z/5GJ06W5eXffd8YcHXPec4aB6DRqFgLHpyy9DkVOmoBrFrrc1yQ5RhSn4nV +VlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Cj6iXrf3; 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: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c125si1912763pfg.322.2017.06.28.10.09.30; Wed, 28 Jun 2017 10:09:30 -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=Cj6iXrf3; 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 S1752010AbdF1RJX (ORCPT <rfc822;georgi.djakov@linaro.org> + 25 others); Wed, 28 Jun 2017 13:09:23 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34229 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751614AbdF1RJH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 28 Jun 2017 13:09:07 -0400 Received: by mail-lf0-f53.google.com with SMTP id l13so38826775lfl.1 for <linux-kernel@vger.kernel.org>; Wed, 28 Jun 2017 10:09:07 -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=Cj6iXrf3zNQuPo/vX0gG8YlnBQHrUwiezcFUeCRbkRTheEbdGuYxIm5x8Sxcz0FjdA EuegwM/PGcv2h/pk3KSKYdXpDmULXzWsIVKPlut49cH082m3/wNesZNBwMyW7TrI5pnc nQDcR9JL7/+IqGoESSyBQyBExAi2wOpfZ+hNM= 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=XE6cJhyDwN1xqeUPKkJHiaqlU8kGPaUf7BMCBbzIwU6DyWC998N++EKaJK2A1tMlvc 6syizPkEM3Sjo8MyDeKuTRHb0jSEOnNMBMKffKH8xAgP0WN+VzrTJlX0dpEzO29wvmxT PBWZi9o33aXaY5Fvze+w9CV2X59A4gioOBcgCTZwOd8j20hKmk4hKs0GpQsZMTbbO9jq 89AHFkr7BHx/sMi+k6Zbcmh9naG5YF9Z6bGqsDSdcJVAcpaNTTYiZYMOdukTy9vd6849 gD5r0z1DkhFJ3bMK1CIMJOLlCvKRTxzWzPp1x9AxmnDTAQdHzchkAD0dnNktryGPp2qN Uo0Q== X-Gm-Message-State: AKS2vOyQ8IIy7T4T4FOk32qhU1TGoRFCM9UTbZOB7NbSMH59Ks4KESJ7 lSkF0HyX0bUWaRag X-Received: by 10.25.152.212 with SMTP id a203mr3952117lfe.62.1498669746193; Wed, 28 Jun 2017 10:09:06 -0700 (PDT) Received: from localhost.localdomain (a91-156-68-101.elisa-laajakaista.fi. [91.156.68.101]) by smtp.gmail.com with ESMTPSA id h6sm580796lji.59.2017.06.28.10.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 10:09:02 -0700 (PDT) From: Fathi Boudra <fathi.boudra@linaro.org> To: linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org> Cc: linux-kernel@vger.kernel.org, John Stultz <john.stultz@linaro.org>, Denys Dmytriyenko <denys@ti.com>, SeongJae Park <sj38.park@gmail.com>, Fathi Boudra <fathi.boudra@linaro.org> Subject: [PATCH 1/3] selftests: net: use LDLIBS instead of LDFLAGS Date: Wed, 28 Jun 2017 20:08:57 +0300 Message-Id: <20170628170859.28583-2-fathi.boudra@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170628170859.28583-1-fathi.boudra@linaro.org> References: <20170628170859.28583-1-fathi.boudra@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
selftests: fixes for undefined reference (LDFLAGS -> LDLIBS)
|
expand
|
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
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 <fathi.boudra@linaro.org> --- tools/testing/selftests/net/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.0