fix: strip release binaries
a59f466 parent: 48070f5 modified
src/clonim.nim +7 -1 | @@ -203,7 +203,13 @@ proc main() = | ||
| 203 | 203 | nimCmd.add "--passL:-Wl,--allow-multiple-definition" |
| 204 | 204 | nimCmd.add "--passL:" & rtLib |
| 205 | 205 | nimCmd.add "--passL:-lm" |
| 206 | - if release: nimCmd.add "-d:release" | |
| 206 | + if release: | |
| 207 | + # `-d:release` disables Nim runtime checks but keeps DWARF and symbol | |
| 208 | + # tables by default. Native deliverables should not carry that metadata. | |
| 209 | + nimCmd.add "-d:release" | |
| 210 | + # Nim 2.x has no `--strip` switch; pass the portable linker option through | |
| 211 | + # instead. Zig cc (the bundled linker) and GNU-compatible linkers accept it. | |
| 212 | + nimCmd.add "--passL:-s" | |
| 207 | 213 | nimCmd.add nimFile |
| 208 | 214 | if verbose and not cached: echo "clonim: " & nimCmd.join(" ") |
| 209 | 215 | |
| @@ -203,7 +203,13 @@ proc main() = | |||
| 203 | nimCmd.add "--passL:-Wl,--allow-multiple-definition" | 203 | nimCmd.add "--passL:-Wl,--allow-multiple-definition" |
| 204 | nimCmd.add "--passL:" & rtLib | 204 | nimCmd.add "--passL:" & rtLib |
| 205 | nimCmd.add "--passL:-lm" | 205 | nimCmd.add "--passL:-lm" |
| 206 | - if release: nimCmd.add "-d:release" | 206 | + if release: |
| 207 | + # `-d:release` disables Nim runtime checks but keeps DWARF and symbol | ||
| 208 | + # tables by default. Native deliverables should not carry that metadata. | ||
| 209 | + nimCmd.add "-d:release" | ||
| 210 | + # Nim 2.x has no `--strip` switch; pass the portable linker option through | ||
| 211 | + # instead. Zig cc (the bundled linker) and GNU-compatible linkers accept it. | ||
| 212 | + nimCmd.add "--passL:-s" | ||
| 207 | nimCmd.add nimFile | 213 | nimCmd.add nimFile |
| 208 | if verbose and not cached: echo "clonim: " & nimCmd.join(" ") | 214 | if verbose and not cached: echo "clonim: " & nimCmd.join(" ") |
| 209 | 215 | ||