Re: [Buildroot] [PATCH] package: fix builds with $(PKG)_FLAT_STACKSIZE

Thomas Petazzoni via buildroot <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <aodS3qtR9YJL5U63@windsurf>
Hello!

On Tue, Aug 18, 2026 at 02:17:29AM +0800, Fengwei Tan wrote:
> When a package defines $(PKG)_FLAT_STACKSIZE, ELF2FLT_FLAGS contains
> -Wl,-elf2flt="-r -s<stack-size>". The embedded quotes are needed to
> keep both elf2flt options in single linker argument.
> 
> However, many package Makefiles wrap $(TARGET_CFLAGS) in double quotes,
> for example:
> 
>   CFLAGS="$(TARGET_CFLAGS)"
> 
> After expansion, the embedded quote terminates the outer CFLAGS quote.
> As a result, the shell interprets "-s<stack-size> ..." as a command
> instead of passing it to the compiler.
> 
> Pass -r and -s<stack-size> in separate -Wl arguments instead. This
> avoids embedded quotes; GCC forwards both -elf2flt options to
> ld-elf2flt, which collects them before invoking elf2flt.
> 
> Signed-off-by: Fengwei Tan <[email protected]>

Thanks a lot for your patch, well spotted!

One thing that was missing from your commit message is the indication
of which commit broke this, so I added that and applied your commit to
our master branch.

This feature is not actually used by any package in Buildroot, which
explains why this problem remained unnoticed. Would you be willing to
work on adding a simple test case in support/testing/ for this? I
guess it could be a very simple br2-external, with a very simple
package that uses <pkg>_FLAT_STACKSIZE.

Aside from that, no many of our users use Buildroot for noMMU
platforms. Would you mind sharing your use case? Which platform are
you using, in which context, how did you end up running into this
<pkg>_FLAT_STACKSIZE issue?

Again, thanks for your contribution!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.