From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 17:53:42 +0200 Subject: [PATCH 3/4] Add support for non-PE/COFF capable objcopy Introduce HAVE_EFI_OBJCOPY and set it if objcopy for $ARCH support PE/COOF and EFI, i.e., it supports --target efi-[app|bsdrv|rtdrv] options. Use it to decide whether to invoke objcopy with those options or use the linker to populate the PE/COFF header. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
This commit is contained in:
parent
fb063f0f65
commit
ac98308152
@ -107,6 +107,14 @@ ifeq ($(ARCH),x86_64)
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv],
|
||||
# otherwise we need to compose the PE/COFF header using the assembler
|
||||
#
|
||||
ifneq ($(ARCH),aarch64)
|
||||
export HAVE_EFI_OBJCOPY=y
|
||||
endif
|
||||
|
||||
# Generic compilation flags
|
||||
INCDIR += -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) \
|
||||
-I$(TOPDIR)/inc/protocol
|
||||
|
@ -35,8 +35,8 @@
|
||||
#
|
||||
|
||||
%.efi: %.so
|
||||
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
|
||||
-j .rela -j .reloc --target=$(FORMAT) $*.so $@
|
||||
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel* \
|
||||
-j .rela* -j .reloc $(FORMAT) $*.so $@
|
||||
|
||||
%.so: %.o
|
||||
$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
|
||||
|
@ -58,8 +58,6 @@ LOADLIBES += -lefi -lgnuefi
|
||||
LOADLIBES += $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
|
||||
LOADLIBES += -T $(LDSCRIPT)
|
||||
|
||||
FORMAT = efi-app-$(ARCH)
|
||||
|
||||
TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi \
|
||||
printenv.efi t7.efi t8.efi tcc.efi modelist.efi \
|
||||
route80h.efi drv0_use.efi AllocPages.efi \
|
||||
@ -67,13 +65,27 @@ TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi \
|
||||
TARGET_BSDRIVERS = drv0.efi
|
||||
TARGET_RTDRIVERS =
|
||||
|
||||
ifneq ($(HAVE_EFI_OBJCOPY),)
|
||||
|
||||
FORMAT := --target efi-app-$(ARCH)
|
||||
$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(ARCH)
|
||||
$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(ARCH)
|
||||
|
||||
else
|
||||
|
||||
SUBSYSTEM := 0xa
|
||||
$(TARGET_BSDRIVERS): SUBSYSTEM = 0xb
|
||||
$(TARGET_RTDRIVERS): SUBSYSTEM = 0xc
|
||||
|
||||
FORMAT := -O binary
|
||||
LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
|
||||
|
||||
endif
|
||||
|
||||
TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS)
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
$(TARGET_BSDRIVERS): FORMAT=efi-bsdrv-$(ARCH)
|
||||
$(TARGET_RTDRIVERS): FORMAT=efi-rtdrv-$(ARCH)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS) *~ *.o *.so
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user