diff options
authorMatt Fleming <matt.fleming@intel.com>2013-06-19 13:44:25 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-06-19 14:26:19 +0100
commit9b8f1d3f3bfa72e8375c16137cc15eac579ed256 (patch)
parentdb25b06af0a4be7231a120d53b24cc01e17ed315 (diff)
efi: Mark global BIOS-only symbols as __weak
Unfortunately, there are still some references in generic code to symbols that only make sense under BIOS. Use the __weak tag to allow building for EFI without having to declare these symbols. Accessing these __weak symbols under EFI will generate an error at runtime, indicating to the user that they're executing a BIOS code path. The long-term solution is to move these BIOS-specific symbols into core/bios.c or somewhere equally BIOS-centric so that these symbols are no longer global. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2 files changed, 10 insertions, 8 deletions
diff --git a/core/include/core.h b/core/include/core.h
index 1d20040a..3a63aac7 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -22,14 +22,20 @@ extern char CurrentDirName[];
extern char SubvolName[];
extern char ConfigName[];
extern char config_cwd[];
-extern char KernelName[];
extern char cmd_line[];
extern char ConfigFile[];
extern char syslinux_banner[];
extern char copyright_str[];
-extern uint16_t BIOSName;
-extern char StackBuf[];
-extern unsigned int __bcopyxx_len;
+ * Mark symbols that are only used by BIOS as __weak until we can move
+ * all references out of the generic (EFI + BIOS) code and into
+ * BIOS-specific code.
+ */
+extern __weak uint16_t BIOSName;
+extern __weak char KernelName[];
+extern __weak char StackBuf[];
+extern __weak unsigned int __bcopyxx_len;
extern uint8_t KbdMap[256];
diff --git a/efi/main.c b/efi/main.c
index 27e7f8f3..81a84a46 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -10,7 +10,6 @@
#include "efi.h"
#include "fio.h"
-char KernelName[FILENAME_MAX];
uint16_t PXERetry;
char copyright_str[] = "Copyright (C) 2011\n";
uint8_t SerialNotice = 1;
@@ -24,7 +23,6 @@ uint32_t BIOS_timer_next;
uint32_t timer_irq;
uint8_t KbdMap[256];
char aux_seg[256];
-uint16_t BIOSName;
static inline EFI_STATUS
efi_close_protocol(EFI_HANDLE handle, EFI_GUID *guid, EFI_HANDLE agent,
@@ -156,9 +154,7 @@ size_t numIPAppends = 0;
const uint16_t IPAppends[32];
uint16_t BIOS_fbm = 1;
far_ptr_t InitStack;
-char StackBuf[4096];
far_ptr_t PXEEntry;
-unsigned int __bcopyxx_len = 0;
void gpxe_unload(void)