[PATCH] D61720: [PPC64] Define getThunkSectionSpacing() based on the range of R_PPC64_REL24

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 02:03:55 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: adalava, ruiu, sfertile, peter.smith.
Herald added subscribers: llvm-commits, jsji, kbarton, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay added a comment.

Number of thunks with difference choices of getThunkSectionSpacing:

  A
  
  0: 79692
  0x2000000-0x10000: 78449
  0x2000000-0xc000: 78336
  0x2000000-0x8000: 78332
  0x2000000-0x4000: 78386
  0x2000000-0x2000: 78365
  0x2000000-0x1000: 78345
  0x2000000-0x0000: 78320
  0x2000000+0x4000: 78334
  
  B
  
  0: 112315
  0x2000000-0xc000: 112474
  0x2000000-0x8000: 112333
  0x2000000-0x4000: 111937
  0x2000000-0x0000: 111838
  0x2000000+0x4000: 111851
  0x2000000+0x8000: 111847

The "simplest" number 0x2000000 works no worse than other numbers so I'll just use it.


Suggested by Sean Fertile and Peter Smith.

Thunk section spacing decrease the total number of thunks.  Define
getThunkSectionSpacing() as 0x2000000 to enable it. I tried several
numbers and found 0x2000000 works the best. Numbers near 0x2000000 work
as well but let's just use the simple number.

This changes placement of thunks and also fixes PR40740 reported by
Alfredo Dal'Ava JĂșnior:

.init consists of sections from several object files. Sections other
than the last one do not have a terminator. After defining
getThunkSectionSpacing(), we create the thunk at the end of .init of
thus fix the issue. This is not foolproof but works quite well for such
sections without terminators in practice.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D61720

Files:
  ELF/Arch/PPC64.cpp
  test/ELF/ppc64-bsymbolic-toc-restore.s
  test/ELF/ppc64-call-reach.s
  test/ELF/ppc64-ifunc.s
  test/ELF/ppc64-local-dynamic.s
  test/ELF/ppc64-long-branch-init.s
  test/ELF/ppc64-plt-stub.s
  test/ELF/ppc64-toc-restore-recursive-call.s
  test/ELF/ppc64-toc-restore.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61720.198775.patch
Type: text/x-patch
Size: 10618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/7928d468/attachment.bin>


More information about the llvm-commits mailing list