Message ID | 20240824-x264-textrel-v1-1-fbfcedc7179d@gmx.net |
---|---|
State | Accepted |
Headers | show |
Series | package/x264: disable assembly code on x86 + musl + PIC/PIE | expand |
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
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
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
>>>>> "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.
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
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(+) --- base-commit: 8bd00c16d8af2b4b620a0b2c136e6830b9d6b3a0 change-id: 20240824-x264-textrel-61f3a8689d9f Best regards, -- J. Neuschäfer <j.neuschaefer@gmx.net>