]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/vDSO: fix clang build errors and warnings
authorJohn Hubbard <jhubbard@nvidia.com>
Fri, 5 Jul 2024 19:57:34 +0000 (09:57 -1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Jul 2024 08:33:43 +0000 (10:33 +0200)
commitd5e9dddd18fdfe04772bce07d4a34e39e7b1e402
tree0fe0c92de59b331faf8437bafebc01847c12512b
parent4f5e56dddabe947cc840ffb2db60d9df6ca9e8b9
selftests/vDSO: fix clang build errors and warnings

[ Upstream commit 73810cd45b99c6c418e1c6a487b52c1e74edb20d ]

When building with clang, via:

    make LLVM=1 -C tools/testing/selftests

...there are several warnings, and an error. This fixes all of those and
allows these tests to run and pass.

1. Fix linker error (undefined reference to memcpy) by providing a local
   version of memcpy.

2. clang complains about using this form:

    if (g = h & 0xf0000000)

...so factor out the assignment into a separate step.

3. The code is passing a signed const char* to elf_hash(), which expects
   a const unsigned char *. There are several callers, so fix this at
   the source by allowing the function to accept a signed argument, and
   then converting to unsigned operations, once inside the function.

4. clang doesn't have __attribute__((externally_visible)) and generates
   a warning to that effect. Fortunately, gcc 12 and gcc 13 do not seem
   to require that attribute in order to build, run and pass tests here,
   so remove it.

Reviewed-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Edward Liaw <edliaw@google.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Tested-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/vDSO/parse_vdso.c
tools/testing/selftests/vDSO/vdso_standalone_test_x86.c