[PATCH] [JITLink][RISCV] Use hashmap to find PCREL_HI20 edge (#78849)
authorJonas Hahnfeld <hahnjo@hahnjo.de>
Mon, 12 Feb 2024 18:45:52 +0000 (19:45 +0100)
committerSylvestre Ledru <sylvestre@debian.org>
Sat, 5 Apr 2025 20:24:44 +0000 (22:24 +0200)
commita6d0dabbb181de53ad48f197ce409b8ad4403868
treed8527edbcbaedebeac81f164543121e969749429
parent322b45abe5866d6d2c1a33ccb82d073aee5c09be
[PATCH] [JITLink][RISCV] Use hashmap to find PCREL_HI20 edge (#78849)

As noted in issues #68594 and #73935, `JITLink/RISCV/ELF_ehframe.s`
fails with libstdc++'s expensive checks because `getRISCVPCRelHi20`
calls `std::equal_range` on the edges which may not be ordered by their
offset. Instead let `ELFJITLinker_riscv` build a hashmap of all edges
with type `R_RISCV_PCREL_HI20` that can be looked up in constant time.

Bugs: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1080435

Closes #73935

Gbp-Pq: Name rv64-fix-PCREL_HI20-issue.diff
llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp