[PATCH 06/16] malloc: Ensure the generic mtag hooks are not used
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Fri Mar 5 15:16:40 GMT 2021
Hi,
>> This may make it impossible to compile individual glibc modules with
>> -O0, say, for debugging purposes. I do this quite often with malloc.c
>> and do not want to lose that ability.
>>
>> Do we trust the compiler's default optimizations (at -O0) to do code
>> elimination based on constant conditions?
>
> yes, this breaks -O0, i haven't thought of that.
No this works fine. -O0 optimizes if (0) like you'd expect. You do need a bit
of hacking to do it, I tried:
CPPFLAGS-malloc.c += -O0 -D__OPTIMIZE__
> i thought it's better to guard everything with
> one flag in the code than ifdefs (that can be
> runtime flag with tagging enabled or constant 0
> when disabled) since ifdefed code is not checked
> by the compiler.
Agreed, generic C code is better than preprocessed code that is never
checked for all possible configurations.
And to reduce the overhead further without ifuncs we will likely need to
move most of the tagging code into a separate if (tagging_enabled) block
similar to the single-threaded fast path (instead of checking the boolean
many times).
Cheers,
Wilco
More information about the Libc-alpha
mailing list