From patchwork Wed Jan 16 17:43:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 10766479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C29213BF for ; Wed, 16 Jan 2019 17:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47CA82BAA5 for ; Wed, 16 Jan 2019 17:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C56A2E930; Wed, 16 Jan 2019 17:44:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C80032BAA5 for ; Wed, 16 Jan 2019 17:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727460AbfAPRoL (ORCPT ); Wed, 16 Jan 2019 12:44:11 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40355 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbfAPRoL (ORCPT ); Wed, 16 Jan 2019 12:44:11 -0500 Received: by mail-ot1-f68.google.com with SMTP id s5so8480489oth.7 for ; Wed, 16 Jan 2019 09:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=CjETfAnfRxtbE9MWGkPp2aHU9Y+vwQE7qZ1JQ/QEJmM=; b=SYJt/2jFty9uyfCQ+VSpn/7urDoH9zQ8wkSsk946KPg8eE+owKpIT4Z1tFPhbM4Ok4 4Vp0rRlVH1jiKTXHbIkmRu8pBb8OKOiNXN3pgBbD7d2TtVRX/FX3/64X+Sv3ihvO524W yt/6XADt7d/tSDDPXihdxAJj9bP5hWC1ToYIo= 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; bh=CjETfAnfRxtbE9MWGkPp2aHU9Y+vwQE7qZ1JQ/QEJmM=; b=Oo8NqOcn0emnhtdUMPwBs88qZPjs5JkR7Db99npi0s9eKcIOOrVpj2Y21sUl+wN+vd 0jaFOfYRezyWN5nHarchgytLMlhCl9XkH3qnn/zTg6fWrTwxKy3iJYqeGnbTzjlbh3cg WwlHHE/oBxbKwEiM/GDyCT91+zTWzCqlh4B4bI7xtPsseGr1EKq56VM8K6Lw8+L7pnGy opPKGZ+l7hyBwIiMW+ZQ7S2ev3pwSY/KdGJo8AzoKL+fwiNLDyam4/bhTp1vwebQ0lwe d3QF0wSPabpRe8SoRjOsx/rEI70W673qwq9Qf/MXLsmw5AQWzMA/O4NK8qkScRgiSN9e K4nw== X-Gm-Message-State: AJcUukcskqwM1RQst3l4S+ezmslAa1uokPhznfvt6tKngr1N11az8AFv zu9+HTq427KtOday/OqyiQUI8A== X-Google-Smtp-Source: ALg8bN7E2a+BrEjT0XTiStofNUshGEOMJ1QwK4HVMst67gq8PT3Ao7WA8OS97kdmjlyGgEJPWiOr2Q== X-Received: by 2002:a9d:6191:: with SMTP id g17mr6481114otk.56.1547660650423; Wed, 16 Jan 2019 09:44:10 -0800 (PST) Received: from alago.cortijodelrio.net (CableLink-189-218-30-19.Hosts.InterCable.net. [189.218.30.19]) by smtp.googlemail.com with ESMTPSA id m129sm3152973oif.50.2019.01.16.09.44.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 09:44:09 -0800 (PST) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuah@kernel.org Cc: Fathi Boudra , Denys Dmytriyenko , linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/4] selftests: lib: allow to override CC in the top-level Makefile Date: Wed, 16 Jan 2019 11:43:17 -0600 Message-Id: <20190116174320.14938-1-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fathi Boudra Relax CC assignment to allow to override CC in the top-level Makefile. Signed-off-by: Denys Dmytriyenko --- tools/testing/selftests/lib.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 8b0f16409ed7..0f9c47eaaa6f 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -1,6 +1,6 @@ # This mimics the top-level Makefile. We do it explicitly here so that this # Makefile can operate with or without the kbuild infrastructure. -CC := $(CROSS_COMPILE)gcc +CC ?= $(CROSS_COMPILE)gcc ifeq (0,$(MAKELEVEL)) OUTPUT := $(shell pwd) From patchwork Wed Jan 16 17:43:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 10766481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9021691E for ; Wed, 16 Jan 2019 17:44:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C94B2BAA5 for ; Wed, 16 Jan 2019 17:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 703952E95D; Wed, 16 Jan 2019 17:44:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D2862BAA5 for ; Wed, 16 Jan 2019 17:44:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727419AbfAPRo0 (ORCPT ); Wed, 16 Jan 2019 12:44:26 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:39661 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbfAPRoZ (ORCPT ); Wed, 16 Jan 2019 12:44:25 -0500 Received: by mail-ot1-f65.google.com with SMTP id n8so8488488otl.6 for ; Wed, 16 Jan 2019 09:44:24 -0800 (PST) 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=rjGu5CVIAm8AJWA4l+rx6t8yEPYdDyoeZJtii+mb+X4=; b=A/+1RsA1qWeOGru+NTCbI9tMTbwUCEmxSB6HjSc61ZmqlQhiyu/+VIDtuT/P/BHQ+9 baKb5geW6QYq6avK8c446uHe/xAT7dmtNjp4LZJMHg+ai8IdzziCam8gho5Dya9uffa9 Xa5D2ObyORG/9fqQwnx0m14a1Pk4GKXNrlZEI= 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=rjGu5CVIAm8AJWA4l+rx6t8yEPYdDyoeZJtii+mb+X4=; b=lXv4jQLjEQslNn6eqMUs7me+Zd/Qgt4qE5GqmbbUopc7RPgSsbvZP77SWFhjU8H/p/ FOfKH/8zTRqnzKlZmboaAxgBHpViRl5l6trCZarxPW+sPEk21u563nIajJebmVthNW+4 fCSmrkAhcqBT7fv0kOSiLl5ImwQVjXRueza276hKDp9GwTeJztZmiiKHRjaat2kuz2BV wllsnra2RnrXXnoICiB7on8G81dqMcD3j6V+gP/GBHgB0CKGRbbdnVh8DXHY6+jvQjNw bd1uGfZVVO3lK3UI321+AqBmjAZfkTAa5PWJ0uPOT/CJfLEPs2z5239oJqUKGqrqb1h3 MWIA== X-Gm-Message-State: AJcUukc8PhEY4yle/2Zkl+6OgNHCITNILOZCMkaUeSIo7GYS8C/GypRC TcD0aRe/mNKL7oQxvr5rpyk/vQ== X-Google-Smtp-Source: ALg8bN6n82Zv+yTcNErlzZwi7o5YkE5AdO25K7+WDFyam2V3ydxRUvKbxDpft9R8+fqNnGg/cqVPaw== X-Received: by 2002:a9d:4806:: with SMTP id c6mr5894410otf.127.1547660664043; Wed, 16 Jan 2019 09:44:24 -0800 (PST) Received: from alago.cortijodelrio.net (CableLink-189-218-30-19.Hosts.InterCable.net. [189.218.30.19]) by smtp.googlemail.com with ESMTPSA id m129sm3152973oif.50.2019.01.16.09.44.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 09:44:23 -0800 (PST) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuah@kernel.org Cc: Fathi Boudra , "David S. Miller" , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/4] selftests: net: use LDLIBS instead of LDFLAGS Date: Wed, 16 Jan 2019 11:43:18 -0600 Message-Id: <20190116174320.14938-2-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190116174320.14938-1-daniel.diaz@linaro.org> References: <20190116174320.14938-1-daniel.diaz@linaro.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fathi Boudra 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(-) diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index f8f3e90700c0..1e6d14d2825c 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -21,6 +21,6 @@ TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls KSFT_KHDR_INSTALL := 1 include ../lib.mk -$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma +$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma $(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread $(OUTPUT)/tcp_inq: LDFLAGS += -lpthread From patchwork Wed Jan 16 17:43:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 10766483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 053A891E for ; Wed, 16 Jan 2019 17:44:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E35E42BAA5 for ; Wed, 16 Jan 2019 17:44:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D770B2E95D; Wed, 16 Jan 2019 17:44:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 202C62BAA5 for ; Wed, 16 Jan 2019 17:44:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbfAPRos (ORCPT ); Wed, 16 Jan 2019 12:44:48 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:38479 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbfAPRon (ORCPT ); Wed, 16 Jan 2019 12:44:43 -0500 Received: by mail-oi1-f195.google.com with SMTP id a77so3873438oii.5 for ; Wed, 16 Jan 2019 09:44:43 -0800 (PST) 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=DBgikpoYDKLEsgn7BLzA/++54/fMRAvNSrEOYwzsOh8=; b=e7h7QqHzW42AQDkJh7c6/QoNKvD63z2+M5xmA7fgyLu1+/7J6PSLFK+51KLCPqi4YD f1ToYgfo6MeyVl2XR77cwkDxyMNKNVZ/ll40is4ZbqMdjvbLGkNp6DBIesrx/5021ON1 wz9ahbUNGzS+YKi8f1rzhl1raNff65vVdqyHE= 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=DBgikpoYDKLEsgn7BLzA/++54/fMRAvNSrEOYwzsOh8=; b=ch6snm2EYuFu+hwHZReZwubrnYc2brmduGqRSBdg3hQsQzsh4fX4xhzl9PwITR7xgF eLTLjlBSv30ijI7aB0BLmBfUDiaqxkb0TOO+wk3aHHCFx4x5OfhjD1WMbGYFFeGaOAlh JXrTwykxLRzYdkZqgJSh1bGeYu3J9WHZ6A+XolCSifVxhIeiIVtcooXMnXAGbQlOC801 VoxWyQFf2JPPznJQtxHitKBrasXFq/agYL2eikUT4kE5IxUbutee0Irc28n+JNF0v+Vp WKAMuyLYRBr8RvAUEIitdutryEdxQEG6t6p4/JZ+h/ALk+3Ltc9/Cbh+925cyQPjDwb2 w5mg== X-Gm-Message-State: AJcUukdv/Sfje8MxT0HhuYZrJXcbHa3xHHansJ6l3kWyIhjb0nXq/pbe l+DYypO4wBpV34l0QTmEBUUTiQ== X-Google-Smtp-Source: ALg8bN4S4y3YgBSPkE0rbw31yJI6R0kiFXRG71naTplcdigJMXWEwpxxatgcIf6u5j0EeT9++xT7cw== X-Received: by 2002:aca:3209:: with SMTP id y9mr4174552oiy.198.1547660682542; Wed, 16 Jan 2019 09:44:42 -0800 (PST) Received: from alago.cortijodelrio.net (CableLink-189-218-30-19.Hosts.InterCable.net. [189.218.30.19]) by smtp.googlemail.com with ESMTPSA id m129sm3152973oif.50.2019.01.16.09.44.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 09:44:41 -0800 (PST) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuah@kernel.org Cc: Fathi Boudra , Kees Cook , Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/4] selftests: seccomp: use LDLIBS instead of LDFLAGS Date: Wed, 16 Jan 2019 11:43:19 -0600 Message-Id: <20190116174320.14938-3-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190116174320.14938-1-daniel.diaz@linaro.org> References: <20190116174320.14938-1-daniel.diaz@linaro.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fathi Boudra 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 Acked-by: Kees Cook --- tools/testing/selftests/seccomp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile index fce7f4ce0692..1760b3e39730 100644 --- a/tools/testing/selftests/seccomp/Makefile +++ b/tools/testing/selftests/seccomp/Makefile @@ -9,7 +9,7 @@ BINARIES := seccomp_bpf seccomp_benchmark CFLAGS += -Wl,-no-as-needed -Wall seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h - $(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@ TEST_PROGS += $(BINARIES) EXTRA_CLEAN := $(BINARIES) From patchwork Wed Jan 16 17:43:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 10766485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7546217FB for ; Wed, 16 Jan 2019 17:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F3F92E941 for ; Wed, 16 Jan 2019 17:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53CC52E96B; Wed, 16 Jan 2019 17:44:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D361D2E941 for ; Wed, 16 Jan 2019 17:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726914AbfAPRoy (ORCPT ); Wed, 16 Jan 2019 12:44:54 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:44999 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726741AbfAPRoy (ORCPT ); Wed, 16 Jan 2019 12:44:54 -0500 Received: by mail-oi1-f193.google.com with SMTP id m6so3845650oig.11 for ; Wed, 16 Jan 2019 09:44:53 -0800 (PST) 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=9ntliFnHMh1UFNI4i4XDupue9MMU30iXjJz2OA1O7CA=; b=dE6LaPYLsHeS+ovTqbvwCuSHNPNEk3K5LNXIm2pin52MRe9AEshtvGhtUaT/VcQfsf gqmwwhDTOCtkpd/n+1VJpacJfROA6aQYHN47Ej0jJM0MRC0aRNxFpoKTvlhMc0Hw+Tfg I6g2EU3HqPqW0kO5J2e1pLJvs7+tWMc+RWpd0= 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=9ntliFnHMh1UFNI4i4XDupue9MMU30iXjJz2OA1O7CA=; b=V05VrC5MPjKE09s2UMVOW746n8AvvEhe7UQoFovc1qAKWRy8mZHYSYcKqVc5XXa1EG SzZS6Gdf/jXV8Lu/OnSMuBxYD63On6sbHMCRWIrreg/O5UfhQ0Vs8i68hOq+t95VejDX eX/9g2Ypc9RQXZ+iY4fqilL2AoMrxtBrPI8pRs5L3lbyClY8BbHrc+Z4jzuydEeMoyzh GrQ0AXuYNh0bmSDZOnlCsGCR1AZ6At3S/y7pIO/WTwKR1XtsvrVFAW5MnpqvJYfwZpIY l8ACAzch0lF3V/VApxhj1oqVJNKOV5dpH/dyR8zB+NqZ0ud6II1shDTAyfwwh0xd/vzF Afcw== X-Gm-Message-State: AJcUukfUypErMky42CASvk6TshG9mXZUv80T/iT0PgZKyVz6A3lpKOZR uEN6L6KhVZAPpimFYT0Iz3eJdg== X-Google-Smtp-Source: ALg8bN7cpCI03/LDta+Zt56exwYfkyZ06NbTx5DgNNwHmvViSlk8WwsVOE0d4mMo1TYGXUP9s07jkA== X-Received: by 2002:a54:488b:: with SMTP id r11mr595706oic.80.1547660693160; Wed, 16 Jan 2019 09:44:53 -0800 (PST) Received: from alago.cortijodelrio.net (CableLink-189-218-30-19.Hosts.InterCable.net. [189.218.30.19]) by smtp.googlemail.com with ESMTPSA id m129sm3152973oif.50.2019.01.16.09.44.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 09:44:52 -0800 (PST) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuah@kernel.org Cc: Fathi Boudra , Denys Dmytriyenko , John Stultz , Thomas Gleixner , Stephen Boyd , linux-kernel@vger.kernel.org (open list:TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER), linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK) Subject: [PATCH 4/4] selftests: timers: use LDLIBS instead of LDFLAGS Date: Wed, 16 Jan 2019 11:43:20 -0600 Message-Id: <20190116174320.14938-4-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190116174320.14938-1-daniel.diaz@linaro.org> References: <20190116174320.14938-1-daniel.diaz@linaro.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fathi Boudra 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(-) diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile index c02683cfb6c9..7656c7ce79d9 100644 --- a/tools/testing/selftests/timers/Makefile +++ b/tools/testing/selftests/timers/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += -O3 -Wl,-no-as-needed -Wall -LDFLAGS += -lrt -lpthread -lm +LDLIBS += -lrt -lpthread -lm # these are all "safe" tests that don't modify # system time or require escalated privileges