Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Cc: Vladimir Murzin <vladimir.murzin@arm.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	buildroot@buildroot.org, Romain Naour <romain.naour@gmail.com>,
	Giulio Benetti <giulio.benetti@benettiengineering.com>,
	Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Subject: Re: [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC
Date: Sun, 16 Apr 2023 21:01:31 +0200	[thread overview]
Message-ID: <20230416190131.GD2819@scaer> (raw)
In-Reply-To: <20220819151734.926106-9-Ben.Wolsieffer@hefring.com>

Ben, All,

On 2022-08-19 11:17 -0400, Ben Wolsieffer spake thusly:
> Patch the target matching code in libtool to understand
> arm-*-uclinuxfdpiceabi targets. To avoid the need to run autoreconf,
> this patching must be performed in the configure script.
> 
> Without this patch, libtool refuses to build ARM FDPIC shared libraries.
> This is especially important because NPTL thread-local storage is broken
> in static libraries that are linked into dynamic FDPIC executables.

If static build is known to be broken with FDPIC, then maybe we should
just forbid it:

    config BR2_STATIC_LIBS
        bool "static only"
        depends on BR2_BINFMT_SUPPORTS_STATIC
        depends on !BR2_TOOLCHAIN_USES_GLIBC

    comment "static only needs a toolchain w/ uclibc or musl"
        depends on BR2_BINFMT_SUPPORTS_STATIC
        depends on BR2_TOOLCHAIN_USES_GLIBC

    config BR2_SHARED_LIBS
        bool "shared only"
        depends on BR2_BINFMT_SUPPORTS_SHARED

    config BR2_SHARED_STATIC_LIBS
        bool "both static and shared"
        depends on BR2_BINFMT_SUPPORTS_STATIC && BR2_BINFMT_SUPPORTS_SHARED

BR2_BINFMT_SUPPORTS_STATIC would be a new symbol that BR2_BINFMT_ELF
and BR2_BINFMT_FLAT would select, but not BR2_BINFMT_FDPIC.

Regards,
Yann E. MORIN.

> Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
> ---
>  package/pkg-autotools.mk | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
> index b6224b349d..60e70a6e2f 100644
> --- a/package/pkg-autotools.mk
> +++ b/package/pkg-autotools.mk
> @@ -87,6 +87,16 @@ define CONFIGURE_FIX_POWERPC64_HOOK
>  	support/scripts/fix-configure-powerpc64.sh $($(PKG)_DIR)
>  endef
>  
> +#
> +# Hook to add support for arm-*-uclinuxfdpiceabi to the configure script
> +#
> +define CONFIGURE_FIX_UCLINUXFDPICEABI_HOOK
> +	@$(call MESSAGE,"Adding uclinuxfdpiceabi to configure")
> +	find $($(PKG)_DIR) -name configure \
> +		-exec grep -qF 'Generated by GNU Autoconf' {} \; \
> +		-exec sed -Ei 's#((\s|^)linux\*\B)#\1 | uclinuxfdpiceabi#' '{}' \;
> +endef
> +
>  #
>  # Hook to gettextize the package if needed
>  #
> @@ -269,6 +279,13 @@ ifneq ($$(filter powerpc64%,$$(if $$(filter target,$(4)),$$(ARCH),$$(HOSTARCH)))
>  $(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_POWERPC64_HOOK
>  endif
>  
> +# Append a configure hook if building for ARM with FDPIC enabled.
> +# Must be added after other pre-configure hooks that might regenerate the
> +# configure script and overwrite the changes made here.
> +ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_BINFMT_FDPIC),y:y)
> +$(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_UCLINUXFDPICEABI_HOOK
> +endif
> +
>  #
>  # Build step. Only define it if not already defined by the package .mk
>  # file.
> -- 
> 2.37.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-04-16 19:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 1/8] Revert "arch: drop now useless support for FDPIC" Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 2/8] arch: don't enable FDPIC binaries by default Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 3/8] arch: make FDPIC dependent on toolchain support Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC Ben Wolsieffer
2023-04-16 16:22   ` Yann E. MORIN
2022-08-19 15:17 ` [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled Ben Wolsieffer
2023-09-30 20:36   ` Thomas Petazzoni via buildroot
2022-08-19 15:17 ` [Buildroot] [PATCH v3 6/8] linux: " Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 7/8] package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC Ben Wolsieffer
2023-04-16 19:01   ` Yann E. MORIN [this message]
2022-08-22  9:52 ` [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Waldemar Brodkorb
2022-08-26  3:22   ` Ben Wolsieffer
2022-09-22 13:18 ` Waldemar Brodkorb
2023-09-30 20:12 ` Thomas Petazzoni via buildroot
2023-10-02 14:18   ` Ben Wolsieffer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230416190131.GD2819@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=ben.wolsieffer@hefring.com \
    --cc=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=romain.naour@gmail.com \
    --cc=thomas.de_schampheleire@nokia.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.murzin@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox