From 991d9c72a8439716acaec4440805d21d3670b58f Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Tue, 12 Dec 2017 15:29:21 +0100 Subject: [PATCH 01/13] conditional check for PPC/x86 --- modules/woff2/src/port.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/woff2/src/port.h b/modules/woff2/src/port.h index fcecbe775..4e3a87270 100644 --- a/modules/woff2/src/port.h +++ b/modules/woff2/src/port.h @@ -72,8 +72,10 @@ inline int Log2Floor(uint32 n) { #endif /* endianness */ #endif /* CPU whitelist */ +#if !defined(__i386) && !defined(__x86_64__) #ifndef WOFF_BIG_ENDIAN #error unexpected endianness #endif +#endif /* !defined(__i386) && !defined(__x86_64__) */ #endif // WOFF2_PORT_H_ From 79e98020c75ae64e551640de0c602a29edd742c6 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Tue, 12 Dec 2017 15:32:47 +0100 Subject: [PATCH 02/13] remove flags to remove altivec from here --- config/config.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/config.mk b/config/config.mk index cbd3693c4..d0de93df2 100644 --- a/config/config.mk +++ b/config/config.mk @@ -399,10 +399,10 @@ endif # WINNT && !GNU_CC ifeq ($(OS_ARCH),Darwin) # Compiling ObjC requires an Apple compiler anyway, so it's ok to set # host CMFLAGS here. -HOST_CMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec -HOST_CMMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec -OS_COMPILE_CMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec -OS_COMPILE_CMMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec +HOST_CMFLAGS += -fobjc-exceptions +HOST_CMMFLAGS += -fobjc-exceptions +OS_COMPILE_CMFLAGS += -fobjc-exceptions +OS_COMPILE_CMMFLAGS += -fobjc-exceptions ifeq ($(MOZ_WIDGET_TOOLKIT),uikit) OS_COMPILE_CMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch From b89023984e5ebd65ae177bd59c17fbf305528adb Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Tue, 12 Dec 2017 15:57:28 +0100 Subject: [PATCH 03/13] make it only a warning on non-intel --- gfx/thebes/gfxMacPlatformFontList.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index d38ded97c..75abc38af 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -488,7 +488,7 @@ MacOSFontEntry::GetFontTable(uint32_t aTag) if (MOZ_LIKELY(mFontTableDirSize > 0)) { // XXX: This assumes big endian (warning Intel) #ifndef __ppc__ -#error needs GetFontTable fast path needs little endian version +#warning needs GetFontTable fast path needs little endian version #endif #ifdef DEBUG_X From 9560b56f7f98a40b30f774ab764f31fb3119aca1 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Tue, 12 Dec 2017 16:30:14 +0100 Subject: [PATCH 04/13] factor code constants to a tag and make it endianness dependent --- gfx/2d/ScaledFontMac.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gfx/2d/ScaledFontMac.cpp b/gfx/2d/ScaledFontMac.cpp index 45343d6ec..1d8378aae 100644 --- a/gfx/2d/ScaledFontMac.cpp +++ b/gfx/2d/ScaledFontMac.cpp @@ -218,6 +218,12 @@ struct writeBuf int offset; }; +#ifdef __ppc__ +#define TAG_CFF 0x43464620 +#else +#define TAG_CFF 0x20464643 +#endif + bool ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton) { @@ -233,7 +239,7 @@ ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton) bool CFF = false; for (CFIndex i = 0; i(table.Elements())); TableRecord *records = new TableRecord[count]; for (uint32_t i=3; i<(sizer/4); i+=4) { // Skip header -#ifndef __ppc__ -#error need little-endian version -#endif uint32_t tag = wtable[i]; - if (tag == 0x43464620) // 'CFF ' + if (tag == TAG_CFF) CFF = true; // We know the length from the directory, so we can simply import // the data. We assume the table exists, and OMG if it doesn't. From e36e6dd70782beab9cd84a5282ff5e69a3534d9f Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Fri, 15 Dec 2017 09:59:39 +0100 Subject: [PATCH 05/13] disable obsolete carbon plugin stuff --- dom/plugins/ipc/PluginInstanceChild.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index a36ff9bf7..c634b986c 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -257,7 +257,8 @@ PluginInstanceChild::DoNPP_New() Initialize(); -#if defined(XP_MACOSX) && defined(__i386__) +#if 0 +//#if defined(XP_MACOSX) && defined(__i386__) // If an i386 Mac OS X plugin has selected the Carbon event model then // we have to fail. We do not support putting Carbon event model plugins // out of process. Note that Carbon is the default model so out of process From 40e74a22f0b7adc0fe81d96ada276f6d0c6a6644 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Fri, 15 Dec 2017 10:15:28 +0100 Subject: [PATCH 06/13] add missing intel CPU type --- xpcom/threads/nsProcessCommon.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 82170b247..ed4390e45 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -48,6 +48,7 @@ using namespace mozilla; #ifdef XP_MACOSX typedef int cpu_type_t; // we don't have cpu_type* on 10.4. #define CPU_TYPE_ANY ((cpu_type_t) -1) +#define CPU_TYPE_X86 ((cpu_type_t) 7) #define CPU_TYPE_POWERPC ((cpu_type_t) 18) cpu_type_t pref_cpu_types[2] = { From dd8d39889cbbc6254eacce21800d6e98e730277b Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sat, 16 Dec 2017 18:41:27 +0100 Subject: [PATCH 07/13] Revert "conditional check for PPC/x86" temporarily to make better pull request. This reverts commit 991d9c72a8439716acaec4440805d21d3670b58f. --- modules/woff2/src/port.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/woff2/src/port.h b/modules/woff2/src/port.h index 4e3a87270..fcecbe775 100644 --- a/modules/woff2/src/port.h +++ b/modules/woff2/src/port.h @@ -72,10 +72,8 @@ inline int Log2Floor(uint32 n) { #endif /* endianness */ #endif /* CPU whitelist */ -#if !defined(__i386) && !defined(__x86_64__) #ifndef WOFF_BIG_ENDIAN #error unexpected endianness #endif -#endif /* !defined(__i386) && !defined(__x86_64__) */ #endif // WOFF2_PORT_H_ From 46c4e5cb41d245a9d473ee43ca2ceb8df733544d Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sat, 16 Dec 2017 18:58:55 +0100 Subject: [PATCH 08/13] better ifdef for x86 to include SSe header that enables the member function definitions --- xpcom/string/nsUTF8Utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xpcom/string/nsUTF8Utils.h b/xpcom/string/nsUTF8Utils.h index 41747f0d4..f121c514b 100644 --- a/xpcom/string/nsUTF8Utils.h +++ b/xpcom/string/nsUTF8Utils.h @@ -12,7 +12,8 @@ #include "nscore.h" #include "mozilla/Assertions.h" -#if MOZILLA_MAY_SUPPORT_SSE2 + +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #include "mozilla/SSE.h" #endif From dbe31570d033bff90559c10bb6b9952ddcc86fe4 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sat, 16 Dec 2017 19:45:40 +0100 Subject: [PATCH 09/13] look for log2() without std namespace --- gfx/ots/src/silf.cc | 6 +++--- gfx/ots/src/sill.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx/ots/src/silf.cc b/gfx/ots/src/silf.cc index 56970427b..4e696bf7c 100644 --- a/gfx/ots/src/silf.cc +++ b/gfx/ots/src/silf.cc @@ -298,7 +298,7 @@ bool OpenTypeSILF::SILSub::ParsePart(Buffer& table) { this->searchPseudo = this->pseudoSelector = this->pseudoShift = 0; } } else { - unsigned floorLog2 = std::floor(std::log2(this->numPseudo)); + unsigned floorLog2 = std::floor(log2(this->numPseudo)); if (this->searchPseudo != 6 * (unsigned)std::pow(2, floorLog2) || this->pseudoSelector != floorLog2 || this->pseudoShift != 6 * this->numPseudo - this->searchPseudo) { @@ -565,7 +565,7 @@ LookupClass::ParsePart(Buffer& table) { this->searchRange = this->entrySelector = this->rangeShift = 0; } } else { - unsigned floorLog2 = std::floor(std::log2(this->numIDs)); + unsigned floorLog2 = std::floor(log2(this->numIDs)); if (this->searchRange != (unsigned)std::pow(2, floorLog2) || this->entrySelector != floorLog2 || this->rangeShift != this->numIDs - this->searchRange) { @@ -694,7 +694,7 @@ SILPass::ParsePart(Buffer& table, const size_t SILSub_init_offset, this->searchRange = this->entrySelector = this->rangeShift = 0; } } else { - unsigned floorLog2 = std::floor(std::log2(this->numRange)); + unsigned floorLog2 = std::floor(log2(this->numRange)); if (this->searchRange != 6 * (unsigned)std::pow(2, floorLog2) || this->entrySelector != floorLog2 || this->rangeShift != 6 * this->numRange - this->searchRange) { diff --git a/gfx/ots/src/sill.cc b/gfx/ots/src/sill.cc index c7b20a980..cd5cf6803 100644 --- a/gfx/ots/src/sill.cc +++ b/gfx/ots/src/sill.cc @@ -35,7 +35,7 @@ bool OpenTypeSILL::Parse(const uint8_t* data, size_t length) { this->searchRange = this->entrySelector = this->rangeShift = 0; } } else { - unsigned floorLog2 = std::floor(std::log2(this->numLangs)); + unsigned floorLog2 = std::floor(log2(this->numLangs)); if (this->searchRange != (unsigned)std::pow(2, floorLog2) || this->entrySelector != floorLog2 || this->rangeShift != this->numLangs - this->searchRange) { From 442bbc38c3b4a4d82b3ae7cd44fe61011abd45bb Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sat, 16 Dec 2017 19:50:27 +0100 Subject: [PATCH 10/13] rewrite access to control and FPU structures --- toolkit/xre/nsSigHandlers.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp index 000129004..73674d406 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -37,6 +37,14 @@ #include #endif +#ifdef XP_MACOSX +#ifndef __ppc__ +#include +#include +#include +#endif +#endif + static char _progname[1024] = "huh?"; // Note: some tests manipulate this value. @@ -160,14 +168,14 @@ static void fpehandler(int signum, siginfo_t *si, void *context) ucontext_t *uc = (ucontext_t *)context; #if defined(__i386__) || defined(__amd64__) - _STRUCT_FP_CONTROL *ctrl = &uc->uc_mcontext->__fs.__fpu_fcw; - ctrl->__invalid = ctrl->__denorm = ctrl->__zdiv = ctrl->__ovrfl = ctrl->__undfl = ctrl->__precis = 1; + fp_control *ctrl = &uc->uc_mcontext->fs.fpu_fcw; + ctrl->invalid = ctrl->denorm = ctrl->zdiv = ctrl->ovrfl = ctrl->undfl = ctrl->precis = 1; - _STRUCT_FP_STATUS *status = &uc->uc_mcontext->__fs.__fpu_fsw; - status->__invalid = status->__denorm = status->__zdiv = status->__ovrfl = status->__undfl = - status->__precis = status->__stkflt = status->__errsumm = 0; + fp_status *status = &uc->uc_mcontext->fs.fpu_fsw; + status->invalid = status->denorm = status->zdiv = status->ovrfl = status->undfl = + status->precis = status->stkflt = status->errsumm = 0; - uint32_t *mxcsr = &uc->uc_mcontext->__fs.__fpu_mxcsr; + uint32_t *mxcsr = &uc->uc_mcontext->fs.fpu_mxcsr; *mxcsr |= SSE_EXCEPTION_MASK; /* disable all SSE exceptions */ *mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */ #endif From 3c4213344c2d3ed83996ff3b7efa5558a2d6d804 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sat, 16 Dec 2017 21:43:15 +0100 Subject: [PATCH 11/13] Wrong revert! Revert "Revert "conditional check for PPC/x86" temporarily to make better pull request." This reverts commit dd8d39889cbbc6254eacce21800d6e98e730277b. --- modules/woff2/src/port.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/woff2/src/port.h b/modules/woff2/src/port.h index fcecbe775..4e3a87270 100644 --- a/modules/woff2/src/port.h +++ b/modules/woff2/src/port.h @@ -72,8 +72,10 @@ inline int Log2Floor(uint32 n) { #endif /* endianness */ #endif /* CPU whitelist */ +#if !defined(__i386) && !defined(__x86_64__) #ifndef WOFF_BIG_ENDIAN #error unexpected endianness #endif +#endif /* !defined(__i386) && !defined(__x86_64__) */ #endif // WOFF2_PORT_H_ From a4ecbbce7211c6c6f253b62ca37333f0494d15dc Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sat, 16 Dec 2017 21:44:24 +0100 Subject: [PATCH 12/13] Corretly revert to allow better pull. Revert "remove flags to remove altivec from here" This reverts commit 79e98020c75ae64e551640de0c602a29edd742c6. --- config/config.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/config.mk b/config/config.mk index d0de93df2..cbd3693c4 100644 --- a/config/config.mk +++ b/config/config.mk @@ -399,10 +399,10 @@ endif # WINNT && !GNU_CC ifeq ($(OS_ARCH),Darwin) # Compiling ObjC requires an Apple compiler anyway, so it's ok to set # host CMFLAGS here. -HOST_CMFLAGS += -fobjc-exceptions -HOST_CMMFLAGS += -fobjc-exceptions -OS_COMPILE_CMFLAGS += -fobjc-exceptions -OS_COMPILE_CMMFLAGS += -fobjc-exceptions +HOST_CMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec +HOST_CMMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec +OS_COMPILE_CMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec +OS_COMPILE_CMMFLAGS += -fobjc-exceptions -mno-altivec -mabi=no-altivec ifeq ($(MOZ_WIDGET_TOOLKIT),uikit) OS_COMPILE_CMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch From 476c7498d921a6a1af325ff2c2985ef5b7b3dc07 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Sun, 17 Dec 2017 19:16:07 +0100 Subject: [PATCH 13/13] Revert "look for log2() without std namespace" - need to investigate more This reverts commit dbe31570d033bff90559c10bb6b9952ddcc86fe4. --- gfx/ots/src/silf.cc | 6 +++--- gfx/ots/src/sill.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx/ots/src/silf.cc b/gfx/ots/src/silf.cc index 4e696bf7c..56970427b 100644 --- a/gfx/ots/src/silf.cc +++ b/gfx/ots/src/silf.cc @@ -298,7 +298,7 @@ bool OpenTypeSILF::SILSub::ParsePart(Buffer& table) { this->searchPseudo = this->pseudoSelector = this->pseudoShift = 0; } } else { - unsigned floorLog2 = std::floor(log2(this->numPseudo)); + unsigned floorLog2 = std::floor(std::log2(this->numPseudo)); if (this->searchPseudo != 6 * (unsigned)std::pow(2, floorLog2) || this->pseudoSelector != floorLog2 || this->pseudoShift != 6 * this->numPseudo - this->searchPseudo) { @@ -565,7 +565,7 @@ LookupClass::ParsePart(Buffer& table) { this->searchRange = this->entrySelector = this->rangeShift = 0; } } else { - unsigned floorLog2 = std::floor(log2(this->numIDs)); + unsigned floorLog2 = std::floor(std::log2(this->numIDs)); if (this->searchRange != (unsigned)std::pow(2, floorLog2) || this->entrySelector != floorLog2 || this->rangeShift != this->numIDs - this->searchRange) { @@ -694,7 +694,7 @@ SILPass::ParsePart(Buffer& table, const size_t SILSub_init_offset, this->searchRange = this->entrySelector = this->rangeShift = 0; } } else { - unsigned floorLog2 = std::floor(log2(this->numRange)); + unsigned floorLog2 = std::floor(std::log2(this->numRange)); if (this->searchRange != 6 * (unsigned)std::pow(2, floorLog2) || this->entrySelector != floorLog2 || this->rangeShift != 6 * this->numRange - this->searchRange) { diff --git a/gfx/ots/src/sill.cc b/gfx/ots/src/sill.cc index cd5cf6803..c7b20a980 100644 --- a/gfx/ots/src/sill.cc +++ b/gfx/ots/src/sill.cc @@ -35,7 +35,7 @@ bool OpenTypeSILL::Parse(const uint8_t* data, size_t length) { this->searchRange = this->entrySelector = this->rangeShift = 0; } } else { - unsigned floorLog2 = std::floor(log2(this->numLangs)); + unsigned floorLog2 = std::floor(std::log2(this->numLangs)); if (this->searchRange != (unsigned)std::pow(2, floorLog2) || this->entrySelector != floorLog2 || this->rangeShift != this->numLangs - this->searchRange) {