-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Compile Error on AVR atmega328p with global_asm! in lib.rs #134758
Comments
I think @Patryk27 has been working on the AVR targets, there are some interesting interactions with target features on this platform iirc. Also @xjnxjnxjn would you mind formatting the issue description? It's kind of difficult to read currently, Just wrap the code in fences like
|
... some formatting |
Thx for the format hints, i've done my best now. I'm new at github, so do i have to inform/ask @jfrimmel or @Patryk27 to have a look at it ? Or are they informed by github or by themselve looking at AVR related issues ? |
Thanks! Much better now :)
Using If you would be willing to look into this yourself a bit, you could try the following:
|
I've done following on lib- and bin-crate
llvm-ir result for bin-crate is
llvm-ir result for lib-crate is
I've tried to add
to the lib compile command, no change. |
Hi, I've just tried replicating the issue and in my case the compilation passes without any errors - could you prepare an example repository I could |
I'm on
|
Could you try updating to the latest nightly? Might not make a difference, but there have been a handful of changes to how we codegen asm in the past few months (mostly |
Switched to
no difference, same error, same *.ll files. |
This seems to be a rustc issue - it fails to propagate some target information to LLVM; a very similar thing happens for RISC-V:
Turning LTO off "solves" the problem. Edit: apparently it might be an LLVM issue as well (llvm/llvm-project#61991) - in any case, it's not AVR-specific, it can happen for all targets. |
Ok, I'll use this until the problem is solved.
Yes, this seems to be the underlying issue. I'm a bit proud, I've found the "error line" in the LLVM source by myself :) Is there a way to get informed, if this issue is solved by LLVM and/or rustc ? Thx again. |
This is my first issue, so I'm not sure if this is the right place to report or if it is reported already.
Also formatting this issue is new to me ...
I'm on Rust with AVR atmega328p, using
I use "global_asm!" macro which compiles Ok in a bin main.rs and gives a compile error in a lib lib.rs.
The error is
The source in both, main.rs and lib.rs is
To test, I have two crates, one to test as --bin with main.rs, one to test as --lib with lib.rs
Both crates have .cargo/config.toml
Both have Config.toml
The main.rs in the bin test crate :
... compiles and links fine !
The lib.rs in the lib test crate :
... and gives compile error
Command for both crates is cargo build --release
I've tracked it down to llvm :
The ("","") forces the feature map to go to the lowest for AVR and does not honor, that "atmega328p" features should be used.
Ich I patch it to
it compiles fine :) But this is not a Solution
So here I stuck ...
br
xjn
The text was updated successfully, but these errors were encountered: