On Sun, Jun 1, 2025 at 6:26 AM Bin Meng <[email protected]> wrote:
> It was observed that getty crashes on RISC-V 64-bit target, with the
> busybox binary compiled by clang/LLVM 17 with -O2. Not only getty,
> but also some other applets like syslogd/vi are broken too.
>
> Commit 5156b245 ("Make const ptr assign as function call in clang")
> introduced XZALLOC_CONST_PTR() to defeat the compiler optimization,
> however it only fixed a small number of broken places when compiling
> busybox with clang/LLVM. A large number of places remain broken.
>
> This commit renames existing ASSIGN_CONST_PTR() to _ASSIGN_CONST_PTR()
> and makes the new ASSIGN_CONST_PTR() an out-of-line function to prevent
> clang from reading pointer before it is assigned. With that, previous
> XZALLOC_CONST_PTR() is no longer necessary and gets removed.

XZALLOC_CONST_PTR() is a function in order to claw back
a bit of annoying code size growth (compared to gcc): we trade
one call to xzalloc() for one call to XZALLOC_CONST_PTR(),
hopefully resulting in minimal code growth.

I just made ASSIGN_CONST_PTR() a function too (on clang)
to fix the problem you describe.

Please try current git.
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to