rust-fuzz / cargo-fuzz

Command line helpers for fuzzing
https://rust-fuzz.github.io/book/cargo-fuzz.html
Apache License 2.0
1.55k stars 109 forks source link

Disable lto and explicit profile #385

Open ijc opened 2 months ago

ijc commented 2 months ago

Fixes #384.

I included both the disable LTO bit and the capability to support custom profiles. I'm happy to drop either one.

I'm concerned about how custom profiles will interact with these uses of build.release and build.dev: https://github.com/rust-fuzz/cargo-fuzz/blob/a608970259c3b0d575e70b0748c1c4cf79081031/src/project.rs#L233-L235 and https://github.com/rust-fuzz/cargo-fuzz/blob/a608970259c3b0d575e70b0748c1c4cf79081031/src/project.rs#L241-L251

I'm unclear how to determine the right condition for a custom profile -- might be a reason to drop that bit.

fitzgen commented 2 months ago

I'm concerned about how custom profiles will interact with ...

I haven't looked at the actual PR yet, but I think we can make it so that we have a build.profile that is ultimately a String[^0] and we can match on that value and set these flags only for the profiles and special cases we are aware of. For custom profiles, the user can always specify their own custom flags in the profile definition, and that might be the best we can offer here.

[^0]: Or an enum Profile { Dev, Release, Custom(String) } or something.

ijc commented 2 months ago

@fitzgen I'm not sure what is wrong with CI.

I ran the cargo +nightly-2024-09-18 test locally (since that is the version CI picked up) and it passes.

fitzgen commented 2 months ago

I've retriggered CI, just in case it was some weird ephemeral issue (haven't really had those issues as far as I can remember)