23 ms·
This somewhat custom use-case has an option turned on that jacks the size way up. Here is a hacky way to undo that option. You could also just ... not turn it
by compiler-guy 10mo ago
This somewhat custom use-case has an option turned on that jacks the size way up. Here is a hacky way to undo that option.
You could also just ... not turn it on in the first place. You are doing a nonstandard build already.
- kragen 10mo agoYour first paragraph appears to be a sarcastic paraphrase of the article; please correct me if I'm misunderstanding that. What's the somewhat custom use-case, and what's the option that jacks up the size? I don't see anything in the article that would obviously fit either description.
- yellow_lead 10mo agoThe option is LTO
- compiler-guy 10mo agoA very quick paraphrase, sure. Don't really think it is sarcastic, but whatever. The custom-use-case is the article's very raison-d'etre: "... I wanted to distribute a static library and the size was causing me problems. Specifically, I had a Rust library that I wanted to make available to Go developers." The option is LTO. The situation here is a bit like building a binary with debug info, and then saying, "But I don't need debug info and it is causing me size-problems, so I'll strip it." But the better option is to not build with debug info in the first place.
- kragen 10mo agoI don't think of distributing a static library as a particularly custom use case, but more as the default way to distribute a compiled library. I missed that LTO was a non-default option! Thanks for pointing that out. In that case I agree.