Skip to content

Improve generating Custom entry function #104001

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

Merged
merged 3 commits into from
Nov 19, 2022
Merged

Conversation

Ayush1325
Copy link
Contributor

This commit is aimed at making compiler-generated entry functions (Basically just C main right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of #100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh ayushsingh1325@gmail.com

@rustbot
Copy link
Collaborator

rustbot commented Nov 5, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 5, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 5, 2022

These commits modify compiler targets.
(See the Target Tier Policy.)

@klensy
Copy link
Contributor

klensy commented Nov 10, 2022

And now there will be 3 copy&pasted matches instead of one? Maybe there is a other way.

@Ayush1325
Copy link
Contributor Author

And now there will be 3 copy&pasted matches instead of one? Maybe there is a other way.

Can you elaborate on what you mean by "copy&pasted matches"?

@klensy
Copy link
Contributor

klensy commented Nov 10, 2022

Can you elaborate on what you mean by "copy&pasted matches"?

That big match from llvm_cconv and it's from\into string conversions. Maybe write separate FromStr impl for Conv instead of placing that code into rustc_target.

This commit is aimed at making compiler generated entry functions
(Basically just C `main` right now) more generic so other targets can do
similar things for custom entry. This was initially implemented as part
of rust-lang#100316.

Currently, this moves the entry function name and Call convention to the
target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
@wesleywiser
Copy link
Member

Thanks @Ayush1325, this looks good to me!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 14, 2022

📌 Commit 9f0a862 has been approved by wesleywiser

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 14, 2022
This is a continuation of 9f0a862 for
gcc.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2022

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

@rustbot
Copy link
Collaborator

rustbot commented Nov 17, 2022

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@Ayush1325
Copy link
Contributor Author

@bjorn3 I have tried doing the same stuff for cranelift. However, I'm not sure how to map the call convention with entry_abi since the CallConv in cranelift are unfamiliar to me.

@bjorn3
Copy link
Member

bjorn3 commented Nov 17, 2022

You could extract the match at

let call_conv = match fn_abi.conv {
into a function and then use this function.

This is a continuation of 9f0a862 for
cranelift.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
@bjorn3
Copy link
Member

bjorn3 commented Nov 17, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 17, 2022

📌 Commit 2436dff has been approved by bjorn3

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 17, 2022

🌲 The tree is currently closed for pull requests below priority 1. This pull request will be tested once the tree is reopened.

@Ayush1325
Copy link
Contributor Author

@antoyo Can you check out 6dfe239 as well?

@bjorn3
Copy link
Member

bjorn3 commented Nov 17, 2022

I think it is fine.

@antoyo
Copy link
Contributor

antoyo commented Nov 17, 2022

@antoyo Can you check out 6dfe239 as well?

That looks fine to me!

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Nov 19, 2022
Improve generating Custom entry function

This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of rust-lang#100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#104001 (Improve generating Custom entry function)
 - rust-lang#104411 (nll: correctly deal with bivariance)
 - rust-lang#104528 (Properly link `{Once,Lazy}{Cell,Lock}` in docs)
 - rust-lang#104553 (Improve accuracy of asinh and acosh)
 - rust-lang#104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)
 - rust-lang#104566 (couple of clippy::perf fixes)
 - rust-lang#104575 (deduplicate tests)
 - rust-lang#104580 (diagnostics: only show one suggestion for method -> assoc fn)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit aeeac5d into rust-lang:master Nov 19, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 19, 2022
@Ayush1325 Ayush1325 deleted the custom-entry branch November 19, 2022 11:00
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 14, 2022
Improve generating Custom entry function

This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of rust-lang#100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
antoyo pushed a commit to antoyo/rust that referenced this pull request Jun 19, 2023
Improve generating Custom entry function

This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of rust-lang#100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants