summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/Makefile.pcbios
diff options
context:
space:
mode:
authorMichael Brown2021-02-15 10:54:03 +0100
committerMichael Brown2021-02-15 11:02:32 +0100
commit1b99ba2a93df92df63a7cddfb1b2cfb7b96be772 (patch)
tree4dd2e876f75b02c740913b4b0c6adc182f51463c /src/arch/x86/Makefile.pcbios
parent[cloud] Use PCIAPI_DIRECT for cloud images (diff)
downloadipxe-1b99ba2a93df92df63a7cddfb1b2cfb7b96be772.tar.gz
ipxe-1b99ba2a93df92df63a7cddfb1b2cfb7b96be772.tar.xz
ipxe-1b99ba2a93df92df63a7cddfb1b2cfb7b96be772.zip
[build] Work around stray sections introduced by some binutils versions
Some versions of GNU ld (observed with binutils 2.36 on Arch Linux) introduce a .note.gnu.property section marked as loadable at a high address and with non-empty contents. This adds approximately 128MB of garbage to the BIOS .usb disk images. Fix by using a custom linker script for the prefix-only binaries such as the USB disk partition table and MBR, in order to allow unwanted sections to be explicitly discarded. Reported-by: Christian Hesse <mail@eworm.de> Tested-by: Christian Hesse <mail@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/Makefile.pcbios')
-rw-r--r--src/arch/x86/Makefile.pcbios11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/arch/x86/Makefile.pcbios b/src/arch/x86/Makefile.pcbios
index 751d7d28c..ed8d554a7 100644
--- a/src/arch/x86/Makefile.pcbios
+++ b/src/arch/x86/Makefile.pcbios
@@ -4,18 +4,15 @@
#
SRCDIRS += arch/x86/drivers/net
-# The i386 linker script
+# The linker scripts
#
LDSCRIPT = arch/x86/scripts/pcbios.lds
+LDSCRIPT_PREFIX = arch/x86/scripts/prefixonly.lds
# Stop ld from complaining about our customised linker script
#
LDFLAGS += -N --no-check-sections
-# Prefix always starts at address zero
-#
-LDFLAGS += --section-start=.prefix=0
-
# Media types.
#
MEDIA += rom
@@ -73,12 +70,12 @@ NON_AUTO_MEDIA += fd0
# Special target for building Master Boot Record binary
$(BIN)/mbr.tmp : $(BIN)/mbr.o
$(QM)$(ECHO) " [LD] $@"
- $(Q)$(LD) $(LDFLAGS) -o $@ -e mbr $<
+ $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT_PREFIX) -o $@ -e mbr $<
# rule to make a USB disk image
$(BIN)/usbdisk.tmp : $(BIN)/usbdisk.o
$(QM)$(ECHO) " [LD] $@"
- $(Q)$(LD) $(LDFLAGS) -o $@ -e mbr $<
+ $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT_PREFIX) -o $@ -e mbr $<
NON_AUTO_MEDIA += usb
%usb: $(BIN)/usbdisk.bin %hd