Fix native binary patching on Linux (#730)

Co-authored-by: bl-ue <[email protected]>
This commit is contained in:
signadou
2026-05-10 10:30:14 -06:00
committed by GitHub
co-authored by bl-ue
parent 2412be9383
commit ece3eaedf4
9 changed files with 136 additions and 7706 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.13.1
version: 11.0.9
- name: Setup Node.js
uses: actions/setup-node@v5
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.13.1
version: 11.0.9
- name: Setup Node.js
uses: actions/setup-node@v5
+2
View File
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
- Fix native binary patching on Linux (#730) - @signadou
## [v4.0.12](https://github.com/Piebald-AI/tweakcc/releases/tag/v4.0.12) - 2026-05-07
- Add voice mode patch (tengu_amber_quartz + tengu_sotto_voce) (#587) - @TyceHerrman
+1 -1
View File
@@ -7,7 +7,7 @@ Thank you for your interest in contributing to tweakcc! This document provides g
### Prerequisites
- **Node.js**: 24.x (20.0.0 or higher required)
- **pnpm**: 10.13.1 or higher
- **pnpm**: 11.0.9 or higher
```bash
pnpm install
-7405
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -80,7 +80,7 @@
"gray-matter": "^4.0.3",
"ink": "^6.1.0",
"ink-link": "^4.1.0",
"node-lief": "^1.1.1",
"node-lief": "^1.3.0",
"oxfmt": "^0.28.0",
"react": "^19.1.1",
"wasmagic": "^1.0.7",
+68 -209
View File
@@ -28,13 +28,13 @@ importers:
version: 4.0.3
ink:
specifier: ^6.1.0
version: 6.1.0(@types/[email protected])(react[email protected])(react@19.1.1)
version: 6.1.0(@types/[email protected])([email protected])
ink-link:
specifier: ^4.1.0
version: 4.1.0([email protected](@types/[email protected])(react[email protected])(react@19.1.1))
version: 4.1.0([email protected](@types/[email protected])([email protected]))
node-lief:
specifier: ^1.1.1
version: 1.1.1
specifier: ^1.3.0
version: 1.3.0
oxfmt:
specifier: ^0.28.0
version: 0.28.0
@@ -80,7 +80,7 @@ importers:
version: 3.6.2
tsdown:
specifier: ^0.18.4
version: 0.18.4([email protected])
version: 0.18.4(@emnapi/[email protected])(@emnapi/[email protected])([email protected])
tsx:
specifier: ^4.20.3
version: 4.20.3
@@ -92,7 +92,7 @@ importers:
version: 8.39.0([email protected])([email protected])
vitest:
specifier: ^3.2.4
version: 3.2.4(@types/[email protected])([email protected])([email protected])([email protected])
version: 3.2.4(@types/[email protected])([email protected])([email protected])
packages:
@@ -121,14 +121,14 @@ packages:
resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==}
engines: {node: '>=6.9.0'}
'@emnapi/core@1.7.1':
resolution: {integrity: sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==}
'@emnapi/core@1.10.0':
resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==}
'@emnapi/runtime@1.7.1':
resolution: {integrity: sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==}
'@emnapi/runtime@1.10.0':
resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==}
'@emnapi/wasi-threads@1.1.0':
resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==}
'@emnapi/wasi-threads@1.2.1':
resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==}
'@esbuild/[email protected]':
resolution: {integrity: sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA==}
@@ -357,8 +357,11 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@napi-rs/[email protected].1':
resolution: {integrity: sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==}
'@napi-rs/[email protected].4':
resolution: {integrity: sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow==}
peerDependencies:
'@emnapi/core': ^1.7.1
'@emnapi/runtime': ^1.7.1
'@nodelib/[email protected]':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
@@ -621,8 +624,8 @@ packages:
resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==}
engines: {node: '>=18'}
'@tybys/[email protected].1':
resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==}
'@tybys/[email protected].2':
resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==}
'@types/[email protected]':
resolution: {integrity: sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==}
@@ -978,10 +981,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
[email protected]:
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==}
engines: {node: '>=0.3.1'}
@@ -1516,74 +1515,6 @@ packages:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
[email protected]:
resolution: {integrity: sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [darwin]
[email protected]:
resolution: {integrity: sha512-k1EvjakfumAQoTfcXUcHQZhSpLlkAuEkdMBsI/ivWw9hL+7FtilQc0Cy3hrx0AAQrVtQAbMI7YjCgYgvn37PzA==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [darwin]
[email protected]:
resolution: {integrity: sha512-kmW6UGCGg2PcyUE59K5r0kWfKPAVy4SltVeut+umLCFoJ53RdCUWxcRDzO1eTaxf/7Q2H7LTquFHPL5R+Gjyig==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [freebsd]
[email protected]:
resolution: {integrity: sha512-MjxUShl1v8pit+6D/zSPq9S9dQ2NPFSQwGvxBCYaBYLPlCWuPh9/t1MRS8iUaR8i+a6w7aps+B4N0S1TYP/R+Q==}
engines: {node: '>= 12.0.0'}
cpu: [arm]
os: [linux]
[email protected]:
resolution: {integrity: sha512-gB72maP8rmrKsnKYy8XUuXi/4OctJiuQjcuqWNlJQ6jZiWqtPvqFziskH3hnajfvKB27ynbVCucKSm2rkQp4Bw==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
libc: [glibc]
[email protected]:
resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
libc: [musl]
[email protected]:
resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
libc: [glibc]
[email protected]:
resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
libc: [musl]
[email protected]:
resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [win32]
[email protected]:
resolution: {integrity: sha512-PVqXh48wh4T53F/1CCu8PIPCxLzWyCnn/9T5W1Jpmdy5h9Cwd+0YQS6/LwhHXSafuc61/xg9Lv5OrCby6a++jg==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [win32]
[email protected]:
resolution: {integrity: sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg==}
engines: {node: '>= 12.0.0'}
[email protected]:
resolution: {integrity: sha512-lDIj4RnYmK7/kXMya+qJsmkRFkGolciXjrsZ6PC25GdTfWOAWetR0ZbsNXRAj1EHHImRSalc+whZFg56F5DVow==}
engines: {node: '>=20.17'}
@@ -1664,8 +1595,8 @@ packages:
resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==}
hasBin: true
node-lief@1.1.1:
resolution: {integrity: sha512-tD/MLRu8fnVEzcXmJpiy1Ge3u14yBmYHXGAQGbmrG8MvVk+eXhp42yDMAjP8aqn6MnD91GWD6x8R1WyHNd5TwA==}
node-lief@1.3.0:
resolution: {integrity: sha512-HlZw0jG/kDaPngass2QA79iW5QmSKZuSdKfrI35MiwV0GDDiB+qghhkuOhub/dW2QxFqMZw3OBulI32JqHn0Wg==}
[email protected]:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
@@ -1803,9 +1734,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
[email protected]:
resolution: {integrity: sha512-2wJiGffPWK0KggBjVwnTaAk+Z3MSxKInHmdzPTrBh1mAarexsa93Kw+WMX88+XjN+TtYgAiLe9xeTqcO5FfJTw==}
[email protected]:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
@@ -1941,10 +1869,6 @@ packages:
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==}
engines: {node: '>= 0.4'}
[email protected]:
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
engines: {node: '>= 0.4'}
@@ -2334,18 +2258,6 @@ packages:
resolution: {integrity: sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==}
engines: {node: '>=18'}
[email protected]:
resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==}
engines: {node: '>=8.3.0'}
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ^5.0.2
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
[email protected]:
resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==}
engines: {node: '>=10.0.0'}
@@ -2398,18 +2310,18 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5
'@emnapi/core@1.7.1':
'@emnapi/core@1.10.0':
dependencies:
'@emnapi/wasi-threads': 1.1.0
'@emnapi/wasi-threads': 1.2.1
tslib: 2.8.1
optional: true
'@emnapi/runtime@1.7.1':
'@emnapi/runtime@1.10.0':
dependencies:
tslib: 2.8.1
optional: true
'@emnapi/wasi-threads@1.1.0':
'@emnapi/wasi-threads@1.2.1':
dependencies:
tslib: 2.8.1
optional: true
@@ -2563,11 +2475,11 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.4
'@napi-rs/[email protected].1':
'@napi-rs/[email protected].4(@emnapi/[email protected])(@emnapi/[email protected])':
dependencies:
'@emnapi/core': 1.7.1
'@emnapi/runtime': 1.7.1
'@tybys/wasm-util': 0.10.1
'@emnapi/core': 1.10.0
'@emnapi/runtime': 1.10.0
'@tybys/wasm-util': 0.10.2
optional: true
'@nodelib/[email protected]':
@@ -2642,9 +2554,12 @@ snapshots:
'@rolldown/[email protected]':
optional: true
'@rolldown/[email protected]':
'@rolldown/[email protected](@emnapi/[email protected])(@emnapi/[email protected])':
dependencies:
'@napi-rs/wasm-runtime': 1.1.1
'@napi-rs/wasm-runtime': 1.1.4(@emnapi/[email protected])(@emnapi/[email protected])
transitivePeerDependencies:
- '@emnapi/core'
- '@emnapi/runtime'
optional: true
'@rolldown/[email protected]':
@@ -2717,7 +2632,7 @@ snapshots:
'@sindresorhus/[email protected]': {}
'@tybys/[email protected].1':
'@tybys/[email protected].2':
dependencies:
tslib: 2.8.1
optional: true
@@ -2846,13 +2761,13 @@ snapshots:
chai: 5.2.1
tinyrainbow: 2.0.0
'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':
'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected]))':
dependencies:
'@vitest/spy': 3.2.4
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
vite: 7.0.6(@types/[email protected])([email protected])([email protected])([email protected])
vite: 7.0.6(@types/[email protected])([email protected])([email protected])
'@vitest/[email protected]':
dependencies:
@@ -3134,9 +3049,6 @@ snapshots:
[email protected]: {}
[email protected]:
optional: true
[email protected]: {}
[email protected]:
@@ -3576,13 +3488,13 @@ snapshots:
[email protected]: {}
[email protected]([email protected](@types/[email protected])(react[email protected])(react@19.1.1)):
[email protected]([email protected](@types/[email protected])([email protected])):
dependencies:
ink: 6.1.0(@types/[email protected])(react[email protected])(react@19.1.1)
ink: 6.1.0(@types/[email protected])([email protected])
prop-types: 15.8.1
terminal-link: 3.0.0
[email protected](@types/[email protected])(react[email protected])(react@19.1.1):
[email protected](@types/[email protected])([email protected]):
dependencies:
'@alcalzone/ansi-tokenize': 0.1.3
ansi-escapes: 7.0.0
@@ -3611,7 +3523,6 @@ snapshots:
yoga-layout: 3.2.1
optionalDependencies:
'@types/react': 18.3.23
react-devtools-core: 4.19.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -3793,52 +3704,6 @@ snapshots:
prelude-ls: 1.2.1
type-check: 0.4.0
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
optional: true
[email protected]:
dependencies:
detect-libc: 2.1.2
optionalDependencies:
lightningcss-darwin-arm64: 1.30.1
lightningcss-darwin-x64: 1.30.1
lightningcss-freebsd-x64: 1.30.1
lightningcss-linux-arm-gnueabihf: 1.30.1
lightningcss-linux-arm64-gnu: 1.30.1
lightningcss-linux-arm64-musl: 1.30.1
lightningcss-linux-x64-gnu: 1.30.1
lightningcss-linux-x64-musl: 1.30.1
lightningcss-win32-arm64-msvc: 1.30.1
lightningcss-win32-x64-msvc: 1.30.1
optional: true
[email protected]:
dependencies:
commander: 14.0.2
@@ -3915,7 +3780,7 @@ snapshots:
[email protected]: {}
node-lief@1.1.1:
node-lief@1.3.0:
dependencies:
node-addon-api: 8.5.0
node-gyp-build: 4.8.4
@@ -4052,15 +3917,6 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
shell-quote: 1.8.3
ws: 7.5.10
transitivePeerDependencies:
- bufferutil
- utf-8-validate
optional: true
[email protected]: {}
[email protected]([email protected]):
@@ -4114,7 +3970,7 @@ snapshots:
[email protected]: {}
[email protected]([email protected])([email protected]):
[email protected]([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected]):
dependencies:
'@babel/generator': 7.28.5
'@babel/parser': 7.28.5
@@ -4124,13 +3980,13 @@ snapshots:
dts-resolver: 2.1.3
get-tsconfig: 4.13.0
obug: 2.1.1
rolldown: 1.0.0-beta.57
rolldown: 1.0.0-beta.57(@emnapi/[email protected])(@emnapi/[email protected])
optionalDependencies:
typescript: 5.9.2
transitivePeerDependencies:
- oxc-resolver
[email protected]:
[email protected](@emnapi/[email protected])(@emnapi/[email protected]):
dependencies:
'@oxc-project/types': 0.103.0
'@rolldown/pluginutils': 1.0.0-beta.57
@@ -4145,9 +4001,12 @@ snapshots:
'@rolldown/binding-linux-x64-gnu': 1.0.0-beta.57
'@rolldown/binding-linux-x64-musl': 1.0.0-beta.57
'@rolldown/binding-openharmony-arm64': 1.0.0-beta.57
'@rolldown/binding-wasm32-wasi': 1.0.0-beta.57
'@rolldown/binding-wasm32-wasi': 1.0.0-beta.57(@emnapi/[email protected])(@emnapi/[email protected])
'@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.57
'@rolldown/binding-win32-x64-msvc': 1.0.0-beta.57
transitivePeerDependencies:
- '@emnapi/core'
- '@emnapi/runtime'
[email protected]:
dependencies:
@@ -4243,9 +4102,6 @@ snapshots:
[email protected]: {}
[email protected]:
optional: true
[email protected]:
dependencies:
es-errors: 1.3.0
@@ -4428,7 +4284,7 @@ snapshots:
dependencies:
typescript: 5.9.2
[email protected]([email protected]):
[email protected](@emnapi/[email protected])(@emnapi/[email protected])([email protected]):
dependencies:
ansis: 4.2.0
cac: 6.7.14
@@ -4438,17 +4294,19 @@ snapshots:
import-without-cache: 0.2.5
obug: 2.1.1
picomatch: 4.0.3
rolldown: 1.0.0-beta.57
rolldown-plugin-dts: 0.20.0([email protected])([email protected])
rolldown: 1.0.0-beta.57(@emnapi/[email protected])(@emnapi/[email protected])
rolldown-plugin-dts: 0.20.0([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
semver: 7.7.3
tinyexec: 1.0.2
tinyglobby: 0.2.15
tree-kill: 1.2.2
unconfig-core: 7.4.2
unrun: 0.2.21
unrun: 0.2.21(@emnapi/[email protected])(@emnapi/[email protected])
optionalDependencies:
typescript: 5.9.2
transitivePeerDependencies:
- '@emnapi/core'
- '@emnapi/runtime'
- '@ts-macro/tsc'
- '@typescript/native-preview'
- oxc-resolver
@@ -4535,21 +4393,24 @@ snapshots:
[email protected]: {}
[email protected]:
[email protected](@emnapi/[email protected])(@emnapi/[email protected]):
dependencies:
rolldown: 1.0.0-beta.57
rolldown: 1.0.0-beta.57(@emnapi/[email protected])(@emnapi/[email protected])
transitivePeerDependencies:
- '@emnapi/core'
- '@emnapi/runtime'
[email protected]:
dependencies:
punycode: 2.3.1
[email protected](@types/[email protected])([email protected])([email protected])([email protected]):
[email protected](@types/[email protected])([email protected])([email protected]):
dependencies:
cac: 6.7.14
debug: 4.4.1
es-module-lexer: 1.7.0
pathe: 2.0.3
vite: 7.0.6(@types/[email protected])([email protected])([email protected])([email protected])
vite: 7.0.6(@types/[email protected])([email protected])([email protected])
transitivePeerDependencies:
- '@types/node'
- jiti
@@ -4564,7 +4425,7 @@ snapshots:
- tsx
- yaml
[email protected](@types/[email protected])([email protected])([email protected])([email protected]):
[email protected](@types/[email protected])([email protected])([email protected]):
dependencies:
esbuild: 0.25.8
fdir: 6.4.6([email protected])
@@ -4575,15 +4436,14 @@ snapshots:
optionalDependencies:
'@types/node': 20.19.10
fsevents: 2.3.3
lightningcss: 1.30.1
tsx: 4.20.3
yaml: 2.8.2
[email protected](@types/[email protected])([email protected])([email protected])([email protected]):
[email protected](@types/[email protected])([email protected])([email protected]):
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected])([email protected]))
'@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected]))
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -4601,8 +4461,8 @@ snapshots:
tinyglobby: 0.2.14
tinypool: 1.1.1
tinyrainbow: 2.0.0
vite: 7.0.6(@types/[email protected])([email protected])([email protected])([email protected])
vite-node: 3.2.4(@types/[email protected])([email protected])([email protected])([email protected])
vite: 7.0.6(@types/[email protected])([email protected])([email protected])
vite-node: 3.2.4(@types/[email protected])([email protected])([email protected])
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 20.19.10
@@ -4688,9 +4548,6 @@ snapshots:
string-width: 7.2.0
strip-ansi: 7.1.0
[email protected]:
optional: true
[email protected]: {}
[email protected]: {}
@@ -4698,3 +4555,5 @@ snapshots:
[email protected]: {}
[email protected]: {}
time: {}
+3
View File
@@ -0,0 +1,3 @@
allowBuilds:
esbuild: true
node-lief: false
+59 -88
View File
@@ -1205,19 +1205,14 @@ function repackPE(
*/
const BLOB_HEADER_ALIGNMENT = 16384;
function alignBigInt(value: bigint, alignment: bigint): bigint {
return ((value + alignment - 1n) / alignment) * alignment;
}
/**
* Repack an ELF binary that uses the new .bun section format (post-PR#26923).
*
* The .bun section uses the same [u64 payload_len][payload] format as macOS/PE.
* At build time, Bun's writeBunSection() creates a PT_LOAD segment to map the
* .bun section data, and stores the segment's vaddr in the BUN_COMPILED symbol
* (located at its original position in the RW data segment). At runtime, the
* Bun runtime reads BUN_COMPILED.size as a vaddr pointer to the mapped data.
*
* On repack we need to:
* 1. Set the .bun section content (LIEF handles file layout)
* 2. Update the PT_LOAD segment's fileSize/virtualSize to cover the new data
* 3. Patch BUN_COMPILED.size with the (possibly unchanged) vaddr
* Repack an ELF binary that uses Bun's new .bun section format (post-PR#26923).
* Current Bun extends the existing writable PT_LOAD and leaves PT_GNU_STACK
* alone; adding a separate late PT_LOAD breaks some Linux loaders.
*/
function repackELFSection(
elfBinary: LIEF.ELF.Binary,
@@ -1232,108 +1227,84 @@ function repackELFSection(
throw new Error('.bun section not found');
}
const newSectionData = buildSectionData(newBunBuffer, sectionHeaderSize);
debug(`repackELFSection: Original section size: ${bunSection.size}`);
debug(`repackELFSection: New section data size: ${newSectionData.length}`);
// Find the .bun PT_LOAD segment (read-only, vaddr matches .bun section)
const bunSectionVaddr = bunSection.virtualAddress;
const segments = elfBinary.segments();
const bunSegment = segments.find(
s =>
s.type === 'LOAD' &&
s.flags === 4 && // PF_R
s.virtualAddress === bunSectionVaddr
);
if (!bunSegment) {
throw new Error(
`.bun PT_LOAD segment not found (looking for LOAD with vaddr=0x${bunSectionVaddr.toString(16)})`
);
const rwSegment = elfBinary
.segments()
.find(s => s.type === 'LOAD' && (s.flags & 2) !== 0);
if (!rwSegment) {
throw new Error('No writable ELF PT_LOAD segment found');
}
debug(
`repackELFSection: Found .bun segment: vaddr=0x${bunSegment.virtualAddress.toString(16)}, ` +
`filesz=0x${bunSegment.fileSize.toString(16)}, memsz=0x${bunSegment.virtualSize.toString(16)}`
);
// Find the original BUN_COMPILED location by searching for the .bun section's
// vaddr value at BLOB_HEADER_ALIGNMENT-aligned virtual addresses in the RW
// LOAD segment. writeBunSection() wrote the vaddr at the ORIGINAL .bun section
// location (where BUN_COMPILED lives in the base binary's data segment), then
// relocated the section header to point to the appended data.
const newSectionData = buildSectionData(newBunBuffer, sectionHeaderSize);
const oldBunSectionVaddr = bunSection.virtualAddress;
const vaddrBytes = Buffer.alloc(8);
vaddrBytes.writeBigUInt64LE(bunSectionVaddr);
vaddrBytes.writeBigUInt64LE(oldBunSectionVaddr);
let bunCompiledVaddr: bigint | null = null;
// Find the RW LOAD segment (flags include W=2)
const rwSegment = segments.find(
s => s.type === 'LOAD' && (s.flags & 2) !== 0
const rwContent = rwSegment.content;
const rwVaddrStart = rwSegment.virtualAddress;
const firstAligned = alignBigInt(
rwVaddrStart,
BigInt(BLOB_HEADER_ALIGNMENT)
);
const lastCandidate = rwVaddrStart + BigInt(rwContent.length) - 8n;
if (rwSegment) {
const rwContent = rwSegment.content;
const rwVaddrStart = Number(rwSegment.virtualAddress);
// Search at BLOB_HEADER_ALIGNMENT-aligned virtual addresses
const firstAligned =
Math.ceil(rwVaddrStart / BLOB_HEADER_ALIGNMENT) * BLOB_HEADER_ALIGNMENT;
for (
let va = firstAligned;
va < rwVaddrStart + rwContent.length - 8;
va += BLOB_HEADER_ALIGNMENT
) {
const off = va - rwVaddrStart;
if (rwContent.subarray(off, off + 8).equals(vaddrBytes)) {
bunCompiledVaddr = BigInt(va);
debug(
`repackELFSection: BUN_COMPILED at vaddr 0x${bunCompiledVaddr.toString(16)} ` +
`(offset ${off} in RW segment)`
);
break;
}
for (
let va = firstAligned;
va <= lastCandidate;
va += BigInt(BLOB_HEADER_ALIGNMENT)
) {
const off = Number(va - rwVaddrStart);
if (rwContent.subarray(off, off + 8).equals(vaddrBytes)) {
bunCompiledVaddr = va;
break;
}
}
if (bunCompiledVaddr === null) {
throw new Error(
'Could not find original BUN_COMPILED location in binary'
`Could not find original BUN_COMPILED location in binary (searched for 0x${oldBunSectionVaddr.toString(16)})`
);
}
// Set the new section content
bunSection.content = newSectionData;
const pageSize = elfBinary.pageSize();
const newContentSize = BigInt(newSectionData.length);
const alignedNewSize = alignBigInt(newContentSize, pageSize);
const newVaddr = alignBigInt(elfBinary.nextVirtualAddress(), pageSize);
const offsetInSegment = newVaddr - rwSegment.virtualAddress;
const newFileOffset = rwSegment.fileOffset + offsetInSegment;
const oldRwFileEnd = rwSegment.fileOffset + rwSegment.fileSize;
const extensionSize = newFileOffset + alignedNewSize - oldRwFileEnd;
// Update the PT_LOAD segment sizes to cover the new content.
// LIEF's ELF Builder handles the actual file layout, but we need to tell
// the segment how big the mapped region should be.
const pageSize = Number(bunSegment.alignment);
const alignedSize = BigInt(
Math.ceil(newSectionData.length / pageSize) * pageSize
);
bunSegment.fileSize = alignedSize;
bunSegment.virtualSize = alignedSize;
if (extensionSize < 0n) {
throw new Error(
'New .bun location overlaps existing writable ELF segment'
);
}
debug(
`repackELFSection: Updated segment: filesz=0x${bunSegment.fileSize.toString(16)}, ` +
`memsz=0x${bunSegment.virtualSize.toString(16)}`
`repackELFSection: moving .bun to offset=0x${newFileOffset.toString(16)}, vaddr=0x${newVaddr.toString(16)}, size=0x${newContentSize.toString(16)}`
);
// Patch BUN_COMPILED.size to point to the .bun section vaddr.
// The vaddr doesn't change (LIEF keeps the section at the same virtual address),
// so we just re-write the same value to ensure it's correct.
if (extensionSize > 0n) {
const extendedSegment = elfBinary.extend(rwSegment, extensionSize);
if (!extendedSegment) {
throw new Error('Failed to extend writable ELF PT_LOAD segment');
}
}
bunSection.fileOffset = newFileOffset;
bunSection.virtualAddress = newVaddr;
bunSection.content = newSectionData;
bunSection.size = newContentSize;
const vaddrPatch = Buffer.alloc(8);
vaddrPatch.writeBigUInt64LE(bunSectionVaddr);
vaddrPatch.writeBigUInt64LE(newVaddr);
elfBinary.patchAddress(bunCompiledVaddr, vaddrPatch);
debug(
`repackELFSection: Patched BUN_COMPILED at vaddr 0x${bunCompiledVaddr.toString(16)} -> 0x${bunSectionVaddr.toString(16)}`
`repackELFSection: Patched BUN_COMPILED at vaddr 0x${bunCompiledVaddr.toString(16)} -> 0x${newVaddr.toString(16)}`
);
// Write the modified binary
atomicWriteBinary(elfBinary, outputPath, binPath);
debug('repackELFSection: Write completed successfully');
} catch (error) {