bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] xmalloc and rpl_malloc


From: Paul Eggert
Subject: Re: [Bug-gnulib] xmalloc and rpl_malloc
Date: 15 Jan 2003 12:53:01 -0800

Bruno Haible <address@hidden> writes:

> > Or did you mean that a C program might define malloc itself?  But that
> > also violates the standard.
> 
> Huh?! All the provisions in the ELF runtime system, that guarantee
> that a malloc() in the executable hides a malloc() in libc, their
> purpose must be to fulfill a standard, isn't it?

It's not to fulfill the C Standard.  The C Standard prohibits a
program from defining any external symbol that is defined by the
standard libraries.  This holds even if the program doesn't include
the corresponding header.

POSIX-only symbols are different.  A POSIX program is free to define an
external symbol 'open' so long as it doesn't include any header that
declares 'open'.

Those ELF mechanisms are needed to handle the case of POSIX-only
symbols.  The same mechanisms, if used for 'malloc', also let the user
redefine 'malloc'.  An implementation can support the redefinition of
'malloc', but is not required to.

The GNU C library does not support general redefinition of standard C
functions.  If memory serves, it works in some cases but not others,
and anyway it is not supported.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]