Removed defination of _fltused from
RustPkg/Library/UefiRustIntrinsicLib since compiler_builtins now
provides one

Cc: Jiewen Yao <jiewen....@intel.com>

Signed-off-by: Ayush Singh <ayushdevel1...@gmail.com>
---
 RustPkg/Library/UefiRustIntrinsicLib/src/lib.rs |  8 --
 RustPkg/Test/TestRustLangApp/.cargo/config.toml |  3 +
 RustPkg/Test/TestRustLangApp/src/main.rs        | 95 +++++++++-----------
 3 files changed, 43 insertions(+), 63 deletions(-)

diff --git a/RustPkg/Library/UefiRustIntrinsicLib/src/lib.rs 
b/RustPkg/Library/UefiRustIntrinsicLib/src/lib.rs
index c2341e9a65af..2bfdc524a11c 100644
--- a/RustPkg/Library/UefiRustIntrinsicLib/src/lib.rs
+++ b/RustPkg/Library/UefiRustIntrinsicLib/src/lib.rs
@@ -12,15 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 #![cfg_attr(not(test), no_std)]
-
 #![allow(unused)]
 
-#[used]
-#[no_mangle]
-pub static _fltused : i32 = 0;
-
 extern crate uefi_rust_panic_lib;
-
-
diff --git a/RustPkg/Test/TestRustLangApp/.cargo/config.toml 
b/RustPkg/Test/TestRustLangApp/.cargo/config.toml
new file mode 100644
index 000000000000..422bf9d2ab4e
--- /dev/null
+++ b/RustPkg/Test/TestRustLangApp/.cargo/config.toml
@@ -0,0 +1,3 @@
+[unstable]
+build-std = ["core", "compiler_builtins", "alloc"]
+build-std-features = ["compiler-builtins-mem"]
diff --git a/RustPkg/Test/TestRustLangApp/src/main.rs 
b/RustPkg/Test/TestRustLangApp/src/main.rs
index 9dcea4fa5c4e..72bb12e16adf 100644
--- a/RustPkg/Test/TestRustLangApp/src/main.rs
+++ b/RustPkg/Test/TestRustLangApp/src/main.rs
@@ -13,120 +13,105 @@
 // limitations under the License.
 
 #![crate_type = "staticlib"]
-
 #![feature(alloc_layout_extra)]
 #![feature(allocator_api)]
 #![feature(alloc_error_handler)]
-#![feature(core_panic_info)]
-#![feature(asm)]
-
 #![cfg_attr(not(test), no_std)]
 #![no_main]
-
 #![allow(unused)]
 
 mod mem;
 
 extern crate test_rust_lang_lib;
+extern crate uefi_rust_allocation_lib;
 extern crate uefi_rust_intrinsic_lib;
 extern crate uefi_rust_panic_lib;
-extern crate uefi_rust_allocation_lib;
 
 use r_efi::efi;
-use r_efi::efi::{Status};
+use r_efi::efi::Status;
 
-use core::panic::PanicInfo;
 use core::ffi::c_void;
+use core::panic::PanicInfo;
 
 use core::mem::size_of;
 use core::mem::transmute;
 
 use core::slice::from_raw_parts;
 
-
-static mut ST : *mut efi::SystemTable = core::ptr::null_mut();
-static mut BS : *mut efi::BootServices = core::ptr::null_mut();
+static mut ST: *mut efi::SystemTable = core::ptr::null_mut();
+static mut BS: *mut efi::BootServices = core::ptr::null_mut();
 
 extern crate alloc;
 
-use alloc::vec::Vec;
 use alloc::boxed::Box;
-
+use alloc::vec::Vec;
 
 #[no_mangle]
 #[export_name = "AllocatePool"]
-extern fn AllocatePool (size: usize) -> *mut c_void
-{
-      let mut address : *mut c_void = core::ptr::null_mut();
-    
-      let status = unsafe { ((*BS).allocate_pool) (
-                     efi::MemoryType::BootServicesData,
-                     size,
-                     &mut address as *mut *mut c_void
-                     ) } ;
-      if status != Status::SUCCESS {
+extern "C" fn AllocatePool(size: usize) -> *mut c_void {
+    let mut address: *mut c_void = core::ptr::null_mut();
+
+    let status = unsafe {
+        ((*BS).allocate_pool)(
+            efi::MemoryType::BootServicesData,
+            size,
+            &mut address as *mut *mut c_void,
+        )
+    };
+    if status != Status::SUCCESS {
         return core::ptr::null_mut();
-      }
-      address as *mut c_void
+    }
+    address as *mut c_void
 }
 
-
-
 #[no_mangle]
 #[export_name = "AllocateZeroPool"]
-extern fn AllocateZeroPool (size: usize) -> *mut c_void
-{
-    let buffer = AllocatePool (size);
+extern "C" fn AllocateZeroPool(size: usize) -> *mut c_void {
+    let buffer = AllocatePool(size);
     if buffer == core::ptr::null_mut() {
-      return core::ptr::null_mut();
+        return core::ptr::null_mut();
     }
 
-    unsafe {core::ptr::write_bytes (buffer, 0, size);}
+    unsafe {
+        core::ptr::write_bytes(buffer, 0, size);
+    }
 
     buffer as *mut c_void
 }
 
-
-
 #[no_mangle]
 #[export_name = "FreePool"]
-extern fn FreePool (buffer: *mut c_void)
-{
+extern "C" fn FreePool(buffer: *mut c_void) {
     unsafe {
-      ((*BS).free_pool) (buffer as *mut c_void);
+        ((*BS).free_pool)(buffer as *mut c_void);
     }
 }
 #[no_mangle]
 #[export_name = "ExternInit"]
-extern fn ExternInit(data: *mut usize)
-{
-}
-
+extern "C" fn ExternInit(data: *mut usize) {}
 
 #[no_mangle]
-pub extern fn efi_main(handle: efi::Handle, system_table: *mut 
efi::SystemTable) -> Status
-{
+pub extern "C" fn efi_main(handle: efi::Handle, system_table: *mut 
efi::SystemTable) -> Status {
     uefi_rust_allocation_lib::init(system_table);
 
     unsafe {
-      ST = system_table;
-      BS = (*ST).boot_services;
+        ST = system_table;
+        BS = (*ST).boot_services;
     }
 
     // L"Hello World!/r/n"
-    let string_name  = & mut [
-      0x48u16, 0x65u16, 0x6cu16, 0x6cu16, 0x6fu16, 0x20u16,
-      0x57u16, 0x6fu16, 0x72u16, 0x6cu16, 0x64u16, 0x21u16,
-      0x0Au16, 0x0Du16, 0x00u16
-      ];
+    let string_name = &mut [
+        0x48u16, 0x65u16, 0x6cu16, 0x6cu16, 0x6fu16, 0x20u16, 0x57u16, 
0x6fu16, 0x72u16, 0x6cu16,
+        0x64u16, 0x21u16, 0x0Au16, 0x0Du16, 0x00u16,
+    ];
     unsafe {
-      ((*((*ST).con_out)).output_string) (
-          unsafe {(*ST).con_out},
-          string_name.as_ptr() as *mut efi::Char16,
-          );
+        ((*((*ST).con_out)).output_string)(
+            unsafe { (*ST).con_out },
+            string_name.as_ptr() as *mut efi::Char16,
+        );
     }
 
-    test_rust_lang_lib::test_integer_overflow (0x10000, 0xFFFFFFFF, 
0xFFFFFFFF);
+    test_rust_lang_lib::test_integer_overflow(0x10000, 0xFFFFFFFF, 0xFFFFFFFF);
 
     Status::SUCCESS
 }
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87756): https://edk2.groups.io/g/devel/message/87756
Mute This Topic: https://groups.io/mt/89884786/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to