diff options
author | Job Noorman <jnoorman@igalia.com> | 2023-07-28 10:52:41 +0200 |
---|---|---|
committer | Job Noorman <jnoorman@igalia.com> | 2023-07-28 10:55:58 +0200 |
commit | 856745c5ebe5e3da35c4f08bc6090e2d348ea048 (patch) | |
tree | cca1cfe2aa5eacdda094ce8c52bef1c74fe66fb1 /llvm/lib/Object/COFFImportFile.cpp | |
parent | 57ca62d5d35a424722059f42da4a6c75fbba2eb0 (diff) | |
download | llvm-856745c5ebe5e3da35c4f08bc6090e2d348ea048.zip llvm-856745c5ebe5e3da35c4f08bc6090e2d348ea048.tar.gz llvm-856745c5ebe5e3da35c4f08bc6090e2d348ea048.tar.bz2 |
[RISCV][MC] Relax conditional branches to unresolved symbols
D108961 introduced relaxation for out-of-range conditional branches.
However, relaxation was only performed when the branch target could be
resolved. I believe this has two undesired consequences:
- `b<cc> ... foo`, where `foo` is undefined, would not be relaxed
although there is no guarantee the offset to `foo` will fit;
- Conditional branches are never relaxed with `-mattr=+relax` because MC
considers fixups where `shouldForceRelocation` returns true (which
will be the case with `+relax`) to be unresolved.
Note that binutils performs conditional branch relaxation in both cases.
This patch proposes to perform conditional branch relaxation even when
the target cannot be resolved.
Note on llvm/test/MC/RISCV/long-conditional-jump.s: I've removed the
`.p2align` because this causes alignment nops to be inserted for the
`+relax` tests. This in turn causes all the branch targets to change
compared to the non-`+relax` tests. Since `+relax` shouldn't change
these offsets, I found this confusing and hence chose to remove the
alignment.
Reviewed By: asb, MaskRay, reames
Differential Revision: https://reviews.llvm.org/D154958
Diffstat (limited to 'llvm/lib/Object/COFFImportFile.cpp')
0 files changed, 0 insertions, 0 deletions