FTBFS hurd: fixing unsupported platform Hurd
authorCarsten Schoenert <c.schoenert@t-online.de>
Sat, 29 Mar 2014 19:58:55 +0000 (20:58 +0100)
committerCarsten Schoenert <c.schoenert@t-online.de>
Sun, 12 Apr 2020 08:21:40 +0000 (09:21 +0100)
On the Hurd platform the build failed in
js/src/jit/AsmJSSignalHandlers.cpp:131 because of unsupported
mode for reading / writing thead state with following message.

 # error "Don't know how to read/write to the thread state via the mcontext_t."

The original patch comes from Richard Brown <rbraun@sceen.net>
https://lists.alioth.debian.org/pipermail/pkg-mozilla-maintainers/2014-March/015565.html

After release of Thunderbird 44 there are additional changes made as the
various configuration files where split into more files.

Gbp-Pq: Topic porting-kfreebsd-hurd
Gbp-Pq: Name FTBFS-hurd-fixing-unsupported-platform-Hurd.patch

dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleChild.h
ipc/chromium/chromium-config.mozbuild
ipc/chromium/moz.build
ipc/chromium/src/base/message_loop.cc
ipc/chromium/src/base/process_util_posix.cc
ipc/chromium/src/build/build_config.h
ipc/chromium/src/third_party/libeventcommon.mozbuild
ipc/glue/GeckoChildProcessHost.cpp
js/src/wasm/WasmSignalHandlers.cpp

index 28d0e53dd36e8913fae3ce1690851b6a21233eeb..f1662e482b3441604b9c8de75399eee4b51fa2ae 100644 (file)
@@ -283,7 +283,7 @@ bool PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
 
   GetIPCChannel()->SetAbortOnError(true);
 
-#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) || defined(OS_HURD)
   mShutdownFunc =
       (NP_PLUGINSHUTDOWN)PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
 
@@ -1528,7 +1528,7 @@ mozilla::ipc::IPCResult PluginModuleChild::AnswerNP_GetEntryPoints(
   AssertPluginThread();
   MOZ_ASSERT(mIsChrome);
 
-#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) || defined(OS_HURD)
   return IPC_OK();
 #elif defined(OS_WIN) || defined(OS_MACOSX)
   *_retval = mGetEntryPointsFunc(&mFunctions);
@@ -1563,7 +1563,7 @@ NPError PluginModuleChild::DoNP_Initialize(const PluginSettings& aSettings) {
 #endif
 
   NPError result;
-#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) || defined(OS_HURD)
   result = mInitializeFunc(&sBrowserFuncs, &mFunctions);
 #elif defined(OS_WIN) || defined(OS_MACOSX)
   result = mInitializeFunc(&sBrowserFuncs);
index e770c97ece87720a7549c22a1b885047c0d2f9fc..1070e1a36df991c78e91438e643f854e9922fb2e 100644 (file)
@@ -228,7 +228,7 @@ class PluginModuleChild : public PPluginModuleChild {
 
   // we get this from the plugin
   NP_PLUGINSHUTDOWN mShutdownFunc;
-#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) || defined(OS_HURD)
   NP_PLUGINUNIXINIT mInitializeFunc;
 #elif defined(OS_WIN) || defined(OS_MACOSX)
   NP_PLUGININIT mInitializeFunc;
index 1dd914f29480cd719a61082b4329e10ceb9a439b..30ee42f7d606a64644f9e674580577bdb620f6c2 100644 (file)
@@ -67,6 +67,11 @@ else:
             'OS_BSD': 1,
         })
 
+    elif CONFIG['OS_ARCH'] == 'GNU':
+        DEFINES.update({
+            'OS_HURD': 1,
+        })
+
     else:
         DEFINES['OS_LINUX'] = 1
 
index 3766f259e572c4e892fe7cd4ed7ca9ba257f3350..5710d102ae0163f6caf75eecb6261b9739ea4836 100644 (file)
@@ -114,7 +114,7 @@ if os_bsd or os_linux:
             'src/base/message_pump_glib.cc',
         ]
 
-if os_solaris:
+if os_solaris or os_hurd:
     SOURCES += [
         'src/base/process_util_linux.cc',
         'src/base/time_posix.cc',
index 4741bf0caaba1ab12868e073708a19b632b0c42a..1eb555f9e534cd61d4f25800a557ad92d23a352a 100644 (file)
@@ -21,7 +21,7 @@
 #if defined(OS_POSIX)
 #  include "base/message_pump_libevent.h"
 #endif
-#if defined(OS_LINUX) || defined(OS_BSD)
+#if defined(OS_LINUX) || defined(OS_BSD)|| defined(OS_HURD)
 #  if defined(MOZ_WIDGET_GTK)
 #    include "base/message_pump_glib.h"
 #  endif
@@ -235,7 +235,7 @@ MessageLoop::MessageLoop(Type type, nsIEventTarget* aEventTarget)
   if (type_ == TYPE_UI) {
 #  if defined(OS_MACOSX)
     pump_ = base::MessagePumpMac::Create();
-#  elif defined(OS_LINUX) || defined(OS_BSD)
+#  elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_HURD)
     pump_ = new base::MessagePumpForUI();
 #  endif  // OS_LINUX
   } else if (type_ == TYPE_IO) {
index 719178ea55f3c2e8551277ba249dbf7966b3802b..bed6f31be0ae0982e5e3904355987bbe15e2d29a 100644 (file)
@@ -120,7 +120,7 @@ void CloseSuperfluousFds(void* aCtx, bool (*aShouldPreserve)(void*, int)) {
 #if defined(ANDROID)
   static const rlim_t kSystemDefaultMaxFds = 1024;
   static const char kFDDir[] = "/proc/self/fd";
-#elif defined(OS_LINUX) || defined(OS_SOLARIS)
+#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_HURD)
   static const rlim_t kSystemDefaultMaxFds = 8192;
   static const char kFDDir[] = "/proc/self/fd";
 #elif defined(OS_MACOSX)
index 4e0711daef840da1227a68589edf0f4877b210f0..72105fc50b716517d9eef5e214bb761a349ceae7 100644 (file)
@@ -24,6 +24,7 @@
 #  define OS_MACOSX 1
 #elif defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)
 #  define OS_LINUX 1
+#  define OS_HURD 1
 #elif defined(__DragonFly__)
 #  define OS_DRAGONFLY 1
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
@@ -50,7 +51,7 @@
 // For access to standard POSIX features, use OS_POSIX instead of a more
 // specific macro.
 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || \
-    defined(OS_SOLARIS)
+    defined(OS_SOLARIS) || defined(OS_HURD)
 #  define OS_POSIX 1
 #endif
 
index 5037ec77a5842350d323a15baa0e90e44ab34d09..c858d9c8aa9135a23518e4f9eb0a6af2a89cfc22 100644 (file)
@@ -8,6 +8,7 @@ os_win = 0
 os_posix = 0
 os_macosx = 0
 os_bsd = 0
+os_hurd = 0
 os_linux = 0
 os_solaris = 0
 
@@ -25,6 +26,10 @@ else:
     elif CONFIG['OS_ARCH'] == 'SunOS':
         os_solaris = 1
         libevent_include_suffix = 'solaris'
+    # attempt to get GNU hurd into the build again, further modification probably needed
+    elif CONFIG['OS_ARCH'] == 'GNU':
+        os_hurd = 1
+        libevent_include_suffix = 'gnu'
     else:
         os_linux = 1
         if CONFIG['OS_TARGET'] == 'Android':
index d87cb0a0461822f448955e12198369b8d641a905..9cc001e5da210c7ce51245696c3b41bfc3aefe73 100644 (file)
@@ -789,7 +789,7 @@ bool GeckoChildProcessHost::PerformAsyncLaunch(
   // and passing wstrings from one config to the other is unsafe.  So
   // we split the logic here.
 
-#  if defined(OS_POSIX)
+#  if defined(OS_POSIX) || defined(OS_HURD)
 #    if defined(MOZ_WIDGET_GTK)
   if (mProcessType == GeckoProcessType_Content) {
     // disable IM module to avoid sandbox violation
@@ -810,7 +810,7 @@ bool GeckoChildProcessHost::PerformAsyncLaunch(
     MOZ_ASSERT(gGREBinPath);
     nsCString path;
     NS_CopyUnicodeToNative(nsDependentString(gGREBinPath), path);
-#    if defined(OS_LINUX) || defined(OS_BSD)
+#    if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_HURD)
     const char* ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
     nsCString new_ld_lib_path(path.get());
 
@@ -897,7 +897,7 @@ bool GeckoChildProcessHost::PerformAsyncLaunch(
   childArgv.push_back(pidstring);
 
   if (!CrashReporter::IsDummy()) {
-#  if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
+#  if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) || defined(OS_HURD)
     int childCrashFd, childCrashRemapFd;
     if (!CrashReporter::CreateNotificationPipeForChild(&childCrashFd,
                                                        &childCrashRemapFd)) {
index 636537f847862ef693dd6582e2783de4e3d403c5..cfb297020f64865131ff813662f99eca2b2946bf 100644 (file)
@@ -108,7 +108,7 @@ using mozilla::DebugOnly;
 #    define R01_sig(p) ((p)->sc_frame.fixreg[1])
 #    define R32_sig(p) ((p)->sc_frame.srr0)
 #  endif
-#elif defined(__linux__) || defined(__sun)
+#elif defined(__linux__) || defined(__sun) || defined(__GNU__)
 #  if defined(__linux__)
 #    define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_EIP])
 #    define EBP_sig(p) ((p)->uc_mcontext.gregs[REG_EBP])