Bug 1775616 - update the disable conditions to include the platforms that test browse...
[gecko.git] / build / pure_virtual / pure_virtual.c
blob23b18f2aae7d81a4f95a2a39d96db1302d003433
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include <mozilla/Assertions.h>
7 // This function is used in vtables to point at pure virtual methods.
8 // The implementation in the standard library usually aborts, but
9 // the function is normally never called (a call would be a bug).
10 // Each of these entries in vtables, however, require an unnecessary
11 // dynamic relocation. Defining our own function makes the linker
12 // point the vtables here instead of the standard library, replacing
13 // the dynamic relocations with relative relocations.
15 // On Windows, it doesn't really make a difference, but on macOS it
16 // can be packed better, saving about 10KB in libxul, and on 64-bits
17 // ELF systems, with packed relative relocations, it saves 140KB.
19 // Another advantage of having our own is that we can use MOZ_CRASH
20 // instead of the system's abort.
21 #ifdef _MSC_VER
22 int __cdecl _purecall() { MOZ_CRASH("pure virtual call"); }
23 #else
24 __attribute__((visibility("hidden"))) void __cxa_pure_virtual() {
25 MOZ_CRASH("pure virtual call");
27 #endif