[PATCH] Compile elf/rtld.c with -fno-tree-loop-distribute-patterns.
Florian Weimer
fw@deneb.enyo.de
Mon Nov 25 08:09:00 GMT 2019
* Sandra Loosemore:
>> Is it possible to do this via a pragma? If I understand things
>> correctly, this is not necessary for PI_STATIC_AND_HIDDEN targets
>> (where initialization of the dynamic loader is simpler).
>
> I see that the definitions of memset and memmove use
> "inhibit_loop_to_libcall" (which expands into an optimize attribute) to
> prevent recursion, but I didn't think the header where that is defined
> (include/libc-symbols.h) is supposed to be included in the dynamic
> linker?
elf/rtld.os is built with -include ../include/libc-symbols.h, so the
declaration should be in scope. I don't know why it is not effective.
It probably only applies to the implementations of memset and memmove
themselves (if the generic ones written in C are used).
> Also, already in elf/Makefile there is another instance where
> it adds -fno-tree-loop-distribute-patterns to the CFLAGS, so I just
> copied that. I don't work with glibc internals enough to have a good
> feel for what the preferred solution is but I'll test a different
> solution if this one isn't good enough.
I had hoped we could write something like this at the start of
elf/rtld.c:
#ifndef PI_STATIC_AND_HIDDEN
# pragma GCC optimize ("no-tree-loop-distribute-patterns")
#endif
Then the optimization would still be applied on the targets where it
is safe to do so.
But I don't have a strong opinion about this and would appreciate
feedback from others.
More information about the Libc-alpha
mailing list