Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6337983ybv; Wed, 12 Feb 2020 10:16:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxKl6AW269pjvq0PLlhKcuxBaLo6JT3H2mqzbGpQP9XlYT1ZbVQFND1hJNODFJWEjhMxLTg X-Received: by 2002:aca:4106:: with SMTP id o6mr195101oia.173.1581531380016; Wed, 12 Feb 2020 10:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581531380; cv=none; d=google.com; s=arc-20160816; b=i1o9DuxjVCjAHdCn0OUrWtCQYA7wrMDBaHuoouFvnIb4+qT+LTN0DD2uzxnrXg1PD6 CAhJzTrldMPgPy0aD42STTLlc4J550UXitxR4tJmZmWsI+pWJR6NyRsXy8Z79KJnNc7f Jm+yqzbYOeQKVRndvN8yHRZ/yMANgAQqXj/e5xFPlG2u4nk3cRQT+p2GzWSYbkfVrSr7 XYP9vugK2aB4n7Hawvgv2P+R0n3yvPylVXsOEzR1q7vcV5HV3tEvh+61fV3Ela5oDp3G Q2BTR84qFN19b1BLKKoU0HSX2zS/XIVxBBs0pRAP/b+z41JrUC08NJdYgtd+EpVzdxSg B8EA== 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=PtesyftPZd4mnexdPRtR52Eq9qtX0L2J2ujHrIWtsOw=; b=vskkyw957uiVMTJzBLT0h1ybNtiySV5uY+kSbONT89Yazpu4i/QH58RNUXh8H7asqu U+1DQyLZtm2jhlkr9xtrGb9gp27nSswZH8hXHtAGQ+zrEP4acyNK64jcASsG8adVZ2w8 5Wyx3BfkLXVIdpv+jdRZ1nQIVrGB3EcBh9Y0KdPoHIgg6BuDKbHXlJV/e9NWICr9BGP7 o4EcPrQsjfjZJYC1iCfYSYv6dS2gIIdVELA+Q0cE7CjXHMCqTELJ1UKzWkE+AYffuzyD UGvqt7mSnKMbxVts1chGEuwv8Zl/LqsW4lkFOoc/48wq5DmBM5aSQeRSAv6aSLPmP26U ihVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FcMbBJTt; 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 v13si508143otp.273.2020.02.12.10.16.07; Wed, 12 Feb 2020 10:16:20 -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=FcMbBJTt; 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 S1728794AbgBLSPu (ORCPT + 99 others); Wed, 12 Feb 2020 13:15:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:49274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbgBLSPu (ORCPT ); Wed, 12 Feb 2020 13:15:50 -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 546BE2073C; Wed, 12 Feb 2020 18:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581531349; bh=kOqJbVCC1I1+rcE3QheAKMQBYpL4dBwVq3+rzFsB9tU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=FcMbBJTt7N6Bx+hLXCgOyEiN56/H0SNvmHg8/MkdLDbkI9gXt8cCu4PZcJMcUxvKm LY56E+Ep3Y90MAoTwDNHtDSh4pSM29XsRjbWjfdqMgm9Df3qivGI+hie7vqgnijR2j 4GKzQ4SiPmpJzt3Ooi3l1bmxhMW+C7+rOc7KxdT8= 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: Wed, 12 Feb 2020 11:15:48 -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: <20200212140040.126747-1-dima@arista.com> 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 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 thanks, -- Shuah