]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Use unique entry symbols for each prefix
authorMichael Brown <mcb30@ipxe.org>
Wed, 23 Feb 2011 21:12:56 +0000 (21:12 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 23 Feb 2011 21:12:56 +0000 (21:12 +0000)
Some binutils versions will drag in an object to satisfy the entry
symbol; some won't.  Try to cope with this exciting variety of
behaviour by ensuring that all entry symbols are unique.

Remove the explicit inclusion of the prefix object on the linker
command line, since the entry symbol now provides all the information
needed to identify the prefix.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
17 files changed:
src/Makefile.housekeeping
src/arch/i386/prefix/dskprefix.S
src/arch/i386/prefix/hdprefix.S
src/arch/i386/prefix/kkpxeprefix.S
src/arch/i386/prefix/kpxeprefix.S
src/arch/i386/prefix/linuxprefix.S
src/arch/i386/prefix/lkrnprefix.S
src/arch/i386/prefix/mromprefix.S
src/arch/i386/prefix/nbiprefix.S
src/arch/i386/prefix/pxeprefix.S
src/arch/i386/prefix/romprefix.S
src/arch/i386/scripts/i386-kir.lds
src/arch/i386/scripts/i386.lds
src/arch/i386/scripts/linux.lds
src/arch/x86/Makefile.efi
src/arch/x86_64/prefix/linuxprefix.S
src/arch/x86_64/scripts/linux.lds

index c4350671afffc2d7c17ea0980bd57b0c49e3497e..0570f018a30afa2f6f3900746e1bd57337527d5a 100644 (file)
@@ -656,9 +656,9 @@ TGT_PCI_DEVICE      = $(PCI_DEVICE_$(TGT_ROM_NAME))
 #                 ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
 #
 TGT_LD_DRIVERS = $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
-TGT_LD_PREFIX  = obj_$(TGT_PREFIX)prefix
 TGT_LD_IDS     = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
                  pci_device_id=$(firstword $(TGT_PCI_DEVICE) 0)
+TGT_LD_ENTRY   = _$(TGT_PREFIX)_start
 
 # Calculate linker flags based on link-time options for the current
 # target type (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the
@@ -668,10 +668,10 @@ TGT_LD_IDS        = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
 #               "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
 #                --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
 #
-TGT_LD_FLAGS   = $(foreach SYM,$(TGT_LD_PREFIX) $(TGT_LD_DRIVERS) obj_config,\
+TGT_LD_FLAGS   = $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) obj_config,\
                    -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
                  $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
-                 $(TGT_LD_FLAGS_PRE)
+                 -e $(TGT_LD_ENTRY)
 
 # Calculate list of debugging versions of objects to be included in
 # the target.
@@ -698,8 +698,8 @@ $(BIN)/%.info :
        @$(ECHO) 'PCI device           : $(TGT_PCI_DEVICE)'
        @$(ECHO)
        @$(ECHO) 'LD driver symbols    : $(TGT_LD_DRIVERS)'
-       @$(ECHO) 'LD prefix symbols    : $(TGT_LD_PREFIX)'
        @$(ECHO) 'LD ID symbols        : $(TGT_LD_IDS)'
+       @$(ECHO) 'LD entry point       : $(TGT_LD_ENTRY)'
        @$(ECHO)
        @$(ECHO) 'LD target flags      : $(TGT_LD_FLAGS)'
        @$(ECHO)
index 78a108b55ad21770b99ca3043b0b6144f54d84d4..7aa017ccdfc5a09bd192b358a9ad6b3af936600b 100644 (file)
@@ -27,8 +27,8 @@ FILE_LICENCE ( GPL2_ONLY )
        .text
        .section ".prefix", "ax", @progbits
        .code16
-       .globl  start
-start:
+       .globl  _dsk_start
+_dsk_start:
 
        jmp     $BOOTSEG, $go           /* reload cs:ip to match relocation addr */
 go: 
index a471aa0df90cf54b73d74eb0d34eb93a2af26997..876bfe1bee2ca120c5da23b0789b73770b1a0eb5 100644 (file)
@@ -5,8 +5,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
        .section ".prefix", "awx", @progbits
        .code16
        .org 0
-       .globl  start
-start:
+       .globl  _hd_start
+_hd_start:
 
        movw    $load_image, %bp
        jmp     find_active_partition
index 02cc6feea688b6871616e9398cb4bc546e00035a..d177d7d6203ccfe764183cebc5a6f61b8a674c1a 100644 (file)
@@ -10,4 +10,5 @@ REQUEST_OBJECT ( pxeparent_dhcp )
 
 #define PXELOADER_KEEP_UNDI
 #define PXELOADER_KEEP_PXE
+#define _pxe_start _kkpxe_start
 #include "pxeprefix.S"
index 923facccd59ba2f25b39cfbd274859d47ead273e..c75608172af05df2682cbc930b9f36565727b08e 100644 (file)
@@ -6,4 +6,5 @@
 FILE_LICENCE ( GPL2_OR_LATER )
 
 #define PXELOADER_KEEP_UNDI
+#define _pxe_start _kpxe_start
 #include "pxeprefix.S"
index b32b08f2e8f2d7ab203e91d1cfb32ed0cd3f6f81..ff22e9feed4b09e6538b20cd9b60d7caaf67d96b 100644 (file)
@@ -2,10 +2,10 @@
 
        .section ".text"
        .code32
-       .globl _start
-       .type _start, @function
+       .globl _linux_start
+       .type _linux_start, @function
 
-_start:
+_linux_start:
        xorl    %ebp, %ebp
 
        popl    %esi       // save argc
index 7577a8a16330edd37bafffb3562ab663bf85b964..008c79efd7da4345f5ff2dc334d0731234187ea1 100644 (file)
@@ -49,8 +49,8 @@ FILE_LICENCE ( GPL_ANY )
        .arch i386
        .org    0
        .section ".prefix", "ax", @progbits
-       .globl  start
-start:
+       .globl  _lkrn_start
+_lkrn_start:
 /* 
        This is a minimal boot sector.  If anyone tries to execute it (e.g., if
        a .lilo file is dd'ed to a floppy), print an error message. 
index 3e177d001fa7cedd193d98a321cdd001c4010058..7bbe44c4ea1ceed59df97b1fb2b97e271abed386 100644 (file)
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER )
 #define PCI_BAR_EXPROM                 0x30
 
 #define ROMPREFIX_EXCLUDE_PAYLOAD 1
+#define _rom_start _mrom_start
 #include "romprefix.S"
 
        .text
index b93170e50cb8e6a4ba4791ed48fafc14a7f11d51..01dce90fb615ddba560845041192dbeb4c0f6d27 100644 (file)
@@ -17,7 +17,7 @@ file_header:
        .byte   0
        .byte   0               /* No flags */
        .word   0x0000, 0x07c0  /* Load header to 0x07c0:0x0000 */
-       .word   start, 0x07c0   /* Start execution at 0x07c0:entry */
+       .word   _nbi_start, 0x07c0      /* Start execution at 0x07c0:entry */
        .size   file_header, . - file_header
 
 /*****************************************************************************
@@ -49,8 +49,8 @@ memlen:       .long   -512
  * NBI entry point
  *****************************************************************************
  */
-       .globl  start
-start:
+       .globl  _nbi_start
+_nbi_start:
        /* Install iPXE */
        call    install
 
index 0bfd0ae3a912c2a0af8fba48f0b56b80ad6287ae..b7468cdf05b50a10a7600d1e5f97c47a784286db 100644 (file)
@@ -24,8 +24,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
  *****************************************************************************
  */
        .section ".prefix", "ax", @progbits
-       .globl  start
-start:
+       .globl  _pxe_start
+_pxe_start:
        jmp     $0x7c0, $1f
 1:
        /* Preserve registers for possible return to PXE */
index 53af422a41f07b82b7810f86818a77638df62d93..ede0fb425cf936826360497aef0ef790b3d78927 100644 (file)
@@ -45,8 +45,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
        .code16
        .arch i386
        .section ".prefix", "ax", @progbits
-       .globl  start
-start:
+       .globl  _rom_start
+_rom_start:
        
        .org    0x00
 romheader:
index 620bc2fe37398ebf6b4ef6bd1ed8265ceb35b166..338d6ee878608276f6c3749ae8ec91cd8ae488c0 100644 (file)
@@ -7,7 +7,6 @@
 
 OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
 OUTPUT_ARCH ( i386 )
-ENTRY ( _entry )
 
 SECTIONS {
 
index dd07194cb748326952253dba98fbe67384563212..c5bc631fa92473063d2191ad2e825c07620f8e54 100644 (file)
@@ -5,8 +5,6 @@
  *
  */
 
-ENTRY ( start )
-
 SECTIONS {
 
     /* Each section starts at a virtual address of zero.
index 654f68e3097a468dd525dbb8f203744b3854249b..5501d93f76c847dd0050511ab2d299fb39ec063b 100644 (file)
@@ -8,8 +8,6 @@
 OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
 OUTPUT_ARCH ( i386 )
 
-ENTRY ( _start )
-
 SECTIONS {
        _max_align = 32;
 
index 4f0c1b245235fc148f27c02e52f8806badac3dfe..bef8d59d8de43980e4e786cb8c7eb9bb3e781320 100644 (file)
@@ -13,10 +13,6 @@ 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 4aa0b84032533fd85fc295d60b8dba8cb8e6d64d..713b9e38dd36ca54a3410771ece9ce664a8372cc 100644 (file)
@@ -2,10 +2,10 @@
 
        .section ".text"
        .code64
-       .globl _start
-       .type _start, @function
+       .globl _linux_start
+       .type _linux_start, @function
 
-_start:
+_linux_start:
        xorq    %rbp, %rbp
 
        popq    %rdi       // argc -> C arg1
index 3bcd7aa1bca7f9f1f5880b6df40cc869e1303138..ed32b7cf55b16ddc098920d056b4321c733acea2 100644 (file)
@@ -8,8 +8,6 @@
 OUTPUT_FORMAT ( "elf64-x86-64", "elf64-x86-64", "elf64-x86-64" )
 OUTPUT_ARCH ( i386:x86-64 )
 
-ENTRY ( _start )
-
 SECTIONS {
        _max_align = 32;