This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should malloc-related functions be weak?


Florian Weimer <fweimer@redhat.com> writes:

> On 07/29/2016 02:27 PM, Tulio Magno Quites Machado Filho wrote:
>>
>> According to the __malloc_hook man page [1]
>>
>>     Programmers should instead preempt calls to the relevant functions by
>>     defining and exporting functions such as "malloc" and "free".
>>
>> But malloc, free and realloc are all global functions, causing problems when
>> linking statically.
>>
>> Shouldn't they be weak functions?
>
> I don't think so.  With those non-weak definition, the static linker 
> enforces that you interpose *all* malloc-related APIs in use.

Including the new __malloc_fork_lock_parent, __malloc_fork_unlock_parent and
__malloc_fork_unlock_child?

-- 
Tulio Magno


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]