Reputation: 43
in gnu library C source code, man could see some of functions prototype are followed with libc_hidden_proto
macro, what is used for.
Upvotes: 2
Views: 749
Reputation: 213756
what is used for.
It's documented in inlcude/libc-symbols.h
:
/* The following macros are used for PLT bypassing within libc.so
(and if needed other libraries similarly).
First of all, you need to have the function prototyped somewhere,
say in foo/foo.h:
int foo (int __bar);
If calls to foo within libc.so should always go to foo defined in libc.so,
then in include/foo.h you add:
libc_hidden_proto (foo)
line and after the foo function definition:
int foo (int __bar)
{
return __bar;
}
libc_hidden_def (foo)
or
int foo (int __bar)
{
return __bar;
}
libc_hidden_weak (foo)
In other words, this allows GLIBC to call e.g. __mmap
which is defined inside libc.so.6
even if you LD_PRELOAD
ed some other library which defines its own __mmap
.
Upvotes: 3