allocate_once: Apply asm redirection before first use

Compilers may not be able to apply asm redirections to functions
after these functions are used for the first time, e.g. clang 15.

Reviewed-by: Fangrui Song <maskray@google.com>
This commit is contained in:
Adhemerval Zanella 2022-10-25 10:42:16 -03:00
parent 34b358eb03
commit 8161978f89

View File

@ -27,6 +27,9 @@ void *__libc_allocate_once_slow (void **__place,
void (*__deallocate) (void *__closure, void (*__deallocate) (void *__closure,
void *__ptr), void *__ptr),
void *__closure); void *__closure);
#ifndef _ISOMAC
libc_hidden_proto (__libc_allocate_once_slow)
#endif
/* Return an a pointer to an allocated and initialized data structure. /* Return an a pointer to an allocated and initialized data structure.
If this function returns a non-NULL value, the caller can assume If this function returns a non-NULL value, the caller can assume
@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
__closure); __closure);
} }
#ifndef _ISOMAC
libc_hidden_proto (__libc_allocate_once_slow)
#endif
#endif /* _ALLOCATE_ONCE_H */ #endif /* _ALLOCATE_ONCE_H */