[PATCH] D128093: [lld-macho] Initial support for Linker Optimization Hints

Daniel Bertalan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 13:33:37 PDT 2022


BertalanD added a comment.

> (*) offsets[2] is never used, so it looks like this array can drop the 3rd element.

The other types of optimization hints do make use of this third parameter, and I plan to add them very soon.

I'll look into packing the `OptimizationHint` struct a bit better tomorrow. That would sacrifice on generality, but I don't think we need to worry about pairs of instructions that are so far apart. Note to self: if it does happen, fail gracefully.

> Note the needed tests as well.

@MaskRay  What other tests should I add? I'm definitely going to add a case where the target is at a lower VM address than the instruction pair. Testing all the other failure paths (no relocations at the specified address, the relocations point at a different address, the registers don't match, the target instructions aren't actually ADRP/ADD) sounds a bit excessive, especially as these can only happen if the input is malformed. But if you think there's some value in that, I will of course add those.

> At least for applyOptimizationHints, this could help https://reviews.llvm.org/D128140.

Sections are already relocated in parallel, which includes performing these relaxations. I don't think there are any guarantees that for each relocation, there's a unique LOH, so we'd open up ourselves to concurrency bugs if we started modifying the same `InputSection`'s output buffer in parallel.


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

https://reviews.llvm.org/D128093



More information about the llvm-commits mailing list