]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Prevent EFI code from being linked in to non-EFI builds
authorMichael Brown <mcb30@ipxe.org>
Fri, 19 May 2017 11:21:18 +0000 (12:21 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 19 May 2017 11:21:18 +0000 (12:21 +0100)
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>
src/interface/efi/efi_init.c

index cfaff606e75b02df35080847816790bf45ef1631..ed9707f2c91f50354400f459825b78253bef708c 100644 (file)
@@ -32,8 +32,14 @@ EFI_HANDLE efi_image_handle;
 /** Loaded image protocol for this image */
 EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image;
 
-/** System table passed to entry point */
-EFI_SYSTEM_TABLE *efi_systab;
+/** System table passed to entry point
+ *
+ * We construct the symbol name efi_systab via the PLATFORM macro.
+ * This ensures that the symbol is defined only in EFI builds, and so
+ * prevents EFI code from being incorrectly linked in to a non-EFI
+ * build.
+ */
+EFI_SYSTEM_TABLE * _C2 ( PLATFORM, _systab );
 
 /** EFI shutdown is in progress */
 int efi_shutdown_in_progress;