From patchwork Wed Jun 28 17:08: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: 106555 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: 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 + 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 ); Wed, 28 Jun 2017 13:09:07 -0400 Received: by mail-lf0-f53.google.com with SMTP id l13so38826775lfl.1 for ; 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 To: linux-kselftest@vger.kernel.org, Shuah Khan Cc: linux-kernel@vger.kernel.org, John Stultz , Denys Dmytriyenko , SeongJae Park , Fathi Boudra 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 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 From patchwork Wed Jun 28 17:08:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fathi Boudra X-Patchwork-Id: 106557 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp158504qge; Wed, 28 Jun 2017 10:09:45 -0700 (PDT) X-Received: by 10.98.80.198 with SMTP id g67mr12133254pfj.146.1498669785466; Wed, 28 Jun 2017 10:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498669785; cv=none; d=google.com; s=arc-20160816; b=yiqlPrP5XLY3rnPO/l2MbSSiQggIHSbhKyYJq0QEIWMnyLeYoAxzqNFSjBAnpFl1aJ td7MJuifVLaxwhbiUQFBI4NBG1kIF48nMmZiV9d8ukLDkCm1zZzjsFO5+8DjWJtjG/82 4V6eshw5p9svu/4k/wVR/rHMQBjahTYq1sTG6DOu44Jh+ZZmdh+o/bfXCiiv/UrNmZGB Oegl3Fi7uECgfedYZUgXgeWqgG1CJV67cFAqE4UiWgnXA5HK7SD3f3cbyaLVFeWzcqSA gE/W45QvYvYXPCCwC7nPfykfhAn0W192OXgbaoTcEZeX0Jre5+BESFVpA1t/EBA+BYoI EJ1Q== 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=T5Dq4XafISS3u9gEZHjM6ccBJMfAuOnD3IEP7ikIB2I=; b=QDaZdX+FRiV+2GAaOhmAp+bRI1MHk9b42e9NpdqwCxEeIP5ImtP0XnQ7fq6nCZargh z0zd1Y+lBD5apiOaDqyR7WKV0JkUyzHilWI/AlmEP1eLHTKgbdlcugiyVpYFQoVwYny0 7a/GgwXp+vvwaZHpEZFl9sicuWGYzU35VTKHM6uBGsbMHCsUvyznIPjyYeC6zVr7acm/ Lo7nffpMJIiGq2cAuD1M7uU2HfxEoaDSEebEDfpDlJugbGqyNBk1NrL+2KPx3MmBUq4q EsXojHXnNN41HOHu5LOZNo4H+CuRMDdwZW0EwgCaSqW98FZQEOj4Qoe/U7oDmI2iM2f9 PjwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=UKp8vXiw; 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 k5si2110825pln.98.2017.06.28.10.09.45; Wed, 28 Jun 2017 10:09:45 -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=UKp8vXiw; 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 S1752124AbdF1RJn (ORCPT + 25 others); Wed, 28 Jun 2017 13:09:43 -0400 Received: from mail-lf0-f43.google.com ([209.85.215.43]:35973 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751840AbdF1RJJ (ORCPT ); Wed, 28 Jun 2017 13:09:09 -0400 Received: by mail-lf0-f43.google.com with SMTP id h22so38748695lfk.3 for ; Wed, 28 Jun 2017 10:09:08 -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=T5Dq4XafISS3u9gEZHjM6ccBJMfAuOnD3IEP7ikIB2I=; b=UKp8vXiwYMbujEANozFRv14Hf3fJSAMpwompUttni8+TuRHHTRDVuTSe1W0AbdScqa lzO61omg3Rgt5wKL816eAbwHnG7s7uDyd/g89ZoQHbU7H+J3zEuVOSxe5REvHZ2OJrkv ftSpkl4dSSAxCuNC4CP0eKeX2upMrb7LMtSP8= 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=T5Dq4XafISS3u9gEZHjM6ccBJMfAuOnD3IEP7ikIB2I=; b=sCTPJwydul/0mjYhcmeiFLArlCFjEa7lAWdb8x6OH1G/W+nVYMAE6bKIdoXvH1nTwd iRLf1841CXy8EoAulAUnk3cp+uZKRYQAjr3OXl5In9zANTpkA6nQH4R4NSGBayUje3m2 SjQf5oGsNa251M/oB+DyJ0uQLlhtG6KXVHtgLs31/dtOs3XvQdMMMQTNv8WgOO/H0bwj IfKnuxkS/rbnd4Pj9zEOzrQdZpPWHkWV6QbTElCzvTA7OqcMSszw5xmdDSDnNHDV+MTX g3BkIMOOWKreE0jIjOKRSZws2EANhenqn7Z14hPo/ssMKkqRpMl4wzJ5b+vpuyZ7n/w9 oZFg== X-Gm-Message-State: AKS2vOweD6Bryyd07jro0BeherOzlD0J/937WNppWTCuogtx8qxxLxqN ba9NPIz2Mroa1t59 X-Received: by 10.25.115.210 with SMTP id h79mr4303998lfk.163.1498669747473; Wed, 28 Jun 2017 10:09:07 -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.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 10:09:06 -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 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS Date: Wed, 28 Jun 2017 20:08:58 +0300 Message-Id: <20170628170859.28583-3-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org seccomp_bpf fails to build due to undefined reference errors: aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -O2 -pipe -g -feliminate-unused-debug-types -Wl,-no-as-needed -Wall -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lpthread seccomp_bpf.c -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf /tmp/ccrlR3MW.o: In function `tsync_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920: undefined reference to `sem_post' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920: undefined reference to `sem_post' /tmp/ccrlR3MW.o: In function `TSYNC_setup': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1863: undefined reference to `sem_init' /tmp/ccrlR3MW.o: In function `TSYNC_teardown': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1904: undefined reference to `sem_destroy' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1897: undefined reference to `pthread_kill' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1898: undefined reference to `pthread_cancel' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1899: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /tmp/ccrlR3MW.o: In function `TSYNC_siblings_fail_prctl': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1978: undefined reference to `sem_wait' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1990: undefined reference to `pthread_join' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1992: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_ancestor': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2016: undefined reference to `sem_wait' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2032: undefined reference to `pthread_join' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2034: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /tmp/ccrlR3MW.o: In function `TSYNC_two_sibling_want_nnp': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2046: undefined reference to `sem_wait' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2058: undefined reference to `pthread_join' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2060: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_no_filter': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2073: undefined reference to `sem_wait' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2098: undefined reference to `pthread_join' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2100: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_one_divergence': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2125: undefined reference to `sem_wait' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2143: undefined reference to `pthread_join' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2145: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_not_under_filter': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2169: undefined reference to `sem_wait' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2202: undefined reference to `pthread_join' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2227: undefined reference to `pthread_join' /tmp/ccrlR3MW.o: In function `tsync_start_sibling': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941: undefined reference to `pthread_create' 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 libpthread. Signed-off-by: Fathi Boudra --- tools/testing/selftests/seccomp/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.0 diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile index aeb0c805f3ca..d1c74ce70f08 100644 --- a/tools/testing/selftests/seccomp/Makefile +++ b/tools/testing/selftests/seccomp/Makefile @@ -1,8 +1,8 @@ TEST_GEN_PROGS := seccomp_bpf CFLAGS += -Wl,-no-as-needed -Wall -LDFLAGS += -lpthread +LDLIBS += -lpthread include ../lib.mk $(TEST_GEN_PROGS): seccomp_bpf.c ../kselftest_harness.h - $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ + $(CC) $(CFLAGS) $(LDLIBS) $< -o $@ From patchwork Wed Jun 28 17:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fathi Boudra X-Patchwork-Id: 106556 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp158493qge; Wed, 28 Jun 2017 10:09:45 -0700 (PDT) X-Received: by 10.99.104.74 with SMTP id d71mr11807453pgc.7.1498669785098; Wed, 28 Jun 2017 10:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498669785; cv=none; d=google.com; s=arc-20160816; b=QNfqjS5/j+XCvgkihqVZEocs6W2UDrx8n55yykNksO87PtN877eOaHSnke/P8AH/IU ikZKq12Ukot848KCI/Xgo4t7IQ23JB/16p5KfThMwXVi/JG/fQJa7BzIQ7eDk+7KoUop L3RO115XH93+iTWwIAvjnsNsg+QqWAaiNkgwQYKBo14DmWwQOr7/E8xC8oJCvR8IPmsq QmR1P2pyXGkHh/msQ6z4FuFAmAQK88aExi7VA6HU+h7j+XwiD+ynzpFzeUm9zDdE7z/e xpdH8FtaIiFnrXZHGPm3g7F5tzsoqScjhEr+OoGySa0WC1yz4pkR+WgfzRh6/TDa5V92 wsrQ== 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=y0FuqVJLjkLXrYZ2OgokxI/xGpFHC7qi0rzVJlYcqys=; b=S5ELjezopvFampqXl1/AineQI1TfRNscT1xa95BcLZqoOGIbor3w+P19Ye3dbsKTMs 9D00SbjTEFhhQOPCoxiCqCf6+qUJEJJ29z9TSpIW4ZO+EWZWAArOm0sfbEyp8MF0S5nK 4XA12cgdq4LAo/sZDzOCDasohLmoxtM8IwkZEvCLm/9URFWFbDm3imeKrY7KuNfCQ4jV aPxBAqm6DCY7z75yBsX4GVqL+Eju1gT1rhsyOGjwGxbfKXzQ1CD7/gH8OKZ3bPRHsBBy n3NvpMgVX2XS8OdLALSNX8cKuw7ayVFq1UfWNPfsJyAcpnEugc7FBdI8fiwOy7am7/yC 9LzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=fIC68zu1; 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 k5si2110825pln.98.2017.06.28.10.09.44; Wed, 28 Jun 2017 10:09:45 -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=fIC68zu1; 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 S1752059AbdF1RJc (ORCPT + 25 others); Wed, 28 Jun 2017 13:09:32 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:34858 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbdF1RJK (ORCPT ); Wed, 28 Jun 2017 13:09:10 -0400 Received: by mail-lf0-f41.google.com with SMTP id b207so38765978lfg.2 for ; Wed, 28 Jun 2017 10:09:10 -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=y0FuqVJLjkLXrYZ2OgokxI/xGpFHC7qi0rzVJlYcqys=; b=fIC68zu1VQ59fbcmxIX+CLZ2aRUgx0C+iqP1EZ7hS6IrWHa2oo+lu32JJ/CTPD83UY 4gNHMM6c+K43vV1E7EMmtZxxMIt2cSdwvjuoZh/sEvaePkM4HKITkPDL24aItgQKE56F XGoCRSMjGZ5V5qEfGyAPTBhvzAeb1uFLUShjE= 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=y0FuqVJLjkLXrYZ2OgokxI/xGpFHC7qi0rzVJlYcqys=; b=fDgIYFesVw3tj4MhOyhfMexi08jLIIv+Mb9V6GA8Bvsl7aG96kVUKlBrTImaO1chDA ssK/u7yz03JscMdstg/zSE5qcQQPtTZRIXtjc/4LxoPXDj96xspDW+xJd/i3/XWcqLvS 7hEcqqMQPW2N+8Q+AsjOOFdwq5wkLMQjL5LTSy+av42BfxqWB9pG6t9OGWiC2dseO6fH pPxRKOYh5Bje3lmLqhcCcLwoHJHnEhGAOdeWlgnBC+TJXxodAtBii2TcYe0VxMIDPIBc 0GpnhcFUNTaTfe9kP7QuXVlSktw9A8vLVxhGJrBQk5ruCiCJjCmr2398MMqDM0k0PtLm nEaw== X-Gm-Message-State: AKS2vOyasrhKhbyWf2JDFP+MKP/E9wD8TtVyyHqX8yJA9ztv38NeIMaD gJNTqKjCHFdWhfLc X-Received: by 10.25.206.205 with SMTP id e196mr3949090lfg.126.1498669749106; Wed, 28 Jun 2017 10:09:09 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 10:09:07 -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 3/3] selftests: timers: use LDLIBS instead of LDFLAGS Date: Wed, 28 Jun 2017 20:08:59 +0300 Message-Id: <20170628170859.28583-4-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org posix_timers fails to build due to undefined reference errors: aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread posix_timers.c -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers /tmp/cc1FTZzT.o: In function `check_timer_create': /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157: undefined reference to `timer_create' /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170: undefined reference to `timer_settime' collect2: error: ld returned 1 exit status 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 libpthread. Signed-off-by: Denys Dmytriyenko Signed-off-by: Fathi Boudra --- tools/testing/selftests/timers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.0 diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile index 5fa1d7e9a915..f48d7ca9d9b1 100644 --- a/tools/testing/selftests/timers/Makefile +++ b/tools/testing/selftests/timers/Makefile @@ -1,6 +1,6 @@ BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) -LDFLAGS += -lrt -lpthread +LDLIBS += -lrt -lpthread # these are all "safe" tests that don't modify # system time or require escalated privileges