]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Fix .efi and .efidrv linking
authorPiotr Jaroszyński <p.jaroszynski@gmail.com>
Tue, 30 Mar 2010 16:18:43 +0000 (18:18 +0200)
committerMichael Brown <mcb30@ipxe.org>
Thu, 27 May 2010 09:38:12 +0000 (10:38 +0100)
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>
src/Makefile.housekeeping
src/arch/x86/Makefile.efi
src/arch/x86/prefix/efidrvprefix.c
src/arch/x86/prefix/efiprefix.c
src/arch/x86/scripts/efi.lds

index 8139672455c7f96dde55d6c6e1560a39ee1ff446..fbb274fff25d8ba8e297c01b41057781a5899e36 100644 (file)
@@ -612,7 +612,8 @@ TGT_LD_IDS  = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
 #
 TGT_LD_FLAGS   = $(foreach SYM,$(TGT_LD_PREFIX) $(TGT_LD_DRIVERS) obj_config,\
                    -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
-                 $(patsubst %,--defsym %,$(TGT_LD_IDS))
+                 $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
+                 $(TGT_LD_FLAGS_PRE)
 
 # Calculate list of debugging versions of objects to be included in
 # the target.
index bef8d59d8de43980e4e786cb8c7eb9bb3e781320..4f0c1b245235fc148f27c02e52f8806badac3dfe 100644 (file)
@@ -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)
index 1de08a37a8e0ed120386d6e5ec7afc6a5d1bceae..2215104b04e422c2ed24bd069aa0d904887a21f5 100644 (file)
@@ -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 */
index 61a9fc643fae9ef1db75fa585ff3fbf4f8e89915..1515c6fc48aac7d6cbe4f3235d1677d61edda0fe 100644 (file)
@@ -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 */
index 7525b81b069af341f87cf53ae8c81331685baa79..4368f73257d7f6edbe05efe576d2d4e7eb2ad249 100644 (file)
@@ -5,8 +5,6 @@
  *
  */
 
-ENTRY ( _start )
-
 SECTIONS {
 
     /* The file starts at a virtual address of zero, and sections are