summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorPiotr Jaroszyński2010-03-30 18:18:43 +0200
committerMichael Brown2010-05-27 11:38:12 +0200
commitc68839d4d69742ac21c430aca8a9a4de81dd6ca5 (patch)
treee5cc42d7e05387c02bab34e060502adf782e2e2d /src/arch
parent[compiler] Fix 64bit compile time errors (diff)
downloadipxe-c68839d4d69742ac21c430aca8a9a4de81dd6ca5.tar.gz
ipxe-c68839d4d69742ac21c430aca8a9a4de81dd6ca5.tar.xz
ipxe-c68839d4d69742ac21c430aca8a9a4de81dd6ca5.zip
[efi] Fix .efi and .efidrv linking
The linker chooses to look for _start first and always picks efidrvprefix.o to satisfy it (probably because it's earlier in the archive) which causes a multiple definition error when the linker later has to pick efiprefix.o for other symbols. Fix by using EFI-specific TGT_LD_FLAGS with an explicit entry point. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Joshua Oreman <oremanj@rwcr.net> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/Makefile.efi4
-rw-r--r--src/arch/x86/prefix/efidrvprefix.c4
-rw-r--r--src/arch/x86/prefix/efiprefix.c4
-rw-r--r--src/arch/x86/scripts/efi.lds2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/arch/x86/Makefile.efi b/src/arch/x86/Makefile.efi
index bef8d59d8..4f0c1b245 100644
--- a/src/arch/x86/Makefile.efi
+++ b/src/arch/x86/Makefile.efi
@@ -13,6 +13,10 @@ LDFLAGS += -q -S
NON_AUTO_MEDIA += efi
NON_AUTO_MEDIA += efidrv
+# Specify entry point
+#
+TGT_LD_FLAGS_PRE = -e _$(TGT_PREFIX)_start
+
# Rules for building EFI files
#
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
diff --git a/src/arch/x86/prefix/efidrvprefix.c b/src/arch/x86/prefix/efidrvprefix.c
index 1de08a37a..2215104b0 100644
--- a/src/arch/x86/prefix/efidrvprefix.c
+++ b/src/arch/x86/prefix/efidrvprefix.c
@@ -29,8 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v systab System table
* @ret efirc EFI return status code
*/
-EFI_STATUS EFIAPI _start ( EFI_HANDLE image_handle,
- EFI_SYSTEM_TABLE *systab ) {
+EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle,
+ EFI_SYSTEM_TABLE *systab ) {
EFI_STATUS efirc;
/* Initialise EFI environment */
diff --git a/src/arch/x86/prefix/efiprefix.c b/src/arch/x86/prefix/efiprefix.c
index 61a9fc643..1515c6fc4 100644
--- a/src/arch/x86/prefix/efiprefix.c
+++ b/src/arch/x86/prefix/efiprefix.c
@@ -28,8 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v systab System table
* @ret efirc EFI return status code
*/
-EFI_STATUS EFIAPI _start ( EFI_HANDLE image_handle,
- EFI_SYSTEM_TABLE *systab ) {
+EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
+ EFI_SYSTEM_TABLE *systab ) {
EFI_STATUS efirc;
/* Initialise EFI environment */
diff --git a/src/arch/x86/scripts/efi.lds b/src/arch/x86/scripts/efi.lds
index 7525b81b0..4368f7325 100644
--- a/src/arch/x86/scripts/efi.lds
+++ b/src/arch/x86/scripts/efi.lds
@@ -5,8 +5,6 @@
*
*/
-ENTRY ( _start )
-
SECTIONS {
/* The file starts at a virtual address of zero, and sections are