From patchwork Tue Aug 12 13:33:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 35259 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6431720540 for ; Tue, 12 Aug 2014 13:33:47 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf45483557oag.4 for ; Tue, 12 Aug 2014 06:33:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=2xbSPrYwVC3ZPNdP+aLGJ9FhFWQveT9ruZ0/01/Ej1k=; b=I6Kx7sjkjZANU5+sQriPEwjp1oJxAKZ0ARmbcP41EUUnd3GCQeeRHHGEZArFlDpuad TCHtI7ml0BbhmHBiXjDc2HJUhEkUbgG1lAgyMSlW/gjhqyOYFye083fjjyLtwY/QA47I sKa1sw/R2BnTjaUFgMkZj/E8x4Umz3Td+ezP5RZpas6kY82wA2UTYQ2agXWmiA//d/ae LdBcSYDA/eUDws7//W6fWriTiTVtOrN7wPs3n+vRn7MVzrvd2437wWxsUmd5q5uz7raN b4PdBsgbD8HeX+4I2efAQbC0AdSGf1sCpuoDq7QFSwFgE6aC8eCEdCfdjnD6SBwBPHMO m69w== X-Gm-Message-State: ALoCoQnl07UaMqv+RnT7VFqnk8qbCNZ0qzOG/1ZM0GEySwCUJ/e3tat56gLbBqj40iDBTMAfFQIv X-Received: by 10.42.82.79 with SMTP id c15mr16847724icl.7.1407850427032; Tue, 12 Aug 2014 06:33:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.148 with SMTP id v20ls141682qgv.93.gmail; Tue, 12 Aug 2014 06:33:46 -0700 (PDT) X-Received: by 10.52.146.17 with SMTP id sy17mr23629496vdb.29.1407850426918; Tue, 12 Aug 2014 06:33:46 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id th5si8209503vdb.39.2014.08.12.06.33.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 06:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so13124870vcb.21 for ; Tue, 12 Aug 2014 06:33:46 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr3818877vcn.16.1407850426801; Tue, 12 Aug 2014 06:33:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp249191vcb; Tue, 12 Aug 2014 06:33:46 -0700 (PDT) X-Received: by 10.194.61.99 with SMTP id o3mr5209731wjr.103.1407850425716; Tue, 12 Aug 2014 06:33:45 -0700 (PDT) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by mx.google.com with ESMTPS id m9si22386479wib.84.2014.08.12.06.33.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 06:33:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ard.biesheuvel@linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; Received: by mail-wi0-f180.google.com with SMTP id n3so5792443wiv.1 for ; Tue, 12 Aug 2014 06:33:45 -0700 (PDT) X-Received: by 10.180.189.139 with SMTP id gi11mr32796585wic.51.1407850425218; Tue, 12 Aug 2014 06:33:45 -0700 (PDT) Received: from ards-macbook-pro.local ([109.227.30.102]) by mx.google.com with ESMTPSA id kw1sm9347231wjb.19.2014.08.12.06.33.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 06:33:44 -0700 (PDT) From: Ard Biesheuvel To: matthew.garrett@nebula.com, pjones@redhat.com Cc: leif.lindholm@linaro.org, ilias.biris@linaro.org, patches@linaro.org, Ard Biesheuvel Subject: [PATCH 4/5] Add support for 64-bit ARM (AArch64) Date: Tue, 12 Aug 2014 15:33:21 +0200 Message-Id: <1407850402-11193-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1407850402-11193-1-git-send-email-ard.biesheuvel@linaro.org> References: <1407850402-11193-1-git-send-email-ard.biesheuvel@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This adds support for building the shim for a 64-bit ARM UEFI environment. Signed-off-by: Ard Biesheuvel --- Cryptlib/OpenSSL/Makefile | 3 +++ Makefile | 10 ++++++++ elf_aarch64_efi.lds | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 elf_aarch64_efi.lds diff --git a/Cryptlib/OpenSSL/Makefile b/Cryptlib/OpenSSL/Makefile index 90975801b1d9..17b5695b827c 100644 --- a/Cryptlib/OpenSSL/Makefile +++ b/Cryptlib/OpenSSL/Makefile @@ -12,6 +12,9 @@ ifeq ($(ARCH),ia32) CFLAGS += -mno-mmx -mno-sse -mno-red-zone -maccumulate-outgoing-args \ -m32 -DTHIRTY_TWO_BIT endif +ifeq ($(ARCH),aarch64) + CFLAGS += -O2 -DSIXTY_FOUR_BIT_LONG -ffreestanding -I$(shell $(CC) -print-file-name=include) +endif LDFLAGS = -nostdlib -znocombreloc TARGET = libopenssl.a diff --git a/Makefile b/Makefile index f65bb3b8a253..3529b454476a 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,10 @@ ifeq ($(ARCH),ia32) CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args -m32 endif +ifeq ($(ARCH),aarch64) + CFLAGS += -ffreestanding -I$(shell $(CC) -print-file-name=include) +endif + ifneq ($(origin VENDOR_CERT_FILE), undefined) CFLAGS += -DVENDOR_CERT_FILE=\"$(VENDOR_CERT_FILE)\" endif @@ -108,6 +112,12 @@ Cryptlib/OpenSSL/libopenssl.a: lib/lib.a: $(MAKE) -C lib +ifeq ($(ARCH),aarch64) +FORMAT := -O binary +SUBSYSTEM := 0xa +LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM) +endif + FORMAT ?= --target efi-app-$(ARCH) %.efi: %.so diff --git a/elf_aarch64_efi.lds b/elf_aarch64_efi.lds new file mode 100644 index 000000000000..9c9a05554bc1 --- /dev/null +++ b/elf_aarch64_efi.lds @@ -0,0 +1,65 @@ +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") +OUTPUT_ARCH(aarch64) +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); + + .rela.dyn : { *(.rela.dyn) } + .rela.plt : { *(.rela.plt) } + .rela.got : { *(.rela.got) } + .rela.data : { *(.rela.data) *(.rela.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) } +}