This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Should malloc-related functions be weak?
Florian Weimer <fweimer@redhat.com> writes:
> On 07/29/2016 03:11 PM, Tulio Magno Quites Machado Filho wrote:
>> 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?
>
> Hmm, right. Would you file a bug for this so that we do not forget it?
Bug created: https://sourceware.org/bugzilla/show_bug.cgi?id=20424
--
Tulio Magno