Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp940437ybv; Thu, 13 Feb 2020 12:25:57 -0800 (PST) X-Google-Smtp-Source: APXvYqx7Lr/mR6KYQbQrnmtgxcVPQTAFiVyGbmx7tI1tQ4ouOeiMrDov+Jz0GoOo2QqoXGDd1IqZ X-Received: by 2002:a05:6808:8ca:: with SMTP id k10mr4151475oij.164.1581625557861; Thu, 13 Feb 2020 12:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581625557; cv=none; d=google.com; s=arc-20160816; b=0TGi9hm7cGjrxnfgO0g/YwPY3zLY4nwbfNjHKM5ne2mR+DunQIZju2GX7OTYXkOA8q wxu2XOONk07vdHzQLcCqfmFpgfgZzKg7PZXWTHlwzs09LOAKX4q1zB3sOCofLG7Uj8zX XN2ocTvgtGMiqO676JMA9TA1Z6R9w5v5MqG5gL0ZtQ5OfjI5Vb5I5QIeHqkpLS/4SSOj xSSPRttRslTiqN0sii58V+8V30D9ArLwBDlwxfcRZsKSvw43TQQP7oMngTsLb+2LFsvn MzBDbjMaUFkq3JX2KnwCLws+rvBmZIT6cMn95gL4IqQsYa9RXwD3ykRTgfzVk6kcRhDJ zkNQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ZXkxRUNlDzVTSoJcJyOXfGxRg2qLipqsXFvZwXFGEKc=; b=reshZn9sFIy2VBbpCPlOCAv/2HJHyBfSGOGxnEs63UKA+jhTENAnynv7BU9ebNfCoN dLUhmD7UXZMPftFSnHizxbw4Yi6CZ5ucVX4Vgq0kPAnBnQjpuuzEiaIvSa4XF/N9pi8r 4IRsETv6uCBI87Y82nlq6vpbcJncGXq6WlM5uJTHcxScTUeC4DefVsFxP/xMfyxyPnoG swQo2OL3RbhtOmwJ8S0O0Uqr0cy7rkbgzZjWfLaOpumJT4FoTxaWKWWE9vKodS7+WDtv If7a/y4fxb/eW/jbRur/9obqzpNsjJj8uQGCUBC8kAHwQ5SiSj2s+I8HM56UrW6fKPeB 1New== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="sfMcKn2/"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si1836309otr.304.2020.02.13.12.25.45; Thu, 13 Feb 2020 12:25:57 -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=@kernel.org header.s=default header.b="sfMcKn2/"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728236AbgBMUYY (ORCPT + 99 others); Thu, 13 Feb 2020 15:24:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:39738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727609AbgBMUYY (ORCPT ); Thu, 13 Feb 2020 15:24:24 -0500 Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 660B92465D; Thu, 13 Feb 2020 20:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581625463; bh=DolAPdCk22SLyDaWX4/4ey1Kn6tU4YHgFyx67/rkQ88=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=sfMcKn2/cV9sm3HkaYqeu7ftrAHMzCWD1Hf13MNuK8zNEYicNsnq0jWSRhaxBSgms +kc+SQ89MvaiXG54hZQyijw9c3XUW8MJa0Vt8aa02AVD5X3YMcFyFEGZPKZXXulaA/ 9X96Y3fX6gimomTnnq4axIZENcpnjuo7jE0OlhSc= Subject: Re: [PATCH] selftests: use LDLIBS for libraries instead of LDFLAGS To: Dmitry Safonov Cc: linux-kselftest@vger.kernel.org, avagin@gmail.com, linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, shuah References: <20200212140040.126747-1-dima@arista.com> From: shuah Message-ID: Date: Thu, 13 Feb 2020 13:24:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/20 11:15 AM, shuah wrote: > On 2/12/20 7:00 AM, Dmitry Safonov wrote: >> 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(-) >> > > > Looks good. Thanks for fixing it quickly. > > Please split these into 4 patches and send one for each test. > > For timens: > > Tested-by: Shuah Khan > In the interest of getting this fix in, I applied it to git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git fixes branch. No need to do anything. thanks, -- Shuah