Skip to content

[lld] Use llvm::partition_point (NFC) #145209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lld/ELF/Arch/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,8 @@ static std::optional<uint64_t> getControlTransferAddend(InputSection &is,

static std::pair<Relocation *, uint64_t>
getBranchInfoAtTarget(InputSection &is, uint64_t offset) {
auto *i =
std::partition_point(is.relocations.begin(), is.relocations.end(),
[&](Relocation &r) { return r.offset < offset; });
auto *i = llvm::partition_point(
is.relocations, [&](Relocation &r) { return r.offset < offset; });
if (i != is.relocations.end() && i->offset == offset &&
i->type == R_AARCH64_JUMP26) {
return {i, i->addend};
Expand Down
5 changes: 2 additions & 3 deletions lld/ELF/Arch/X86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1193,9 +1193,8 @@ static std::pair<Relocation *, uint64_t>
getBranchInfoAtTarget(InputSection &is, uint64_t offset) {
auto content = is.contentMaybeDecompress();
if (content.size() > offset && content[offset] == 0xe9) { // JMP immediate
auto *i = std::partition_point(
is.relocations.begin(), is.relocations.end(),
[&](Relocation &r) { return r.offset < offset + 1; });
auto *i = llvm::partition_point(
is.relocations, [&](Relocation &r) { return r.offset < offset + 1; });
// Unlike with getControlTransferAddend() it is valid to accept a PC32
// relocation here because we know that this is actually a JMP and not some
// other reference, so the interpretation is that we add 4 to the addend and
Expand Down
Loading