From owner-freebsd-hackers@FreeBSD.ORG Sun Sep 14 13:40:22 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD497A8 for ; Sun, 14 Sep 2014 13:40:22 +0000 (UTC) Received: from mail.metricspace.net (mail.metricspace.net [IPv6:2001:470:1f11:617::103]) by mx1.freebsd.org (Postfix) with ESMTP id A57BA835 for ; Sun, 14 Sep 2014 13:40:22 +0000 (UTC) Received: from [172.16.1.182] (unknown [172.16.1.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: eric) by mail.metricspace.net (Postfix) with ESMTPSA id D18FC2F44C for ; Sun, 14 Sep 2014 13:40:21 +0000 (UTC) Message-ID: <54159AC5.1010800@metricspace.net> Date: Sun, 14 Sep 2014 09:40:21 -0400 From: Eric McCorkle User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: "freebsd-hackers@freebsd.org" Subject: Resuming old EFI project Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Sep 2014 13:40:22 -0000 Hello everyone, About two years ago, I was working on a project to try and finish the EFI support for AMD64. Unfortunately, I had to abandon the project due to family illness and a job search. At this point, I'm in a position to pick that project back up as a side project (I also have better hardware now ;) It seems everything in sys/boot/amd64/efi is pretty much unchanged. One thing that's changed things quite a bit, though, is the switch to clang. When I was working on it before, there was a custom linker script that got used to produce loader as a PE binary (EFI uses the PE format and win32 ABI). However, that script seemed to produce bad offsets when using clang. On the other hand, clang can cross-compile to the win32 ABI (by giving it -target x86_64-unknown-win32). This does have some additional advantages; win32 has slightly different conventions, and I remember reading about an issue someone was having because of a stack alignment issue when they were using a linker script solution. So the thing to do might be to cross-compile loader and its dependencies (stand, ficl, if I recall). The issue here is that you'd potentially be producing two sets of libraries: one with the standard ABI and one with the win32 ABI. Worth noting: there's supposedly a way to get clang to produce "object" files that are actually LLVM bitcode; that could potentially avoid generating two sets of object files. I welcome any suggestions or comments.