[PATCH] D73254: [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 25 09:35:55 PST 2020


grimar added inline comments.


================
Comment at: lld/ELF/Target.h:92
+    relocate(loc, rel, val);
+  }
 
----------------
```
Relocation rel{};
rel.expr = R_NONE;
rel.type = type;
```

This will initialize the `expr` and `type` fields twice, isn't?
First to the default values and then to `R_NONE` and `type`.
Applying relocations is a path that is performance sensible.
I am not sure how compiler can/will optimize this place, but why don't you just want to use
`relocate(loc, {R_NONE, type, 0, 0, nullptr}, val);` to avoid double initialization?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73254





More information about the llvm-commits mailing list