From 72a3108e1e204fd63ba486ef59eccd44219a7a56 Mon Sep 17 00:00:00 2001 From: Noemi Erli Date: Tue, 1 Aug 2023 15:09:51 +0300 Subject: [PATCH] Backed out changeset a2017655dd34 (bug 1844484) for causing failures in test_crash_purevirtual.js --- build/pure_virtual/moz.build | 17 ------------ build/pure_virtual/pure_virtual.c | 27 ------------------- mfbt/moz.build | 5 ---- python/mozbuild/mozbuild/frontend/emitter.py | 2 -- .../test/unit/test_crash_purevirtual.js | 8 ++++++ 5 files changed, 8 insertions(+), 51 deletions(-) delete mode 100644 build/pure_virtual/moz.build delete mode 100644 build/pure_virtual/pure_virtual.c diff --git a/build/pure_virtual/moz.build b/build/pure_virtual/moz.build deleted file mode 100644 index c49cb8fe80cb..000000000000 --- a/build/pure_virtual/moz.build +++ /dev/null @@ -1,17 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -Library("pure_virtual") - -SOURCES += ["pure_virtual.c"] - -FORCE_STATIC_LIB = True - -USE_STATIC_LIBS = True - -# Build a real library so that the linker can remove it if the symbol -# is never used. -NO_EXPAND_LIBS = True diff --git a/build/pure_virtual/pure_virtual.c b/build/pure_virtual/pure_virtual.c deleted file mode 100644 index 23b18f2aae7d..000000000000 --- a/build/pure_virtual/pure_virtual.c +++ /dev/null @@ -1,27 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include - -// This function is used in vtables to point at pure virtual methods. -// The implementation in the standard library usually aborts, but -// the function is normally never called (a call would be a bug). -// Each of these entries in vtables, however, require an unnecessary -// dynamic relocation. Defining our own function makes the linker -// point the vtables here instead of the standard library, replacing -// the dynamic relocations with relative relocations. -// -// On Windows, it doesn't really make a difference, but on macOS it -// can be packed better, saving about 10KB in libxul, and on 64-bits -// ELF systems, with packed relative relocations, it saves 140KB. -// -// Another advantage of having our own is that we can use MOZ_CRASH -// instead of the system's abort. -#ifdef _MSC_VER -int __cdecl _purecall() { MOZ_CRASH("pure virtual call"); } -#else -__attribute__((visibility("hidden"))) void __cxa_pure_virtual() { - MOZ_CRASH("pure virtual call"); -} -#endif diff --git a/mfbt/moz.build b/mfbt/moz.build index 5f8c0925a545..4cdcfcd0fc3d 100644 --- a/mfbt/moz.build +++ b/mfbt/moz.build @@ -205,8 +205,3 @@ if CONFIG["MOZ_NEEDS_LIBATOMIC"]: OS_LIBS += ["atomic"] DEFINES["LZ4LIB_VISIBILITY"] = "" - -# This is kind of gross because this is not a subdirectory, -# but pure_virtual requires mfbt to build and some projects -# don't use mfbt. -DIRS += ["../build/pure_virtual"] diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index f4100772418e..360205f8ec97 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -388,8 +388,6 @@ class TreeMetadataEmitter(LoggingMixin): context, obj, variable, self.STDCXXCOMPAT_NAME[obj.KIND] ) if obj.KIND == "target": - if "pure_virtual" in self._libs: - self._link_library(context, obj, variable, "pure_virtual") for lib in context.config.substs.get("STLPORT_LIBS", []): obj.link_system_library(lib) diff --git a/toolkit/crashreporter/test/unit/test_crash_purevirtual.js b/toolkit/crashreporter/test/unit/test_crash_purevirtual.js index cc81c008df09..e482eaa41586 100644 --- a/toolkit/crashreporter/test/unit/test_crash_purevirtual.js +++ b/toolkit/crashreporter/test/unit/test_crash_purevirtual.js @@ -6,6 +6,14 @@ add_task(async function run_test() { return; } + var isOSX = "nsILocalFileMac" in Ci; + if (isOSX) { + dump( + "INFO | test_crash_purevirtual.js | TODO: purecalls not caught on OS X\n" + ); + return; + } + // Try crashing with a pure virtual call await do_crash( function () {