[PATCH] Don't use nested function in test-ffs

Florian Weimer fweimer@redhat.com
Thu Nov 12 09:02:08 GMT 2020


* Szabolcs Nagy via Libc-alpha:

> The 11/12/2020 13:27, Siddhesh Poyarekar via Libc-alpha wrote:
>> There is no real need to use a nested function in that test, so break
>> it out so that it can build with clang too.
>
> btw last time i looked at clang, mostly to build musl, the
> main issues were incompatible inline asm handling on some
> targets breaking inline syscalls and lack of fenv support
> breaking libm.

I think there's also an issue where assembler redirects of standard C
functions do not affect builtins.

For example, GCC (on targets where the copy is not expanded inline) will
generate a call to memcpy_redirect for this:

void *memcpy (void *, const void *, __typeof__ (sizeof (0)))
  __asm__ ("memcpy_redirect");

struct S { int a[128]; };

void
copy (const struct S *from, struct S *to)
{
  *to = *from;
}

I believe Clang calls memcpy instead.

> and in glibc i'd expect the nested functions in the dynamic
> linker to be challenging to fix: that will affect generic
> and target code too.

Yes, but that #include at the top level and in the middle of a function
definition I would like to see fixed *anyway*. 8-)

My understanding is that Siddhesh only wants to run the test suite with
Clang, which I think is a worthwhile goal even if we do not intend to
build glibc with Clang.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list