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>
Wed, 19 Apr 2023 15:28:54 +0000 (16:28 +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

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 968eb017f6d8d54f657f1f51ea30e7a327e6d467..df2ec253ce55ad9e829646e2029e4fd2407554aa 100644 (file)
@@ -56,5 +56,10 @@ else:
         DEFINES['OS_OPENBSD'] = 1
         DEFINES['OS_BSD'] = 1
 
+    elif CONFIG['OS_ARCH'] == 'GNU':
+        DEFINES.update({
+            'OS_HURD': 1,
+        })
+
     else:
         DEFINES['OS_LINUX'] = 1
index 0a9ab349d40ac2358e75f8611ac2bcc3b6c287c0..2696bf76583f7abadede01a6da2a975906a9046d 100644 (file)
@@ -117,7 +117,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 425d6c4ebcd112e51aaaaa12ee9b6877fff67420..693f65c7160fd74bb3781acd6884b3828a8d0904 100644 (file)
@@ -26,7 +26,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
@@ -291,7 +291,7 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* 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 80e7ac08a4827446ce051fdc4427c281b5fd1c4c..42052622dbb4e1b5f7fc5e1aa6c5de876d123102 100644 (file)
@@ -114,7 +114,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 e104c58d23e568eb61b790f78091c6fe3ef54e71..4e29caceea32fee3ed9bc0f78d8421db8628f1f4 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 7a5794894697e21f30d48226ae00cffc36529984..61f23c89db42a27d14329989ffac683dd7b60aaf 100644 (file)
@@ -1115,12 +1115,31 @@ bool LinuxProcessLauncher::DoSetup() {
 }
 #endif  // MOZ_WIDGET_GTK
 
-#ifdef OS_POSIX
+#if defined(OS_POSIX) || defined(OS_HURD)
 bool PosixProcessLauncher::DoSetup() {
   if (!BaseProcessLauncher::DoSetup()) {
     return false;
   }
 
+//--------------------------------------------------
+  // For POSIX, we have to be extremely anal about *not* using
+  // std::wstring in code compiled with Mozilla's -fshort-wchar
+  // configuration, because chromium is compiled with -fno-short-wchar
+  // and passing wstrings from one config to the other is unsafe.  So
+  // we split the logic here.
+
+#    if defined(MOZ_WIDGET_GTK)
+  if (mProcessType == GeckoProcessType_Content) {
+    // disable IM module to avoid sandbox violation
+    mLaunchOptions->env_map["GTK_IM_MODULE"] = "gtk-im-context-simple";
+
+    // Disable ATK accessibility code in content processes because it conflicts
+    // with the sandbox, and we proxy that information through the main process
+    // anyway.
+    mLaunchOptions->env_map["NO_AT_BRIDGE"] = "1";
+  }
+#    endif  // defined(MOZ_WIDGET_GTK)
+
   // XPCOM may not be initialized in some subprocesses.  We don't want
   // to initialize XPCOM just for the directory service, especially
   // since LD_LIBRARY_PATH is already set correctly in subprocesses
@@ -1129,7 +1148,7 @@ bool PosixProcessLauncher::DoSetup() {
     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());
 
@@ -1221,7 +1240,7 @@ bool PosixProcessLauncher::DoSetup() {
   mChildArgv.push_back(mPidString);
 
   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 (NS_WARN_IF(!CrashReporter::CreateNotificationPipeForChild(
             &childCrashFd, &childCrashRemapFd))) {
index 4a45905431fe509a7434f480c93f4d0c2436c6e6..67d18a9ebb738586c42003903ac922e8b4f752ae 100644 (file)
@@ -111,7 +111,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])