Commit a222989
committed
fix: disable LTO/ThinLTO in binding.gyp for Windows + Node 26 builds
Node.js 26 was built with clang-cl + lld and ThinLTO enabled. Its
installed common.gypi propagates `enable_thin_lto=true` to downstream
native addons, and the conditions inside common.gypi append
`-flto=thin` to cl.exe's AdditionalOptions and `/opt:lldltojobs=<n>`
to link.exe's AdditionalOptions whenever that variable is true.
That's fine when the addon is also built with clang-cl, but the
overwhelmingly common case for consumers is the regular MSVC toolchain
where:
- cl.exe warns and ignores `-flto=thin` (D9002)
- link.exe warns and ignores `/flto=thin` (LNK4044)
- link.exe fails with `LNK1117: syntax error in option
'opt:lldltojobs=2'` because /OPT: only accepts
REF/ICF/NOREF/NOICF/LBR/NOLBR
Force enable_lto and enable_thin_lto off in binding.gyp's `variables`
so the common.gypi conditions evaluate false and the flags are never
emitted. Affects every consumer building node-libcurl from source on
Windows against Node 26; harmless on Linux/macOS and on older Node
versions.1 parent 7670677 commit a222989
2 files changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
18 | 33 | | |
19 | 34 | | |
20 | 35 | | |
| |||
0 commit comments