llvm-project
16dcf47e - [RISC-V][Mach-O] Fix bogus 12-bit range check on subtraction expressions. (#222205)

Commit
61 days ago
[RISC-V][Mach-O] Fix bogus 12-bit range check on subtraction expressions. (#222205) Assembling a subtraction expression whose offset does not fit in a signed 12-bit integer, such as .word _a - _b + 5000 failed with a misleading diagnostic: error: AUIPC out of range of corresponding %pcrel_lo instruction The check was copied from the %pcrel_lo path, where 12 bits is a real constraint because the offset is inlined in the immediate field of an addi or an lw. For data, the addend is stored inline in the bytes being relocated, and a .word has all 32 bits available to hold it. Drop the check. No extra relocation record is needed; the offset is simply written in the data, as otool reports in the tests: .long 5000 @ KIND_DATA
Author
Parents
Loading