On Mon, May 27, 2024 at 02:16:22PM -0700, John Hubbard wrote: > 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. It might be best to split the 4 _different_ fixes into separate patches. > > 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. There has been multiple attempts to fix this. I can see these two: https://lore.kernel.org/all/20211206102931.1433871-1-anders.roxell@xxxxxxxxxx/ https://lore.kernel.org/all/20240501002150.1370861-1-edliaw@xxxxxxxxxx/ ... I guess we somehow missed those? > > 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. > There is also a v4 fix for this item that was sent out here: https://lore.kernel.org/all/20240506181951.1804451-1-edliaw@xxxxxxxxxx/ > 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. > > [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@xxxxxxxxxxxxxxx/ What is this about? Left over from v1 maybe? > > Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx> > --- I would prefer to pick up the fixes from folks who sent out the patches first but I'm fine either way. Reviewed-by: Carlos Llamas <cmllamas@xxxxxxxxxx>