mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
Display an error on Linux in the absence of SSE2
This commit is contained in:
parent
adb584360c
commit
989d1736b2
9 changed files with 129 additions and 0 deletions
|
|
@ -33,6 +33,14 @@ NSDISTMODE = copy
|
||||||
|
|
||||||
include $(topsrcdir)/config/config.mk
|
include $(topsrcdir)/config/config.mk
|
||||||
|
|
||||||
|
# If we are trying to show an error dialog about the lack of SSE2 support,
|
||||||
|
# make sure that code itself doesn't use SSE2.
|
||||||
|
ifdef MOZ_LINUX_SSE2_STARTUP_ERROR
|
||||||
|
CXXFLAGS := $(filter-out -march=% -msse2 -mfpmath=sse,$(CXXFLAGS))
|
||||||
|
CXX := $(filter-out -march=% -msse2 -mfpmath=sse,$(CXX))
|
||||||
|
CXXFLAGS += -mno-sse2 -mfpmath=387
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),WINNT)
|
ifeq ($(OS_ARCH),WINNT)
|
||||||
# Rebuild firefox.exe if the manifest changes - it's included by splash.rc.
|
# Rebuild firefox.exe if the manifest changes - it's included by splash.rc.
|
||||||
# (this dependency should really be just for firefox.exe, not other targets)
|
# (this dependency should really be just for firefox.exe, not other targets)
|
||||||
|
|
|
||||||
|
|
@ -68,3 +68,6 @@ if CONFIG['MOZ_LINKER']:
|
||||||
|
|
||||||
if CONFIG['HAVE_CLOCK_MONOTONIC']:
|
if CONFIG['HAVE_CLOCK_MONOTONIC']:
|
||||||
OS_LIBS += CONFIG['REALTIME_LIBS']
|
OS_LIBS += CONFIG['REALTIME_LIBS']
|
||||||
|
|
||||||
|
if CONFIG['MOZ_LINUX_SSE2_STARTUP_ERROR']:
|
||||||
|
DEFINES['MOZ_LINUX_SSE2_STARTUP_ERROR'] = True
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,51 @@
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/WindowsDllBlocklist.h"
|
#include "mozilla/WindowsDllBlocklist.h"
|
||||||
|
|
||||||
|
#ifdef MOZ_LINUX_SSE2_STARTUP_ERROR
|
||||||
|
#include <cpuid.h>
|
||||||
|
#include "mozilla/Unused.h"
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsSSE2Available()
|
||||||
|
{
|
||||||
|
// The rest of the app has been compiled to assume that SSE2 is present
|
||||||
|
// unconditionally, so we can't use the normal copy of SSE.cpp here.
|
||||||
|
// Since SSE.cpp caches the results and we need them only transiently,
|
||||||
|
// instead of #including SSE.cpp here, let's just inline the specific check
|
||||||
|
// that's needed.
|
||||||
|
unsigned int level = 1u;
|
||||||
|
unsigned int eax, ebx, ecx, edx;
|
||||||
|
unsigned int bits = (1u<<26);
|
||||||
|
unsigned int max = __get_cpuid_max(0, nullptr);
|
||||||
|
if (level > max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
__cpuid_count(level, 0, eax, ebx, ecx, edx);
|
||||||
|
return (edx & bits) == bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char sSSE2Message[] =
|
||||||
|
"This browser version requires a processor with the SSE2 instruction "
|
||||||
|
"set extension.\n";
|
||||||
|
|
||||||
|
__attribute__((constructor))
|
||||||
|
static void
|
||||||
|
SSE2Check()
|
||||||
|
{
|
||||||
|
if (IsSSE2Available()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Using write() in order to avoid jemalloc-based buffering. Ignoring return
|
||||||
|
// values, since there isn't much we could do on failure and there is no
|
||||||
|
// point in trying to recover from errors.
|
||||||
|
MOZ_UNUSED(write(STDERR_FILENO,
|
||||||
|
sSSE2Message,
|
||||||
|
MOZ_ARRAY_LENGTH(sSSE2Message) - 1));
|
||||||
|
// _exit() instead of exit() to avoid running the usual "at exit" code.
|
||||||
|
_exit(255);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID)
|
#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID)
|
||||||
#define MOZ_BROWSER_CAN_BE_CONTENTPROC
|
#define MOZ_BROWSER_CAN_BE_CONTENTPROC
|
||||||
#include "../../ipc/contentproc/plugin-container.cpp"
|
#include "../../ipc/contentproc/plugin-container.cpp"
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,11 @@ if test "$OS_ARCH" = "WINNT" -o \
|
||||||
MOZ_BUNDLED_FONTS=1
|
MOZ_BUNDLED_FONTS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Display an error on non-SSE2 Linux systems
|
||||||
|
if test "$OS_ARCH" = "Linux"; then
|
||||||
|
MOZ_LINUX_SSE2_STARTUP_ERROR=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Short-circuit a few services to be removed
|
# Short-circuit a few services to be removed
|
||||||
MOZ_MAINTENANCE_SERVICE=
|
MOZ_MAINTENANCE_SERVICE=
|
||||||
MOZ_SERVICES_HEALTHREPORT=
|
MOZ_SERVICES_HEALTHREPORT=
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,14 @@ NSDISTMODE = copy
|
||||||
|
|
||||||
include $(topsrcdir)/config/config.mk
|
include $(topsrcdir)/config/config.mk
|
||||||
|
|
||||||
|
# If we are trying to show an error dialog about the lack of SSE2 support,
|
||||||
|
# make sure that code itself doesn't use SSE2.
|
||||||
|
ifdef MOZ_LINUX_SSE2_STARTUP_ERROR
|
||||||
|
CXXFLAGS := $(filter-out -march=% -msse2 -mfpmath=sse,$(CXXFLAGS))
|
||||||
|
CXX := $(filter-out -march=% -msse2 -mfpmath=sse,$(CXX))
|
||||||
|
CXXFLAGS += -mno-sse2 -mfpmath=387
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),WINNT)
|
ifeq ($(OS_ARCH),WINNT)
|
||||||
# Rebuild firefox.exe if the manifest changes - it's included by splash.rc.
|
# Rebuild firefox.exe if the manifest changes - it's included by splash.rc.
|
||||||
# (this dependency should really be just for firefox.exe, not other targets)
|
# (this dependency should really be just for firefox.exe, not other targets)
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ if CONFIG['HAVE_CLOCK_MONOTONIC']:
|
||||||
if CONFIG['MOZ_GPSD']:
|
if CONFIG['MOZ_GPSD']:
|
||||||
DEFINES['MOZ_GPSD'] = True
|
DEFINES['MOZ_GPSD'] = True
|
||||||
|
|
||||||
|
|
||||||
|
if CONFIG['MOZ_LINUX_SSE2_STARTUP_ERROR']:
|
||||||
|
DEFINES['MOZ_LINUX_SSE2_STARTUP_ERROR'] = True
|
||||||
|
|
||||||
for icon in ('firefox', 'document', 'newwindow', 'newtab', 'pbmode'):
|
for icon in ('firefox', 'document', 'newwindow', 'newtab', 'pbmode'):
|
||||||
DEFINES[icon.upper() + '_ICO'] = '"%s/dist/branding/%s.ico"' % (
|
DEFINES[icon.upper() + '_ICO'] = '"%s/dist/branding/%s.ico"' % (
|
||||||
TOPOBJDIR, icon)
|
TOPOBJDIR, icon)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,51 @@
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/WindowsDllBlocklist.h"
|
#include "mozilla/WindowsDllBlocklist.h"
|
||||||
|
|
||||||
|
#ifdef MOZ_LINUX_SSE2_STARTUP_ERROR
|
||||||
|
#include <cpuid.h>
|
||||||
|
#include "mozilla/Unused.h"
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsSSE2Available()
|
||||||
|
{
|
||||||
|
// The rest of the app has been compiled to assume that SSE2 is present
|
||||||
|
// unconditionally, so we can't use the normal copy of SSE.cpp here.
|
||||||
|
// Since SSE.cpp caches the results and we need them only transiently,
|
||||||
|
// instead of #including SSE.cpp here, let's just inline the specific check
|
||||||
|
// that's needed.
|
||||||
|
unsigned int level = 1u;
|
||||||
|
unsigned int eax, ebx, ecx, edx;
|
||||||
|
unsigned int bits = (1u<<26);
|
||||||
|
unsigned int max = __get_cpuid_max(0, nullptr);
|
||||||
|
if (level > max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
__cpuid_count(level, 0, eax, ebx, ecx, edx);
|
||||||
|
return (edx & bits) == bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char sSSE2Message[] =
|
||||||
|
"This browser version requires a processor with the SSE2 instruction "
|
||||||
|
"set extension.\n";
|
||||||
|
|
||||||
|
__attribute__((constructor))
|
||||||
|
static void
|
||||||
|
SSE2Check()
|
||||||
|
{
|
||||||
|
if (IsSSE2Available()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Using write() in order to avoid jemalloc-based buffering. Ignoring return
|
||||||
|
// values, since there isn't much we could do on failure and there is no
|
||||||
|
// point in trying to recover from errors.
|
||||||
|
MOZ_UNUSED(write(STDERR_FILENO,
|
||||||
|
sSSE2Message,
|
||||||
|
MOZ_ARRAY_LENGTH(sSSE2Message) - 1));
|
||||||
|
// _exit() instead of exit() to avoid running the usual "at exit" code.
|
||||||
|
_exit(255);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID)
|
#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID)
|
||||||
#define MOZ_BROWSER_CAN_BE_CONTENTPROC
|
#define MOZ_BROWSER_CAN_BE_CONTENTPROC
|
||||||
#include "../../ipc/contentproc/plugin-container.cpp"
|
#include "../../ipc/contentproc/plugin-container.cpp"
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,11 @@ if test "$OS_ARCH" = "WINNT"; then
|
||||||
MOZ_MAINTENANCE_SERVICE=
|
MOZ_MAINTENANCE_SERVICE=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Display an error on non-SSE2 Linux systems
|
||||||
|
if test "$OS_ARCH" = "Linux"; then
|
||||||
|
MOZ_LINUX_SSE2_STARTUP_ERROR=1
|
||||||
|
fi
|
||||||
|
|
||||||
# For Basilisk we want to use 52.9.YYYY.MM.DD as MOZ_APP_VERSION in release
|
# For Basilisk we want to use 52.9.YYYY.MM.DD as MOZ_APP_VERSION in release
|
||||||
# builds so add-on developers have something to target while maintaining
|
# builds so add-on developers have something to target while maintaining
|
||||||
# Firefox compatiblity.
|
# Firefox compatiblity.
|
||||||
|
|
|
||||||
|
|
@ -4884,6 +4884,12 @@ if test "$USE_FC_FREETYPE"; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl ========================================================
|
||||||
|
dnl Check if we need the Linux SSE2 error dialog
|
||||||
|
dnl ========================================================
|
||||||
|
|
||||||
|
AC_SUBST(MOZ_LINUX_SSE2_STARTUP_ERROR)
|
||||||
|
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
dnl Check for pixman and cairo
|
dnl Check for pixman and cairo
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue