From 53338b67361e352839933a8069a6f42f90d677b8 Mon Sep 17 00:00:00 2001 From: Ramesh Date: Fri, 27 Feb 2026 19:14:08 +0530 Subject: [PATCH 1/3] fix: correct ARM LE ELF SO entry point alignment The _start label in the armle ELF shared object template was landing at offset 0xF6, which is half-word aligned but not word aligned. ARM A32 requires 4-byte (word) alignment for instruction addresses. This caused the shared object to fail to load and execute on 32-bit ARM Linux targets. Fix: add 2 null padding bytes between strtab and _start, pushing the entry point from 0xF6 to 0xF8 (word aligned). Fixes #19668 --- .../src/elf/dll/elf_dll_armle_template.s | 5 ++++- data/templates/template_armle_linux_dll.bin | Bin 246 -> 248 bytes 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/data/templates/src/elf/dll/elf_dll_armle_template.s b/data/templates/src/elf/dll/elf_dll_armle_template.s index 8d14f71056..10816f6865 100644 --- a/data/templates/src/elf/dll/elf_dll_armle_template.s +++ b/data/templates/src/elf/dll/elf_dll_armle_template.s @@ -88,5 +88,8 @@ strtab: db 0 db 0 strtabsz equ $ - strtab + + db 0x00, 0x00 ; add padding to honor 4-byte (word) alignment + global _start -_start: +_start: \ No newline at end of file diff --git a/data/templates/template_armle_linux_dll.bin b/data/templates/template_armle_linux_dll.bin index 8539a773b343e5a924b0a93ce00fced66a9b204c..675d548602265cf015feaaf934d9232d89ef2eb4 100644 GIT binary patch delta 19 Zcmeyy_=9nR1mlm1lIwxQNnIue1^`r*2WFOb1mm}flIwxQNnHRwI0t6{ From ac715797a777b9054fc1d2c3e5d30886935ecadc Mon Sep 17 00:00:00 2001 From: Martin Sutovsky Date: Thu, 9 Apr 2026 16:09:55 +0200 Subject: [PATCH 2/3] Rreplaces the hardcoded padding with align 4 keyword --- .../src/elf/dll/elf_dll_armle_template.s | 5 ++--- data/templates/template_armle_linux_dll.bin | Bin 248 -> 248 bytes 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/data/templates/src/elf/dll/elf_dll_armle_template.s b/data/templates/src/elf/dll/elf_dll_armle_template.s index 10816f6865..a4ab92551c 100644 --- a/data/templates/src/elf/dll/elf_dll_armle_template.s +++ b/data/templates/src/elf/dll/elf_dll_armle_template.s @@ -89,7 +89,6 @@ strtab: db 0 strtabsz equ $ - strtab - db 0x00, 0x00 ; add padding to honor 4-byte (word) alignment - +align 4 global _start -_start: \ No newline at end of file +_start: diff --git a/data/templates/template_armle_linux_dll.bin b/data/templates/template_armle_linux_dll.bin index 675d548602265cf015feaaf934d9232d89ef2eb4..0304080cb9292f243a02ed1d289d5388c1d97c87 100644 GIT binary patch delta 9 Qcmeyt_=9o6H>L>_02lQHn*aa+ delta 9 Qcmeyt_=9o6Hzo!K02W09djJ3c From 53df5b989aa15bd11d93d65d5d7f6b5d8c0325b5 Mon Sep 17 00:00:00 2001 From: Martin Sutovsky Date: Thu, 9 Apr 2026 16:24:51 +0200 Subject: [PATCH 3/3] Fixes alignment for Riscv32 LE --- .../src/elf/dll/elf_dll_riscv32le_template.s | 1 + data/templates/template_riscv32le_linux_dll.bin | Bin 246 -> 248 bytes 2 files changed, 1 insertion(+) diff --git a/data/templates/src/elf/dll/elf_dll_riscv32le_template.s b/data/templates/src/elf/dll/elf_dll_riscv32le_template.s index 7e4828f158..709e863fd4 100644 --- a/data/templates/src/elf/dll/elf_dll_riscv32le_template.s +++ b/data/templates/src/elf/dll/elf_dll_riscv32le_template.s @@ -94,5 +94,6 @@ strtab: db 0 strtabsz equ $ - strtab +align 4 global _start _start: diff --git a/data/templates/template_riscv32le_linux_dll.bin b/data/templates/template_riscv32le_linux_dll.bin index 725ae9dc12d92384310efc4c7339c1414262e834..bb07f41dbbf03549c26dce2fbe7b694ce1d014a6 100644 GIT binary patch delta 19 Zcmeyy_=9nR1mlm1lIwxQNnNH1698642#o*$ delta 16 Wcmeyt_>FOb1mm}flIwxQNnHRwI0t6{