Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE
@ 2024-08-24 20:11 J. Neuschäfer via buildroot
  2024-08-25 13:06 ` Thomas Petazzoni via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: J. Neuschäfer via buildroot @ 2024-08-24 20:11 UTC (permalink / raw)
  To: buildroot; +Cc: Bernd Kuhls, Yann Morin, David du Colombier, J. Neuschäfer

The x264 package uses large amounts of non-PIC assembly code
(e.g. common/x86/dct-a.asm), which results in textrels, which aren't
supported by musl-libc's dynamic linker.

Disable x264's assembly code when compiling for x86 with PIC/PIE and
musl-libc to avoid this particular incompatibility.

Reported-by: Yann Morin <yann.morin@orange.com>
Fixes: https://lore.kernel.org/buildroot/ZrsirnrvgsEIpAJI@tl-lnx-nyma7486-2/
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
---
 package/x264/x264.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/x264/x264.mk b/package/x264/x264.mk
index 97caf19466..e96d993017 100644
--- a/package/x264/x264.mk
+++ b/package/x264/x264.mk
@@ -14,9 +14,15 @@ X264_INSTALL_STAGING = YES
 X264_CONF_OPTS = --disable-avs --disable-lavf --disable-swscale

 ifeq ($(BR2_i386)$(BR2_x86_64),y)
+ifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_PIC_PIE),yy)
+# libx264 uses large amounts of non-pic assembly code, resulting in text
+# section relocations, which are not supported on musl-libc's ld.so.
+X264_CONF_OPTS += --disable-asm
+else
 # nasm needed for assembly files
 X264_DEPENDENCIES += host-nasm
 X264_CONF_ENV += AS="$(HOST_DIR)/bin/nasm"
+endif
 else ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_aarch64),y)
 # We need to pass gcc as AS, because the ARM assembly files have to be
 # preprocessed

---
base-commit: 8bd00c16d8af2b4b620a0b2c136e6830b9d6b3a0
change-id: 20240824-x264-textrel-61f3a8689d9f

Best regards,
--
J. Neuschäfer <j.neuschaefer@gmx.net>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE
  2024-08-24 20:11 [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE J. Neuschäfer via buildroot
@ 2024-08-25 13:06 ` Thomas Petazzoni via buildroot
  2024-08-25 18:41   ` J. Neuschäfer via buildroot
       [not found] ` <20240825150652.09dcab72__4297.44312293536$1724591243$gmane$org@windsurf>
  2024-09-18 17:05 ` Peter Korsgaard
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-08-25 13:06 UTC (permalink / raw)
  To: J. Neuschäfer via buildroot
  Cc: Bernd Kuhls, Yann Morin, J. Neuschäfer, David du Colombier

On Sat, 24 Aug 2024 22:11:02 +0200
J. Neuschäfer via buildroot <buildroot@buildroot.org> wrote:

> The x264 package uses large amounts of non-PIC assembly code
> (e.g. common/x86/dct-a.asm), which results in textrels, which aren't
> supported by musl-libc's dynamic linker.
> 
> Disable x264's assembly code when compiling for x86 with PIC/PIE and
> musl-libc to avoid this particular incompatibility.
> 
> Reported-by: Yann Morin <yann.morin@orange.com>
> Fixes: https://lore.kernel.org/buildroot/ZrsirnrvgsEIpAJI@tl-lnx-nyma7486-2/
> Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
> ---
>  package/x264/x264.mk | 6 ++++++
>  1 file changed, 6 insertions(+)

I've applied to master, but to be honest, I'm not really thrilled. Has
this been taken up to the musl's maintainers? It's rather annoying than
on a major architecture like x86 we can't get the assembly optimized
x264 code.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE
       [not found] ` <20240825150652.09dcab72__4297.44312293536$1724591243$gmane$org@windsurf>
@ 2024-08-25 13:33   ` Bernd Kuhls
  0 siblings, 0 replies; 5+ messages in thread
From: Bernd Kuhls @ 2024-08-25 13:33 UTC (permalink / raw)
  To: buildroot

Am Sun, 25 Aug 2024 15:06:52 +0200 schrieb Thomas Petazzoni via buildroot:

> I've applied to master, but to be honest, I'm not really thrilled. Has
> this been taken up to the musl's maintainers?

Hi Thomas,

it looks like a design choice:

https://www.openwall.com/lists/musl/2020/09/25/4
"Indeed, textrels are intentionally not supported as part of the
philosophy of having a dynamic linker that's universal rather than
arch-specific for each arch."

Voidlinux discussed this issue: https://github.com/void-linux/void-
packages/issues/26641

Regards, Bernd

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE
  2024-08-25 13:06 ` Thomas Petazzoni via buildroot
@ 2024-08-25 18:41   ` J. Neuschäfer via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: J. Neuschäfer via buildroot @ 2024-08-25 18:41 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Bernd Kuhls, Yann Morin, J. Neuschäfer, David du Colombier,
	J. Neuschäfer via buildroot

On Sun, Aug 25, 2024 at 03:06:52PM +0200, Thomas Petazzoni wrote:
> On Sat, 24 Aug 2024 22:11:02 +0200
> J. Neuschäfer via buildroot <buildroot@buildroot.org> wrote:
>
> > The x264 package uses large amounts of non-PIC assembly code
> > (e.g. common/x86/dct-a.asm), which results in textrels, which aren't
> > supported by musl-libc's dynamic linker.
> >
> > Disable x264's assembly code when compiling for x86 with PIC/PIE and
> > musl-libc to avoid this particular incompatibility.
> >
> > Reported-by: Yann Morin <yann.morin@orange.com>
> > Fixes: https://lore.kernel.org/buildroot/ZrsirnrvgsEIpAJI@tl-lnx-nyma7486-2/
> > Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
> > ---
> >  package/x264/x264.mk | 6 ++++++
> >  1 file changed, 6 insertions(+)
>
> I've applied to master, but to be honest, I'm not really thrilled. Has
> this been taken up to the musl's maintainers? It's rather annoying than
> on a major architecture like x86 we can't get the assembly optimized
> x264 code.

I've raised this topic in the musl IRC channel and the consensus was
that x264 should be fixed not to use textrels.


-- jn
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE
  2024-08-24 20:11 [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE J. Neuschäfer via buildroot
  2024-08-25 13:06 ` Thomas Petazzoni via buildroot
       [not found] ` <20240825150652.09dcab72__4297.44312293536$1724591243$gmane$org@windsurf>
@ 2024-09-18 17:05 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2024-09-18 17:05 UTC (permalink / raw)
  To: J. Neuschäfer via buildroot
  Cc: Bernd Kuhls, Yann Morin, J. Neuschäfer, David du Colombier

>>>>> "J" == J Neuschäfer via buildroot <buildroot@buildroot.org> writes:

 > The x264 package uses large amounts of non-PIC assembly code
 > (e.g. common/x86/dct-a.asm), which results in textrels, which aren't
 > supported by musl-libc's dynamic linker.

 > Disable x264's assembly code when compiling for x86 with PIC/PIE and
 > musl-libc to avoid this particular incompatibility.

 > Reported-by: Yann Morin <yann.morin@orange.com>
 > Fixes: https://lore.kernel.org/buildroot/ZrsirnrvgsEIpAJI@tl-lnx-nyma7486-2/
 > Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>

Committed to 2024.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-18 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24 20:11 [Buildroot] [PATCH] package/x264: disable assembly code on x86 + musl + PIC/PIE J. Neuschäfer via buildroot
2024-08-25 13:06 ` Thomas Petazzoni via buildroot
2024-08-25 18:41   ` J. Neuschäfer via buildroot
     [not found] ` <20240825150652.09dcab72__4297.44312293536$1724591243$gmane$org@windsurf>
2024-08-25 13:33   ` Bernd Kuhls
2024-09-18 17:05 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox