lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <111cdd72-05bc-5811-092f-419937a9f1e0@linuxfoundation.org>
Date:   Wed, 16 Aug 2023 11:14:12 -0600
From:   Shuah Khan <skhan@...uxfoundation.org>
To:     Andre Przywara <andre.przywara@....com>,
        Shuah Khan <shuah@...nel.org>, Nhat Pham <nphamcs@...il.com>,
        Johannes Weiner <hannes@...xchg.org>
Cc:     linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 1/3] selftests: cachestat: properly link in librt

On 8/15/23 09:56, Andre Przywara wrote:
> 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@....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

Thank you. Applied to linux-kselftest next for Linux 6.6-rc1

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ