[PATCH] D85994: [LLD][PowerPC] Add check in LLD to produce an error for missing TLSGD/TLSLD

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 12:31:25 PDT 2020


MaskRay added a comment.

The code and comment can be further reduced. Other than that, this mostly looks good.



================
Comment at: lld/ELF/Relocations.cpp:1315
+        sym.getName() == "__tls_get_addr") {
+      // Check if the R_PPC64_REL24/R_PPC64_REL24_NOTOC relocation is the
+      // first relocation. It shound't ever be first because that means
----------------
You may reduce the comments by adding one sentence to the previous comment:

// ... , preceded by a R_PPC64_TLSGD/R_PPC64_TLSLD

Then the comment below can be dropped as well.


================
Comment at: lld/ELF/Relocations.cpp:1318
+      // there is no R_PPC64_TLSGD/R_PPC64_TLSLD before it.
+      if ((i - 1) == start)
+        errorOrWarn("Call to __tls_get_addr is missing a "
----------------
The two errorOrWarn can be combined.

```
bool err = i - start < 2;
if (!err) {
  const RelTy &prevRel = *(i - 2);
  if (...)
    err = true;
}
if (err)
  errOrWarn
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85994



More information about the llvm-commits mailing list