diff options
author | Fangrui Song <i@maskray.me> | 2025-06-10 09:28:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-10 09:28:39 -0700 |
commit | 8957e64a20fc7f4277565c6cfe3e555c119783ce (patch) | |
tree | 255ad4928928426966ad418290804ba3092bcb6e /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 1cb906e8325d2b73054f2b4fa943b66377152f37 (diff) | |
download | llvm-8957e64a20fc7f4277565c6cfe3e555c119783ce.zip llvm-8957e64a20fc7f4277565c6cfe3e555c119783ce.tar.gz llvm-8957e64a20fc7f4277565c6cfe3e555c119783ce.tar.bz2 |
[ELF,RISCV] Fix oscillation due to call relaxation
The new test (derived from riscv32 openssl/test/cmp_msg_test.c) revealed
oscillation in two R_RISCV_CALL_PLT jumps:
- First jump (~2^11 bytes away): alternated between 4 and 8 bytes.
- Second jump (~2^20 bytes away): alternated between 2 and 8 bytes.
The issue is not related to alignment. In 2019, GNU ld addressed a
similar problem by reducing the relaxation allowance for cross-section
relaxation (https://sourceware.org/bugzilla/show_bug.cgi?id=25181).
This approach would result in a suboptimal layout for the tight range
tested by riscv-relax-call.s.
This patch stabilizes the process by preventing `remove` increment after
a few passes, similar to integrated assembler's fragment relaxation.
(For the Android bit reproduce, `pass < 2` leads to non-optimal layout
while `pass < 3` and `pass < 4` output is identical.)
Fix https://github.com/llvm/llvm-project/issues/113838
Possibly fix https://github.com/llvm/llvm-project/issues/123248 (inputs
are bitcode, subject to ever-changing code generation, not reproducible)
Pull Request: https://github.com/llvm/llvm-project/pull/142899
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions