Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6095684ybv; Wed, 12 Feb 2020 06:01:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxjYS02BRaglCej8HoESiRf9/ziA8+Ojrx87o1LPPOJyFQ0e2WpoZr6XISxwR972RKnNCeR X-Received: by 2002:aca:43c1:: with SMTP id q184mr5961554oia.116.1581516092758; Wed, 12 Feb 2020 06:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581516092; cv=none; d=google.com; s=arc-20160816; b=ForLCI8VyYsIvikjEhSSHVVfIj31zvwG+vtX1tGIBfHhIIgYEkVvpdehiXz/kXj7TH 3wW3x0VrKdU1TlQ+sibKlJPQ/WwHuNIbCM6HTbT+EsU/cBYZ3ZHy7dJvPMcF7gjkoObl 0h25xbKdqxPb7JywiLU2jIen2oY0vFPUw8aRh9kOXDg442g2krmZ3o4amrgvza3t5VPr qAb6HGoIJIho6afaL/J+ebatS8Zud03cVbAMlpHrlFWTdVrlfy2KjhZvz1yS7MobBJJF QKTZMi4HcADe9AjR5k+kH4Lvw413k/hC8Hms6yUc1agiYEJXDkF6Ze3oOgTj+FySc/L7 DxTg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=n3+13tIKTDO43P03qEQWz4Nr4xrTb2HjHzMbiw8Y1no=; b=hBbh2i0PPq2nPuOKycvjIUS4ysUcaoHoi4rFoxZzrDNOgeE0ABPTrWeTt3kOS1EkuA C8AdZTBXsoewG2zd74H7a0f8FrYSI/x7ekvMcfwbqcYigDy00m8gJghRHRvqa7CbZCqe ljZjfi/T79nksfPylxFNHYGQ4vp/LoBlq45HXqkMWJ/bH+OpX/6S8+vWEiFh6d+yK/3I joWboL3ni0iOeSvKd/KCMK0Qba7vxx6Xs5xFC6rfdk9qFO7TNjZ0wD44Qugyikgy42Hn 5vNUMhYqgtreaWCoVsxPnd82PiEmtxMvcdyPJfsbHekqL2lHCTlvlJHkz0nDha+qTwEa dkPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=STO8HDkT; 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=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si229465otk.244.2020.02.12.06.01.19; Wed, 12 Feb 2020 06:01:32 -0800 (PST) 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=@arista.com header.s=googlenew header.b=STO8HDkT; 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=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727980AbgBLOAu (ORCPT + 99 others); Wed, 12 Feb 2020 09:00:50 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35952 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbgBLOAu (ORCPT ); Wed, 12 Feb 2020 09:00:50 -0500 Received: by mail-wm1-f68.google.com with SMTP id p17so2580912wma.1 for ; Wed, 12 Feb 2020 06:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n3+13tIKTDO43P03qEQWz4Nr4xrTb2HjHzMbiw8Y1no=; b=STO8HDkTM/llblvCu5xNJ5PHGWn5qt5gn4AsCxw2m+xsQo7V4i5WVDv74Gyr1VBvdx oYgR8QHRfs2fscm8j2jjzApk7LiwG8raJ5cbqbvABIrcfcox39IX+0TLnzGHdC5ptLXu hgQyss3zQc0c72APgC8UrAhckZWc6aVwhnLcwSPpE80f7sxdwBcGEdV9bf7pQ0bTUMYi zsIySlxRpgaRfFn8fbENPbnTUuI/bQ4XuLfCrPjFr5aJwiiEL/O+CNtbDOH9/sZE957x 9rXciZUl1GXD0P1y0dr4U77pV21uUTuFoJiNE6TR27dw16KaMaNI6goHbs9cu6oK7HhZ u1xg== 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:mime-version :content-transfer-encoding; bh=n3+13tIKTDO43P03qEQWz4Nr4xrTb2HjHzMbiw8Y1no=; b=E50WSxI8V93irDiSOtG6hwQWbho3OgzJ30JNJgYPTs25acplkgGzlL917xcDa85jW+ lu6Eg4M8fUdq4XXeMXCA3Yc8bUDIrchvGvwicvCnB4gbgJiFDRuu/Ao19ynHfSInR8Qv pCWcBXJS+Tov39dckiTGjnJsydbz2alJ/LqEghmPg3lPNapo/JoNouq7FR9/oE96ZheM gqmVmZd2wmBaLVS+0G9UXPNR4i1tNZS1fwQZb/ZEUs6/+6wYPmmuwiAAu0ZjfzR216t9 1uxKTyQdGk+Yvz9zoXzO20+ZmMeV6uWhnsQSPwNIRfJV+u64JbDn/s61bZRRlhyxi1yv idIQ== X-Gm-Message-State: APjAAAW9pwMYoYfaUug/TxRZYJbw3lWwBUjuVUhAhOhVKzRKB3Ld65Gw F7LxhiYu5Gv9egEMhZGjQlYv1g== X-Received: by 2002:a1c:3b09:: with SMTP id i9mr12707947wma.31.1581516048180; Wed, 12 Feb 2020 06:00:48 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id s23sm802694wra.15.2020.02.12.06.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 06:00:46 -0800 (PST) From: Dmitry Safonov To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, avagin@gmail.com, linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Dmitry Safonov , Shuah Khan Subject: [PATCH] selftests: use LDLIBS for libraries instead of LDFLAGS Date: Wed, 12 Feb 2020 14:00:40 +0000 Message-Id: <20200212140040.126747-1-dima@arista.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While building selftests, the following errors were observed: > tools/testing/selftests/timens' > gcc -Wall -Werror -pthread -lrt -ldl timens.c -o tools/testing/selftests/timens/timens > /usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers': > timens.c:(.text+0x65a): undefined reference to `timer_create' > collect2: error: ld returned 1 exit status Quoting commit 870f193d48c2 ("selftests: net: use LDLIBS instead of LDFLAGS"): 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. While at here, correct other selftests, not only timens ones. Reported-by: Shuah Khan Signed-off-by: Dmitry Safonov --- tools/testing/selftests/futex/functional/Makefile | 2 +- tools/testing/selftests/net/Makefile | 4 ++-- tools/testing/selftests/rtc/Makefile | 2 +- tools/testing/selftests/timens/Makefile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile index 30996306cabc..23207829ec75 100644 --- a/tools/testing/selftests/futex/functional/Makefile +++ b/tools/testing/selftests/futex/functional/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 INCLUDES := -I../include -I../../ CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES) -LDFLAGS := $(LDFLAGS) -pthread -lrt +LDLIBS := -lpthread -lrt HEADERS := \ ../include/futextest.h \ diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index b5694196430a..287ae916ec0b 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -27,5 +27,5 @@ KSFT_KHDR_INSTALL := 1 include ../lib.mk $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma -$(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread -$(OUTPUT)/tcp_inq: LDFLAGS += -lpthread +$(OUTPUT)/tcp_mmap: LDLIBS += -lpthread +$(OUTPUT)/tcp_inq: LDLIBS += -lpthread diff --git a/tools/testing/selftests/rtc/Makefile b/tools/testing/selftests/rtc/Makefile index de9c8566672a..2d93d65723c9 100644 --- a/tools/testing/selftests/rtc/Makefile +++ b/tools/testing/selftests/rtc/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 TEST_GEN_PROGS = rtctest diff --git a/tools/testing/selftests/timens/Makefile b/tools/testing/selftests/timens/Makefile index e9fb30bd8aeb..b4fd9a934654 100644 --- a/tools/testing/selftests/timens/Makefile +++ b/tools/testing/selftests/timens/Makefile @@ -2,6 +2,6 @@ TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec TEST_GEN_PROGS_EXTENDED := gettime_perf CFLAGS := -Wall -Werror -pthread -LDFLAGS := -lrt -ldl +LDLIBS := -lrt -ldl include ../lib.mk -- 2.25.0