From 1f67289a9e5eec98fa2eb34e8188920753bc19a8 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Tue, 30 Dec 2025 17:31:29 +0100 Subject: [PATCH] tools/mpy_ld.py: Fix handling of R_RISCV_TLSDESC_LOAD_LO12. This commit fixes handling of the R_RISCV_TLSDESC_LOAD_LO12 RISC-V object file relocation, fixing a couple of mistakes in its usage. The condition check for TLS relocations presence and their rejection when found in object files skipped checking for R_RISCV_TLSDESC_LOAD_LO12 relocations, which is part of the set of unsupported TLS relocations and thus needing an object file rejection. Interestingly, that relocation name constant was actually misspelled in the file - since it was skipped in the list of relocations being checked its wrong name did pass unnoticed until now. This is not a critical change as the linker will raise an error about an unknown relocation type rather than report a more descriptive message to the user, but it's nice to have nonetheless. Signed-off-by: Alessandro Gatti --- tools/mpy_ld.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 20418c6748..b3b28e453d 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -121,7 +121,7 @@ R_XTENSA_PDIFF32 = 59 R_RISCV_SET_ULEB128 = 60 R_RISCV_SUB_ULEB128 = 61 R_RISCV_TLSDESC_HI20 = 62 -R_RISCC_TLSDESC_LOAD_LO12 = 63 +R_RISCV_TLSDESC_LOAD_LO12 = 63 R_RISCV_TLSDESC_ADD_LO12 = 64 R_RISCV_TLSDESC_CALL = 65 @@ -682,6 +682,7 @@ def do_relocation_text(env, text_addr, r): elif env.arch.name == "EM_RISCV" and r_info_type in ( R_RISCV_TLS_GD_HI20, R_RISCV_TLSDESC_HI20, + R_RISCV_TLSDESC_LOAD_LO12, R_RISCV_TLSDESC_ADD_LO12, R_RISCV_TLSDESC_CALL, ):