Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Possibly no longer need init() function? #21

Closed
ian-h-chamberlain opened this issue Feb 11, 2023 · 7 comments · Fixed by #22
Closed

Possibly no longer need init() function? #21

ian-h-chamberlain opened this issue Feb 11, 2023 · 7 comments · Fixed by #22
Assignees

Comments

@ian-h-chamberlain
Copy link
Member

It looks like rust-lang/rust#47384 has been fixed since 1.62, so I wonder if we might be able to rely on #[no_mangle] and drop all the init() functions we needed to export everything? Same might apply for rust-linker-fix-3ds but this crate has a lot more of them so maybe a better place to start testing.

@Meziu
Copy link
Member

Meziu commented Feb 11, 2023

It'd be great! I'll try when I can.

@Meziu
Copy link
Member

Meziu commented Feb 14, 2023

It works! I've opened 3 PRs for the case:

@ian-h-chamberlain
Copy link
Member Author

That's great! It looks like from your changes that it still requires a function from the given crate to be imported, is that correct? Otherwise we might as well just delete the init function entirely from here and rust-linker-fix-3ds. See also my comment rust3ds/ctru-rs#92 (comment)

@AzureMarker
Copy link
Member

Wow, I'm surprised it works, since I still ran into issues and had to open this issue:
rust-lang/rust#94348

@ian-h-chamberlain
Copy link
Member Author

yeah, I think the intention (based on rust-lang/rust#94348 (comment)) was always that #[no_mangle] functions should no be discarded by the compiler, so the use cases for #[used] are primarily on static variables? but it seems like enough stuff got moved around that it works how we want it to now?

@AzureMarker I wonder if you would still be able to reproduce that issue or not given that this seems to be working for the 3ds libs now.

@Meziu
Copy link
Member

Meziu commented Feb 15, 2023

but it seems like enough stuff got moved around that it works how we want it to now?

That’s my guess. The “fix” for that issue completely revamped the linking setup made by the compiler.

@Meziu Meziu closed this as completed in #22 Feb 15, 2023
@Meziu
Copy link
Member

Meziu commented Feb 15, 2023

I feel like a weight has been lifted from the toolchain!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants