Skip to content
Commit 2d3390f8 authored by Eric Ackermann's avatar Eric Ackermann Committed by Benjamin Cabé
Browse files

llext: Fix off-by-one in RISC-V truncation check



The RISC-V architecture-specific relocations need to check whether
each required relocation can fit into the modified instruction's
immediate. All immediates in RISC-V are encoded as two's complement.
The current truncation check has an off-by-one error for checking
the maximum negative distance, as two's complement encoding can
represent a negative value that is the maximum positive value plus
one, causing LLEXT to refuse loading valid code.
This commit adds an additional condition to the check that fixes
the aforementioned issue.

Signed-off-by: default avatarEric Ackermann <eric.ackermann@cispa.de>
parent 5faf471c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment