Message ID | 20230815155612.2535947-2-andre.przywara@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp756681vqo; Tue, 15 Aug 2023 16:30:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrg1k9nDHnJRgMhIays9wyb12tmRUUOTYbFpGRuhVocov1uTHjr8hidw6Pph+2wwarFj4q X-Received: by 2002:a05:6a20:4284:b0:135:293b:efaf with SMTP id o4-20020a056a20428400b00135293befafmr510878pzj.10.1692142250065; Tue, 15 Aug 2023 16:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692142250; cv=none; d=google.com; s=arc-20160816; b=s12hY8LTsflNsI/qrkwA4T13rGYI9GGbr0YtTkneCjDkL9nK27q4e209MFBtX0pGdK WADPZV730UiLan2aHn3wKqFqxFxG4fI6S7qLnxcDaPP016gi8cLUHXOGLi4Gq4cltC1b IEQ3trMndRy5H5rA5TN9qSKOLiN5MGdMc9zjQcE67Fp7K+Rb2S6DPesI85mAG1PYMrst 4XUgBMaegjDEu/778UYFF51e7u7H2NmJbTJyadrVZfT84NgSb75EiPGsA2TYF00M5oap vvZtKvy+5M55n51g5PrC3dH4sBS+D9wDZG1v/09cj4DhdxuwMaP7dUH6RucoezX6OIJW vmcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YlNSoMP2FgHmsuhuEnPfHxeLnh4batQSjqhc3RkeaO4=; fh=UBrbDth7y5oMgl8brvefl9eZ6RQ3QXA6llOLfOqxpDM=; b=yxN2R7fFENbmgQDlUfiUDlEEaF0ePaZK5cx67hu7zL9aNh1Wl4UJXco8aYRWL+JjbT 0LIYHx7sIHFwmy3Bka0hLJHQcYacDYjc2iZ4oDa2/rV+12d2uGl6Zh2LFiM0mOk99oRb UcqRMnJYIcTsppsxD7HrPGGjYaypBxMaszzY09rbNzj73JRz9WABzFEk8MKQt0ifM+hy S6ISvm7bb5Mwqb0zyYYv8snT+4Blc5T6KUazcznrMtvFU6sZkW5lTRIiBAgk25te8P4N e5jEDuRbQthTPHamO6PS1rE2hkZMq6hYrVITF8vNO4/e/h4Wmy6rprSsGVRySLOyoxAb D4pQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 36-20020a631664000000b005645bbe3ffbsi10406736pgw.577.2023.08.15.16.30.36; Tue, 15 Aug 2023 16:30:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238391AbjHOP5J (ORCPT <rfc822;274620705z@gmail.com> + 99 others); Tue, 15 Aug 2023 11:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238371AbjHOP4d (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 15 Aug 2023 11:56:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8A4CA1B6; Tue, 15 Aug 2023 08:56:31 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5A37C11FB; Tue, 15 Aug 2023 08:57:13 -0700 (PDT) Received: from donnerap.arm.com (donnerap.manchester.arm.com [10.32.100.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B2773F6C4; Tue, 15 Aug 2023 08:56:29 -0700 (PDT) From: Andre Przywara <andre.przywara@arm.com> To: Shuah Khan <shuah@kernel.org>, Nhat Pham <nphamcs@gmail.com>, Johannes Weiner <hannes@cmpxchg.org> Cc: linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] selftests: cachestat: properly link in librt Date: Tue, 15 Aug 2023 16:56:10 +0100 Message-Id: <20230815155612.2535947-2-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815155612.2535947-1-andre.przywara@arm.com> References: <20230815155612.2535947-1-andre.przywara@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774339752013799288 X-GMAIL-MSGID: 1774339752013799288 |
Series |
selftests: cachestat: fix build and run on older kernels
|
|
Commit Message
Andre Przywara
Aug. 15, 2023, 3:56 p.m. UTC
Libraries should be listed last on the compiler's command line, so that
the linker can look for and find still unresolved symbols. The librt
library, required for the shm_* functions, was announced using CFLAGS,
which puts the library *before* the source files, and fails compilation
on my system:
======================
gcc -isystem /src/linux-selftests/usr/include -Wall -lrt test_cachestat.c
-o /src/linux-selftests/kselftest/cachestat/test_cachestat
/usr/bin/ld: /tmp/cceQWO3u.o: in function `test_cachestat_shmem':
test_cachestat.c:(.text+0x890): undefined reference to `shm_open'
/usr/bin/ld: test_cachestat.c:(.text+0x99c): undefined reference to `shm_unlink'
collect2: error: ld returned 1 exit status
make[4]: *** [../lib.mk:181: /src/linux-selftests/kselftest/cachestat/test_cachestat] Error 1
======================
Announce the library using the LDLIBS variable, which ensures the proper
ordering on the command line.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
tools/testing/selftests/cachestat/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/cachestat/Makefile b/tools/testing/selftests/cachestat/Makefile index fca73aaa7d141..778b54ebb0364 100644 --- a/tools/testing/selftests/cachestat/Makefile +++ b/tools/testing/selftests/cachestat/Makefile @@ -3,6 +3,6 @@ TEST_GEN_PROGS := test_cachestat CFLAGS += $(KHDR_INCLUDES) CFLAGS += -Wall -CFLAGS += -lrt +LDLIBS += -lrt include ../lib.mk