Browse Source

[efi] Prevent EFI code from being linked in to non-EFI builds

Ensure that efi_systab is an undefined symbol in non-EFI builds.  In
particular, this prevents users from incorrectly enabling IMAGE_EFI in
a BIOS build of iPXE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
de37652044
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      src/interface/efi/efi_init.c

+ 8
- 2
src/interface/efi/efi_init.c View File

@@ -32,8 +32,14 @@ EFI_HANDLE efi_image_handle;
32 32
 /** Loaded image protocol for this image */
33 33
 EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image;
34 34
 
35
-/** System table passed to entry point */
36
-EFI_SYSTEM_TABLE *efi_systab;
35
+/** System table passed to entry point
36
+ *
37
+ * We construct the symbol name efi_systab via the PLATFORM macro.
38
+ * This ensures that the symbol is defined only in EFI builds, and so
39
+ * prevents EFI code from being incorrectly linked in to a non-EFI
40
+ * build.
41
+ */
42
+EFI_SYSTEM_TABLE * _C2 ( PLATFORM, _systab );
37 43
 
38 44
 /** EFI shutdown is in progress */
39 45
 int efi_shutdown_in_progress;

Loading…
Cancel
Save