summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/cachestat
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2023-08-15 18:56:10 +0300
committerShuah Khan <skhan@linuxfoundation.org>2023-08-16 20:12:39 +0300
commit7fb10233e0617603402abffc0d8d2cbf5ef55560 (patch)
tree9d531c6406cacc9595dda5800f9e273fa6bcdfa7 /tools/testing/selftests/cachestat
parentfbf4dec702774286db409815ffb077711a96b824 (diff)
downloadlinux-7fb10233e0617603402abffc0d8d2cbf5ef55560.tar.xz
selftests: cachestat: properly link in librt
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> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/cachestat')
-rw-r--r--tools/testing/selftests/cachestat/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/cachestat/Makefile b/tools/testing/selftests/cachestat/Makefile
index fca73aaa7d14..778b54ebb036 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