File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ pub trait CargoCmd {
1313 fn cc_env ( & mut self , triplet : impl AsRef < str > , cc : impl AsRef < Path > ) -> & mut Self ;
1414 fn ar_env ( & mut self , triplet : impl AsRef < str > , ar : impl AsRef < Path > ) -> & mut Self ;
1515 fn sysroot ( & mut self , path : impl AsRef < Path > ) -> & mut Self ;
16+ fn entrypoint ( & mut self , entry : impl AsRef < str > ) -> & mut Self ;
1617 fn append_rustflags ( & mut self , flags : impl AsRef < OsStr > ) -> & mut Self ;
1718 fn append_cflags ( & mut self , triplet : impl AsRef < str > , flags : impl AsRef < OsStr > ) -> & mut Self ;
1819 fn append_bindgen_cflags ( & mut self , flags : impl AsRef < OsStr > ) -> & mut Self ;
@@ -102,6 +103,11 @@ impl CargoCmd for Command {
102103 . append_rustflags ( path. as_ref ( ) )
103104 }
104105
106+ fn entrypoint ( & mut self , entry : impl AsRef < str > ) -> & mut Self {
107+ let entry = entry. as_ref ( ) ;
108+ self . append_rustflags ( format ! ( "-Clink-args=-e{entry}" ) )
109+ }
110+
105111 fn append_rustflags ( & mut self , flags : impl AsRef < OsStr > ) -> & mut Self {
106112 if flags. as_ref ( ) . is_empty ( ) {
107113 return self ;
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ impl CargoCommandExt for std::process::Command {
8383 fn populate_from_args ( & mut self , args : & Args ) -> & mut Self {
8484 self . target ( & args. target ) ;
8585 self . sysroot ( args. sysroot_dir ( ) ) ;
86+ self . entrypoint ( "entrypoint" ) ;
8687 if let Some ( clang) = & args. clang {
8788 self . cc_env ( & args. target , clang) ;
8889 } else {
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ pub fn build(args: &Args) -> Result<()> {
2424 let target_spec = match args. target . as_str ( ) {
2525 "x86_64-hyperlight-none" => {
2626 let mut spec = get_spec ( args, "x86_64-unknown-none" ) ?;
27- spec. entry_name = Some ( "entrypoint" . into ( ) ) ;
27+ // entry_name seems to be ignored, use RUSTFLAGS with -Clink-args=-eentrypoint instead
28+ //spec.entry_name = Some("entrypoint".into());
2829 spec. code_model = Some ( "small" . into ( ) ) ;
2930 spec. linker = Some ( "rust-lld" . into ( ) ) ;
3031 spec. linker_flavor = Some ( "gnu-lld" . into ( ) ) ;
You can’t perform that action at this time.
0 commit comments