[Buildroot] [RFC v2 14/14] package: disable -ztext

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Feb 5 11:33:07 UTC 2025


On Wed, 18 Dec 2024 21:30:53 -0800
Brian Cain via buildroot <buildroot at buildroot.org> wrote:

> Signed-off-by: Brian Cain <brian.cain at oss.qualcomm.com>
> ---
>  package/Makefile.in | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 0d60e76bff..e4da9d2ff6 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -171,8 +171,12 @@ TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
>  # "-z" to be passed and the "text" keyword to be dropped otherwise. Both
>  # gcc and ld supports that, so it probably won't cause us problems.
>  ifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_STATIC_LIBS),y:)
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CLANG),y)
> +TARGET_LDFLAGS += -Wl,-ztext
> +else
>  TARGET_LDFLAGS += -ztext

The problem with -Wl,-ztext, at least with gcc toolchains is that sometimes
the $(TARGET_LDFLAGS) get passed to the linker directly, and the linker
(at least from binutils) doesn't understand -Wl,-ztext, it only
understand -ztext. See Buildroot commit
bd035872be9948515ee50ae034bda4a2e044ff22.

Of course, perhaps things are different with the linker used in Clang
toolchains, I don't know.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com


More information about the buildroot mailing list