[PATCH] D46653: Start support for linking object files with split stacks

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 19:58:22 PDT 2018


ruiu added a comment.

Could you read other functions in the same file and other files in the same directory and make your code look the same as others in coding style? Consistency is really important, and it is hard for me to read some code in this patch because of lack of consistency.



================
Comment at: ELF/Arch/X86_64.cpp:469
+// B) Or a load of a stack pointer offset with an lea to r10 or r11.
+
+template <>
----------------
This is inconsistent in style with other functions in the same file. Please remove the blank line.


================
Comment at: ELF/Arch/X86_64.cpp:474-477
+  const uint8_t P0[] = {0x64, 0x3b, 0x24, 0x25};
+  const uint8_t R0[] = {0xf9, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00};
+  if (Loc + sizeof(P0) < End && memcmp(P0, Loc, sizeof(P0)) == 0 &&
+      Loc + sizeof(R0) < End) {
----------------
Please write more directly and concise as we do in other places in the same file.

  if (Loc + 8 < End && memcmp(Loc, "\x64\x3b\x24\x25", 4)) {
    memcpy(Loc, "\xf9\x0f\x1f\x84\x00\x00\x00\x00", 8);
    return true;
  }


================
Comment at: ELF/Arch/X86_64.cpp:481
+  }
+  // Adjust "lea -0x200(%rsp),%r10" to lea "-0x4200(%rsp),%r10"
+  const uint8_t P1[] = {0x44, 0x8d, 0x94, 0x24, 0x00, 0xf2, 0xff};
----------------
Style issue: put a blank line before comment.


================
Comment at: ELF/InputSection.cpp:222
+Defined *InputSectionBase::getEnclosingFunction(uint64_t Offset) {
+  if (getFile<ELFT>() == nullptr) return nullptr;
+
----------------
Style issue.


================
Comment at: ELF/InputSection.cpp:227
+      if (D->Section == this && D->Type == STT_FUNC)
+        if (D->Value <= Offset && Offset < D->Value + D->Size) return D;
+  return nullptr;
----------------
Style issue. You should use clang-format to fix format issues.


================
Comment at: ELF/InputSection.cpp:838
+template <class ELFT>
+void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *Buf,
+                                                         uint8_t *End) {
----------------
This function looks too dense because of the lack of any blank lines. Please make your new code look the same as other code in style.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46653





More information about the llvm-commits mailing list