[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>
This commit is contained in:
Michael Brown
2011-02-23 21:12:56 +00:00
parent 295c2fd671
commit 030e5a064e
17 changed files with 26 additions and 34 deletions

View 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)