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 $@