mirror of https://github.com/ipxe/ipxe.git
[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>pull/1/head
parent
295c2fd671
commit
030e5a064e
|
@ -656,9 +656,9 @@ TGT_PCI_DEVICE = $(PCI_DEVICE_$(TGT_ROM_NAME))
|
||||||
# ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
|
# ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
|
||||||
#
|
#
|
||||||
TGT_LD_DRIVERS = $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
|
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) \
|
TGT_LD_IDS = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
|
||||||
pci_device_id=$(firstword $(TGT_PCI_DEVICE) 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
|
# Calculate linker flags based on link-time options for the current
|
||||||
# target type (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the
|
# 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
|
# "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
|
||||||
# --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
|
# --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) ) \
|
-u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
|
||||||
$(patsubst %,--defsym %,$(TGT_LD_IDS)) \
|
$(patsubst %,--defsym %,$(TGT_LD_IDS)) \
|
||||||
$(TGT_LD_FLAGS_PRE)
|
-e $(TGT_LD_ENTRY)
|
||||||
|
|
||||||
# Calculate list of debugging versions of objects to be included in
|
# Calculate list of debugging versions of objects to be included in
|
||||||
# the target.
|
# the target.
|
||||||
|
@ -698,8 +698,8 @@ $(BIN)/%.info :
|
||||||
@$(ECHO) 'PCI device : $(TGT_PCI_DEVICE)'
|
@$(ECHO) 'PCI device : $(TGT_PCI_DEVICE)'
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@$(ECHO) 'LD driver symbols : $(TGT_LD_DRIVERS)'
|
@$(ECHO) 'LD driver symbols : $(TGT_LD_DRIVERS)'
|
||||||
@$(ECHO) 'LD prefix symbols : $(TGT_LD_PREFIX)'
|
|
||||||
@$(ECHO) 'LD ID symbols : $(TGT_LD_IDS)'
|
@$(ECHO) 'LD ID symbols : $(TGT_LD_IDS)'
|
||||||
|
@$(ECHO) 'LD entry point : $(TGT_LD_ENTRY)'
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@$(ECHO) 'LD target flags : $(TGT_LD_FLAGS)'
|
@$(ECHO) 'LD target flags : $(TGT_LD_FLAGS)'
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
|
|
|
@ -27,8 +27,8 @@ FILE_LICENCE ( GPL2_ONLY )
|
||||||
.text
|
.text
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.code16
|
.code16
|
||||||
.globl start
|
.globl _dsk_start
|
||||||
start:
|
_dsk_start:
|
||||||
|
|
||||||
jmp $BOOTSEG, $go /* reload cs:ip to match relocation addr */
|
jmp $BOOTSEG, $go /* reload cs:ip to match relocation addr */
|
||||||
go:
|
go:
|
||||||
|
|
|
@ -5,8 +5,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
.code16
|
.code16
|
||||||
.org 0
|
.org 0
|
||||||
.globl start
|
.globl _hd_start
|
||||||
start:
|
_hd_start:
|
||||||
|
|
||||||
movw $load_image, %bp
|
movw $load_image, %bp
|
||||||
jmp find_active_partition
|
jmp find_active_partition
|
||||||
|
|
|
@ -10,4 +10,5 @@ REQUEST_OBJECT ( pxeparent_dhcp )
|
||||||
|
|
||||||
#define PXELOADER_KEEP_UNDI
|
#define PXELOADER_KEEP_UNDI
|
||||||
#define PXELOADER_KEEP_PXE
|
#define PXELOADER_KEEP_PXE
|
||||||
|
#define _pxe_start _kkpxe_start
|
||||||
#include "pxeprefix.S"
|
#include "pxeprefix.S"
|
||||||
|
|
|
@ -6,4 +6,5 @@
|
||||||
FILE_LICENCE ( GPL2_OR_LATER )
|
FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
|
|
||||||
#define PXELOADER_KEEP_UNDI
|
#define PXELOADER_KEEP_UNDI
|
||||||
|
#define _pxe_start _kpxe_start
|
||||||
#include "pxeprefix.S"
|
#include "pxeprefix.S"
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
.section ".text"
|
.section ".text"
|
||||||
.code32
|
.code32
|
||||||
.globl _start
|
.globl _linux_start
|
||||||
.type _start, @function
|
.type _linux_start, @function
|
||||||
|
|
||||||
_start:
|
_linux_start:
|
||||||
xorl %ebp, %ebp
|
xorl %ebp, %ebp
|
||||||
|
|
||||||
popl %esi // save argc
|
popl %esi // save argc
|
||||||
|
|
|
@ -49,8 +49,8 @@ FILE_LICENCE ( GPL_ANY )
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.globl start
|
.globl _lkrn_start
|
||||||
start:
|
_lkrn_start:
|
||||||
/*
|
/*
|
||||||
This is a minimal boot sector. If anyone tries to execute it (e.g., if
|
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.
|
a .lilo file is dd'ed to a floppy), print an error message.
|
||||||
|
|
|
@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
#define PCI_BAR_EXPROM 0x30
|
#define PCI_BAR_EXPROM 0x30
|
||||||
|
|
||||||
#define ROMPREFIX_EXCLUDE_PAYLOAD 1
|
#define ROMPREFIX_EXCLUDE_PAYLOAD 1
|
||||||
|
#define _rom_start _mrom_start
|
||||||
#include "romprefix.S"
|
#include "romprefix.S"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
|
@ -17,7 +17,7 @@ file_header:
|
||||||
.byte 0
|
.byte 0
|
||||||
.byte 0 /* No flags */
|
.byte 0 /* No flags */
|
||||||
.word 0x0000, 0x07c0 /* Load header to 0x07c0:0x0000 */
|
.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
|
.size file_header, . - file_header
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -49,8 +49,8 @@ memlen: .long -512
|
||||||
* NBI entry point
|
* NBI entry point
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*/
|
*/
|
||||||
.globl start
|
.globl _nbi_start
|
||||||
start:
|
_nbi_start:
|
||||||
/* Install iPXE */
|
/* Install iPXE */
|
||||||
call install
|
call install
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*/
|
*/
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.globl start
|
.globl _pxe_start
|
||||||
start:
|
_pxe_start:
|
||||||
jmp $0x7c0, $1f
|
jmp $0x7c0, $1f
|
||||||
1:
|
1:
|
||||||
/* Preserve registers for possible return to PXE */
|
/* Preserve registers for possible return to PXE */
|
||||||
|
|
|
@ -45,8 +45,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
.code16
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.globl start
|
.globl _rom_start
|
||||||
start:
|
_rom_start:
|
||||||
|
|
||||||
.org 0x00
|
.org 0x00
|
||||||
romheader:
|
romheader:
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
|
OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
|
||||||
OUTPUT_ARCH ( i386 )
|
OUTPUT_ARCH ( i386 )
|
||||||
ENTRY ( _entry )
|
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ENTRY ( start )
|
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
|
|
||||||
/* Each section starts at a virtual address of zero.
|
/* Each section starts at a virtual address of zero.
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
|
OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
|
||||||
OUTPUT_ARCH ( i386 )
|
OUTPUT_ARCH ( i386 )
|
||||||
|
|
||||||
ENTRY ( _start )
|
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
_max_align = 32;
|
_max_align = 32;
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,6 @@ LDFLAGS += -q -S
|
||||||
NON_AUTO_MEDIA += efi
|
NON_AUTO_MEDIA += efi
|
||||||
NON_AUTO_MEDIA += efidrv
|
NON_AUTO_MEDIA += efidrv
|
||||||
|
|
||||||
# Specify entry point
|
|
||||||
#
|
|
||||||
TGT_LD_FLAGS_PRE = -e _$(TGT_PREFIX)_start
|
|
||||||
|
|
||||||
# Rules for building EFI files
|
# Rules for building EFI files
|
||||||
#
|
#
|
||||||
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
|
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
.section ".text"
|
.section ".text"
|
||||||
.code64
|
.code64
|
||||||
.globl _start
|
.globl _linux_start
|
||||||
.type _start, @function
|
.type _linux_start, @function
|
||||||
|
|
||||||
_start:
|
_linux_start:
|
||||||
xorq %rbp, %rbp
|
xorq %rbp, %rbp
|
||||||
|
|
||||||
popq %rdi // argc -> C arg1
|
popq %rdi // argc -> C arg1
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
OUTPUT_FORMAT ( "elf64-x86-64", "elf64-x86-64", "elf64-x86-64" )
|
OUTPUT_FORMAT ( "elf64-x86-64", "elf64-x86-64", "elf64-x86-64" )
|
||||||
OUTPUT_ARCH ( i386:x86-64 )
|
OUTPUT_ARCH ( i386:x86-64 )
|
||||||
|
|
||||||
ENTRY ( _start )
|
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
_max_align = 32;
|
_max_align = 32;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue