[libc-commits] [libc] [libc][uefi] add crt1 (PR #132150)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Fri Mar 21 11:27:50 PDT 2025
================
@@ -0,0 +1,29 @@
+//===-- Implementation of crt for UEFI ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--------------------------------------------------------------------===//
+
+#include "include/llvm-libc-macros/stdlib-macros.h"
+#include "include/llvm-libc-types/EFI_HANDLE.h"
+#include "include/llvm-libc-types/EFI_STATUS.h"
+#include "include/llvm-libc-types/EFI_SYSTEM_TABLE.h"
+#include "src/__support/macros/config.h"
+
+EFI_HANDLE efi_image_handle;
+EFI_SYSTEM_TABLE *efi_system_table;
+
+extern "C" int main(int argc, char **argv, char **envp);
+
+extern "C" EFI_STATUS EfiMain(EFI_HANDLE ImageHandle,
+ EFI_SYSTEM_TABLE *SystemTable) {
+ efi_image_handle = ImageHandle;
+ efi_system_table = SystemTable;
+
+ main(0, NULL, NULL);
+
+ // TODO: convert the return value of main to EFI_STATUS
----------------
jhuber6 wrote:
There's C standard errno values if nothing else.
https://github.com/llvm/llvm-project/pull/132150
More information about the libc-commits
mailing list