Add support for 32-bit ARM

This adds support for building the shim for a 32-bit ARM UEFI environment.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Ard Biesheuvel 2014-08-12 15:33:22 +02:00 committed by Peter Jones
parent 04cba93d64
commit fa525bc463
4 changed files with 92 additions and 16 deletions

View File

@ -15,6 +15,9 @@ endif
ifeq ($(ARCH),aarch64)
CFLAGS += -O2 -DSIXTY_FOUR_BIT_LONG -ffreestanding -I$(shell $(CC) -print-file-name=include)
endif
ifeq ($(ARCH),arm)
CFLAGS += -O2 -DTHIRTY_TWO_BIT -ffreestanding -I$(shell $(CC) -print-file-name=include)
endif
LDFLAGS = -nostdlib -znocombreloc
TARGET = libopenssl.a

View File

@ -41,6 +41,10 @@ ifeq ($(ARCH),aarch64)
CFLAGS += -ffreestanding -I$(shell $(CC) -print-file-name=include)
endif
ifeq ($(ARCH),arm)
CFLAGS += -ffreestanding -I$(shell $(CC) -print-file-name=include)
endif
ifneq ($(origin VENDOR_CERT_FILE), undefined)
CFLAGS += -DVENDOR_CERT_FILE=\"$(VENDOR_CERT_FILE)\"
endif
@ -118,6 +122,12 @@ SUBSYSTEM := 0xa
LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
endif
ifeq ($(ARCH),arm)
FORMAT := -O binary
SUBSYSTEM := 0xa
LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
endif
FORMAT ?= --target efi-app-$(ARCH)
%.efi: %.so

30
cert.S
View File

@ -1,9 +1,7 @@
.globl cert_table
.data
.align 16
.type cert_table, @object
.type cert_table, %object
.size cert_table, 4
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
cert_table:
#if defined(VENDOR_CERT_FILE)
.long vendor_cert_priv_end - vendor_cert_priv
@ -20,48 +18,48 @@ cert_table:
#if defined(VENDOR_CERT_FILE)
.data
.align 1
.type vendor_cert_priv, @object
.type vendor_cert_priv, %object
.size vendor_cert_priv, vendor_cert_priv_end-vendor_cert_priv
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
vendor_cert_priv:
.incbin VENDOR_CERT_FILE
vendor_cert_priv_end:
#else
.bss
.type vendor_cert_priv, @object
.type vendor_cert_priv, %object
.size vendor_cert_priv, 1
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
vendor_cert_priv:
.zero 1
.data
.align 4
.type vendor_cert_size_priv, @object
.type vendor_cert_size_priv, %object
.size vendor_cert_size_priv, 4
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
vendor_cert_priv_end:
#endif
#if defined(VENDOR_DBX_FILE)
.data
.align 1
.type vendor_dbx_priv, @object
.type vendor_dbx_priv, %object
.size vendor_dbx_priv, vendor_dbx_priv_end-vendor_dbx_priv
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
vendor_dbx_priv:
.incbin VENDOR_DBX_FILE
vendor_dbx_priv_end:
#else
.bss
.type vendor_dbx_priv, @object
.type vendor_dbx_priv, %object
.size vendor_dbx_priv, 1
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
vendor_dbx_priv:
.zero 1
.data
.align 4
.type vendor_dbx_size_priv, @object
.type vendor_dbx_size_priv, %object
.size vendor_dbx_size_priv, 4
.section .vendor_cert, "a", @progbits
.section .vendor_cert, "a", %progbits
vendor_dbx_priv_end:
#endif

65
elf_arm_efi.lds Normal file
View File

@ -0,0 +1,65 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
.text 0x0 : {
*(.text.head)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
_etext = .;
}
.dynamic : { *(.dynamic) }
.data :
{
*(.sdata)
*(.data)
*(.data1)
*(.data)
*(.got.plt)
*(.got)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
. = ALIGN(16);
_bss = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
. = ALIGN(16);
_bss_end = .;
}
. = ALIGN(4096);
.vendor_cert :
{
*(.vendor_cert)
}
. = ALIGN(4096);
.rel.dyn : { *(.rel.dyn) }
.rel.plt : { *(.rel.plt) }
.rel.got : { *(.rel.got) }
.rel.data : { *(.rel.data) *(.rel.data*) }
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
/DISCARD/ :
{
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}