From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2821C352A3 for ; Thu, 13 Feb 2020 20:24:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 894AD24682 for ; Thu, 13 Feb 2020 20:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581625464; bh=DolAPdCk22SLyDaWX4/4ey1Kn6tU4YHgFyx67/rkQ88=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-ID:From; b=iPY6Kc6cDjLGH1pAlI4sgiqbVAy4QTS9e3LyTrcby3cQhgCtHj1SoWXsJdl4rBlW9 AMAljoO2O7vVXCF+71PGBM6Ue+anMa5yNekmgVfBlwfKVf5CnxZ0N/f3P6yRqluAsb UVMC6Gve1hqqhqg2X+sejeRPIxyqXvAnj5flhdi0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727594AbgBMUYY (ORCPT ); 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-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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