Browse Source

[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>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
030e5a064e

+ 4
- 4
src/Makefile.housekeeping View File

656
 #		   ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
656
 #		   ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
657
 #
657
 #
658
 TGT_LD_DRIVERS	= $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
658
 TGT_LD_DRIVERS	= $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
659
-TGT_LD_PREFIX	= obj_$(TGT_PREFIX)prefix
660
 TGT_LD_IDS	= pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
659
 TGT_LD_IDS	= pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
661
 		  pci_device_id=$(firstword $(TGT_PCI_DEVICE) 0)
660
 		  pci_device_id=$(firstword $(TGT_PCI_DEVICE) 0)
661
+TGT_LD_ENTRY	= _$(TGT_PREFIX)_start
662
 
662
 
663
 # Calculate linker flags based on link-time options for the current
663
 # Calculate linker flags based on link-time options for the current
664
 # target type (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the
664
 # target type (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the
668
 #		 "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
668
 #		 "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
669
 #		  --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
669
 #		  --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
670
 #
670
 #
671
-TGT_LD_FLAGS	= $(foreach SYM,$(TGT_LD_PREFIX) $(TGT_LD_DRIVERS) obj_config,\
671
+TGT_LD_FLAGS	= $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) obj_config,\
672
 		    -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
672
 		    -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
673
 		  $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
673
 		  $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
674
-		  $(TGT_LD_FLAGS_PRE)
674
+		  -e $(TGT_LD_ENTRY)
675
 
675
 
676
 # Calculate list of debugging versions of objects to be included in
676
 # Calculate list of debugging versions of objects to be included in
677
 # the target.
677
 # the target.
698
 	@$(ECHO) 'PCI device           : $(TGT_PCI_DEVICE)'
698
 	@$(ECHO) 'PCI device           : $(TGT_PCI_DEVICE)'
699
 	@$(ECHO)
699
 	@$(ECHO)
700
 	@$(ECHO) 'LD driver symbols    : $(TGT_LD_DRIVERS)'
700
 	@$(ECHO) 'LD driver symbols    : $(TGT_LD_DRIVERS)'
701
-	@$(ECHO) 'LD prefix symbols    : $(TGT_LD_PREFIX)'
702
 	@$(ECHO) 'LD ID symbols        : $(TGT_LD_IDS)'
701
 	@$(ECHO) 'LD ID symbols        : $(TGT_LD_IDS)'
702
+	@$(ECHO) 'LD entry point       : $(TGT_LD_ENTRY)'
703
 	@$(ECHO)
703
 	@$(ECHO)
704
 	@$(ECHO) 'LD target flags      : $(TGT_LD_FLAGS)'
704
 	@$(ECHO) 'LD target flags      : $(TGT_LD_FLAGS)'
705
 	@$(ECHO)
705
 	@$(ECHO)

+ 2
- 2
src/arch/i386/prefix/dskprefix.S View File

27
 	.text
27
 	.text
28
 	.section ".prefix", "ax", @progbits
28
 	.section ".prefix", "ax", @progbits
29
 	.code16
29
 	.code16
30
-	.globl	start
31
-start:
30
+	.globl	_dsk_start
31
+_dsk_start:
32
 
32
 
33
 	jmp	$BOOTSEG, $go		/* reload cs:ip to match relocation addr */
33
 	jmp	$BOOTSEG, $go		/* reload cs:ip to match relocation addr */
34
 go: 
34
 go: 

+ 2
- 2
src/arch/i386/prefix/hdprefix.S View File

5
 	.section ".prefix", "awx", @progbits
5
 	.section ".prefix", "awx", @progbits
6
 	.code16
6
 	.code16
7
 	.org 0
7
 	.org 0
8
-	.globl	start
9
-start:
8
+	.globl	_hd_start
9
+_hd_start:
10
 
10
 
11
 	movw	$load_image, %bp
11
 	movw	$load_image, %bp
12
 	jmp	find_active_partition
12
 	jmp	find_active_partition

+ 1
- 0
src/arch/i386/prefix/kkpxeprefix.S View File

10
 
10
 
11
 #define PXELOADER_KEEP_UNDI
11
 #define PXELOADER_KEEP_UNDI
12
 #define PXELOADER_KEEP_PXE
12
 #define PXELOADER_KEEP_PXE
13
+#define _pxe_start _kkpxe_start
13
 #include "pxeprefix.S"
14
 #include "pxeprefix.S"

+ 1
- 0
src/arch/i386/prefix/kpxeprefix.S View File

6
 FILE_LICENCE ( GPL2_OR_LATER )
6
 FILE_LICENCE ( GPL2_OR_LATER )
7
 
7
 
8
 #define PXELOADER_KEEP_UNDI
8
 #define PXELOADER_KEEP_UNDI
9
+#define _pxe_start _kpxe_start
9
 #include "pxeprefix.S"
10
 #include "pxeprefix.S"

+ 3
- 3
src/arch/i386/prefix/linuxprefix.S View File

2
 
2
 
3
 	.section ".text"
3
 	.section ".text"
4
 	.code32
4
 	.code32
5
-	.globl _start
6
-	.type _start, @function
5
+	.globl _linux_start
6
+	.type _linux_start, @function
7
 
7
 
8
-_start:
8
+_linux_start:
9
 	xorl	%ebp, %ebp
9
 	xorl	%ebp, %ebp
10
 
10
 
11
 	popl	%esi       // save argc
11
 	popl	%esi       // save argc

+ 2
- 2
src/arch/i386/prefix/lkrnprefix.S View File

49
 	.arch i386
49
 	.arch i386
50
 	.org	0
50
 	.org	0
51
 	.section ".prefix", "ax", @progbits
51
 	.section ".prefix", "ax", @progbits
52
-	.globl	start
53
-start:
52
+	.globl	_lkrn_start
53
+_lkrn_start:
54
 /* 
54
 /* 
55
 	This is a minimal boot sector.	If anyone tries to execute it (e.g., if
55
 	This is a minimal boot sector.	If anyone tries to execute it (e.g., if
56
 	a .lilo file is dd'ed to a floppy), print an error message. 
56
 	a .lilo file is dd'ed to a floppy), print an error message. 

+ 1
- 0
src/arch/i386/prefix/mromprefix.S View File

30
 #define PCI_BAR_EXPROM			0x30
30
 #define PCI_BAR_EXPROM			0x30
31
 
31
 
32
 #define ROMPREFIX_EXCLUDE_PAYLOAD 1
32
 #define ROMPREFIX_EXCLUDE_PAYLOAD 1
33
+#define _rom_start _mrom_start
33
 #include "romprefix.S"
34
 #include "romprefix.S"
34
 
35
 
35
 	.text
36
 	.text

+ 3
- 3
src/arch/i386/prefix/nbiprefix.S View File

17
 	.byte	0
17
 	.byte	0
18
 	.byte	0		/* No flags */
18
 	.byte	0		/* No flags */
19
 	.word	0x0000, 0x07c0	/* Load header to 0x07c0:0x0000 */
19
 	.word	0x0000, 0x07c0	/* Load header to 0x07c0:0x0000 */
20
-	.word	start, 0x07c0	/* Start execution at 0x07c0:entry */
20
+	.word	_nbi_start, 0x07c0	/* Start execution at 0x07c0:entry */
21
 	.size	file_header, . - file_header
21
 	.size	file_header, . - file_header
22
 
22
 
23
 /*****************************************************************************
23
 /*****************************************************************************
49
  * NBI entry point
49
  * NBI entry point
50
  *****************************************************************************
50
  *****************************************************************************
51
  */
51
  */
52
-	.globl	start
53
-start:
52
+	.globl	_nbi_start
53
+_nbi_start:
54
 	/* Install iPXE */
54
 	/* Install iPXE */
55
 	call	install
55
 	call	install
56
 
56
 

+ 2
- 2
src/arch/i386/prefix/pxeprefix.S View File

24
  *****************************************************************************
24
  *****************************************************************************
25
  */
25
  */
26
 	.section ".prefix", "ax", @progbits
26
 	.section ".prefix", "ax", @progbits
27
-	.globl	start
28
-start:
27
+	.globl	_pxe_start
28
+_pxe_start:
29
 	jmp	$0x7c0, $1f
29
 	jmp	$0x7c0, $1f
30
 1:
30
 1:
31
 	/* Preserve registers for possible return to PXE */
31
 	/* Preserve registers for possible return to PXE */

+ 2
- 2
src/arch/i386/prefix/romprefix.S View File

45
 	.code16
45
 	.code16
46
 	.arch i386
46
 	.arch i386
47
 	.section ".prefix", "ax", @progbits
47
 	.section ".prefix", "ax", @progbits
48
-	.globl	start
49
-start:
48
+	.globl	_rom_start
49
+_rom_start:
50
 	
50
 	
51
 	.org	0x00
51
 	.org	0x00
52
 romheader:
52
 romheader:

+ 0
- 1
src/arch/i386/scripts/i386-kir.lds View File

7
 
7
 
8
 OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
8
 OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
9
 OUTPUT_ARCH ( i386 )
9
 OUTPUT_ARCH ( i386 )
10
-ENTRY ( _entry )
11
 
10
 
12
 SECTIONS {
11
 SECTIONS {
13
 
12
 

+ 0
- 2
src/arch/i386/scripts/i386.lds View File

5
  *
5
  *
6
  */
6
  */
7
 
7
 
8
-ENTRY ( start )
9
-
10
 SECTIONS {
8
 SECTIONS {
11
 
9
 
12
     /* Each section starts at a virtual address of zero.
10
     /* Each section starts at a virtual address of zero.

+ 0
- 2
src/arch/i386/scripts/linux.lds View File

8
 OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
8
 OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" )
9
 OUTPUT_ARCH ( i386 )
9
 OUTPUT_ARCH ( i386 )
10
 
10
 
11
-ENTRY ( _start )
12
-
13
 SECTIONS {
11
 SECTIONS {
14
 	_max_align = 32;
12
 	_max_align = 32;
15
 
13
 

+ 0
- 4
src/arch/x86/Makefile.efi View File

13
 NON_AUTO_MEDIA	+= efi
13
 NON_AUTO_MEDIA	+= efi
14
 NON_AUTO_MEDIA	+= efidrv
14
 NON_AUTO_MEDIA	+= efidrv
15
 
15
 
16
-# Specify entry point
17
-#
18
-TGT_LD_FLAGS_PRE = -e _$(TGT_PREFIX)_start
19
-
20
 # Rules for building EFI files
16
 # Rules for building EFI files
21
 #
17
 #
22
 $(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
18
 $(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)

+ 3
- 3
src/arch/x86_64/prefix/linuxprefix.S View File

2
 
2
 
3
 	.section ".text"
3
 	.section ".text"
4
 	.code64
4
 	.code64
5
-	.globl _start
6
-	.type _start, @function
5
+	.globl _linux_start
6
+	.type _linux_start, @function
7
 
7
 
8
-_start:
8
+_linux_start:
9
 	xorq	%rbp, %rbp
9
 	xorq	%rbp, %rbp
10
 
10
 
11
 	popq	%rdi       // argc -> C arg1
11
 	popq	%rdi       // argc -> C arg1

+ 0
- 2
src/arch/x86_64/scripts/linux.lds View File

8
 OUTPUT_FORMAT ( "elf64-x86-64", "elf64-x86-64", "elf64-x86-64" )
8
 OUTPUT_FORMAT ( "elf64-x86-64", "elf64-x86-64", "elf64-x86-64" )
9
 OUTPUT_ARCH ( i386:x86-64 )
9
 OUTPUT_ARCH ( i386:x86-64 )
10
 
10
 
11
-ENTRY ( _start )
12
-
13
 SECTIONS {
11
 SECTIONS {
14
 	_max_align = 32;
12
 	_max_align = 32;
15
 
13
 

Loading…
Cancel
Save