Commit 175f62a
authored
ffi: cfg-gate local tcc_delete extern to match bun_tcc_sys (#30743)
`src/runtime/ffi/mod.rs` declares its own unconditional `extern "C" { fn
tcc_delete }`, separate from `bun_tcc_sys::tcc_externs!` which correctly
cfg-gates the libtcc externs on `cfg.tinycc` (= NOT android / freebsd /
windows-aarch64, where `libtcc.a` isn't built).
`Function::drop` calls it inside `if let Some(state)` — `state` is never
`Some` on those targets so the call is dead at runtime, but with cargo
LTO overridden off (asan / linker-plugin-lto path in `rust.ts`) the
symbol reference survives into the staticlib and link fails:
```
lld-link: error: undefined symbol: tcc_delete
```
Gate the local extern on the same predicate as `tcc_externs!` and
provide an `unreachable!()` stub on the disabled targets, mirroring what
`src/tcc_sys/tcc.rs` already does.1 parent 952d337 commit 175f62a
1 file changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| 122 | + | |
122 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
| |||
0 commit comments