Bug#849838: firefox: Fix broken hppa build support

2017-01-01 Thread John Paul Adrian Glaubitz
On 01/01/2017 03:27 PM, John David Anglin wrote:
> On 2017-01-01, at 5:45 AM, John Paul Adrian Glaubitz wrote:
> 
>> I don't think it makes much sense to update the patch for the Debian 
>> package, but I can
>> update the upstream patch accordingly by adding the comment. I won't change 
>> anything
>> else though. Although I'm not even sure how important the comment is either 
>> as the
>> commit message I added explains the change in every detail.
> 
> I strongly believe the code needs documentation.  It greatly helps debugging.

Sure, but there is also "git blame" which will bring up the long comment you
wrote. Any, I updated the patch I sent upstream to include the comment.

>> If you look at the rest of the PA-RISC assembly code in xptcall, you'll see 
>> that all
>> mnemonics are written in upper-case, so I'm going to keep 'STW' instead of 
>> 'stw'.
> 
> Doesn't matter.  Uppercase is HP style.

Sure, but I just wanted the style to be consistent with the rest of the code.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#849838: firefox: Fix broken hppa build support

2017-01-01 Thread John David Anglin
On 2017-01-01, at 5:45 AM, John Paul Adrian Glaubitz wrote:

> I don't think it makes much sense to update the patch for the Debian package, 
> but I can
> update the upstream patch accordingly by adding the comment. I won't change 
> anything
> else though. Although I'm not even sure how important the comment is either 
> as the
> commit message I added explains the change in every detail.

I strongly believe the code needs documentation.  It greatly helps debugging.

> 
> If you look at the rest of the PA-RISC assembly code in xptcall, you'll see 
> that all
> mnemonics are written in upper-case, so I'm going to keep 'STW' instead of 
> 'stw'.

Doesn't matter.  Uppercase is HP style.

Dave
--
John David Anglin   dave.ang...@bell.net



Bug#849838: firefox: Fix broken hppa build support

2017-01-01 Thread John Paul Adrian Glaubitz
Hi Dave!

On 01/01/2017 02:33 AM, John David Anglin wrote:
> The attached patch fixes the compile issues and includes the comment that I 
> had.  My icedove
> build still isn't complete yet but it's well past the point where the compile 
> breakage occurred.

I don't think it makes much sense to update the patch for the Debian package, 
but I can
update the upstream patch accordingly by adding the comment. I won't change 
anything
else though. Although I'm not even sure how important the comment is either as 
the
commit message I added explains the change in every detail.

If you look at the rest of the PA-RISC assembly code in xptcall, you'll see 
that all
mnemonics are written in upper-case, so I'm going to keep 'STW' instead of 
'stw'.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#849838: firefox: Fix broken hppa build support

2016-12-31 Thread John David Anglin
Hi Adrian,

On 2016-12-31, at 8:11 PM, John Paul Adrian Glaubitz wrote:

> Source: firefox
> Version: 50.1.0-1
> Severity: normal
> Tags: patch
> User: debian-h...@lists.debian.org
> Usertags: hppa
> 
> The attached patch fixes the problem by fixing the hppa-specific xpcom
> code. Furthermore, it enables the PowerPC atomic operations for hppa
> as these are generic enough to be used on other targets as well.


The attached patch fixes the compile issues and includes the comment that I 
had.  My icedove
build still isn't complete yet but it's well past the point where the compile 
breakage occurred.

Dave
--
John David Anglin   dave.ang...@bell.net


Description: 
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 icedove (1:45.5.1-1) unstable; urgency=medium
 .

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: , 
Bug: 
Bug-Debian: https://bugs.debian.org/
Bug-Ubuntu: https://launchpad.net/bugs/
Forwarded: 
Reviewed-By: 
Last-Update: 2016-12-30

Index: icedove-45.5.1/mozilla/js/src/jit/AtomicOperations.h
===
--- icedove-45.5.1.orig/mozilla/js/src/jit/AtomicOperations.h
+++ icedove-45.5.1/mozilla/js/src/jit/AtomicOperations.h
@@ -298,6 +298,8 @@ AtomicOperations::isLockfree(int32_t siz
 # include "jit/arm/AtomicOperations-arm.h"
 #elif defined(JS_CODEGEN_ARM64)
 # include "jit/arm64/AtomicOperations-arm64.h"
+#elif defined(__hppa__)
+# include "jit/none/AtomicOperations-ppc.h"
 #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
 # include "jit/mips-shared/AtomicOperations-mips-shared.h"
 #elif defined(__ppc64__) || defined(__PPC64_)   \
Index: icedove-45.5.1/mozilla/xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp
===
--- icedove-45.5.1.orig/mozilla/xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp
+++ icedove-45.5.1/mozilla/xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp
@@ -126,11 +126,21 @@ PrepareAndDispatch(nsXPTCStubBase* self,
 
 extern "C" nsresult SharedStub(int);
 
+#ifdef __GNUC__
 #define STUB_ENTRY(n)   \
 nsresult nsXPTCStubBase::Stub##n()  \
 {   \
+/* Save arg0 in its stack slot.  This assumes frame size is 64. */ \
+__asm__ __volatile__("stw %r26,-36-64(%sp)"); \
 return SharedStub(n);   \
 }
+#else
+#define STUB_ENTRY(n)   \
+nsresult nsXPTCStubBase::Stub##n()  \
+{   \
+return SharedStub(n);   \
+}
+#endif
 
 #define SENTINEL_ENTRY(n) \
 nsresult nsXPTCStubBase::Sentinel##n() \


Bug#849838: firefox: Fix broken hppa build support

2016-12-31 Thread John Paul Adrian Glaubitz
Source: firefox
Version: 50.1.0-1
Severity: normal
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hppa

Hi!

Firefox currently fails to build from source on hppa due to a bug
in the xpcom code. The resulting crash happens during 'make install':

resource://gre/components/Push.js
resource://gre/components/PushComponents.js
resource://gre/components/PushServiceHandler.js
Traceback (most recent call last):
  File "/<>/toolkit/mozapps/installer/packager.py", line 415, in 

main()
  File "/<>/toolkit/mozapps/installer/packager.py", line 409, in 
main
args.source, gre_path, base)
  File "/<>/toolkit/mozapps/installer/packager.py", line 166, in 
precompile_cache
errors.fatal('Error while running startup cache precompilation')
  File "/<>/python/mozbuild/mozpack/errors.py", line 103, in fatal
self._handle(self.FATAL, msg)
  File "/<>/python/mozbuild/mozpack/errors.py", line 98, in _handle
raise ErrorMessage(msg)
mozpack.errors.ErrorMessage: Error: Error while running startup cache 
precompilation

The attached patch fixes the problem by fixing the hppa-specific xpcom
code. Furthermore, it enables the PowerPC atomic operations for hppa
as these are generic enough to be used on other targets as well.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Description: Fix build on hppa
Author: John Paul Adrian Glaubitz 
Forwarded: https://bugzilla.mozilla.org/show_bug.cgi?id=1325495
Last-Update: 2017-01-01

Index: firefox-50.1.0/js/src/jit/AtomicOperations.h
===
--- firefox-50.1.0.orig/js/src/jit/AtomicOperations.h
+++ firefox-50.1.0/js/src/jit/AtomicOperations.h
@@ -324,6 +324,8 @@ AtomicOperations::isLockfree(int32_t siz
 # include "jit/arm/AtomicOperations-arm.h"
 #elif defined(JS_CODEGEN_ARM64)
 # include "jit/arm64/AtomicOperations-arm64.h"
+#elif defined(__hppa__)
+# include "jit/none/AtomicOperations-ppc.h"
 #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
 # include "jit/mips-shared/AtomicOperations-mips-shared.h"
 #elif defined(__ppc__) || defined(__PPC__)
Index: firefox-50.1.0/xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp
===
--- firefox-50.1.0.orig/xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp
+++ firefox-50.1.0/xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp
@@ -126,11 +126,20 @@ PrepareAndDispatch(nsXPTCStubBase* self,
 
 extern "C" nsresult SharedStub(int);
 
+#ifdef __GNUC__
 #define STUB_ENTRY(n)   \
 nsresult nsXPTCStubBase::Stub##n()  \
 {   \
+__asm__ __volatile__ ("STW %r26, -36-64(%sp)"); \
 return SharedStub(n);   \
 }
+#else
+#define STUB_ENTRY(n)   \
+nsresult nsXPTCStubBase::Stub##n()  \
+{   \
+return SharedStub(n);   \
+}
+#endif
 
 #define SENTINEL_ENTRY(n) \
 nsresult nsXPTCStubBase::Sentinel##n() \