diff options
author | Michael Brown | 2011-02-23 22:12:56 +0100 |
---|---|---|
committer | Michael Brown | 2011-02-23 22:12:56 +0100 |
commit | 030e5a064e5f7252b3b77a27c78169f4a5c974c5 (patch) | |
tree | d6d310ab791f714a0d2da64543deb3cb6f261b4a | |
parent | [build] Ensure an entry point symbol exists in all builds (diff) | |
download | ipxe-030e5a064e5f7252b3b77a27c78169f4a5c974c5.tar.gz ipxe-030e5a064e5f7252b3b77a27c78169f4a5c974c5.tar.xz ipxe-030e5a064e5f7252b3b77a27c78169f4a5c974c5.zip |
[build] Use unique entry symbols for each prefix
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>
-rw-r--r-- | src/Makefile.housekeeping | 8 | ||||
-rw-r--r-- | src/arch/i386/prefix/dskprefix.S | 4 | ||||
-rw-r--r-- | src/arch/i386/prefix/hdprefix.S | 4 | ||||
-rw-r--r-- | src/arch/i386/prefix/kkpxeprefix.S | 1 | ||||
-rw-r--r-- | src/arch/i386/prefix/kpxeprefix.S | 1 | ||||
-rw-r--r-- | src/arch/i386/prefix/linuxprefix.S | 6 | ||||
-rw-r--r-- | src/arch/i386/prefix/lkrnprefix.S | 4 | ||||
-rw-r--r-- | src/arch/i386/prefix/mromprefix.S | 1 | ||||
-rw-r--r-- | src/arch/i386/prefix/nbiprefix.S | 6 | ||||
-rw-r--r-- | src/arch/i386/prefix/pxeprefix.S | 4 | ||||
-rw-r--r-- | src/arch/i386/prefix/romprefix.S | 4 | ||||
-rw-r--r-- | src/arch/i386/scripts/i386-kir.lds | 1 | ||||
-rw-r--r-- | src/arch/i386/scripts/i386.lds | 2 | ||||
-rw-r--r-- | src/arch/i386/scripts/linux.lds | 2 | ||||
-rw-r--r-- | src/arch/x86/Makefile.efi | 4 | ||||
-rw-r--r-- | src/arch/x86_64/prefix/linuxprefix.S | 6 | ||||
-rw-r--r-- | src/arch/x86_64/scripts/linux.lds | 2 |
17 files changed, 26 insertions, 34 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index c4350671..0570f018 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -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) diff --git a/src/arch/i386/prefix/dskprefix.S b/src/arch/i386/prefix/dskprefix.S index 78a108b5..7aa017cc 100644 --- a/src/arch/i386/prefix/dskprefix.S +++ b/src/arch/i386/prefix/dskprefix.S @@ -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: diff --git a/src/arch/i386/prefix/hdprefix.S b/src/arch/i386/prefix/hdprefix.S index a471aa0d..876bfe1b 100644 --- a/src/arch/i386/prefix/hdprefix.S +++ b/src/arch/i386/prefix/hdprefix.S @@ -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 diff --git a/src/arch/i386/prefix/kkpxeprefix.S b/src/arch/i386/prefix/kkpxeprefix.S index 02cc6fee..d177d7d6 100644 --- a/src/arch/i386/prefix/kkpxeprefix.S +++ b/src/arch/i386/prefix/kkpxeprefix.S @@ -10,4 +10,5 @@ REQUEST_OBJECT ( pxeparent_dhcp ) #define PXELOADER_KEEP_UNDI #define PXELOADER_KEEP_PXE +#define _pxe_start _kkpxe_start #include "pxeprefix.S" diff --git a/src/arch/i386/prefix/kpxeprefix.S b/src/arch/i386/prefix/kpxeprefix.S index 923faccc..c7560817 100644 --- a/src/arch/i386/prefix/kpxeprefix.S +++ b/src/arch/i386/prefix/kpxeprefix.S @@ -6,4 +6,5 @@ FILE_LICENCE ( GPL2_OR_LATER ) #define PXELOADER_KEEP_UNDI +#define _pxe_start _kpxe_start #include "pxeprefix.S" diff --git a/src/arch/i386/prefix/linuxprefix.S b/src/arch/i386/prefix/linuxprefix.S index b32b08f2..ff22e9fe 100644 --- a/src/arch/i386/prefix/linuxprefix.S +++ b/src/arch/i386/prefix/linuxprefix.S @@ -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 diff --git a/src/arch/i386/prefix/lkrnprefix.S b/src/arch/i386/prefix/lkrnprefix.S index 7577a8a1..008c79ef 100644 --- a/src/arch/i386/prefix/lkrnprefix.S +++ b/src/arch/i386/prefix/lkrnprefix.S @@ -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. diff --git a/src/arch/i386/prefix/mromprefix.S b/src/arch/i386/prefix/mromprefix.S index 3e177d00..7bbe44c4 100644 --- a/src/arch/i386/prefix/mromprefix.S +++ b/src/arch/i386/prefix/mromprefix.S @@ -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 diff --git a/src/arch/i386/prefix/nbiprefix.S b/src/arch/i386/prefix/nbiprefix.S index b93170e5..01dce90f 100644 --- a/src/arch/i386/prefix/nbiprefix.S +++ b/src/arch/i386/prefix/nbiprefix.S @@ -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 diff --git a/src/arch/i386/prefix/pxeprefix.S b/src/arch/i386/prefix/pxeprefix.S index 0bfd0ae3..b7468cdf 100644 --- a/src/arch/i386/prefix/pxeprefix.S +++ b/src/arch/i386/prefix/pxeprefix.S @@ -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 */ diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S index 53af422a..ede0fb42 100644 --- a/src/arch/i386/prefix/romprefix.S +++ b/src/arch/i386/prefix/romprefix.S @@ -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: diff --git a/src/arch/i386/scripts/i386-kir.lds b/src/arch/i386/scripts/i386-kir.lds index 620bc2fe..338d6ee8 100644 --- a/src/arch/i386/scripts/i386-kir.lds +++ b/src/arch/i386/scripts/i386-kir.lds @@ -7,7 +7,6 @@ OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" ) OUTPUT_ARCH ( i386 ) -ENTRY ( _entry ) SECTIONS { diff --git a/src/arch/i386/scripts/i386.lds b/src/arch/i386/scripts/i386.lds index dd07194c..c5bc631f 100644 --- a/src/arch/i386/scripts/i386.lds +++ b/src/arch/i386/scripts/i386.lds @@ -5,8 +5,6 @@ * */ -ENTRY ( start ) - SECTIONS { /* Each section starts at a virtual address of zero. diff --git a/src/arch/i386/scripts/linux.lds b/src/arch/i386/scripts/linux.lds index 654f68e3..5501d93f 100644 --- a/src/arch/i386/scripts/linux.lds +++ b/src/arch/i386/scripts/linux.lds @@ -8,8 +8,6 @@ OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" ) OUTPUT_ARCH ( i386 ) -ENTRY ( _start ) - SECTIONS { _max_align = 32; diff --git a/src/arch/x86/Makefile.efi b/src/arch/x86/Makefile.efi index 4f0c1b24..bef8d59d 100644 --- a/src/arch/x86/Makefile.efi +++ b/src/arch/x86/Makefile.efi @@ -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) diff --git a/src/arch/x86_64/prefix/linuxprefix.S b/src/arch/x86_64/prefix/linuxprefix.S index 4aa0b840..713b9e38 100644 --- a/src/arch/x86_64/prefix/linuxprefix.S +++ b/src/arch/x86_64/prefix/linuxprefix.S @@ -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 diff --git a/src/arch/x86_64/scripts/linux.lds b/src/arch/x86_64/scripts/linux.lds index 3bcd7aa1..ed32b7cf 100644 --- a/src/arch/x86_64/scripts/linux.lds +++ b/src/arch/x86_64/scripts/linux.lds @@ -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; |