[PATCH] D19528: [ELF] - Implemented -z combrelocs/nocombreloc.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 04:19:40 PDT 2016


>> "If the load offset is non-zero, the dynamic linker can still make use of this dynamic tag, as relative relocation handling is typically way simpler than >handling other relocations (since symbol lookup is not necessary) and thus it can handle all relative relocations in a tight loop in one
>> place and then handle the remaining relocations with the fully featured relocation handling routine."
>
>I failed to notice glibc or musl doing that. Lets start simple. Don't
>set the tags. Sort by offset only and benchmark it.

That should not work. I think we need sorting by symbol index anyways because main point of this optimization is to group relocations against the same symbol together:
"The dynamic linker in glibc uses a one element cache when processing relocs: if a relocation refers to the same symbol as the previous relocation, then the dynamic linker reuses the value rather than looking up the symbol again. Thus the dynamic linker gets the best results if the dynamic relocations are sorted so that all dynamic relocations for a given dynamic symbol are adjacent."
(http://www.airs.com/blog/archives/186)

>
>We can then benchmark if some other sorting gives additional benefits.
So I think I`ll start from benchmarking code without patch, original version of path and version without tags.
I think it is reasonable to prove that whole optimization works at first, and after that it is possible to tweak it if it is really needed.

>Cheers,
>Rafael

George.


More information about the llvm-commits mailing list