Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2296779imc; Tue, 12 Mar 2019 10:50:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcVNnrA4JU0OjVKingSzuVLH6EnJKeFXbIN4i8C9rxopWi3bPPyP+Gl6Q2ubovaxZSitSr X-Received: by 2002:a63:e310:: with SMTP id f16mr34937519pgh.93.1552413015037; Tue, 12 Mar 2019 10:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413015; cv=none; d=google.com; s=arc-20160816; b=hty1ELKFyBdQgC42Pj8xw52FxfAD78OkSG8F5mGdDFSE8C4c1zBDxYrmxcnY0ceRvk QDE9gofTmaete+OKtwk+an/0rA5scBbprEb7uHs0MtCes02VeAojkHL16GRzNe6zVcdi r8KykCx7Q324XJcoCJ4z67p68tfHlsNw9uwF1biVNQKQ4Q05LWjtxr6FrNKFm6NJ1GUT rx5OXHAbL8MsiFLtLtfhNjPZyUv+Oijg811tWz0T9O3pHaOeMG7SbC5VO6OJ7gx29sDX 4EBr2exv+LWEPpd4nIeNMXaFV6ierEuVk3wydbf0n6ibyzLulteb045cdZs2kwWeTCZX BfQA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eTjWpUQBDt7bQ12+FOtfQNFFxytL5dDz9Swcf551Pqw=; b=uB/LeTwfnqhGncf5Pb2e3aaZhHjahhwDcVMTuZA5Bdna7TXZuDScPJPGcaomLWbPCw YFq9k6/Mb2vo78QWFtwIW/jy10In8i0yYcFhLBCDsCv6lPHCXoG8VytHef8FT/yl1MSz HDOqWt5c3q8bYwt8noOtjC/BdXCEvtMaQ6oczJ4PvuMm1WnagMyyts15LmSxq9FwxvTz p8g2rOdkQZiArxCW6SihVNU8gwWJ0XuxaAOPsxJqul4HGWy70TxIDc0Q/4Oj499sTo49 6ZgFsCICs8U68ZBlHTQ0q7fbUyNnLeIWikTr+RD6rULF/8uVLq1ntQrIY7vYkcq00abO qYcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LZeTcMRJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si6395263plc.233.2019.03.12.10.49.59; Tue, 12 Mar 2019 10:50:15 -0700 (PDT) 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=LZeTcMRJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728534AbfCLROw (ORCPT + 99 others); Tue, 12 Mar 2019 13:14:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:52268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728248AbfCLROJ (ORCPT ); Tue, 12 Mar 2019 13:14:09 -0400 Received: from localhost (unknown [104.133.8.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F3EE62173C; Tue, 12 Mar 2019 17:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410848; bh=EYomO/K0ZvVrR3ZUXqCthgz/ulcvwcsM1pWbtBEW3VU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZeTcMRJYJMJgIMkO5UurYnz2eVYO90f8IRQp0uMovev4//32Ti0zWNdi0EFW2m4Z 6U/Obf5EBBanQB2ChVp9PAcRMqs9DTA/XKmOQqEguZ60ky8OOgMY1PLXLRQIlRsw3p tRpyU+WqSNymBDlMfEbNrxdn3fAxi68RVn6gttdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Denys Dmytriyenko , Fathi Boudra , Shuah Khan , Sasha Levin Subject: [PATCH 4.19 033/149] selftests: timers: use LDLIBS instead of LDFLAGS Date: Tue, 12 Mar 2019 10:07:31 -0700 Message-Id: <20190312170352.473279365@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170349.421581206@linuxfoundation.org> References: <20190312170349.421581206@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 7d4e591bc051d3382c45caaa2530969fb42ed23d ] 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 Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- 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 -- 2.19.1