Comments (12)
It is in original post in a .zip, together with .s for 1.73.
I am sorry for not providing one for 1.74, but this is what I had at hand.
from cargo-show-asm.
cargo run --release -- --manifest-path sample/Cargo.toml --native --intel sample::main --rust --no-default-features
works for me...
CI seem to detect it when it's there if I run with no argument... But fails to find it when it's called.
fn() -> ()
vs -> u32
shouldn't really affect anything, in both cases it should be a label like this: _ZN6sample4main17hecd2c58e95d09ed1E:
.
I'll poke around, will let you know if I manage to reproduce it.
from cargo-show-asm.
Okay, got the jackpot. The return value was indeed not an issue.
The culprit lied in rust-lang/rust#116505
In short, with default features turned off, main was trivial enough to be marked as inline
function automatically which then made the symbol weak. Since nobody was referencing it, it got stripped away.
Marking main in default-features=false
config as #[inline(never)]
or replacing 1 + 1
in it's body with a simple println!("foo")
call (to make the main
function sophisticated enough not to be subject to the new automatic marking as inline) makes the test pass again.
from cargo-show-asm.
It looks like main
is now stripped? That seems somewhat plausible as it's defined in lib.rs
, so who knows..
from cargo-show-asm.
Interestingly enough it works on my machine with 1.75.0
% cargo run --release -- --manifest-path sample/Cargo.toml --native --intel
Finished release [optimized] target(s) in 0.02s
Running `target/release/cargo-asm --manifest-path sample/Cargo.toml --native --intel`
Finished release [optimized + debuginfo] target(s) in 0.00s
Try one of those by name or a sequence number
0 "<&T as core::fmt::Display>::fmt" [17]
1 "<sample::MyRngCore as rand_core::block::BlockRngCore>::generate" [18]
2 "core::ptr::drop_in_place<ahash::random_state::DefaultRandomSource>" [7]
3 "hashbrown::raw::RawTable<T,A>::reserve_rehash" [1238]
4 "hashbrown::raw::RawTable<T,A>::reserve_rehash::{{closure}}" [299]
5 "hashbrown::set::HashSet<T,S,A>::insert" [382]
6 "hashbrown::set::HashSet<T>::new" [241]
7 "make_bar" [8]
8 "sample::main" [751]
% rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)
Can you try passing --everything
to check if sample::main
is there under some other name? Or any ideas how to reproduce it on my end?
from cargo-show-asm.
Stripping shouldn't affect anything - c-s-a doesn't run on compiled code, it asks rustc to dump generated .s
file.
from cargo-show-asm.
Can you try building it with --no-default-features on sample
? E.g:
cargo run --release -- --manifest-path sample/Cargo.toml --native --intel sample::main --rust --no-default-features
It looks like that makes a difference, as we also test the same scenario with default features on sample in CI and that passes even on 1.75.
By stripping I've meant dead code elimination, maybe there's now a MIR optimization that removes main
from libs (so that it won't even have code generated for it) - though I don't see why it would only happen with default features turned off.
I'll post results with --everything in the morning.
from cargo-show-asm.
I have a hunch, will try that in the morning though;
With default features turned off, sample::main
has a signature of fn() -> u32
which IIRC isn't a valid function signature for an entry point. With default features turned on, its signature is fn() -> ()
and that is a valid entry point signature. Maybe it is being preserved with default features (as it's an entry point) and being stripped away without any default features (as it's dead code?)
from cargo-show-asm.
Well, IMHO the return value should make a difference as to whether the code is stripped altogether or not.
from cargo-show-asm.
Can you attach the raw .s
file?
from cargo-show-asm.
Good catch!
from cargo-show-asm.
Closing as it's fixed with e7e31ac71fdc8d350226a39ac2be5a4a47c6bac0
from cargo-show-asm.
Related Issues (20)
- Support inlining info in asm files
- `--print KIND=PATH` is stable
- Remove extraneous blank lines HOT 5
- Add use a separate library to implement syntax highlight for llvm/mir/asm
- Wrong path used for rustc sources HOT 10
- Automate release process
- --rust flag shows code from libstd HOT 4
- Function selection via index broken on v0.2.24 to v0.2.28 HOT 6
- Option to include called functions (to some depth) HOT 6
- Install fails with rustc 1.74.0 HOT 3
- [Bugfix]: release-plz workflow - ERROR failed to update packages HOT 3
- color output can be very difficult to read on dark backgrounds HOT 1
- `--simplify` removes inline assembly HOT 5
- Debug info included by default in 0.2.33 HOT 1
- Missing/incorrect line information HOT 6
- An easier way to compare different versions
- Missed no_mangle symbol in no_std/no_main Windows code HOT 10
- On 32bit Windows no_mangle names needs stripping
- Support `rustc_codegen_cranelift` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-show-asm.