On 06/23/2015 04:29 AM, Jakub Jelinek wrote:
On Tue, Jun 23, 2015 at 12:18:30PM +0200, Marek Polacek wrote:
Is it intended that programs be able to take the address of
the builtins that correspond to libc functions and make calls
to the underlying libc functions via such pointers? (If so,
the patch will need some tweaking.)
I don't think so, at least clang doesn't allow e.g.
size_t (*fp) (const char *) = __builtin_strlen;
Well, clang is irrelevant here, __builtin_strlen etc. is a GNU
extension, so it matters what we decide about it. As this used to work
for decades (if the builtin function has a libc fallback), suddenly
rejecting it could break various programs that e.g. just
#define strlen __builtin_strlen
or similar. Can't we really reject it just for the functions
that don't have a unique fallback?
Let me look into it.
Martin