Skip to content

Commit

Permalink
Bug 1755409 - aarch64 Darwin fails to build with --disable-sandbox r=…
Browse files Browse the repository at this point in the history
…spohl

Make GetAppPath() defined on Mac aarch64 builds even without MOZ_SANDBOX because aarch64 builds may use it for Rosetta pre-translation.

Differential Revision: https://phabricator.services.mozilla.com/D138751
  • Loading branch information
hafta committed Feb 15, 2022
1 parent 10f8925 commit ab2a33e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions xpcom/base/nsMacUtilsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NS_IMPL_ISUPPORTS(nsMacUtilsImpl, nsIMacUtils)
using mozilla::StaticMutexAutoLock;
using mozilla::Unused;

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
StaticAutoPtr<nsCString> nsMacUtilsImpl::sCachedAppPath;
StaticMutex nsMacUtilsImpl::sCachedAppPathMutex;
#endif
Expand Down Expand Up @@ -139,7 +139,7 @@ nsMacUtilsImpl::GetIsTranslated(bool* aIsTranslated) {
return NS_OK;
}

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
// Get the path to the .app directory (aka bundle) for the parent process.
// When executing in the child process, this is the outer .app (such as
// Firefox.app) and not the inner .app containing the child process
Expand Down Expand Up @@ -217,8 +217,9 @@ nsresult nsMacUtilsImpl::ClearCachedAppPathOnShutdown() {
ClearOnShutdown(&sCachedAppPath);
return NS_OK;
}
#endif /* MOZ_SANDBOX || __aarch64__ */

# if defined(DEBUG)
#if defined(MOZ_SANDBOX) && defined(DEBUG)
// If XPCOM_MEM_BLOAT_LOG or XPCOM_MEM_LEAK_LOG is set to a log file
// path, return the path to the parent directory (where sibling log
// files will be saved.)
Expand Down Expand Up @@ -255,8 +256,7 @@ nsresult nsMacUtilsImpl::GetDirectoryPath(const char* aPath,
}
return NS_OK;
}
# endif /* DEBUG */
#endif /* MOZ_SANDBOX */
#endif /* MOZ_SANDBOX && DEBUG */

/* static */
bool nsMacUtilsImpl::IsTCSMAvailable() {
Expand Down
11 changes: 6 additions & 5 deletions xpcom/base/nsMacUtilsImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class nsMacUtilsImpl final : public nsIMacUtils {
static nsresult GetRepoDir(nsIFile** aRepoDir);
static nsresult GetObjDir(nsIFile** aObjDir);

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
static bool GetAppPath(nsCString& aAppPath);
# ifdef DEBUG
#endif /* MOZ_SANDBOX || __aarch64__ */

#if defined(MOZ_SANDBOX) && defined(DEBUG)
static nsresult GetBloatLogDir(nsCString& aDirectoryPath);
static nsresult GetDirectoryPath(const char* aPath,
nsCString& aDirectoryPath);
# endif /* DEBUG */
#endif /* MOZ_SANDBOX */
#endif /* MOZ_SANDBOX && DEBUG */

static void EnableTCSMIfAvailable();
static bool IsTCSMAvailable();
Expand All @@ -65,7 +66,7 @@ class nsMacUtilsImpl final : public nsIMacUtils {
// in our binary.
nsString mBinaryArchs;

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
// Cache the appDir returned from GetAppPath to avoid doing I/O
static StaticAutoPtr<nsCString> sCachedAppPath;
// For thread safe setting/checking of sCachedAppPath
Expand Down

0 comments on commit ab2a33e

Please sign in to comment.