Commit 4be3ef3
authored
feat: strip debug symbols from Node binaries before SEA injection (#16)
## Summary
Strip debug symbols from Node binaries before postject SEA injection.
Node.js ships with full symbol tables (~17 MiB on linux-x64) that aren't
needed at runtime.
### Why before injection?
`strip` must run BEFORE postject injection. Postject corrupts the ELF
section-to-segment layout, causing `strip` to fail with:
```
strip: section .text can't be allocated in segment 2
```
### Pipeline
```
download → copy (+ unsign on macOS/Win) → strip → inject SEA blob → sign
```
### Per-platform behavior
| Platform | Strip command | Savings | Notes |
|----------|-------------|---------|-------|
| Linux | `strip --strip-unneeded` | **~17 MiB** | Removes symbols +
debug sections |
| macOS | `strip -x` | ~5-10 MiB | Local symbols; binary already
unsigned by `macho-unsign` |
| Windows | skipped | 0 | PE releases don't ship debug symbols |
| Cross-compile | silently skipped | 0 | `strip` can't process foreign
binary formats |
### Results (linux-x64, Sentry CLI)
| Metric | Before | After | Change |
|--------|--------|-------|--------|
| Raw binary | 125 MiB | 108 MiB | **-14%** |
| Compressed | 34 MiB | 30 MiB | **-12%** |
| Startup | unchanged | unchanged | — |1 parent af81980 commit 4be3ef3
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
237 | 253 | | |
238 | 254 | | |
239 | 255 | | |
| |||
0 commit comments