[PATCH] D73542: [LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 14:26:00 PST 2020


MaskRay added inline comments.


================
Comment at: lld/ELF/Arch/ARM.cpp:457
+    bool isBlx = (read16le(loc + 2) & 0x1000) == 0;
+    bool interwork = (rel.sym && rel.sym->isFunc()) || rel.type == R_PLT_PC;
+    if (interwork ? (val & 1) == 0 : isBlx) {
----------------
```
-     bool interwork = (rel.sym && rel.sym->isFunc()) || rel.type == R_PLT_PC;
+     bool interwork = (rel.sym && rel.sym->isFunc()) || rel.expr == R_PLT_PC;
```

When no IFUNC is involved, `R_PLT_PC->R_PC` optimization is entirely decided by `sym.isPreemptible`.
Can we use `sym.isPreemptible` instead?

When IFUNC is involved (there is also a FreeBSD extension `-z ifunc-noplt`), I get more confused.

```lang=c
// Relocations.cpp:1323
  if (!sym.isPreemptible && (!sym.isGnuIFunc() || config->zIfuncNoplt)) {
```

(I thought about IFUNC, but apologies that I did not raise the point in the review.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73542





More information about the llvm-commits mailing list