[PATCH] D34689: [LLD][ELF] Pre-create ThunkSections at Target specific intervals

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 15:36:32 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/Arch/ARM.cpp:64
   NeedsThunks = true;
+  // Thumb unconditional branch range on system with Thumb2 branch encoding
+  ThunkSectionSpacing = 0x1000000;
----------------
Can you extend the comment so that it is more friendly to those who don't know much about ARM? e.g. Thumb unconditional branch instructions have xx bit displacement, so it can jump to +-yy bytes. We insert thunks for at least yy bytes to support longer jumps.


================
Comment at: ELF/Arch/ARM.cpp:66
+  ThunkSectionSpacing = 0x1000000;
+  // Allow for 16384 12 byte Thunks per ThunkSectionSpacing
+  ThunkSectionSize = 0x30000;
----------------
Why do you want to limit the size of thunk size?


================
Comment at: ELF/Relocations.cpp:1012
 
-ThunkSection *ThunkCreator::getOSThunkSec(OutputSection *OS,
-                                          std::vector<InputSection *> *ISR) {
-  if (CurTS == nullptr) {
-    uint32_t Off = 0;
-    for (auto *IS : OS->Sections) {
-      Off = IS->OutSecOff + IS->getSize();
-      if ((IS->Flags & SHF_EXECINSTR) == 0)
-        break;
-    }
-    CurTS = addThunkSection(OS, ISR, Off);
-  }
-  return CurTS;
+ThunkSection *ThunkCreator::getISRThunkSec(OutputSection *OS,
+                                           std::vector<InputSection *> *ISR) {
----------------
What is ISR? Adding a function comment would help.


https://reviews.llvm.org/D34689





More information about the llvm-commits mailing list