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 From patchwork Thu Jun 29 07:24: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: 106610 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp780103qge; Thu, 29 Jun 2017 00:25:17 -0700 (PDT) X-Received: by 10.101.83.197 with SMTP id z5mr7059693pgr.261.1498721117136; Thu, 29 Jun 2017 00:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498721117; cv=none; d=google.com; s=arc-20160816; b=OGKx8DBxHhzynHGJZD0FE+jJldivqi0RpjgCdqk+CeR6QmRva3Haycv8sf/hI13g4D nafzafkhzadclCVt/FXmvVO5cWzxS8ugG+J2nYu0PbeTwDmd8XUxQadXCAsRawVX245v SRbRLrHR2ekbs8YfrEMnzteshx11nnKZ+JDiq8eldXVibLFkprGN/rf8GlwJ3zgMOVLL GrVoWk75mLwobeKh6uuwJY5gn2MmiLOkmyXhi5eFpneCf46dCHsu8JIeycHpuk/uMae1 IX0n/olAAWmd3jpZuBiKi4BnZfjpENbAop1Un1hec9swI7oppanBSgQurTV8S6PRxOlH LQCg== 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=0jaSXxDZeQdlhSPxlAB2wUQZDgPruqXO5LerNrcLZco=; b=M0bB3jPmFo5PfTpmtvsRnrjwJ5OO05hisXJMi+fE3yvfM/6EMhK06EhOpV5JclNvcG dbf/M7K1kQPaK29xPLpwYrtG5w8MCB5Gn+VtSd4A6bHwUvJJbdsby7VBiGYcf9NZAO4+ xLICqAJWFWCGJ8+k1SSyNVSwM88uRHlFcX8REwU5Z6pFVulBuLaDIYXWMgW4/OCWgbW5 UtywJgVgHfB2ko9pk7e8Y5pLcH7sMqMzCkQCsqTSHZZDhjRAFAuMvj1vvy3Pqq2KeZV4 KPeUtovwZcB2F2+E5/7P95JYd4F8URtLB89fFpYy+aiJmMdnEsGc2+3OEoSSs/8fIn4F Sg9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=PLZCXViD; 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 d188si3185026pfc.312.2017.06.29.00.25.16; Thu, 29 Jun 2017 00:25:17 -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=PLZCXViD; 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 S1752167AbdF2HZO (ORCPT + 25 others); Thu, 29 Jun 2017 03:25:14 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:34474 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbdF2HZG (ORCPT ); Thu, 29 Jun 2017 03:25:06 -0400 Received: by mail-lf0-f45.google.com with SMTP id l13so47571720lfl.1 for ; Thu, 29 Jun 2017 00:25:04 -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=0jaSXxDZeQdlhSPxlAB2wUQZDgPruqXO5LerNrcLZco=; b=PLZCXViD8WJ0diyJ0M1NBpGGAXDM+cl6piagBQG12GbQbU2Ofh8IOHZqmHpDhUIW0T XmJuvWSieLvObPbBzlYrVJnDmsa1HXOCd4RZ2yx7liUmaThiiED/HJsi7XobdTA5cASK RT4D2qWIiiHvgVnuVmhNoStHukQATGHwLflWo= 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=0jaSXxDZeQdlhSPxlAB2wUQZDgPruqXO5LerNrcLZco=; b=kXjg+6RdK3mJFMs0cTLGf3IbDiRxaYbqz4/rBzGpwCK9J8l1ndJPx022DSJsdiyBBb +33QkptWvqar5BIXucvnm1mYoe9TaVyqOwWpbIITT+2/53dhhgdNQvuJ6jURzlfj7YuA 3mumKXRDxEkeIFdGiEo4YqAwMrbDFErdakGbUe2DPUjIPo/FgElTYL6qQL5P68r1vz8z BraLI2dcrLMGrUTAa5cCNpm98FPzTbeq/RCtc2IFJ+mnj1oL5nqujZ/sKV03bEuaHHWB E/pVcB/Jy2vnbp18PdnctZkuDvt2kwrExSwekKIy3VnkCRXbG1kHeXB5AzJNH0zJCGP/ Mkgg== X-Gm-Message-State: AKS2vOx0QkEbMGGUvx69TlXeN+nN/cNYXw11NOmQ4Uv7/Xzx6VgT3nzh 2M48rfoP9uF7bD1s X-Received: by 10.25.234.6 with SMTP id i6mr5648142lfh.42.1498721103886; Thu, 29 Jun 2017 00:25:03 -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.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 00:25: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 v2 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS Date: Thu, 29 Jun 2017 10:24:58 +0300 Message-Id: <20170629072459.30741-3-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 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..7c0afc3c8aef 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) $(LDFLAGS) $< $(LDLIBS) -o $@ From patchwork Thu Jun 29 07:24: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: 106611 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp780850qge; Thu, 29 Jun 2017 00:26:31 -0700 (PDT) X-Received: by 10.84.229.69 with SMTP id d5mr16109687pln.197.1498721190954; Thu, 29 Jun 2017 00:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498721190; cv=none; d=google.com; s=arc-20160816; b=fKklVVxTk/zfrAyhK+O1J7fAfPfeqKcPzXO3VdADJmQE/JYOfo8G7+H3pgfQIMWwZ5 OmdBH0zxA+8srg9+q6e7sOOyvPPX2WswjLeq/6+qMWOHyz4T83h2U4aUKf5qUs2do+cr kDY4OA/YxHvvb9h2KTgOTQ6pWJGfizyh+M4H1kHikjBcfdphwmmOHz78dRkGCH3RDGB4 M+hih6UONbmeVpOI/8yJIp83nSK3xKpXSMmd9gka66JyO3oCJo4M/oriUB8E1ecBUsu5 WEXJzqu2gj1F0pttlboQlI2BdYNncE4Y5iR83esyneBw8/dwjCAtQQ8ZCvDnxeSYFJA2 LQng== 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=bl6Ytb10oquZsV8LdVBA1dyxdky4LIgvixGjdGm3WqavQFuV/i4TPjyzjXwzES9D5p bcEOsLtloJVzv3OfP3jPYoT8XOWmmQDZj8w8frt7fJzJJ67ARRzIpSot1axBKyNAjZ96 XE2KojmtwoeomJazHc4f4Sg+/UFxGnJh/P8yW8u0t+OnC0z2/fbMzm7xGQzkp7TDSSI1 yO7tvDH3bx8P3ItrE6Q1U1hRXLks00X6G7oeYKB6MmdFN5QiNnQcWmTWGJFBJpppILYO AQwrR5c0bRTx1up5OQS7PeLRcQW11O0lk2NPtYAeEfu5QsWONUDVG1HtyNtiOSGTMzN8 KO0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=NGmzUjVS; 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.30; Thu, 29 Jun 2017 00:26: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=NGmzUjVS; 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 S1752483AbdF2H0D (ORCPT + 25 others); Thu, 29 Jun 2017 03:26:03 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:36710 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbdF2HZI (ORCPT ); Thu, 29 Jun 2017 03:25:08 -0400 Received: by mail-lf0-f48.google.com with SMTP id h22so47513190lfk.3 for ; Thu, 29 Jun 2017 00:25: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=y0FuqVJLjkLXrYZ2OgokxI/xGpFHC7qi0rzVJlYcqys=; b=NGmzUjVShRQqVovo/+V6Q+JhLpPPxrUERT7DdM7j4+yDj6siOdheDFjNbcR0pk1eYV p2uajtAVfyQ9fJzfCqAl8GFjvH90dA5Z+foqRzs+jDMj3CKE50fnl8V9gjw0j0PqTRhp OIcL4mgP/kTC/JLElzu5nChCbWfbh49gdBCbM= 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=XMDqb/6Sj++il5f+EZP2icQ9I5ZlXSFeWEaFQ1A2GrHNdYfQmme9r9y+Ege5tX0WwN pKBW3ZnVOBf9Wn42EQKJ/9/K/K5oxPBnv3axqoyPZ7nrvFLBpKoNjZQF3s2z5Z/+BkUK ykSyV6EeeyJbC4VZ2eOcgWgZz69lkG4LQ81QaZ7Sar5Wh5lUBIUlg++lNdUMsPjirEsC vBJMfDHJ0K7d+GY+WzXQs+gBemwqB26dy9zRav42fzuzzVc9RW0DsU9PaX4JuL7Ja2fM EgKM7fKsOEjiuItw225+/1Yv7mzpNAWjA/ASBq0vG+UsOggKRLu9pOLb4s3V6hCivxHy oPfw== X-Gm-Message-State: AKS2vOxuEcqkNXYbdEqq9rp87+0MyPfa4TL1i5AVkSp0HHedr5ZoQHeO 0jbLqcqtA6ceTEu4 X-Received: by 10.25.235.69 with SMTP id j66mr4950417lfh.141.1498721106188; Thu, 29 Jun 2017 00:25: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 m27sm1082006lfi.50.2017.06.29.00.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 00:25:04 -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 3/3] selftests: timers: use LDLIBS instead of LDFLAGS Date: Thu, 29 Jun 2017 10:24:59 +0300 Message-Id: <20170629072459.30741-4-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 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