summaryrefslogtreecommitdiffstats
path: root/palemoon
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2017-07-13 17:29:49 +0000
committer Eric Hameleers <alien@slackware.com>2017-07-13 17:29:49 +0000
commita65efeadb2b040289fb345a91e321865158bd1d0 (patch)
tree5e84a06e742dfab320d31ec7c19091ec0c5409b0 /palemoon
parent1776dfc2159b86f05cc34598fe00f7d1a2347948 (diff)
downloadasb-a65efeadb2b040289fb345a91e321865158bd1d0.tar.gz
asb-a65efeadb2b040289fb345a91e321865158bd1d0.tar.xz
Initial revision
Diffstat (limited to 'palemoon')
-rw-r--r--palemoon/build/patches/palemoon_stl_mozalloc.patch198
1 files changed, 198 insertions, 0 deletions
diff --git a/palemoon/build/patches/palemoon_stl_mozalloc.patch b/palemoon/build/patches/palemoon_stl_mozalloc.patch
new file mode 100644
index 00000000..8d57ee94
--- /dev/null
+++ b/palemoon/build/patches/palemoon_stl_mozalloc.patch
@@ -0,0 +1,198 @@
+Modified from:
+https://hg.mozilla.org/mozilla-central/rev/68da139d0866
+
+Bug 1269171 - Change how mozalloc.h is hooked in STL wrappers. r=froydnj
+
+Since the introduction of the STL wrappers, they have included
+mozalloc.h, and multiple times, we've hit header reentrancy problems,
+and worked around them as best as we could.
+
+Taking a step back, all mozalloc.h does is:
+- declare moz_* allocator functions.
+- define inline implementations of various operator new/delete variants.
+
+The first only requires the functions to be declared before they are used,
+so mozalloc.h only needs to be included before anything that would use
+those functions.
+
+The second doesn't actually require a specific order, as long as the
+declaration for those functions comes before their use, and they are
+either declared in <new> or implicitly by the C++ compiler.
+
+So all in all, it doesn't matter that mozalloc.h is included before the
+wrapped STL headers. What matters is that it's included when STL headers
+are included. So arrange things such that mozalloc.h is included after
+the first wrapped STL header is fully preprocessed (and all its includes
+have been included).
+
+diff -uar Pale-Moon-27.3.0_Release.orig/config/gcc-stl-wrapper.template.h Pale-Moon-27.3.0_Release/config/gcc-stl-wrapper.template.h
+--- Pale-Moon-27.3.0_Release.orig/config/gcc-stl-wrapper.template.h 2017-04-22 23:34:19.000000000 +0200
++++ Pale-Moon-27.3.0_Release/config/gcc-stl-wrapper.template.h 2017-06-02 12:32:13.957076868 +0200
+@@ -22,21 +22,35 @@
+ #define NOMINMAX 1
+ #endif
+
++#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
++// Enable checked iterators and other goodies
++//
++// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
++// Figure out how to resolve this with -fno-rtti. Maybe build with
++// -frtti in DEBUG builds?
++//
++// # define _GLIBCXX_DEBUG 1
++#endif
++
+ // Don't include mozalloc for cstdlib. See bug 1245076.
+ #ifndef moz_dont_include_mozalloc_for_cstdlib
+ # define moz_dont_include_mozalloc_for_cstdlib
+ #endif
+-#ifndef moz_dont_include_mozalloc_for_${HEADER}
+-// mozalloc.h wants <new>; break the cycle by always explicitly
+-// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
+-//
+-// `#include_next' does not distinguish between <file> and "file"
+-// inclusion, nor does it check that the file you specify has the
+-// same name as the current file. It simply looks for the file
+-// named, starting with the directory in the search path after the
+-// one where the current file was found.
+-# include_next <new>
+
++// Include mozalloc after the STL header and all other headers it includes
++// have been preprocessed.
++#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
++ !defined(moz_dont_include_mozalloc_for_${HEADER})
++# define MOZ_INCLUDE_MOZALLOC_H
++# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
++#endif
++
++
++#pragma GCC visibility push(default)
++#include_next <${HEADER}>
++#pragma GCC visibility pop
++
++#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+ // See if we're in code that can use mozalloc. NB: this duplicates
+ // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+ // can't build with that being included before base/basictypes.h.
+@@ -45,23 +59,8 @@
+ # else
+ # error "STL code can only be used with infallible ::operator new()"
+ # endif
+-
+-#endif
+-
+-#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
+-// Enable checked iterators and other goodies
+-//
+-// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
+-// Figure out how to resolve this with -fno-rtti. Maybe build with
+-// -frtti in DEBUG builds?
+-//
+-// # define _GLIBCXX_DEBUG 1
+ #endif
+
+-#pragma GCC visibility push(default)
+-#include_next <${HEADER}>
+-#pragma GCC visibility pop
+-
+ // gcc calls a __throw_*() function from bits/functexcept.h when it
+ // wants to "throw an exception". functexcept exists nominally to
+ // support -fno-exceptions, but since we'll always use the system
+diff -uar Pale-Moon-27.3.0_Release.orig/config/make-stl-wrappers.py Pale-Moon-27.3.0_Release/config/make-stl-wrappers.py
+--- Pale-Moon-27.3.0_Release.orig/config/make-stl-wrappers.py 2017-04-22 23:34:19.000000000 +0200
++++ Pale-Moon-27.3.0_Release/config/make-stl-wrappers.py 2017-06-02 11:15:11.104763256 +0200
+@@ -30,7 +30,6 @@
+ os.mkdir(outdir)
+
+ template = open(template_file, 'r').read()
+- path_to_new = header_path('new', compiler)
+
+ for header in open(header_list_file, 'r'):
+ header = header.rstrip()
+@@ -40,8 +39,7 @@
+ path = header_path(header, compiler)
+ with FileAvoidWrite(os.path.join(outdir, header)) as f:
+ f.write(string.Template(template).substitute(HEADER=header,
+- HEADER_PATH=path,
+- NEW_HEADER_PATH=path_to_new))
++ HEADER_PATH=path))
+
+
+ if __name__ == '__main__':
+diff -uar Pale-Moon-27.3.0_Release.orig/config/msvc-stl-wrapper.template.h Pale-Moon-27.3.0_Release/config/msvc-stl-wrapper.template.h
+--- Pale-Moon-27.3.0_Release.orig/config/msvc-stl-wrapper.template.h 2017-04-22 23:34:19.000000000 +0200
++++ Pale-Moon-27.3.0_Release/config/msvc-stl-wrapper.template.h 2017-06-02 12:36:00.840712784 +0200
+@@ -15,27 +15,19 @@
+ // Suppress windef.h min and max macros - they make std::min/max not compile.
+ #define NOMINMAX 1
+
++// Include mozalloc after the STL header and all other headers it includes
++// have been preprocessed.
++#if !defined(MOZ_INCLUDE_MOZALLOC_H)
++# define MOZ_INCLUDE_MOZALLOC_H
++# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
++#endif
++
+ // Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
+ // CRT doesn't export std::_Throw(). So we define it.
+ #ifndef mozilla_Throw_h
+ # include "mozilla/throw_msvc.h"
+ #endif
+
+-// Code might include <new> before other wrapped headers, but <new>
+-// includes <exception> and so we want to wrap it. But mozalloc.h
+-// wants <new> also, so we break the cycle by always explicitly
+-// including <new> here.
+-#include <${NEW_HEADER_PATH}>
+-
+-// See if we're in code that can use mozalloc. NB: this duplicates
+-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+-// can't build with that being included before base/basictypes.h.
+-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+-# include "mozilla/mozalloc.h"
+-#else
+-# error "STL code can only be used with infallible ::operator new()"
+-#endif
+-
+ #ifdef _DEBUG
+ // From
+ // http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
+@@ -74,4 +66,15 @@
+
+ #pragma warning( pop )
+
++#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
++// See if we're in code that can use mozalloc. NB: this duplicates
++// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
++// can't build with that being included before base/basictypes.h.
++# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
++# include "mozilla/mozalloc.h"
++# else
++# error "STL code can only be used with infallible ::operator new()"
++# endif
++#endif
++
+ #endif // if mozilla_${HEADER}_h
+diff -uar Pale-Moon-27.3.0_Release.orig/memory/mozalloc/mozalloc.h Pale-Moon-27.3.0_Release/memory/mozalloc/mozalloc.h
+--- Pale-Moon-27.3.0_Release.orig/memory/mozalloc/mozalloc.h 2017-04-22 23:34:19.000000000 +0200
++++ Pale-Moon-27.3.0_Release/memory/mozalloc/mozalloc.h 2017-06-02 12:38:17.240340338 +0200
+@@ -12,10 +12,17 @@
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=427099
+ */
+
+-#include <stdlib.h>
+-#include <string.h>
+ #if defined(__cplusplus)
+ # include <new>
++// Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the
++// corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code
++// using things defined there. Specifically, with stdlib.h, the use of abs()
++// in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs()
++# include <cstdlib>
++# include <cstring>
++#else
++# include <stdlib.h>
++# include <string.h>
+ #endif
+ #include "xpcom-config.h"
+