diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-14 18:40:59 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-14 18:57:52 -0600 |
commit | dfafb0735f09d65a392d03a2d1ad3d0b934981da (patch) | |
tree | f5a1c49f22df2e72494cd114785763b111d6924a /libgcompat/pthread.c | |
parent | d40369b0e09e4e2228ebff305067ec2d99220848 (diff) | |
download | gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.tar.gz gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.tar.bz2 gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.tar.xz gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.zip |
libgcompat: Add and use a macro for defining symbol aliases
* Prefer providing the underscore-prefixed symbol as the strong
definition.
* Do not use a weak alias if the alias is also underscore-prefixed.
* Make libgcompat objects depend on the new header.
[NOTE: I originally took the weak_alias macro from musl's libc.h, but
it's trivial and the same pattern already in use. If desired, I
can add the musl copyright notice.]
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'libgcompat/pthread.c')
-rw-r--r-- | libgcompat/pthread.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libgcompat/pthread.c b/libgcompat/pthread.c index 52daceb..9333554 100644 --- a/libgcompat/pthread.c +++ b/libgcompat/pthread.c @@ -1,14 +1,13 @@ #include <pthread.h> +#include "alias.h" /* weak_alias */ + int __register_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) { return pthread_atfork(prepare, parent, child); } - -int register_atfork(void (*prepare)(void), void (*parent)(void), - void (*child)(void)) - __attribute__((weak, alias("__register_atfork"))); +weak_alias(__register_atfork, register_atfork); void __pthread_register_cancel(void *buf) { |