FTBFS hurd: fixing unsupported platform Hurd
authorCarsten Schoenert <c.schoenert@t-online.de>
Sat, 29 Mar 2014 19:58:55 +0000 (20:58 +0100)
committerPeter Micheal Green <plugwash@raspbian.org>
Fri, 18 Jan 2019 23:40:33 +0000 (23:40 +0000)
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 61e57da20056d1d7a2403eb0e291cf2f19c0bcf3..e063789316b8cf42c2333f3a1ad9499a966d45c2 100644 (file)
@@ -274,7 +274,7 @@ 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");
 
@@ -1751,7 +1751,7 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval)
     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);
@@ -1789,7 +1789,7 @@ 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 764e3350835f5a49214950850cae366e17ae07e4..ecc15702cdc26d3857048250fe73972a94b41664 100644 (file)
@@ -244,7 +244,7 @@ private:
 
     // 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 5558add39d2626ee0b524b31f2e07f663cafd1fd..332a4e2670819e1a39ad9eb882891339ea24b2a7 100644 (file)
@@ -67,5 +67,10 @@ else:
             'OS_BSD': 1,
         })
 
+    elif CONFIG['OS_ARCH'] == 'GNU':
+        DEFINES.update({
+            'OS_HURD': 1,
+        })
+
     else:
         DEFINES['OS_LINUX'] = 1
index 7888251982e8e83a59318f0ef54be8ca140cfc4c..928ccd90e1a3e089fa485e563a810be85c736d16 100644 (file)
@@ -126,7 +126,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/atomicops_internals_x86_gcc.cc',
         'src/base/process_util_linux.cc',
index 49fa63ead26c354d40e3eb4cd971115f5d32cbde..18f9c4b3d8c1971250ca79612ae712e923ffc14a 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
@@ -243,7 +243,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 af4016152179c8acfde1d9f56c0726ad2289e1ea..4475b3e14873b8022dec8228f7b1959eba737fa6 100644 (file)
@@ -127,7 +127,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
 #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 f991c01aec3779f61af0822c190d4277c4377080..f6954443f2326f9c282df3a03d8413a40581e7d9 100644 (file)
@@ -23,6 +23,7 @@
 #elif defined(__APPLE__)
 #define OS_MACOSX 1
 #elif defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)
+#define OS_HURD 1
 #define OS_LINUX 1
 #elif defined(__DragonFly__)
 #define OS_DRAGONFLY 1
@@ -49,7 +50,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)
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || 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 d18ed9edd4ca503bcb8d5ec2b4cc07c76c950bc0..91041f2573c1c85aaaae29a0143a1f1a1ae7ada9 100644 (file)
@@ -646,7 +646,9 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
   // 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)
+  base::environment_map newEnvVars;
+
 #  if defined(MOZ_WIDGET_GTK)
   if (mProcessType == GeckoProcessType_Content) {
     // disable IM module to avoid sandbox violation
@@ -667,7 +669,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
     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());
 
@@ -765,7 +767,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
   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 b35461579c862e8adc3ae517214b671a6f938814..4fc8e5c87d2d945e44eff5bad8431298866b1ce7 100644 (file)
@@ -128,7 +128,7 @@ struct AutoSignalHandler
 #  define EPC_sig(p) ((p)->sc_pc)
 #  define RFP_sig(p) ((p)->sc_regs[30])
 # endif
-#elif defined(__linux__) || defined(__sun)
+#elif defined(__linux__) || defined(__sun) || defined(__GNU__)
 # if defined(__linux__)
 #  define XMM_sig(p,i) ((p)->uc_mcontext.fpregs->_xmm[i])
 #  define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_EIP])