On Sat, 2026-01-31 at 17:15 -0800, Greg Thelen wrote:> By default perl silently drops writes to undefined file handles. Thus
> ".balign 4" is skipped in generated ARM stubs because the
generator
> contains:
> open(OUT, '>', "${outputdir}/${fname}.S");
> print OUT "#include <asm/unistd.h>\n";
> ...
> print out " .balign 4\n";
>
> Write to the generator's OUT filehandle rather than "out".
>
> The result of this change for ARM stubs (e.g.,
> ./usr/klibc/syscalls/recvmsg.S):
> --- /tmp/before 2026-01-31 15:59:58.511500983 -0800
> +++ /tmp/after 2026-01-31 16:01:28.383070634 -0800
> @@ -13,6 +13,7 @@
> swi # __NR_recvmsg
> b __syscall_common
> #else /* __ARM_EABI__ */
> + .balign 4
> recvmsg:
> stmfd sp!,{r4,r5,r7,lr}
> bl __syscall_common
>
> Fixes: bd56c54ae409 ("[klibc] ARM: More EABI and Thumb fixes. Make
the syscall stubs smaller.")
> Signed-off-by: Greg Thelen <gthelen at google.com>
So far as I can see, the .balign directive is redundant here. This
doesn't change the generated code or ELF headers. But this does make
more sense than the original, so I've applied the patch anyway.
Ben.
> ---
> usr/klibc/arch/arm/sysstub.ph | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/usr/klibc/arch/arm/sysstub.ph b/usr/klibc/arch/arm/sysstub.ph
> index dd0c0633c90d..5cb7057af60b 100644
> --- a/usr/klibc/arch/arm/sysstub.ph
> +++ b/usr/klibc/arch/arm/sysstub.ph
> @@ -33,7 +33,7 @@ sub make_sysstub($$$$$@) {
> print OUT "#else /* __ARM_EABI__ */\n";
>
> # ARM EABI version
> - print out " .balign 4\n";
> + print OUT " .balign 4\n";
> print OUT "${fname}:\n";
> print OUT " stmfd sp!,{r4,r5,r7,lr}\n";
> print OUT " bl __syscall_common\n";
--
Ben Hutchings
Any sufficiently advanced bug is indistinguishable from a feature.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL:
<https://lists.zytor.com/archives/klibc/attachments/20260203/7b730e89/attachment.sig>