mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
f873029386
Just enough features are implemented to process a simple "hello world" executable and produce something that still runs (including libc calls). This was mainly a matter of implementing support for various relocations. Currently, the following are handled: - R_RISCV_JAL - R_RISCV_CALL - R_RISCV_CALL_PLT - R_RISCV_BRANCH - R_RISCV_RVC_BRANCH - R_RISCV_RVC_JUMP - R_RISCV_GOT_HI20 - R_RISCV_PCREL_HI20 - R_RISCV_PCREL_LO12_I - R_RISCV_RELAX - R_RISCV_NONE Executables linked with linker relaxation will probably fail to be processed. BOLT relocates .text to a high address while leaving .plt at its original (low) address. This causes PC-relative PLT calls that were relaxed to a JAL to not fit their offset in an I-immediate anymore. This is something that will be addressed in a later patch. Changes to the BOLT core are relatively minor. Two things were tricky to implement and needed slightly larger changes. I'll explain those below. The R_RISCV_CALL(_PLT) relocation is put on the first instruction of a AUIPC/JALR pair, the second does not get any relocation (unlike other PCREL pairs). This causes issues with the combinations of the way BOLT processes binaries and the RISC-V MC-layer handles relocations: - BOLT reassembles instructions one by one and since the JALR doesn't have a relocation, it simply gets copied without modification; - Even though the MC-layer handles R_RISCV_CALL properly (adjusts both the AUIPC and the JALR), it assumes the immediates of both instructions are 0 (to be able to or-in a new value). This will most likely not be the case for the JALR that got copied over. To handle this difficulty without resorting to RISC-V-specific hacks in the BOLT core, a new binary pass was added that searches for AUIPC/JALR pairs and zeroes-out the immediate of the JALR. A second difficulty was supporting ABS symbols. As far as I can tell, ABS symbols were not handled at all, causing __global_pointer$ to break. RewriteInstance::analyzeRelocation was updated to handle these generically. Tests are provided for all supported relocations. Note that in order to test the correct handling of PLT entries, an ELF file produced by GCC had to be used. While I tried to strip the YAML representation, it's still quite large. Any suggestions on how to improve this would be appreciated. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D145687
27 lines
855 B
Plaintext
27 lines
855 B
Plaintext
This file is a list of the people responsible for ensuring that patches for a
|
|
particular part of BOLT are reviewed, either by themself or by someone else.
|
|
They are also the gatekeepers for their part of BOLT, with the final word on
|
|
what goes in or not.
|
|
|
|
The list is sorted by surname and formatted to allow easy grepping and
|
|
beautification by scripts. The fields are: name (N), email (E), web-address
|
|
(W), PGP key ID and fingerprint (P), description (D), snail-mail address
|
|
(S) and (I) IRC handle. Each entry should contain at least the (N), (E) and
|
|
(D) fields.
|
|
|
|
N: Maksim Panchenko, Rafael Auler
|
|
E: maks@fb.com, rafaelauler@fb.com
|
|
D: All parts not covered by someone else
|
|
|
|
N: Alexander Yermolovich
|
|
E: ayermolo@fb.com
|
|
D: DWARF support
|
|
|
|
N: Vladislav Khmelevsky
|
|
E: och95@yandex.ru
|
|
D: AArch64 backend
|
|
|
|
N: Job Noorman
|
|
E: jnoorman@igalia.com
|
|
D: RISC-V backend
|