diff options
author | Michael Brown <mcb30@ipxe.org> | 2018-01-02 21:26:40 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2018-01-02 21:26:40 +0100 |
commit | 2bb4ec1f54af11f51f6f064c0086b6b80be2dcd2 (patch) | |
tree | 33dea6104ca71f5457a707609b12ebb9e712c707 /src/arch/x86 | |
parent | 00c5b958c59ec45736469fce674c5307cabbfd91 (diff) | |
download | ipxe-2bb4ec1f54af11f51f6f064c0086b6b80be2dcd2.zip ipxe-2bb4ec1f54af11f51f6f064c0086b6b80be2dcd2.tar.gz ipxe-2bb4ec1f54af11f51f6f064c0086b6b80be2dcd2.tar.bz2 |
[build] Avoid use of "ld --oformat binary"
Using "ld --oformat binary" for mbr.bin and usbdisk.bin seems to cause
segmentation faults on some versions of binutils (observed on Fedora
27). Work around this problem by using ld to create an intermediate
ELF object, followed by objcopy (via the existing %.tmp -> %.bin rule)
to create the final binary.
Note that we cannot simply use a single-stage "objcopy -O binary"
since this will not process the relocation records for x86_64: see
commit 1afcccd ("[build] Do not use "objcopy -O binary" for objects
with relocation records").
Reported-by: Brent S <bts@square-r00t.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/Makefile.pcbios | 8 | ||||
-rw-r--r-- | src/arch/x86/prefix/mbr.S | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/arch/x86/Makefile.pcbios b/src/arch/x86/Makefile.pcbios index df08e01..c44eefc 100644 --- a/src/arch/x86/Makefile.pcbios +++ b/src/arch/x86/Makefile.pcbios @@ -106,14 +106,14 @@ NON_AUTO_MEDIA += fd0 $(Q)sync # Special target for building Master Boot Record binary -$(BIN)/mbr.bin : $(BIN)/mbr.o +$(BIN)/mbr.tmp : $(BIN)/mbr.o $(QM)$(ECHO) " [LD] $@" - $(Q)$(LD) $(LDFLAGS) -o $@ --oformat binary -e 0 $< + $(Q)$(LD) $(LDFLAGS) -o $@ -e mbr $< # rule to make a USB disk image -$(BIN)/usbdisk.bin : $(BIN)/usbdisk.o +$(BIN)/usbdisk.tmp : $(BIN)/usbdisk.o $(QM)$(ECHO) " [LD] $@" - $(Q)$(LD) $(LDFLAGS) -o $@ --oformat binary -e 0 $< + $(Q)$(LD) $(LDFLAGS) -o $@ -e mbr $< NON_AUTO_MEDIA += usb %usb: $(BIN)/usbdisk.bin %hd diff --git a/src/arch/x86/prefix/mbr.S b/src/arch/x86/prefix/mbr.S index a1e237d..032c0e7 100644 --- a/src/arch/x86/prefix/mbr.S +++ b/src/arch/x86/prefix/mbr.S @@ -6,6 +6,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ) .code16 .org 0 + .globl mbr mbr: movw $exec_sector, %bp jmp find_active_partition |