Package: iceweasel Version: 34.0-1 Severity: wishlist Tags: patch User: debian-...@lists.debian.org Usertags: port-x32 ftbfs-x32
Hi! Here's a set of patches to port iceweasel to the x32 architecture. They _almost_ work -- the build fails trying to access non-existant '/tmp/tmpjUZb3o.zip' during final install stage, log at: http://angband.pl/tmp/iceweasel_34.0-1+x32_x32-20150114-0216.build but as 35.0 has been released today, I think it's better to submit what I got. The failure might be even unrelated to the port... The patches can be concatenated into one, I'm submitting them split into tiny bits. The order is irrelevant.
Description: Get rid of sysctl includes The sysctl syscall has been strongly deprecated on Linux for ages and is not present at all on new architectures. We don't use it anymore, but one #include was left. This patch gets rid of it on platforms that don't use sysctl (ie, any but BSD). This unbreaks x32 and possibly others. Author: Adam Borowski <kilob...@angband.pl> --- iceweasel-34.0.orig/memory/mozjemalloc/jemalloc.c +++ iceweasel-34.0/memory/mozjemalloc/jemalloc.c @@ -325,7 +325,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib #endif #include <sys/time.h> #include <sys/types.h> -#if !defined(MOZ_MEMORY_SOLARIS) && !defined(MOZ_MEMORY_ANDROID) +#if defined(MOZ_MEMORY_BSD) #include <sys/sysctl.h> #endif #include <sys/uio.h> --- iceweasel-34.0.orig/media/mtransport/third_party/nICEr/src/stun/addrs.c +++ iceweasel-34.0/media/mtransport/third_party/nICEr/src/stun/addrs.c @@ -45,7 +45,9 @@ #include <sys/param.h> #include <sys/socket.h> #ifndef ANDROID +#if defined(BSD) || defined(DARWIN) #include <sys/sysctl.h> +#endif #include <sys/syslog.h> #else #include <syslog.h>
Description: Trust __LP64__ on GNUC. Use __LP64__ to detect 64 bit systems, rather than trying to infer that from processor type. This broke __x86_64__ in 32-bit mode (aka x32). Author: Adam Borowski <kilob...@angband.pl> --- iceweasel-34.0.orig/js/src/jstypes.h +++ iceweasel-34.0/js/src/jstypes.h @@ -141,8 +141,7 @@ # endif #elif defined(__GNUC__) /* Additional GCC defines are when running on Solaris, AIX, and HPUX */ -# if defined(__x86_64__) || defined(__sparcv9) || \ - defined(__64BIT__) || defined(__LP64__) +# if defined(__sparcv9) || defined(__64BIT__) || defined(__LP64__) # define JS_64BIT # endif #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Sun Studio C/C++ */
Description: Disable breakpad on x32. While x32 is not supported, breakpad mistakes it for amd64 (as both share the same processor type). This patch fixes the detection. . The profiler depends on breakpad, so it has to be disabled as well. Author: Adam Borowski <kilob...@angband.pl> --- iceweasel-34.0.orig/configure.in +++ iceweasel-34.0/configure.in @@ -1651,6 +1651,9 @@ Linux) *) MOZ_ENABLE_PROFILER_SPS= esac + case "$target" in + x86_64-*linux-gnux32) MOZ_ENABLE_PROFILER_SPS= + esac ;; WINNT|Darwin) ;; *) @@ -5929,6 +5932,10 @@ dnl = Breakpad crash reporting (on by de dnl ======================================================== case $target in +x86_64-*linux-gnux32*) + # x32 is not supported. + MOZ_CRASHREPORTER= + ;; i?86-*-mingw*|x86_64-*-mingw*) MOZ_CRASHREPORTER=1 ;; --- iceweasel-34.0.orig/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h +++ iceweasel-34.0/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h @@ -85,7 +85,8 @@ /* We currently only support x86-32, x86-64, ARM, MIPS, and PPC on Linux. * Porting to other related platforms should not be difficult. */ -#if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ +#if (defined(__i386__) || defined(__x86_64__) && defined(__LP64__) \ + || defined(__ARM_ARCH_3__) || \ defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__)) \ && (defined(__linux) || defined(__ANDROID__))
Description: Disable jpegturbo optimizations on x32. While assembly code in jpegturbo is usable on both amd64 and x32, yasm can't produce elfx32 objects. Author: Adam Borowski <kilob...@angband.pl> --- iceweasel-34.0.orig/configure.in +++ iceweasel-34.0/configure.in @@ -6045,10 +6045,17 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then fi ;; *:x86_64) - if $CC -E -dM -</dev/null | grep -q __ELF__; then - LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF" - LIBJPEG_TURBO_X64_ASM=1 - fi + case "$target" in + *-gnux32) + # yasm doesn't support elfx32. + ;; + *) + if $CC -E -dM -</dev/null | grep -q __ELF__; then + LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF" + LIBJPEG_TURBO_X64_ASM=1 + fi + ;; + esac ;; esac
Description: Disable the js JIT on x32. Author: Adam Borowski <kilob...@angband.pl> --- iceweasel-34.0.orig/js/src/configure.in +++ iceweasel-34.0/js/src/configure.in @@ -1998,6 +1998,8 @@ fi dnl Configure JIT support case "$target" in +x86_64*-gnux32) + ;; i?86-*) ENABLE_ION=1 AC_DEFINE(JS_CPU_X86)
Description: Don't use ycbcr amd64 assembly on x32. The asm-optimized gfx/ycbcr code has argument sizes hard-coded as numbers. We'd need to port it to the x32 calling convention -- otherwise, SSE2 is good. For now, this commit uses the slow generic code path. Author: Adam Borowski <kilob...@angband.pl> --- iceweasel-34.0.orig/gfx/ycbcr/yuv_row_posix.cpp +++ iceweasel-34.0/gfx/ycbcr/yuv_row_posix.cpp @@ -9,7 +9,8 @@ extern "C" { -#if defined(ARCH_CPU_X86_64) +// FIXME: implement x32 assembly (always SSE2) +#if defined(ARCH_CPU_X86_64) && defined(__LP64__) // We don't need CPUID guards here, since x86-64 implies SSE2.
diff -Nru iceweasel-34.0/debian/rules iceweasel-34.0/debian/rules --- iceweasel-34.0/debian/rules 2014-12-03 16:28:03.000000000 +0100 +++ iceweasel-34.0/debian/rules 2015-01-14 00:51:58.000000000 +0100 @@ -101,6 +101,10 @@ CONFIGURE_FLAGS += --enable-optimize=-O2 endif +ifneq (,$(filter x32,$(DEB_BUILD_ARCH))) + CONFIGURE_FLAGS += --disable-elf-hack +endif + ifneq (,$(filter debug,$(DEB_BUILD_OPTIONS))) CONFIGURE_FLAGS += --enable-debug endif