GithubHelp home page GithubHelp logo

Comments (7)

mwaitzman avatar mwaitzman commented on May 31, 2024 1

Oh okay. I was just making sure you were aware that the issue had closed

from cargo-auditable.

nilgoyette avatar nilgoyette commented on May 31, 2024

I tested this project in our commercial project and there's something I don't understand. You advice to add

println!("{}", COMPRESSED_DEPENDENCY_LIST[0]);

in our main.rs so the variable is used and thus added into the binary strings. This, if course, prints something when the program starts. Obviously I and pretty much everybody don't want anything printed in their console. I can't use nightly either, so the black box trick won't do.

Is there any other tricks to use? Or maybe a better question: should we use this project or the only end goal is to add it into cargo and then we use it?

from cargo-auditable.

Shnatsel avatar Shnatsel commented on May 31, 2024

Is there any other tricks to use?

You can only print it if a certain command-line parameter is passed, like with --help. Anything that uses the data in some way will work.

Or maybe a better question: should we use this project or the only end goal is to add it into cargo and then we use it?

The eventual goal is to add it to Cargo itself, but before that it would be great to see how the approach works in practice and if there is anything we need to change before stabilizing the format. So please use it and provide feedback - it's much easier to act on it here than after it's merged into cargo!

from cargo-auditable.

niklasf avatar niklasf commented on May 31, 2024

The crate bencher implements black_box in stable Rust like https://docs.rs/bencher/0.1.5/src/bencher/lib.rs.html#590-596, because the optimizer currently does not remove volatile reads. It's a bit sad to resort to unsafe, though:

unsafe {
    // Safety: u8 is Copy.
    ptr::read_volatile(&COMPRESSED_DEPENDENCY_LIST[0]);
}

from cargo-auditable.

mwaitzman avatar mwaitzman commented on May 31, 2024

The relevant issue (rust-lang/rust#47384) appears to have been quietly fixed, and is now closed as of a week ago

from cargo-auditable.

Shnatsel avatar Shnatsel commented on May 31, 2024

It still isn't usable for ELF - we need #[used(linker)] rather than the current #[used] which is equivalent to #[used(compiler)]. It's difficult to support because only very recent ELF linkers implement the required flags.

I think the way to go is to implement external injection instead, as discussed in #29. I have a prototype in a branch already.

from cargo-auditable.

Shnatsel avatar Shnatsel commented on May 31, 2024

External injection via cargo auditable is now the default, and it avoids this problem.

from cargo-auditable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.