From 83846b3861de3a3bb5a4b3f11863b10507615ffe Mon Sep 17 00:00:00 2001 From: ayeteadoe Date: Sat, 28 Jun 2025 01:34:31 -0700 Subject: [PATCH] LibGC: Enable EXPLICIT_SYMBOL_EXPORT --- Libraries/LibGC/BlockAllocator.h | 2 +- Libraries/LibGC/CMakeLists.txt | 2 +- Libraries/LibGC/Cell.h | 4 ++-- Libraries/LibGC/CellAllocator.h | 4 ++-- Libraries/LibGC/ConservativeVector.h | 4 ++-- Libraries/LibGC/DeferGC.h | 2 +- Libraries/LibGC/ForeignCell.h | 2 +- Libraries/LibGC/Forward.h | 1 + Libraries/LibGC/Heap.h | 2 +- Libraries/LibGC/HeapBlock.h | 2 +- Libraries/LibGC/HeapRoot.h | 2 +- Libraries/LibGC/Internals.h | 6 +++--- Libraries/LibGC/NanBoxedValue.h | 2 +- Libraries/LibGC/Root.h | 2 +- Libraries/LibGC/RootHashMap.h | 2 +- Libraries/LibGC/RootVector.h | 2 +- Libraries/LibGC/WeakContainer.h | 2 +- Libraries/LibJS/CMakeLists.txt | 3 --- 18 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Libraries/LibGC/BlockAllocator.h b/Libraries/LibGC/BlockAllocator.h index e3a5dfa28f..7213bd4fdb 100644 --- a/Libraries/LibGC/BlockAllocator.h +++ b/Libraries/LibGC/BlockAllocator.h @@ -11,7 +11,7 @@ namespace GC { -class BlockAllocator { +class GC_API BlockAllocator { public: BlockAllocator() = default; ~BlockAllocator(); diff --git a/Libraries/LibGC/CMakeLists.txt b/Libraries/LibGC/CMakeLists.txt index eca1f64f1f..37cb5d2c00 100644 --- a/Libraries/LibGC/CMakeLists.txt +++ b/Libraries/LibGC/CMakeLists.txt @@ -12,7 +12,7 @@ set(SOURCES WeakContainer.cpp ) -serenity_lib(LibGC gc) +serenity_lib(LibGC gc EXPLICIT_SYMBOL_EXPORT) target_link_libraries(LibGC PRIVATE LibCore) if (ENABLE_SWIFT) diff --git a/Libraries/LibGC/Cell.h b/Libraries/LibGC/Cell.h index 5c5260715d..8869a21612 100644 --- a/Libraries/LibGC/Cell.h +++ b/Libraries/LibGC/Cell.h @@ -37,7 +37,7 @@ public: \ } \ friend class GC::Heap; -class Cell { +class GC_API Cell { AK_MAKE_NONCOPYABLE(Cell); AK_MAKE_NONMOVABLE(Cell); @@ -57,7 +57,7 @@ public: virtual StringView class_name() const = 0; - class Visitor { + class GC_API Visitor { public: void visit(Cell* cell) { diff --git a/Libraries/LibGC/CellAllocator.h b/Libraries/LibGC/CellAllocator.h index 8a73436901..8ad514c311 100644 --- a/Libraries/LibGC/CellAllocator.h +++ b/Libraries/LibGC/CellAllocator.h @@ -21,7 +21,7 @@ namespace GC { -class CellAllocator { +class GC_API CellAllocator { public: CellAllocator(size_t cell_size, char const* class_name = nullptr); ~CellAllocator() = default; @@ -68,7 +68,7 @@ private: }; template -class TypeIsolatingCellAllocator { +class GC_API TypeIsolatingCellAllocator { public: using CellType = T; diff --git a/Libraries/LibGC/ConservativeVector.h b/Libraries/LibGC/ConservativeVector.h index 64051357de..08a63f2316 100644 --- a/Libraries/LibGC/ConservativeVector.h +++ b/Libraries/LibGC/ConservativeVector.h @@ -14,7 +14,7 @@ namespace GC { -class ConservativeVectorBase { +class GC_API ConservativeVectorBase { public: virtual ReadonlySpan possible_values() const = 0; @@ -32,7 +32,7 @@ public: }; template -class ConservativeVector final +class GC_API ConservativeVector final : public ConservativeVectorBase , public Vector { diff --git a/Libraries/LibGC/DeferGC.h b/Libraries/LibGC/DeferGC.h index 39ae6fc031..3d4b5999cb 100644 --- a/Libraries/LibGC/DeferGC.h +++ b/Libraries/LibGC/DeferGC.h @@ -11,7 +11,7 @@ namespace GC { -class DeferGC { +class GC_API DeferGC { public: explicit DeferGC(Heap& heap) : m_heap(heap) diff --git a/Libraries/LibGC/ForeignCell.h b/Libraries/LibGC/ForeignCell.h index 2e0adb858d..dcb215a054 100644 --- a/Libraries/LibGC/ForeignCell.h +++ b/Libraries/LibGC/ForeignCell.h @@ -24,7 +24,7 @@ struct ForeignPtr; using Base = base_class; \ friend class GC::Heap; -class ForeignCell : public Cell { +class GC_API ForeignCell : public Cell { FOREIGN_CELL(ForeignCell, Cell); public: diff --git a/Libraries/LibGC/Forward.h b/Libraries/LibGC/Forward.h index 265d5d5a81..b531242a68 100644 --- a/Libraries/LibGC/Forward.h +++ b/Libraries/LibGC/Forward.h @@ -7,6 +7,7 @@ #pragma once #include +#include namespace GC { diff --git a/Libraries/LibGC/Heap.h b/Libraries/LibGC/Heap.h index 315cc66ad4..cca850c7f2 100644 --- a/Libraries/LibGC/Heap.h +++ b/Libraries/LibGC/Heap.h @@ -30,7 +30,7 @@ namespace GC { -class Heap : public HeapBase { +class GC_API Heap : public HeapBase { AK_MAKE_NONCOPYABLE(Heap); AK_MAKE_NONMOVABLE(Heap); diff --git a/Libraries/LibGC/HeapBlock.h b/Libraries/LibGC/HeapBlock.h index 17afadeb73..c4b0ee283c 100644 --- a/Libraries/LibGC/HeapBlock.h +++ b/Libraries/LibGC/HeapBlock.h @@ -20,7 +20,7 @@ namespace GC { -class HeapBlock : public HeapBlockBase { +class GC_API HeapBlock : public HeapBlockBase { AK_MAKE_NONCOPYABLE(HeapBlock); AK_MAKE_NONMOVABLE(HeapBlock); diff --git a/Libraries/LibGC/HeapRoot.h b/Libraries/LibGC/HeapRoot.h index 939f3863d9..99344f5ce9 100644 --- a/Libraries/LibGC/HeapRoot.h +++ b/Libraries/LibGC/HeapRoot.h @@ -10,7 +10,7 @@ namespace GC { -struct HeapRoot { +struct GC_API HeapRoot { enum class Type { HeapFunctionCapturedPointer, Root, diff --git a/Libraries/LibGC/Internals.h b/Libraries/LibGC/Internals.h index a6327491a6..00656e65f1 100644 --- a/Libraries/LibGC/Internals.h +++ b/Libraries/LibGC/Internals.h @@ -13,7 +13,7 @@ namespace GC { -class HeapBase { +class GC_API HeapBase { AK_MAKE_NONCOPYABLE(HeapBase); AK_MAKE_NONMOVABLE(HeapBase); @@ -29,12 +29,12 @@ protected: void* m_private_data; }; -class HeapBlockBase { +class GC_API HeapBlockBase { AK_MAKE_NONMOVABLE(HeapBlockBase); AK_MAKE_NONCOPYABLE(HeapBlockBase); public: - GC_API static size_t block_size; + static size_t block_size; static HeapBlockBase* from_cell(Cell const* cell) { return reinterpret_cast(bit_cast(cell) & ~(HeapBlockBase::block_size - 1)); diff --git a/Libraries/LibGC/NanBoxedValue.h b/Libraries/LibGC/NanBoxedValue.h index 989a87efbd..261364d441 100644 --- a/Libraries/LibGC/NanBoxedValue.h +++ b/Libraries/LibGC/NanBoxedValue.h @@ -55,7 +55,7 @@ static constexpr u64 TAG_SHIFT = 48; static constexpr u64 TAG_EXTRACTION = 0xFFFF000000000000; static constexpr u64 SHIFTED_IS_CELL_PATTERN = IS_CELL_PATTERN << TAG_SHIFT; -class NanBoxedValue { +class GC_API NanBoxedValue { public: bool is_cell() const { return (m_value.tag & IS_CELL_PATTERN) == IS_CELL_PATTERN; } diff --git a/Libraries/LibGC/Root.h b/Libraries/LibGC/Root.h index 080ed5e9ee..0841b9aac4 100644 --- a/Libraries/LibGC/Root.h +++ b/Libraries/LibGC/Root.h @@ -17,7 +17,7 @@ namespace GC { -class RootImpl : public RefCounted { +class GC_API RootImpl : public RefCounted { AK_MAKE_NONCOPYABLE(RootImpl); AK_MAKE_NONMOVABLE(RootImpl); diff --git a/Libraries/LibGC/RootHashMap.h b/Libraries/LibGC/RootHashMap.h index 371611f71c..6b0d9e4c44 100644 --- a/Libraries/LibGC/RootHashMap.h +++ b/Libraries/LibGC/RootHashMap.h @@ -15,7 +15,7 @@ namespace GC { -class RootHashMapBase { +class GC_API RootHashMapBase { public: virtual void gather_roots(HashMap&) const = 0; diff --git a/Libraries/LibGC/RootVector.h b/Libraries/LibGC/RootVector.h index 969ce1e7fe..b9705fe75f 100644 --- a/Libraries/LibGC/RootVector.h +++ b/Libraries/LibGC/RootVector.h @@ -16,7 +16,7 @@ namespace GC { -class RootVectorBase { +class GC_API RootVectorBase { public: virtual void gather_roots(HashMap&) const = 0; diff --git a/Libraries/LibGC/WeakContainer.h b/Libraries/LibGC/WeakContainer.h index e2b47d50ec..d61df42b63 100644 --- a/Libraries/LibGC/WeakContainer.h +++ b/Libraries/LibGC/WeakContainer.h @@ -11,7 +11,7 @@ namespace GC { -class WeakContainer { +class GC_API WeakContainer { public: explicit WeakContainer(Heap&); virtual ~WeakContainer(); diff --git a/Libraries/LibJS/CMakeLists.txt b/Libraries/LibJS/CMakeLists.txt index 1477816b91..b64a030502 100644 --- a/Libraries/LibJS/CMakeLists.txt +++ b/Libraries/LibJS/CMakeLists.txt @@ -281,9 +281,6 @@ endif() if (WIN32) # FIXME: Windows on ARM target_link_libraries(LibJS PRIVATE clang_rt.builtins-x86_64.lib) - # FIXME: This is a hack to get around lld-link error undefined symbol GC::HeapBlockBase::block_size - # LibGC HeapBlock.obj is given directly to LibJS linker - target_link_libraries(LibJS PRIVATE $,INCLUDE,HeapBlock>) else() # This flag has no effect on Windows target_compile_options(LibJS PRIVATE -fno-omit-frame-pointer)