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 https://github.com/rust-lang/rust/pull/100316.

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

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
This commit is contained in:
Ayush Singh 2022-11-05 14:36:38 +05:30
parent 5b3e909075
commit 9f0a8620bd
No known key found for this signature in database
GPG key ID: 05CEF5C789E55A74
7 changed files with 135 additions and 20 deletions

View file

@ -89,3 +89,28 @@ impl<A: ToJson> ToJson for Option<A> {
}
}
}
impl ToJson for crate::abi::call::Conv {
fn to_json(&self) -> Json {
let s = match self {
Self::C => "C",
Self::Rust => "Rust",
Self::RustCold => "RustCold",
Self::ArmAapcs => "ArmAapcs",
Self::CCmseNonSecureCall => "CCmseNonSecureCall",
Self::Msp430Intr => "Msp430Intr",
Self::PtxKernel => "PtxKernel",
Self::X86Fastcall => "X86Fastcall",
Self::X86Intr => "X86Intr",
Self::X86Stdcall => "X86Stdcall",
Self::X86ThisCall => "X86ThisCall",
Self::X86VectorCall => "X86VectorCall",
Self::X86_64SysV => "X86_64SysV",
Self::X86_64Win64 => "X86_64Win64",
Self::AmdGpuKernel => "AmdGpuKernel",
Self::AvrInterrupt => "AvrInterrupt",
Self::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt",
};
Json::String(s.to_owned())
}
}