[all-commits] [llvm/llvm-project] 8653db: [lld-macho][test] Make reloc-subtractor.s robust
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Jun 20 20:50:19 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8653db9503774c0f70a5ae3858ceaf180815fe3b
https://github.com/llvm/llvm-project/commit/8653db9503774c0f70a5ae3858ceaf180815fe3b
Author: Fangrui Song <i at maskray.me>
Date: 2023-06-20 (Tue, 20 Jun 2023)
Changed paths:
M lld/test/MachO/reloc-subtractor.s
Log Message:
-----------
[lld-macho][test] Make reloc-subtractor.s robust
The test requires that LLVM integreated assembler generates
SUBTRACTOR/UNSIGNED relocations for `.long _minuend_1 - _subtrahend_1`.
This currently works by luck because:
* `_minuend_1` and `_subtrahend_1` are in different fragments (separated by a MCFillFragment)
* and the result is known to be negative at parsing time.
D153096 will change the assembler to fold `.long _minuend_1 - _subtrahend_1` to
a constant, giving ld -order_file no chance to change the result.
To fix the test, move the referenced labels after the label differences to block
constant folding.
Note: you may think the model is somewhat broken and it is. The
.subsections_via_symbols mechanism does not block such constant folding. In
reality SUBTRACTOR/UNSIGNED is for references to another section, which does not
have the problem.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D153382
More information about the All-commits
mailing list