Skip to content

Commit 7161c47

Browse files
committed
Add macOS arm64 build to CI, fix bmalloc stubs for cross-platform
Add bmalloc/Gigacage stubs with proper types so the tool links on both Linux and macOS without the full bmalloc library. CI now builds on both ubuntu-24.04 (x64) and macos-14 (arm64).
1 parent f226fad commit 7161c47

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

.github/workflows/validate-dnr-rules.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,26 @@ jobs:
1919
include:
2020
- os: ubuntu-24.04
2121
name: linux-x64
22+
deps: cmake ninja-build pkg-config ruby unifdef libicu-dev g++ perl python3
23+
- os: macos-14
24+
name: macos-arm64
25+
deps: cmake ninja icu4c pkg-config
2226
runs-on: ${{ matrix.os }}
2327

2428
steps:
2529
- uses: actions/checkout@v4
2630
with:
2731
fetch-depth: 1
2832

29-
- name: Install dependencies
33+
- name: Install dependencies (Linux)
34+
if: runner.os == 'Linux'
3035
run: |
3136
sudo apt-get update
32-
sudo apt-get install -y --no-install-recommends \
33-
cmake ninja-build pkg-config ruby unifdef libicu-dev g++ perl python3
37+
sudo apt-get install -y --no-install-recommends ${{ matrix.deps }}
38+
39+
- name: Install dependencies (macOS)
40+
if: runner.os == 'macOS'
41+
run: brew install ${{ matrix.deps }}
3442

3543
- name: Cache CMake build
3644
uses: actions/cache@v4
@@ -47,6 +55,8 @@ jobs:
4755
-DPORT=JSCOnly \
4856
-DUSE_SYSTEM_MALLOC=ON \
4957
.
58+
env:
59+
CMAKE_PREFIX_PATH: ${{ runner.os == 'macOS' && '/opt/homebrew/opt/icu4c' || '' }}
5060

5161
- name: Build
5262
run: cmake --build build --target validate-dnr-rules
@@ -67,7 +77,6 @@ jobs:
6777
run: |
6878
file build/bin/validate-dnr-rules
6979
du -h build/bin/validate-dnr-rules
70-
ldd build/bin/validate-dnr-rules || true
7180
7281
- name: Upload artifact
7382
uses: actions/upload-artifact@v4

ghostery/validate-dnr-rules/src/stubs.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,30 @@
33
#include <JavaScriptCore/YarrUnicodeProperties.h>
44
#include <wtf/text/WTFString.h>
55

6-
// Gigacage stub — not needed when using system malloc
6+
// Gigacage/bmalloc stubs — not needed when using system malloc
7+
#include <bmalloc/BPlatform.h>
8+
#include <bmalloc/HeapKind.h>
9+
#include <bmalloc/CompactAllocationMode.h>
10+
711
namespace Gigacage {
812
void ensureGigacage() { }
913
}
1014

15+
extern "C" __attribute__((visibility("default"))) bool disablePrimitiveGigacageRequested = false;
16+
17+
namespace bmalloc::api {
18+
void commitAlignedPhysical(void*, size_t, HeapKind) { }
19+
void decommitAlignedPhysical(void*, size_t, HeapKind) { }
20+
void disableScavenger() { }
21+
void enableMiniMode(bool) { }
22+
void forceEnablePGM(unsigned short) { }
23+
void freeLargeVirtual(void*, size_t, HeapKind) { }
24+
bool isEnabled(HeapKind) { return false; }
25+
void scavenge() { }
26+
void scavengeThisThread() { }
27+
void* tryLargeZeroedMemalignVirtual(size_t, size_t, CompactAllocationMode, HeapKind) { return nullptr; }
28+
}
29+
1130
// YARR Unicode property stubs — only needed for \p{} property
1231
// escapes which DNR regexFilter patterns never use.
1332
namespace JSC::Yarr {

0 commit comments

Comments
 (0)