[RISCV] Implement linker relaxation for R_RISCV_QC_ACCESS_16 and R_RISCV_QC_ACCESS_32#1142
Draft
lenary wants to merge 4 commits into
Draft
[RISCV] Implement linker relaxation for R_RISCV_QC_ACCESS_16 and R_RISCV_QC_ACCESS_32#1142lenary wants to merge 4 commits into
lenary wants to merge 4 commits into
Conversation
These QUALCOMM vendor relocations mark 16-bit compressed and 32-bit load/store instructions as candidates for relaxation from a QC_E_LI + Load/Store sequence. This Change: - Extends the internal QUALCOMM relocation range to cover the new relocations - registers them with applyNone (marker semantics, no instruction changes), - and add tests covering loads, stores, and compressed instructions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Sam Elliott <aelliott@qti.qualcomm.com>
This comment was marked as resolved.
This comment was marked as resolved.
…SCV_QC_ACCESS_32
Relaxes qc.e.li + load/store pairs annotated with R_RISCV_QC_ACCESS_32 (32-bit
instruction) or R_RISCV_QC_ACCESS_16 (16-bit compressed instruction). Four
relaxation variants are applied in priority order:
1. GP-std: qc.e.li + ls → GP-relative 32-bit load/store (saves 6/4 bytes)
2. Abs-std: qc.e.li + ls → x0-based 32-bit load/store (saves 6/4 bytes)
3. GP-xqci: qc.e.li + ls → 6-byte qc.e.l*/qc.e.s* (saves 4/2 bytes)
4. Abs-xqci: qc.e.li + ls → 6-byte qc.e.l*/qc.e.s* (saves 4/2 bytes)
All variants require --relax-xqci. The ACCESS relocation must carry
R_RISCV_RELAX for pair relaxation to occur; without it the qc.e.li falls
back to standalone relaxation. The ACCESS relocation must be exactly 6 bytes
after the qc.e.li.
New internal relocation types R_RISCV_QC_{ABS,GPREL}26_{I,S} are added for
the xqcilo immediate field, along with encoding types EncTy_QC_EI/EncTy_QC_ES
and their encode/clear helpers.
ELFSection::hasFollowing(R, Type) is added to check whether a relocation is
immediately followed by one of a given type in the section's relocation list.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Sam Elliott <aelliott@qti.qualcomm.com>
9f0a6af to
76c9161
Compare
Signed-off-by: Sam Elliott <aelliott@qti.qualcomm.com>
Signed-off-by: Sam Elliott <aelliott@qti.qualcomm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relaxes qc.e.li + load/store pairs annotated with R_RISCV_QC_ACCESS_32 (32-bit
instruction) or R_RISCV_QC_ACCESS_16 (16-bit compressed instruction). Four
relaxation variants are applied in priority order:
All variants require --relax-xqci. The ACCESS relocation must carry
R_RISCV_RELAX for pair relaxation to occur; without it the qc.e.li falls
back to standalone relaxation. The ACCESS relocation must be exactly 6 bytes
after the qc.e.li.
New internal relocation types R_RISCV_QC_{ABS,GPREL}26_{I,S} are added for
the xqcilo immediate field, along with encoding types EncTy_QC_EI/EncTy_QC_ES
and their encode/clear helpers.
ELFSection::hasFollowing(R, Type) is added to check whether a relocation is
immediately followed by one of a given type in the section's relocation list.
--
Stacked on #1139
Assisted by Claude.