[PATCH] D87318: [LLD][PowerPC] Add support for R_PPC64_GOT_TLSGD_PCREL34 used in TLS General Dynamic

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 13:20:59 PDT 2020


MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.


================
Comment at: lld/ELF/Arch/PPC64.cpp:733
+    //            paddi r3, r13, x at tprel, 0
+    writePrefixedInstruction(loc, 0x06000000386d0000); // paddi r3, r13
+    relocateNoSym(loc, R_PPC64_TPREL34, val);
----------------
The comment  on this line is redundant.


================
Comment at: lld/ELF/Arch/PPC64.cpp:747
+    const uintptr_t locAsInt = reinterpret_cast<uintptr_t>(loc);
+    if ((locAsInt % 4) == 0) {
+      write32(loc, NOP);            // nop
----------------
Delete parens around `%`. ditto below


================
Comment at: lld/ELF/Arch/PPC64.cpp:756
+    } else if ((locAsInt % 4) == 1) {
+      write32(loc - 1, NOP); // nop
+    } else {
----------------
The comment is redundant


================
Comment at: lld/ELF/Arch/PPC64.cpp:1429
+    const uintptr_t locAsInt = reinterpret_cast<uintptr_t>(loc);
+    if ((locAsInt % 4) == 0) {
+      write32(loc, NOP);            // bl __tls_get_addr(sym at tlsgd) --> nop
----------------
Delete parens.


================
Comment at: lld/ELF/Arch/PPC64.cpp:1434
+      // bl __tls_get_addr(sym at tlsgd) --> add r3, r3, r13
+      write32(loc - 1, 0x7c636A14);
+    } else {
----------------
User lower-case hexidecimal literals.


================
Comment at: lld/ELF/Relocations.cpp:1375
+      // from the 4 byte alignment.
+      if (i->getType(config->isMips64EL) == R_PPC64_REL24_NOTOC)
+        offset++;
----------------
config->isMips64EL -> `/*isMips64EL=*/false`


================
Comment at: lld/ELF/Relocations.cpp:1376
+      if (i->getType(config->isMips64EL) == R_PPC64_REL24_NOTOC)
+        offset++;
+    }
----------------
The coding standard prefers `++offset`


================
Comment at: lld/test/ELF/ppc64-tls-pcrel-gd.s:184
+  lwz 4, 0(3)
+  addi 5, 4, 1
+  clrldi 4, 5, 32
----------------
Delete the trailing unrelated instructions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87318/new/

https://reviews.llvm.org/D87318



More information about the llvm-commits mailing list