components/desktop/thunderbird/patches/firefox-38-sparc-align.patch
changeset 7018 fdf447a07aff
parent 7017 25872950aa80
child 7020 58ca1f0fa3a7
equal deleted inserted replaced
7017:25872950aa80 7018:fdf447a07aff
     1 Adds asm("ta 6") which suppresses bus error caused by misalignment.
       
     2 
       
     3 diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
       
     4 --- a/js/xpconnect/src/XPCShellImpl.cpp
       
     5 +++ b/js/xpconnect/src/XPCShellImpl.cpp
       
     6 @@ -1320,16 +1320,22 @@ GetCurrentWorkingDirectory(nsAString& wo
       
     7      return true;
       
     8  }
       
     9  
       
    10  static JSSecurityCallbacks shellSecurityCallbacks;
       
    11  
       
    12  int
       
    13  XRE_XPCShellMain(int argc, char** argv, char** envp)
       
    14  {
       
    15 +
       
    16 +#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
       
    17 +    // make unaligned memory access no crash
       
    18 +    asm ( "ta 6" );
       
    19 +#endif
       
    20 +
       
    21      JSRuntime* rt;
       
    22      JSContext* cx;
       
    23      int result = 0;
       
    24      nsresult rv;
       
    25  
       
    26      gErrFile = stderr;
       
    27      gOutFile = stdout;
       
    28      gInFile = stdin;
       
    29 diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c
       
    30 --- a/memory/mozjemalloc/jemalloc.c
       
    31 +++ b/memory/mozjemalloc/jemalloc.c
       
    32 @@ -5551,16 +5551,22 @@ malloc_init(void)
       
    33  #endif
       
    34  
       
    35  #if !defined(MOZ_MEMORY_WINDOWS)
       
    36  static
       
    37  #endif
       
    38  bool
       
    39  malloc_init_hard(void)
       
    40  {
       
    41 +
       
    42 +#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
       
    43 +    // make unaligned memory access no crash
       
    44 +    asm ( "ta 6" );
       
    45 +#endif
       
    46 +
       
    47  	unsigned i;
       
    48  	char buf[PATH_MAX + 1];
       
    49  	const char *opts;
       
    50  	long result;
       
    51  #ifndef MOZ_MEMORY_WINDOWS
       
    52  	int linklen;
       
    53  #endif
       
    54  #ifdef MOZ_MEMORY_DARWIN
       
    55 diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
       
    56 --- a/toolkit/xre/nsAppRunner.cpp
       
    57 +++ b/toolkit/xre/nsAppRunner.cpp
       
    58 @@ -4255,6 +4255,11 @@
       
    59  int
       
    60  XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
       
    61  {
       
    62 +#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
       
    63 +    // make unaligned memory access no crash
       
    64 +    asm ( "ta 6" );
       
    65 +#endif
       
    66 +
       
    67    ScopedLogging log;
       
    68  
       
    69  #if defined(MOZ_SANDBOX) && defined(XP_LINUX) && !defined(ANDROID)