Skip to content

Optimize build for libbz2.a #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bzip2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ fn main() {

let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());

cfg.flag_if_supported("-ffunction-sections")
.flag_if_supported("-fdata-sections")
.flag_if_supported("-fmerge-all-constants")
.flag_if_supported("-Wl,--gc-sections")
.flag_if_supported("-Wl,--icf=safe");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to have -ffunction-sections and co. -Wl,--gc-sections and -Wl,--icf=safe can be omitted though as those only apply to linking by the cc crate, but we only build a staticlib here. They don't have any effect on linking done by rustc.


cfg.include("bzip2-1.0.8")
.define("_FILE_OFFSET_BITS", Some("64"))
.define("BZ_NO_STDIO", None)
Expand Down