Skip to contentSkip to conversation

Various fixes for x32

PATCH In review Christopher Larson 4 participants 22 messages Jan 5, 2017 – Jan 19, 2017

lore
Share & tools
lore
#0 lore raw

cover Various fixes for x32

From: Christopher Larson <[email protected]>

Tested both qemux86-64 and intel-corei7-64 (plus the meta-intel fix) with:

    DEFAULTTUNE_intel-corei7-64 = "corei7-64-x32"
    DEFAULTTUNE_qemux86-64 = "core2-64-x32"

The following changes since commit af330fc0087692039d4256a6fb1e122742e8ec1a:

packagegroup-core-lsb: add opengl to REQUIRED_DISTRO_FEATURES (2017-01-05 13:53:45 +0000)

are available in the git repository at:

git://github.com/kergoth/openembedded-core x32
https://github.com/kergoth/openembedded-core/tree/x32

Christopher Larson (16):
valgrind: skip for linux-gnux32 packagegroup-core-tools-profile: exclude valgrind for x32
grub-efi: ignore arch mismatch for x32
lttng-tools: fix for x32
gnu-efi: build 64-bit for x32
gnu-efi: ignore arch mismatch for x32
gummiboot: fix for x32 from systemd-boot
ltp: fix build for x32
boost: drop flags bits, fix for x32 gstreamer1.0-libav: disable asm for x32
ffmpeg: disable asm for x32
x264: for x32, disable asm and pass -mx32
nss: fix for x32
libunwind: apply a patch to fix x32
gnome-desktop3: fix for x32
webkitgtk: patch & disable JIT for x32

 meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb          |  12 ++
 meta/recipes-bsp/grub/grub-efi_2.00.bb             |   5 +-
 .../gummiboot/configure-allow-setting-EFI_CC.patch |  28 ++++
 meta/recipes-bsp/gummiboot/gummiboot_git.bb        |   1 +
 .../packagegroup-core-tools-profile.bb             |   1 +
 meta/recipes-devtools/valgrind/valgrind_3.12.0.bb  |   3 +
 .../ltp/fcntl-fix-the-time-def-to-use-time_t.patch |  28 ++++
 meta/recipes-extended/ltp/ltp_20160126.bb          |   1 +
 ...op-thumbnail-don-t-convert-time_t-to-long.patch |  72 +++++++++++
 .../gnome-desktop/gnome-desktop3_3.22.2.bb         |   2 +
 meta/recipes-kernel/lttng/lttng-tools/x32.patch    |  16 +++
 meta/recipes-kernel/lttng/lttng-tools_git.bb       |   1 +
 meta/recipes-multimedia/ffmpeg/ffmpeg_3.2.2.bb     |   2 +
 .../gstreamer/gstreamer1.0-libav.inc               |   4 +
 .../x264/x264/Fix-X32-build-by-disabling-asm.patch |  53 ++++++++
 meta/recipes-multimedia/x264/x264_git.bb           |   1 +
 .../webkit/webkitgtk/x32_support.patch             |  22 ++++
 meta/recipes-sato/webkit/webkitgtk_2.14.2.bb       |   7 +
 meta/recipes-support/boost/boost.inc               |   3 +
 ...-Apply-boost-1.62.0-no-forced-flags.patch.patch | 101 +++++++++++++++
 ...Don-t-set-up-m32-m64-we-do-that-ourselves.patch |  98 ++++++++++++++
 ...p-arch-instruction-set-flags-we-do-that-o.patch | 144 +++++++++++++++++++++
 meta/recipes-support/boost/boost_1.62.0.bb         |   3 +
 .../libunwind/libunwind/libunwind-1.1-x32.patch    |  31 +++++
 meta/recipes-support/libunwind/libunwind_git.bb    |   1 +
 .../nss/nss/Fix-compilation-for-X32.patch          |  31 +++++
 meta/recipes-support/nss/nss_3.27.1.bb             |   1 +
 27 files changed, 671 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-bsp/gummiboot/gummiboot/configure-allow-setting-EFI_CC.patch
 create mode 100644 meta/recipes-extended/ltp/ltp/fcntl-fix-the-time-def-to-use-time_t.patch
 create mode 100644 meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-tools/x32.patch
 create mode 100644 meta/recipes-multimedia/x264/x264/Fix-X32-build-by-disabling-asm.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/x32_support.patch
 create mode 100644 meta/recipes-support/boost/boost/0001-Apply-boost-1.62.0-no-forced-flags.patch.patch
 create mode 100644 meta/recipes-support/boost/boost/0002-Don-t-set-up-m32-m64-we-do-that-ourselves.patch
 create mode 100644 meta/recipes-support/boost/boost/0003-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch
 create mode 100644 meta/recipes-support/libunwind/libunwind/libunwind-1.1-x32.patch
 create mode 100644 meta/recipes-support/nss/nss/Fix-compilation-for-X32.patch
Signature · 1 line
2.8.0
#1 lore raw

PATCH 1/16 valgrind: skip for linux-gnux32

From: Christopher Larson <[email protected]>

valgrind doesn't support x32 at this time, so skip it for that host.

---
 meta/recipes-devtools/valgrind/valgrind_3.12.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/valgrind/valgrind_3.12.0.bb +3 -0
index 3385ef7..a4a3e72 100644
@@ -37,6 +37,9 @@ COMPATIBLE_HOST_armv4 = 'null'
 COMPATIBLE_HOST_armv5 = 'null'
 COMPATIBLE_HOST_armv6 = 'null'
 
+# X32 isn't supported by valgrind at this time
+COMPATIBLE_HOST_linux-gnux32 = 'null'
+
 # Disable for some MIPS variants
 COMPATIBLE_HOST_mipsarcho32 = "${@bb.utils.contains("TARGET_FPU", "soft", "null", ".*-linux", d)}"
 COMPATIBLE_HOST_mipsarchn32 = 'null'
Signature · 1 line
2.8.0
#2 lore raw

PATCH 2/16 packagegroup-core-tools-profile: exclude valgrind for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

valgrind doesn't seem to support x32 at this time, even in current upstream.

---
 meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb +1 -0
index 31ad82b..946c947 100644
@@ -68,6 +68,7 @@ VALGRIND_armv4 = ""
 VALGRIND_armv5 = ""
 VALGRIND_armv6 = ""
 VALGRIND_aarch64 = ""
+VALGRIND_linux-gnux32 = ""
 
 RDEPENDS_${PN} = "\
     ${PROFILETOOLS} \
Signature · 1 line
2.8.0
#3 lore raw

PATCH 3/16 grub-efi: ignore arch mismatch for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

Ordinary 64-bit binaries are expected for the bootloader.

---
 meta/recipes-bsp/grub/grub-efi_2.00.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-bsp/grub/grub-efi_2.00.bb +4 -1
index 531482b..03d273d 100644
@@ -65,5 +65,8 @@ FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \
                 ${datadir}/grub \
                 "
 
-BBCLASSEXTEND = "native"
+# 64-bit binaries are expected for the bootloader with an x32 userland
+INSANE_SKIP_${PN}_append_linux-gnux32 = " arch"
+INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch"
 
+BBCLASSEXTEND = "native"
Signature · 1 line
2.8.0
#4 lore raw

PATCH 4/16 lttng-tools: fix for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

---
 meta/recipes-kernel/lttng/lttng-tools/x32.patch | 16 ++++++++++++++++
 meta/recipes-kernel/lttng/lttng-tools_git.bb    |  1 +
 2 files changed, 17 insertions(+)
 create mode 100644 meta/recipes-kernel/lttng/lttng-tools/x32.patch
meta/recipes-kernel/lttng/lttng-tools/x32.patch new file +16 -0
new file mode 100644
index 0000000..b1bb8e4
@@ -0,0 +1,16 @@
+Fix build for x32
+
+Upstream-Status: Pending
+Signed-off-by: Christopher Larson <[email protected]>
+
+--- lttng-tools-2.6.0/src/bin/lttng/utils.c~	2015-01-26 18:17:15.000000000 +0100
++++ lttng-tools-2.6.0/src/bin/lttng/utils.c	2015-07-30 19:45:25.632045712 +0200
+@@ -130,7 +130,7 @@
+ #define HAS_FLS_U32
+ #endif
+ 
+-#if defined(__x86_64)
++#if defined(__x86_64) && !defined(__ILP32__)
+ static inline
+ unsigned int fls_u64(uint64_t x)
+ {
meta/recipes-kernel/lttng/lttng-tools_git.bb +1 -0
index 0d2bd00..29fd75b 100644
@@ -31,6 +31,7 @@ PACKAGECONFIG_remove_libc-musl = "lttng-ust"
 
 SRC_URI = "git://git.lttng.org/lttng-tools.git;branch=stable-2.8 \
            file://0001-Fix-error.h-common-error.h.patch \
+           file://x32.patch \
            file://run-ptest"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.8.0
#5 lore raw

PATCH 5/16 gnu-efi: build 64-bit for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

We're targeting the x86_64 EFI ABI.

---
 meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb +9 -0
index 9ddc4ba..e55ab7f 100644
@@ -52,3 +52,12 @@ BBCLASSEXTEND = "native"
 # CFLAGS += -mno-mmx -mno-sse
 # So also remove -mfpmath=sse from TUNE_CCARGS
 TUNE_CCARGS_remove = "-mfpmath=sse"
+
+python () {
+    ccargs = d.getVar('TUNE_CCARGS', True).split()
+    if '-mx32' in ccargs:
+        # use x86_64 EFI ABI
+        ccargs.remove('-mx32')
+        ccargs.append('-m64')
+        d.setVar('TUNE_CCARGS', ' '.join(ccargs))
+}
Signature · 1 line
2.8.0
#6 lore raw

Re: [PATCH 05/16] gnu-efi: build 64-bit for x32

Quoted 4 lines · Christopher Larson

From: Christopher Larson <[email protected]>

We're targeting the x86_64 EFI ABI.

Chris,

Firstly, thanks for all the x32 patches!

I tried to build gnu-efi for x32 via genericx86-64 and still got a failure about missing the gnu/stubs-64.h. I am building pure x32, is it possibly you build x32 in a TMPDIR that already had a 64bit build?

There is a generated stubs-x32.h, but not the required -64 variant.

Can you confirm this builds correctly?

Thanks

Sau!

Quoted 26 lines

---
 meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb | 9 +++++++++

 1 file changed, 9 insertions(+)
meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb +0 -0
index 9ddc4ba..e55ab7f 100644
@@ -52,3 +52,12 @@ BBCLASSEXTEND = "native"
  # CFLAGS += -mno-mmx -mno-sse
  # So also remove -mfpmath=sse from TUNE_CCARGS

 TUNE_CCARGS_remove = "-mfpmath=sse"

meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb +9 -0
+
+python () {
+    ccargs = d.getVar('TUNE_CCARGS', True).split()
+    if '-mx32' in ccargs:
+        # use x86_64 EFI ABI
+        ccargs.remove('-mx32')
+        ccargs.append('-m64')
+        d.setVar('TUNE_CCARGS', ' '.join(ccargs))
+}

--
2.8.0

#7 lore raw

Re: [PATCH 05/16] gnu-efi: build 64-bit for x32

Quoted 9 lines · Saul
Quoted 4 lines · Christopher Larson

From: Christopher Larson <[email protected]>

We're targeting the x86_64 EFI ABI.

Chris,

Firstly, thanks for all the x32 patches!

Quoted 7 lines

I tried to build gnu-efi for x32 via genericx86-64 and still got a failure about missing the gnu/stubs-64.h. I am building pure x32, is it possibly you build x32 in a TMPDIR that already had a 64bit build?

There is a generated stubs-x32.h, but not the required -64 variant.

Can you confirm this builds correctly?

I'm building x32-only, but admittedly 90% of my builds are with an external toolchain, so any bugs in the build of the toolchain obviously wouldn't be encountered in that case. I suspect that's what's happening here, so this would be a new issue to dive into.

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
#8 lore raw

PATCH 6/16 gnu-efi: ignore arch mismatch for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

---
 meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-bsp/gnu-efi/gnu-efi_3.0.4.bb +3 -0
index e55ab7f..f95029a 100644
@@ -46,6 +46,9 @@ do_install() {
 
 FILES_${PN} += "${libdir}/*.lds"
 
+# 64-bit binaries are expected for EFI when targeting X32
+INSANE_SKIP_${PN}-dev_append_linux-gnux32 = " arch"
+
 BBCLASSEXTEND = "native"
 
 # It doesn't support sse, its make.defaults sets:
Signature · 1 line
2.8.0
#9 lore raw

PATCH 7/16 gummiboot: fix for x32 from systemd-boot

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

---
 .../gummiboot/configure-allow-setting-EFI_CC.patch | 28 ++++++++++++++++++++++
 meta/recipes-bsp/gummiboot/gummiboot_git.bb        |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-bsp/gummiboot/gummiboot/configure-allow-setting-EFI_CC.patch
meta/recipes-bsp/gummiboot/gummiboot/configure-allow-setting-EFI_CC.patch new file +28 -0
new file mode 100644
index 0000000..59997f2
@@ -0,0 +1,28 @@
+From e18c86d8eb1fb6166b8c386446123790e503d28c Mon Sep 17 00:00:00 2001
+From: Marc-Antoine Perennou <[email protected]>
+Date: Wed, 8 Apr 2015 22:33:53 +0200
+Subject: [PATCH] configure: allow setting EFI_CC
+
+Upstream-Status: Backport [from systemd-boot]
+Signed-off-by: Christopher Larson <[email protected]>
+---
+ configure.ac | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 27bbe1d..3efb810 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -37,8 +37,7 @@ AC_SYS_LARGEFILE
+ AC_PROG_CC
+ 
+ dnl Don't try to use things like -std=c99 for efi compilation
+-EFI_CC=$CC
+-AC_SUBST([EFI_CC])
++AC_CHECK_TOOL(EFI_CC, gcc)
+ 
+ AC_PROG_CC_C99
+ AM_PROG_CC_C_O
+-- 
+2.8.0
+
meta/recipes-bsp/gummiboot/gummiboot_git.bb +1 -0
index c684b83..d7d6c28 100644
@@ -14,6 +14,7 @@ SRCREV = "2bcd919c681c952eb867ef1bdb458f1bc49c2d55"
 SRC_URI = "git://anongit.freedesktop.org/gummiboot \
            file://fix-objcopy.patch \
            file://0001-console-Fix-C-syntax-errors-for-function-declaration.patch \
+           file://configure-allow-setting-EFI_CC.patch \
           "
 
 PACKAGECONFIG[manpages] = "--enable-manpages, --disable-manpages, libxslt-native xmlto-native"
Signature · 1 line
2.8.0
#10 lore raw

PATCH 8/16 ltp: fix build for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

We need to use the correct time() definition with time_t rather than a long, since long is 32-bit on x32.

---
 .../ltp/fcntl-fix-the-time-def-to-use-time_t.patch | 28 ++++++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20160126.bb          |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/fcntl-fix-the-time-def-to-use-time_t.patch
meta/recipes-extended/ltp/ltp/fcntl-fix-the-time-def-to-use-time_t.patch new file +28 -0
new file mode 100644
index 0000000..f7e805a
@@ -0,0 +1,28 @@
+From 9590d073d3abe02fe0783ef8c530aef2e873ba9b Mon Sep 17 00:00:00 2001
+From: Christopher Larson <[email protected]>
+Date: Tue, 13 Dec 2016 12:48:29 -0700
+Subject: [PATCH] fcntl: fix the time() def to use time_t
+
+This fixes the build on X32, where long is 32-bit rather than 64-bit.
+
+Signed-off-by: Christopher Larson <[email protected]>
+---
+ testcases/kernel/syscalls/fcntl/fcntl14.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl14.c b/testcases/kernel/syscalls/fcntl/fcntl14.c
+index 3b36572..65ac8fa 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl14.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl14.c
+@@ -789,7 +789,7 @@ void dochild(void)
+ 
+ void run_test(int file_flag, int file_mode, int seek, int start, int end)
+ {
+-	extern long time();
++	extern time_t time();
+ 
+ 	/* reset fail to 0 for each run_test call */
+ 	fail = 0;
+-- 
+2.8.0
+
meta/recipes-extended/ltp/ltp_20160126.bb +1 -0
index 6e2ceac..72d465b 100644
@@ -65,6 +65,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
            file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \
            file://0037-containers-netns_netlink-Avoid-segmentation-fault.patch \
            file://0038-run-posix-option-group-test-replace-CWD-qith-PWD.patch \
+           file://fcntl-fix-the-time-def-to-use-time_t.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.8.0
#11 lore raw

PATCH 9/16 boost: drop flags bits, fix for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

boost was adding -march/-mcpu itself, and adding -m32/-m64 itself as well. Patch that behavior out, apply another similar patch from elsewhere, and adjust BJAM_OPTS to fix the x32 build.

---
 meta/recipes-support/boost/boost.inc               |   3 +
 ...-Apply-boost-1.62.0-no-forced-flags.patch.patch | 101 +++++++++++++++
 ...Don-t-set-up-m32-m64-we-do-that-ourselves.patch |  98 ++++++++++++++
 ...p-arch-instruction-set-flags-we-do-that-o.patch | 144 +++++++++++++++++++++
 meta/recipes-support/boost/boost_1.62.0.bb         |   3 +
 5 files changed, 349 insertions(+)
 create mode 100644 meta/recipes-support/boost/boost/0001-Apply-boost-1.62.0-no-forced-flags.patch.patch
 create mode 100644 meta/recipes-support/boost/boost/0002-Don-t-set-up-m32-m64-we-do-that-ourselves.patch
 create mode 100644 meta/recipes-support/boost/boost/0003-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch
meta/recipes-support/boost/boost.inc +3 -0
index a1a6a90..0b2b17d 100644
@@ -177,6 +177,9 @@ BJAM_OPTS    = '${BOOST_PARALLEL_MAKE} -d+2 -q \
 # Native compilation of bzip2 isn't working
 BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1'
 
+# Adjust the build for x32
+BJAM_OPTS_append_linux-gnux32 = " abi=x32 address-model=64"
+
 do_configure() {
 	cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
 
meta/recipes-support/boost/boost/0001-Apply-boost-1.62.0-no-forced-flags.patch.patch new file +101 -0

101 lines not on this page · raw message

meta/recipes-support/boost/boost/0002-Don-t-set-up-m32-m64-we-do-that-ourselves.patch new file +98 -0

98 lines not on this page · raw message

meta/recipes-support/boost/boost/0003-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch new file +144 -0

144 lines not on this page · raw message

meta/recipes-support/boost/boost_1.62.0.bb +3 -0
index 120d129..96f9241 100644
@@ -9,4 +9,7 @@ SRC_URI += "\
     file://0002-boost-test-execution_monitor.hpp-fix-mips-soft-float.patch \
     file://0004-Use-atomic-by-default-when-BOOST_NO_CXX11_HDR_ATOMIC.patch \
     file://boost-math-disable-pch-for-gcc.patch \
+    file://0001-Apply-boost-1.62.0-no-forced-flags.patch.patch \
+    file://0003-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch \
+    file://0002-Don-t-set-up-m32-m64-we-do-that-ourselves.patch \
 "
Signature · 1 line
2.8.0
#12 lore raw

Re: [PATCH 09/16] boost: drop flags bits, fix for x32

Quoted 2 lines · Christopher Larson

+Upstream-Status: Pending

I think Inappropriate is more fitting here, but you're brave for daring to look into bjam. :)

Ross

#13 lore raw

Re: [PATCH 09/16] boost: drop flags bits, fix for x32

Quoted 8 lines · Ross
Quoted 2 lines · Christopher Larson

+Upstream-Status: Pending

I think Inappropriate is more fitting here, but you're brave for daring to look into bjam. :)

That’s a good point, I’ll fix it on the branch. Thanks!

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
#14 lore raw

Re: [PATCH 09/16] boost: drop flags bits, fix for x32

it will be interesting to know some performance changes due to this patch if any

Quoted 25 lines · Christopher Larson
Quoted 8 lines · Ross
Quoted 2 lines · Christopher Larson

+Upstream-Status: Pending

I think Inappropriate is more fitting here, but you're brave for daring to look into bjam. :)

That’s a good point, I’ll fix it on the branch. Thanks! --
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#15 lore raw

PATCH 10/16 gstreamer1.0-libav: disable asm for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

The included libav lacks support for x32, so disable the assembly optimizations.

---
 meta/recipes-multimedia/gstreamer/gstreamer1.0-libav.inc | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-multimedia/gstreamer/gstreamer1.0-libav.inc +4 -0
index ea01163..c228306 100644
@@ -30,6 +30,10 @@ LIBAV_EXTRA_CONFIGURE_COMMON_ARG = "--target-os=linux \
   ${GSTREAMER_1_0_DEBUG} \
   --cross-prefix='${HOST_PREFIX}'"
 
+# Disable assembly optimizations for X32, as this libav lacks the support
+PACKAGECONFIG_remove_linux-gnux32 = "yasm"
+LIBAV_EXTRA_CONFIGURE_COMMON_ARG_append_linux-gnux32 = " --disable-asm"
+
 LIBAV_EXTRA_CONFIGURE_COMMON = \
 '${LIBAV_EXTRA_CONFIGURE}="${LIBAV_EXTRA_CONFIGURE_COMMON_ARG}"'
 
Signature · 1 line
2.8.0
#16 lore raw

PATCH 11/16 ffmpeg: disable asm for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

This is the usual way this is handled in desktop distros (see debian, gentoo). I wasn't able to track down a patch to add proper x32 support to ffmpeg. There was, however, a libav patch series which may be worth investigating.

---
 meta/recipes-multimedia/ffmpeg/ffmpeg_3.2.2.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-multimedia/ffmpeg/ffmpeg_3.2.2.bb +2 -0
index 4fac46b..66718c4 100644
@@ -92,6 +92,8 @@ EXTRA_OECONF = " \
     ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
 "
 
+EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
+
 do_configure() {
     ${S}/configure ${EXTRA_OECONF}
 }
Signature · 1 line
2.8.0
#17 lore raw

PATCH 12/16 x264: for x32, disable asm and pass -mx32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

We should probably patch it to stop adding the -m argument to CFLAGS/LDFLAGS in the first place, since we pass it in via CC, but this will do for now.

---
 .../x264/x264/Fix-X32-build-by-disabling-asm.patch | 53 ++++++++++++++++++++++
 meta/recipes-multimedia/x264/x264_git.bb           |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 meta/recipes-multimedia/x264/x264/Fix-X32-build-by-disabling-asm.patch
meta/recipes-multimedia/x264/x264/Fix-X32-build-by-disabling-asm.patch new file +53 -0
new file mode 100644
index 0000000..087a448
@@ -0,0 +1,53 @@
+From 66b120079fb21ed38cab0900c63360b0a7853eaa Mon Sep 17 00:00:00 2001
+From: Christopher Larson <[email protected]>
+Date: Tue, 13 Dec 2016 14:22:32 -0700
+Subject: [PATCH] Fix X32 build by disabling asm
+
+This applies gentoo's x32 patch, adjusted slightly, which disables asm support
+for x32 as well as correcting -m.
+
+Debian has a different patch which does the same, and there's a superior yet
+out of date patch series on the x264 list which keeps asm support enabled, but
+doesn't successfully build at this time, and my assembly is very rusty.
+
+Upstream-Status: Pending
+Signed-off-by: Christopher Larson <[email protected]>
+---
+ configure | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index 3109ec4..844aeae 100755
+--- a/configure
++++ b/configure
+@@ -703,7 +703,13 @@ case $host_cpu in
+         AS_EXT=".asm"
+         ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
+         stack_alignment=16
+-        [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
++        if [ $compiler = GNU ]; then
++            if cpp_check "" "" "__ILP32__" ; then
++                CFLAGS="-mx32 $CFLAGS" && LDFLAGS="-mx32 $LDFLAGS"
++            else
++                CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
++            fi
++        fi
+         if [ "$SYS" = MACOSX ]; then
+             ASFLAGS="$ASFLAGS -f macho64 -DPIC -DPREFIX"
+             if cc_check '' "-arch x86_64"; then
+@@ -722,7 +728,11 @@ case $host_cpu in
+                 RCFLAGS="--target=pe-x86-64 $RCFLAGS"
+             fi
+         else
+-            ASFLAGS="$ASFLAGS -f elf64"
++            if cpp_check "" "" "__ILP32__" ; then
++                asm=no
++            else
++                ASFLAGS="$ASFLAGS -f elf64"
++            fi
+         fi
+         ;;
+     powerpc*)
+-- 
+2.8.0
+
meta/recipes-multimedia/x264/x264_git.bb +1 -0
index 1dafdd5..64193dc 100644
@@ -10,6 +10,7 @@ DEPENDS = "yasm-native"
 
 SRC_URI = "git://github.com/mirror/x264;branch=stable \
            file://don-t-default-to-cortex-a9-with-neon.patch \
+           file://Fix-X32-build-by-disabling-asm.patch \
            "
 
 SRCREV = "86b71982e131eaa70125f8d0e725fcade9c4c677"
Signature · 1 line
2.8.0
#18 lore raw

PATCH 13/16 nss: fix for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

This was casting to a pointer, and the pointer sizes are 32-bit on X32, not 64-bit. Adjust as appropriate.

---
 .../nss/nss/Fix-compilation-for-X32.patch          | 31 ++++++++++++++++++++++
 meta/recipes-support/nss/nss_3.27.1.bb             |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-support/nss/nss/Fix-compilation-for-X32.patch
meta/recipes-support/nss/nss/Fix-compilation-for-X32.patch new file +31 -0
new file mode 100644
index 0000000..f7f2c21
@@ -0,0 +1,31 @@
+From c8eadfcdfbc1d5a4799e9a264b0f859cb5954c05 Mon Sep 17 00:00:00 2001
+From: Christopher Larson <[email protected]>
+Date: Tue, 13 Dec 2016 11:40:47 -0700
+Subject: [PATCH 7/7] Fix compilation for X32
+
+X32 uses 32-bit pointers, not 64-bit.
+
+Signed-off-by: Christopher Larson <[email protected]>
+---
+ nss/lib/freebl/poly1305-donna-x64-sse2-incremental-source.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/nss/lib/freebl/poly1305-donna-x64-sse2-incremental-source.c b/nss/lib/freebl/poly1305-donna-x64-sse2-incremental-source.c
+index 2a3301e..d4ade41 100644
+--- a/nss/lib/freebl/poly1305-donna-x64-sse2-incremental-source.c
++++ b/nss/lib/freebl/poly1305-donna-x64-sse2-incremental-source.c
+@@ -87,7 +87,11 @@ static poly1305_state_internal INLINE
+     *
+     poly1305_aligned_state(poly1305_state *state)
+ {
++#ifdef __ILP32__
++    return (poly1305_state_internal *)(((uint32_t)state + 63) & ~63);
++#else
+     return (poly1305_state_internal *)(((uint64_t)state + 63) & ~63);
++#endif
+ }
+ 
+ /* copy 0-63 bytes */
+-- 
+2.8.0
+
meta/recipes-support/nss/nss_3.27.1.bb +1 -0
index 0917938..0b4b5f9 100644
@@ -22,6 +22,7 @@ SRC_URI = "\
     file://nss-fix-nsinstall-build.patch \
     file://disable-Wvarargs-with-clang.patch \
     file://pqg.c-ULL_addend.patch \
+    file://Fix-compilation-for-X32.patch \
     file://nss.pc.in \
     file://signlibs.sh \
 "
Signature · 1 line
2.8.0
#19 lore raw

PATCH 14/16 libunwind: apply a patch to fix x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

Apply patch to fix the X32 build from https://github.com/sjnewbury/x32

---
 .../libunwind/libunwind/libunwind-1.1-x32.patch    | 31 ++++++++++++++++++++++
 meta/recipes-support/libunwind/libunwind_git.bb    |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-support/libunwind/libunwind/libunwind-1.1-x32.patch
meta/recipes-support/libunwind/libunwind/libunwind-1.1-x32.patch new file +31 -0
new file mode 100644
index 0000000..3251646
@@ -0,0 +1,31 @@
+From 506bd37bd580d7382d7c58257dac4b1e502a887c Mon Sep 17 00:00:00 2001
+From: Christopher Larson <[email protected]>
+Date: Tue, 13 Dec 2016 09:50:34 -0700
+Subject: [PATCH] Fix for X32
+
+Apply patch to fix the X32 build from https://github.com/sjnewbury/x32.
+
+Upstream-Status: Pending
+Signed-off-by: Christopher Larson <[email protected]>
+---
+ src/x86_64/Gos-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/x86_64/Gos-linux.c b/src/x86_64/Gos-linux.c
+index 9e1acfc..8169d5a 100644
+--- a/src/x86_64/Gos-linux.c
++++ b/src/x86_64/Gos-linux.c
+@@ -143,8 +143,8 @@ x86_64_sigreturn (unw_cursor_t *cursor)
+ 
+   Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
+              (unsigned long long) c->dwarf.ip, sc);
+-  __asm__ __volatile__ ("mov %0, %%rsp;"
+-                        "mov %1, %%rax;"
++  __asm__ __volatile__ ("mov %q0, %%rsp;"
++                        "mov %q1, %%rax;"
+                         "syscall"
+                         :: "r"(sc), "i"(SYS_rt_sigreturn)
+                         : "memory");
+-- 
+2.8.0
+
meta/recipes-support/libunwind/libunwind_git.bb +1 -0
index 4249430..b637c5c 100644
@@ -11,6 +11,7 @@ SRC_URI = "git://git.sv.gnu.org/libunwind.git \
            file://0001-Fix-build-on-mips-musl.patch \
            file://0001-add-knobs-to-disable-enable-tests.patch \
            file://0001-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \
+           file://libunwind-1.1-x32.patch \
            "
 
 SRC_URI_append_libc-musl = " file://musl-header-conflict.patch"
Signature · 1 line
2.8.0
#20 lore raw

PATCH 15/16 gnome-desktop3: fix for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

Explicitly use strftime+strptime rather than snprintf+atol. This fixes the build for X32, where long's size doesn't match that of time_t.

---
 ...op-thumbnail-don-t-convert-time_t-to-long.patch | 72 ++++++++++++++++++++++
 .../gnome-desktop/gnome-desktop3_3.22.2.bb         |  2 +
 2 files changed, 74 insertions(+)
 create mode 100644 meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch new file +72 -0
new file mode 100644
index 0000000..18a069f
@@ -0,0 +1,72 @@
+From adfa0c8f9fec1faac4bea6a94d947ea32e585923 Mon Sep 17 00:00:00 2001
+From: Christopher Larson <[email protected]>
+Date: Tue, 13 Dec 2016 20:39:51 -0700
+Subject: [PATCH] gnome-desktop-thumbnail: don't convert time_t to long
+
+Explicitly use strftime+strptime rather than snprintf+atol. This fixes the
+build for X32, where long's size doesn't match that of time_t.
+
+Upstream-Status: Pending
+Signed-off-by: Christopher Larson <[email protected]>
+---
+ libgnome-desktop/gnome-desktop-thumbnail.c | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c
+index 3946309..b756333 100644
+--- a/libgnome-desktop/gnome-desktop-thumbnail.c
++++ b/libgnome-desktop/gnome-desktop-thumbnail.c
+@@ -126,6 +126,8 @@
+  * Since: 2.2
+  */
+ 
++#define _XOPEN_SOURCE
++
+ #include <config.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -1483,6 +1485,7 @@ save_thumbnail (GdkPixbuf  *pixbuf,
+   char *tmp_path = NULL;
+   int tmp_fd;
+   char mtime_str[21];
++  struct tm *tmp_mtime = NULL;
+   gboolean ret = FALSE;
+   GError *error = NULL;
+   const char *width, *height;
+@@ -1502,7 +1505,11 @@ save_thumbnail (GdkPixbuf  *pixbuf,
+     goto out;
+   close (tmp_fd);
+ 
+-  g_snprintf (mtime_str, 21, "%ld",  mtime);
++  tmp_mtime = localtime (&mtime);
++  if (!tmp_mtime)
++    goto out;
++  strftime (mtime_str, 21, "%s", tmp_mtime);
++  free (tmp_mtime);
+   width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
+   height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
+ 
+@@ -1695,6 +1702,7 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf          *pixbuf,
+ {
+   const char *thumb_uri, *thumb_mtime_str;
+   time_t thumb_mtime;
++  struct tm tmp_mtime;
+   
+   thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI");
+   if (!thumb_uri)
+@@ -1705,7 +1713,11 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf          *pixbuf,
+   thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime");
+   if (!thumb_mtime_str)
+     return FALSE;
+-  thumb_mtime = atol (thumb_mtime_str);
++  if (!strptime (thumb_mtime_str, "%s", &tmp_mtime))
++    return FALSE;
++  thumb_mtime = mktime (&tmp_mtime);
++  if (!thumb_mtime)
++    return FALSE;
+   if (mtime != thumb_mtime)
+     return FALSE;
+   
+-- 
+2.8.0
+
meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb +2 -0
index e4e9d2f..e72c6ce 100644
@@ -10,6 +10,8 @@ inherit gnome pkgconfig upstream-version-is-even gobject-introspection
 SRC_URI[archive.md5sum] = "3d7222d5305f3db022eca31d8108e02d"
 SRC_URI[archive.sha256sum] = "51d7ebf7a6c359be14c3dd7a022213e931484653815eb10b0131bef4c8979e1c"
 
+SRC_URI += "file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch"
+
 DEPENDS += "intltool-native gnome-common-native gsettings-desktop-schemas gconf virtual/libx11 gtk+3 glib-2.0 startup-notification xkeyboard-config iso-codes udev"
 
 inherit distro_features_check gtk-doc
Signature · 1 line
2.8.0
#21 lore raw

PATCH 16/16 webkitgtk: patch & disable JIT for x32

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

It might not be speedy, but it does build now.

---
 .../webkit/webkitgtk/x32_support.patch             | 22 ++++++++++++++++++++++
 meta/recipes-sato/webkit/webkitgtk_2.14.2.bb       |  7 +++++++
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/x32_support.patch
meta/recipes-sato/webkit/webkitgtk/x32_support.patch new file +22 -0
new file mode 100644
index 0000000..fea4c27
@@ -0,0 +1,22 @@
+From: Daniel Schepler <[email protected]>
+Subject: Fix FTBFS in x32
+Bug-Debian: https://bugs.debian.org/700795
+Upstream-Status: Pending
+Signed-off-by: Christopher Larson <[email protected]>
+Index: webkitgtk/Source/WTF/wtf/Platform.h
+===================================================================
+--- webkitgtk.orig/Source/WTF/wtf/Platform.h
++++ webkitgtk/Source/WTF/wtf/Platform.h
+@@ -182,8 +182,12 @@
+ /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
+ #if   defined(__x86_64__) \
+     || defined(_M_X64)
++#ifdef __ILP32__
++#define WTF_CPU_X86_64_32 1
++#else
+ #define WTF_CPU_X86_64 1
+ #endif
++#endif
+ 
+ /* CPU(ARM64) - Apple */
+ #if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__)
meta/recipes-sato/webkit/webkitgtk_2.14.2.bb +7 -0
index 46b5468..9720432 100644
@@ -20,6 +20,7 @@ SRC_URI = "http://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
            file://0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch \
            file://0001-WebKitMacros-Append-to-I-and-not-to-isystem.patch \
            file://detect_atomics.patch \
+           file://x32_support.patch \
            "
 
 SRC_URI[md5sum] = "2fe3cadbc546d93ca68a13756c2be015"
@@ -85,6 +86,12 @@ EXTRA_OECMAKE_append_toolchain-clang = " -DUSE_LD_GOLD=OFF "
 # JIT not supported on MIPS either
 EXTRA_OECMAKE_append_mipsarch = " -DENABLE_JIT=OFF "
 
+# JIT not supported on X32
+# An attempt was made to upstream JIT support for x32 in
+# https://bugs.webkit.org/show_bug.cgi?id=100450, but this was closed as
+# unresolved due to limited X32 adoption.
+EXTRA_OECMAKE_append_linux-gnux32 = " -DENABLE_JIT=OFF"
+
 SECURITY_CFLAGS_remove_aarch64 = "-fpie"
 SECURITY_CFLAGS_append_aarch64 = " -fPIE"
 
Signature · 1 line
2.8.0