Skip to content
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

Cannot fuzz if profile.release.lto = true #384

Open
ijc opened this issue Sep 17, 2024 · 1 comment · May be fixed by #385
Open

Cannot fuzz if profile.release.lto = true #384

ijc opened this issue Sep 17, 2024 · 1 comment · May be fixed by #385

Comments

@ijc
Copy link

ijc commented Sep 17, 2024

With:

[profile.release]
lto = true

in my workspace Cargo.toml running cargo fuzz run «target» fails to link with:

  = note: rust-lld: error: undefined symbol: __sancov_gen_.327
          >>> referenced by «target».d25d56b5730432d9-cgu.0
          >>>               /home/ianc/Development/cvpn/orga-expressvpn/lightway/target/x86_64-unknown-linux-gnu/release/deps/«target»-3abb84e625a12f1f.«target».d25d56b5730432d9-cgu.0.rcgu.o:(asan.module_dtor.263)
          
          rust-lld: error: undefined symbol: __sancov_gen_.210
          >>> referenced by «target».d25d56b5730432d9-cgu.0
          >>>               /home/ianc/Development/cvpn/orga-expressvpn/lightway/target/x86_64-unknown-linux-gnu/release/deps/«target»-3abb84e625a12f1f.«target».d25d56b5730432d9-cgu.0.rcgu.o:(asan.module_dtor.535)

(there are dozens of these).

Commenting out lto = true results in a successful link and run.

If this isn't an easy fix perhaps cargo fuzz could pass --config profile.release.lto=false to cargo? Alternatively being able to choose a custom profile (not just release vs dev) might be a useful feature in its own right.

Reproduced with

rustc 1.83.0-nightly (9c01301c5 2024-09-05)

and

rustc 1.83.0-nightly (c52c23b6f 2024-09-16)
@fitzgen
Copy link
Member

fitzgen commented Sep 17, 2024

If this isn't an easy fix perhaps cargo fuzz could pass --config profile.release.lto=false to cargo? Alternatively being able to choose a custom profile (not just release vs dev) might be a useful feature in its own right.

I'd be happy to review PRs for both of these things.

ijc added a commit to ijc/cargo-fuzz that referenced this issue Sep 18, 2024
Enabling LTO results in link errors, see rust-fuzz#384 for more info.
@ijc ijc linked a pull request Sep 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants