[webkit-changes] [WebKit/WebKit] c885de: [bmalloc] Prepare for InstallAPI by fixing headers...
Elliott Williams
noreply at github.com
Wed Apr 12 11:24:56 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c885def8396f6ffe1bd6cad5329cd22b62db2941
https://github.com/WebKit/WebKit/commit/c885def8396f6ffe1bd6cad5329cd22b62db2941
Author: Elliott Williams <emw at apple.com>
Date: 2023-04-12 (Wed, 12 Apr 2023)
Changed paths:
M Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
A Source/bmalloc/Configurations/libpas.xcconfig
M Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
M Source/bmalloc/bmalloc/CryptoRandom.cpp
M Source/bmalloc/bmalloc/Gigacage.cpp
M Source/bmalloc/bmalloc/StaticPerProcess.h
M Source/bmalloc/libpas/src/libpas/pas_debug_heap.h
M Source/bmalloc/libpas/src/libpas/pas_enumerate_initially_unaccounted_pages.h
M Source/bmalloc/libpas/src/libpas/pas_enumerate_unaccounted_pages_as_meta.h
M Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/lldb/lldbWebKitTester/lldbWebKitTester.xcodeproj/project.pbxproj
Log Message:
-----------
[bmalloc] Prepare for InstallAPI by fixing headers and hiding libpas declarations
https://bugs.webkit.org/show_bug.cgi?id=254612
Reviewed by Alexey Proskuryakov.
As part of the larger project of JavaScriptCore InstallAPI on Apple
platforms, make non-functional changes that clean up symbol visibility
inconsistencies in bmalloc headers, so that declared visibility matches
actual visibility.
To make this task simpler, start by refactoring libpas's symbols to be
hidden above JavaScriptCore:
1. The (C++) memory API used above JavaScriptCore is pure bmalloc, so in
WebCore and WebKit, it is reasonable to treat libpas as a bmalloc
implementation detail. Refactor bmalloc.xcodeproj to build libpas as
a separate library target to separate its executable content from
bmalloc.
2. JavaScriptCore needs to call into libpas, but the symbols can be
hidden from its clients. Link against libpas.a using -hidden-lpas,
which hides all its symbols.
3. Including bmalloc headers transitively includes libpas. To prevent
JavaScriptCore's upcoming InstallAPI step from seeing
externally-visible libpas declarations, JavaScriptCore compiles with
a -DPAS_BMALLOC_HIDDEN flag which changes the PAS_API directive to
hide declarations.
With libpas hidden, fix up a few visibility issues in bmalloc.
* Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig: Link
against libpas.a and compile with -DPAS_BMALLOC_HIDDEN, as described
above.
* Source/bmalloc/Configurations/libpas.xcconfig: Added.
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj:
- Create new libpas.a static library target. Move libpas sources over
to this target (lots of PBXBuildFile churn).
- Mark header visibility "project-only" for some headers that do not
expose API. For the most part, these are headers which are only
included by c/cpp files. They are no longer installed to
/usr/local/include/bmalloc, and will not be processed by TAPI.
* Source/bmalloc/bmalloc/CryptoRandom.cpp: The ARC4RandomNumberGenerator
storage is intentionally hidden. Use
DECLARE_STATIC_PER_PROCESS_STORAGE_WITH_LINKAGE to mark it BNOEXPORT.
* Source/bmalloc/bmalloc/Gigacage.cpp: The PrimitiveDisableCallbacks
storage is intentionally hidden. Use
DECLARE_STATIC_PER_PROCESS_STORAGE_WITH_LINKAGE to mark it BNOEXPORT.
* Source/bmalloc/bmalloc/StaticPerProcess.h: Add
DECLARE_STATIC_PER_PROCESS_STORAGE_WITH_LINKAGE, to support declaring
storage without forcing it to be BEXPORT.
* Source/bmalloc/libpas/src/libpas/pas_debug_heap.h: For the symbols
that are implemented in bmalloc, use BEXPORT instead of PAS_API.
* Source/bmalloc/libpas/src/libpas/pas_enumerate_initially_unaccounted_pages.h:
Add a missing PAS_END_EXTERN_C.
* Source/bmalloc/libpas/src/libpas/pas_enumerate_unaccounted_pages_as_meta.h:
Add a missing PAS_END_EXTERN_C.
* Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h: Recognize a new
PAS_BMALLOC_HIDDEN flag, which hides PAS_API symbols while still
building like PAS_BMALLOC.
Canonical link: https://commits.webkit.org/262876@main
More information about the webkit-changes
mailing list