Skip to content

Commit

Permalink
[efi] Prevent EFI code from being linked in to non-EFI builds
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed May 19, 2017
1 parent 7457bfc commit de37652
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/interface/efi/efi_init.c
Expand Up @@ -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;
Expand Down

0 comments on commit de37652

Please sign in to comment.