Clear text in compiled binary?

Hello,
i have seen that compiled binarys have the full system path from rust development enviroment in the compiled binary
C:****************************\Rust\Users*rust_user.cargo\registry\src\index.crates.io-
and some other informations in clear text

How can i compile with cargo an exe that have less informations in the compiled binary? Not an obsfuscate but an exe like with upx?

thx

You can pass to rustc (or put in the RUSTFLAGS environment variable) the argument --remap-path-prefix "C:\path\to\something=just_something" and rustc will replace any occurence of the path C:\path\to\something in the exe file with just_something.

Note that for now on Windows this will break debugging and stacktraces (this will be fixed in Rust 1.78)

1 Like

@SkiFire13 thx i will probes this.

Do you know how can i reach the full level of stripping out the most clear strings in my binary? Like UPX but with no compression?

No really, but is there a reason you cannot use UPX?

@SkiFire13 UPX is decompressable. I use some own created libs and don't want that the binary shows how i have the libs named. Like src\icon.rs src\icon_dumname:).rs and so on. My whole source-paths are in the binary. And when i use many crates the C:***************************\Rust\Usersrust_user.cargo\registry\src\index.crates.io- \name*\ and so on can be a little smaller to optimize the binary size. When i remember me in c/c++ compiled binary are not the includes in the binary???

Hmm i think this are only informations that rust need for the panic routine? Can i disable this panic routine, recode the panic routine or control the informations that the panic routine can use?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.