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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 03:30:47 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: grimar, llvm-commits.

This is the option which sorts relocs to optimize dynamic linker performance.
-z combelocs is the default in gold, also it ignores -z nocombreloc
(https://sourceware.org/bugzilla/show_bug.cgi?id=11062), so I guess we can do the same.
So this patch does not add handling of these options, just ignores them,
but adds sorting of relocations before writing them to rel[a].dyn section.

Details about option (taken from http://people.redhat.com/jakub/prelink.pdf, p.2):
New options -z combreloc and -z nocombreloc have been added to the linker. The latter causes the previous
64 linker behavior, i.e. each section requiring relocations has a corresponding relocation section, which is sorted by
ascending r_offset
-z combreloc instructs the linker to create just one relocation section for dynamic relocations
other than symbol jump table (PLT) relocations. This single relocation section (either .rela.dyn or .rel.dyn) is
sorted, so that relative relocations come first (sorted by ascending r_offset), followed by other relocations, sorted
again by ascending r_offset. If more relocations are against the same symbol, they immediately follow the first
relocation against that symbol with lowest r_offset
The number of relative relocations at the beginning of the section is stored in the 
DT_RELACOUNT resp. DT_RELCOUNT dynamic tag.

Initial gold patch was:
https://sourceware.org/ml/binutils/2008-05/msg00062.html

http://reviews.llvm.org/D19528

Files:
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Writer.cpp
  test/ELF/aarch64-abs64-dyn.s
  test/ELF/aarch64-tls-ie.s
  test/ELF/combrelocs.s
  test/ELF/gotpcrelx.s
  test/ELF/i386-got-and-copy.s
  test/ELF/local-got-pie.s
  test/ELF/local-got-shared.s
  test/ELF/relative-dynamic-reloc-ppc64.s
  test/ELF/relative-dynamic-reloc.s
  test/ELF/startstop-shared.s
  test/ELF/tls-dynamic-i686.s
  test/ELF/tls-got.s
  test/ELF/tls-i686.s
  test/ELF/tls-opt-iele-i686-nopic.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19528.54981.patch
Type: text/x-patch
Size: 19167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/7904bf86/attachment.bin>


More information about the llvm-commits mailing list