Procházet zdrojové kódy

[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 před 13 roky
rodič
revize
030e5a064e

+ 4
- 4
src/Makefile.housekeeping Zobrazit soubor

@@ -656,9 +656,9 @@ TGT_PCI_DEVICE	= $(PCI_DEVICE_$(TGT_ROM_NAME))
656 656
 #		   ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
657 657
 #
658 658
 TGT_LD_DRIVERS	= $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
659
-TGT_LD_PREFIX	= obj_$(TGT_PREFIX)prefix
660 659
 TGT_LD_IDS	= pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
661 660
 		  pci_device_id=$(firstword $(TGT_PCI_DEVICE) 0)
661
+TGT_LD_ENTRY	= _$(TGT_PREFIX)_start
662 662
 
663 663
 # Calculate linker flags based on link-time options for the current
664 664
 # 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) \
668 668
 #		 "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
669 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 672
 		    -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
673 673
 		  $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
674
-		  $(TGT_LD_FLAGS_PRE)
674
+		  -e $(TGT_LD_ENTRY)
675 675
 
676 676
 # Calculate list of debugging versions of objects to be included in
677 677
 # the target.
@@ -698,8 +698,8 @@ $(BIN)/%.info :
698 698
 	@$(ECHO) 'PCI device           : $(TGT_PCI_DEVICE)'
699 699
 	@$(ECHO)
700 700
 	@$(ECHO) 'LD driver symbols    : $(TGT_LD_DRIVERS)'
701
-	@$(ECHO) 'LD prefix symbols    : $(TGT_LD_PREFIX)'
702 701
 	@$(ECHO) 'LD ID symbols        : $(TGT_LD_IDS)'
702
+	@$(ECHO) 'LD entry point       : $(TGT_LD_ENTRY)'
703 703
 	@$(ECHO)
704 704
 	@$(ECHO) 'LD target flags      : $(TGT_LD_FLAGS)'
705 705
 	@$(ECHO)

+ 2
- 2
src/arch/i386/prefix/dskprefix.S Zobrazit soubor

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

+ 2
- 2
src/arch/i386/prefix/hdprefix.S Zobrazit soubor

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

+ 1
- 0
src/arch/i386/prefix/kkpxeprefix.S Zobrazit soubor

@@ -10,4 +10,5 @@ REQUEST_OBJECT ( pxeparent_dhcp )
10 10
 
11 11
 #define PXELOADER_KEEP_UNDI
12 12
 #define PXELOADER_KEEP_PXE
13
+#define _pxe_start _kkpxe_start
13 14
 #include "pxeprefix.S"

+ 1
- 0
src/arch/i386/prefix/kpxeprefix.S Zobrazit soubor

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

+ 3
- 3
src/arch/i386/prefix/linuxprefix.S Zobrazit soubor

@@ -2,10 +2,10 @@
2 2
 
3 3
 	.section ".text"
4 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 9
 	xorl	%ebp, %ebp
10 10
 
11 11
 	popl	%esi       // save argc

+ 2
- 2
src/arch/i386/prefix/lkrnprefix.S Zobrazit soubor

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

+ 1
- 0
src/arch/i386/prefix/mromprefix.S Zobrazit soubor

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER )
30 30
 #define PCI_BAR_EXPROM			0x30
31 31
 
32 32
 #define ROMPREFIX_EXCLUDE_PAYLOAD 1
33
+#define _rom_start _mrom_start
33 34
 #include "romprefix.S"
34 35
 
35 36
 	.text

+ 3
- 3
src/arch/i386/prefix/nbiprefix.S Zobrazit soubor

@@ -17,7 +17,7 @@ file_header:
17 17
 	.byte	0
18 18
 	.byte	0		/* No flags */
19 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 21
 	.size	file_header, . - file_header
22 22
 
23 23
 /*****************************************************************************
@@ -49,8 +49,8 @@ memlen:	.long	-512
49 49
  * NBI entry point
50 50
  *****************************************************************************
51 51
  */
52
-	.globl	start
53
-start:
52
+	.globl	_nbi_start
53
+_nbi_start:
54 54
 	/* Install iPXE */
55 55
 	call	install
56 56
 

+ 2
- 2
src/arch/i386/prefix/pxeprefix.S Zobrazit soubor

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

+ 2
- 2
src/arch/i386/prefix/romprefix.S Zobrazit soubor

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

+ 0
- 1
src/arch/i386/scripts/i386-kir.lds Zobrazit soubor

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

+ 0
- 2
src/arch/i386/scripts/i386.lds Zobrazit soubor

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

+ 0
- 2
src/arch/i386/scripts/linux.lds Zobrazit soubor

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

+ 0
- 4
src/arch/x86/Makefile.efi Zobrazit soubor

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

+ 3
- 3
src/arch/x86_64/prefix/linuxprefix.S Zobrazit soubor

@@ -2,10 +2,10 @@
2 2
 
3 3
 	.section ".text"
4 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 9
 	xorq	%rbp, %rbp
10 10
 
11 11
 	popq	%rdi       // argc -> C arg1

+ 0
- 2
src/arch/x86_64/scripts/linux.lds Zobrazit soubor

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

Načítá se…
Zrušit
Uložit