Commit Graph

149 Commits

Author SHA1 Message Date
Nigel Croxon
087d22af38 Don't pass a pointer-to-(LoadedImage *) as a void **;
pass in a real void pointer's address and cast it reasonably.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:24:31 -05:00
Nigel Croxon
1ecae7d44c This makes "-Werror=unused-but-set-variable" work.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:19:24 -05:00
Nigel Croxon
3dd05c7b21 This makes "-Werror=unused-parameter" not fail.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 13:40:08 -05:00
Nigel Croxon
d39106b3e4 Apparently some linkers will just throw caution to the wind and
decide to stick stuff we don't explicitly mention at 0,
no matter what else has already explicitly been located there.
A debian/ubuntu builder noted:

gcc -O0 -g3 -fpic -Wall -fshort-wchar -fno-strict-aliasing \
	-fno-merge-constants -ffreestanding -fno-stack-protector \
	-fno-stack-check --std=c11 -DCONFIG_aarch64 -D__KERNEL__ \
	-I/usr/include/efi/ -I/usr/include/efi/aarch64/ \
	-iquote/«PKGBUILDDIR»/include "-DDEBUGDIR=L\"/\"" \
	-ffreestanding -I/usr/lib/gcc/aarch64-linux-gnu/4.9/include \
	-c -o fakeesrt2.o fakeesrt2.c
ld -nostdlib --warn-common --no-undefined --fatal-warnings -shared \
	-Bsymbolic -L/usr/lib -L/usr/lib --build-id=sha1 \
	/usr/lib/crt0-efi-aarch64.o --defsym=EFI_SUBSYSTEM=0xa \
	-o fakeesrt2.so fakeesrt2.o -lefi -lgnuefi \
	/usr/lib/gcc/aarch64-linux-gnu/4.9/libgcc.a \
	-T elf_aarch64_efi.lds
ld: section .note.gnu.build-id loaded at [00000000,00000023] overlaps section .text loaded at [00000000,0000668f]

This shouldn't be a problem if we explicitly tell it where to put them.

Ard added a patch to do this on Arm and aarch64 targets in 16409cad4cb,
but it needs to be everywhere.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-02-25 09:36:53 -05:00
Nigel Croxon
06db4a2b53 arm: fix linker script for building efi binaries
On arm, the linker script is missing section collection for data and
bss.  This causes some symbols (notably static array symbols) not to
get relocated correctly and the resulting efi binary to crash.  Fix
this by correctly collecting all the data and bss sections.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-02-17 15:32:23 -05:00
Nigel Croxon
333bf05da9 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2] ARM/AARCH64: define C99 types explicitly when building against
older standard

This adds support for the C99 uintXX_t types when building for
older versions of the standard, like the other architectures
already implement.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-01-07 09:40:50 -05:00
Nigel Croxon
e64257b90d From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH] Add ARM .note.gnu.build-id input section to
a dedicated output section

This fixes the builds for ARM and AARCH64, which currently fail at link
time with an error like this:

arm-linux-gnueabi-ld: section .note.gnu.build-id loaded at
   [0000000000000000,0000000000000023] overlaps section .text loaded at
   [0000000000000000,00000000000064cf]

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:38:24 -05:00
Nigel Croxon
d119b0d759 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/2] Replace ARM arithmetic support routines
with EDK2 versions.

Replace the incomplete GPL licensed ARM arithmetic support routines
with the ones from the EDK2 project. These cover long long multiplication
and long long logical shift as well.

Also remove the special case for small dividends in DivU64x32: we can
simply let the compiler handle this, and emit calls to the support
routines where appropriate.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:33:02 -05:00
Nigel Croxon
88e3cf9535 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 1/2] Relicense ARM and AARCH64 source files as
both BSD and GPL

This updates the licenses of the files authored by me under lib/arm
and lib/aarch64 to be both 2-clause BSD and GPL v2+

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:19:46 -05:00
Nigel Croxon
1ae8baefca From: Julian Andres Klode <jak@debian.org>
Subject: [PATCH gnu-efi] lib/arm/setjmp.S: Use %function instead of @function

@ is a comment character on ARM, so use % instead.

Nigel adjusted the wordwrap on the copyright header.

Signed-off-by: Julian Andres Klode <jak@degian.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-11-30 08:52:25 -05:00
Nigel Croxon
9ce3546d05 From: Pete Batard <pete@akeo.ie>
Subject: [PATCH] Fix MSVC breakage due to GNU align extensions in setjmp

* __attribute__((__aligned__(x))), which is used in setjmp, is GNU only => use a macro instead

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-09-23 10:03:31 -04:00
Nigel Croxon
0b5f181a36 From: Pete Batard <pete@akeo.ie>
Date: Wed, 16 Sep 2015 18:26:28 +0100
Subject: [PATCH] Fix VS2015 warnings

* Currently, Visual Studio 2015 generates a lot of warnings such as:
  gnu-efi\inc\efipciio.h(7): warning C4091: 'typedef ': ignored on left of '_EFI_PCI_IO' when no variable is declared
* To address this, gnu-efi should define the INTERFACE_DECL() for MS compilers as it does for GNU

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-09-17 08:22:39 -04:00
Nigel Croxon
fbcdcf56e8 Add the missing URI device path to the unions.
Signed-off-by: Gary Ching-Pang Lin <chinpang@gmail.com>
SIgned-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-08-19 07:28:45 -04:00
Nigel Croxon
af174b874e version 3.0.3 2015-08-17 16:06:47 -04:00
Nigel Croxon
ad7f0d4ba2 From: Gary Ching-Pang Lin <chingpang@gmail.com>
Date: Mon, 17 Aug 2015 17:00:11 +0800
Subject: [PATCH] Add URI Device Path

Add the definition of URI Device Path according to UEFI 2.4c.

Signed-off-by: Gary Ching-Pang Lin <chingpang@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-08-17 16:00:33 -04:00
Nigel Croxon
11a459ba96 This patch makes the following symbols (relatively) consistent between
all of our linker scripts:

_text
_etext
_text_size
_data
_edata
_data_size

There are various things that are slightly different (positions of
.rela*, .dynamic, and similar in relation to .data), but _text and _data
are now always at the beginning of their respective sections with regard
to how a debuger would reference the debug info, and _etext and _edata
are now always extant and guaranteed to be after any of the respective
kind of data the debugger would look for in that section.

This also adds an application example of how it might be used, and a
makefile target for %.efi.debug which will generate a separate debuginfo
file for that example.

This also enables debugging by default (i.e. -g is in CFLAGS) and adds
.note.gnu.build-id sections to our .so files (i.e. --build-id=sha1 is in
LDFLAGS).

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-07-16 12:31:23 -04:00
Nigel Croxon
aac405cc66 Updated Changelog
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:49:40 -04:00
Nigel Croxon
37d7bee82a Added some missing error code descriptions
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:38:39 -04:00
Nigel Croxon
dae0b4b0b0 Turns out we actually need setjmp in one of gnu-efi's prominent
users, and it seems to make more sense to put it here than in
the application.

All of these are derived from the Tiano code, but I re-wrote the
x86_64 one because we use the ELF psABI calling conventions instead
of the MS ABI calling conventions.  Which is to say you probably
shouldn't setjmp()/longjmp() between functions with EFIAPI (aka
__attribute__((ms_abi))) and those without.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:20:51 -04:00
Nigel Croxon
b5a8e93cec Bump version to 3.0.2
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-04-10 08:49:50 -04:00
Nigel Croxon
01c9f11ed5 Fix ARM32 and AARCH64 builds
Without these added into SUBDIRS the initplat.c compilation will fail.

Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-04-10 08:46:40 -04:00
Nigel Croxon
dada63fd3d [PATCH] _SPrint: fix NULL termination
maxlen is the maximum string length not the buffer size.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-03-23 10:41:43 -04:00
Nigel Croxon
ce7098fb52 Enable out-of-tree building
This patch enables building gnu-efi outside of the source tree.
That in turn enables building for multiple architectures in parallel.

The build directory is controlled by the OBJDIR make variable.  It
defaults to the value of ARCH, and can be overridden from the command
line.

This patch also cleans up some doubled slashes between INSTALLROOT
and PREFIX.

Signed-off-by: Jonathan Boeing <jonathan.n.boeing@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-02-19 11:22:45 -05:00
Nigel Croxon
f64cef2627 Since we're keeping this in git, it'd be nice not to see a bunch
of make targets in 'status'

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-06 15:49:50 -05:00
Nigel Croxon
322efb6b21 version number changed from VERSION = 3.0u to VERSION = 3.0.1
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-05 13:20:43 -05:00
Nigel Croxon
09027207f7 From: Pete Batard <pete@akeo.ie>
Date: Wed, 10 Dec 2014 21:08:34 +0000
Subject: [PATCH] fixes for MSVC compilation

These fixes are needed to address the following error and warnings when compiling the library part
using Visual Studio 2013 Community Edition (as in https://github.com/pbatard/uefi-simple):
* "lib\x86_64\math.c(49): error C4235: nonstandard extension used : '_asm' keyword not supported
  on this architecture"
* "lib\print.c(98): error C2059: syntax error : '('" due to placement of EFIAPI macro
* "lib\cmdline.c(94): warning C4090: 'function' : different 'const' qualifiers"
* "lib\smbios.c(25): warning C4068: unknown pragma"
* Also update macro definitions in "inc\<arch>\efibind.h" for MSVC

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-05 13:13:22 -05:00
Nigel Croxon
15805ff38b Add README.git file. Instructions on how to archive.
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 14:23:21 -05:00
Nigel Croxon
b868aa7566 This patch makes generating releases from git a very simple process; you
simply edit the makefile's "VERSION" line to the new version, commit
that as its own commit, and do: "make test-archive".  That'll make a
file in the current directory gnu-efi-$VERSION.tar.bz2 , with its top
level directory gnu-efi-$VERSION/ and the source tree under that.

Once you've tested that and you're sure it's what you want to release,
you do "make archive", which will tag a release in git and generate a
final tarball from it.  You then push to the archive, being sure to
include the tag:

git push origin master:master --tags

And upload the archive wherever it's supposed to go.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 13:26:45 -05:00
Nigel Croxon
530d68ba19 The gnu-efi-3.0 toplevel subdirectory is really annoying. Kill it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 10:09:50 -05:00
Nigel Croxon
00bd66ef46 FreeBSD's binutils doesn't have "-j <glob>" support, so we need to
include non-globbed versions of .rel/.rela individually.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Bill Paul <wpaul@windriver.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 14:33:09 -05:00
Nigel Croxon
56eb64d3c0 Right now we wind up trying to build gnuefi/.o from a source file that's
an empty string.  This is caused by the macros trying to generate
install rules, but there's no real reason to have all that anyway.  So
just have some static install rules that are simpler and don't generate
stuff on the fly.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 14:27:14 -05:00
Nigel Croxon
65e28a90a7 Add current OsIndications values.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com
2014-11-24 12:17:45 -05:00
Nigel Croxon
be231055ce Add the QueryVariableInfo() API.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 12:15:34 -05:00
Nigel Croxon
60efb7a293 Add the capsule API.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 12:13:23 -05:00
Nigel Croxon
ef08b655d1 Fix Table Header misspelling. Change from EFI_TABLE_HEARDER to
EFI_TABLE_HEADER.

Signed-Off-By: Nigel Croxon <nigel.croxon@hp.com>
2014-11-17 16:08:00 -05:00
Nigel Croxon
370cce41da If CROSS_COMPILE is set, ignore the ARCH value supplied on the
command line and use the target machine of the cross compiler.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-06 14:41:40 -05:00
Nigel Croxon
d32fb84543 Allow reuse of this file beyond GPL compatible software,
update the license of crt0-efi-aarch64.S to dual 2-clause BSD/GPLv2+.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-06 14:30:03 -05:00
Nigel Croxon
aa1df67f48 Add the missing Variable attributes
From: Jeremy Compostella <jeremy.compostella@intel.com>
Date: Mon, 13 Oct 2014 17:50:50 +0200
Subject: [PATCH] Add the missing Variable attributes

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-10-21 11:08:47 -04:00
Nigel Croxon
5706dff093 From: David Decotigny <decot@googlers.com>
Date: Mon, 25 Aug 2014 13:28:49 -0700
Subject: [PATCH] document that binutils >= 2.24 needed.

commit ac983081 "Add support for non-PE/COFF capable objcopy" depends
on objcopy accepting wildcards for the section names. This feature is
available only with binutils >= 2.24 (binutils 2e62b7218 "PR
binutils/15033").

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-26 10:54:22 -04:00
Nigel Croxon
6c10e225bc From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 18:19:16 -0700
Subject: [PATCH 5/5] allow to use external stdarg.h

in cases we use gnu-efi together with other libs that define stdarg.h,
break the tie by telling gnu-efi to use that stdarg.h .

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-25 08:51:23 -04:00
Nigel Croxon
16d65c0669 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Mon, 11 Aug 2014 15:39:16 +0200
Subject: [PATCH] Add support for 32-bit ARM

This adds support for 32-bit ARM using an approach similar to the one used for
64-bit ARM (AArch64), i.e., it does not rely on an objcopy that is aware of EFI
or PE/COFF, but lays out the entire PE/COFF header using the assembler.

In the 32-bit ARM case (which does not have a division instruction), some code
has been imported from the Linux kernel to perform the division operations in
software.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-19 12:07:00 -04:00
Nigel Croxon
b28143d4fb Updated Changelog
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:54:19 -04:00
Nigel Croxon
1525190354 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 18:16:59 +0200
Subject: [PATCH 4/4] Add support for 64-bit ARM (AArch64)

This adds support for 64-bit ARM (AArch64) environments. Since there is no
EFI-capable objcopy for this platform, this contains a manually laid out
PE/COFF header using the assembler.

In addition, it includes the relocation bits, some string functions that GCC
assumes are available and other glue to hold it all together.

This can be cross built using

	make CROSS_COMPILE=aarch64-linux-gnu-

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:35:09 -04:00
Nigel Croxon
ac98308152 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>
2014-08-08 15:32:26 -04:00
Nigel Croxon
fb063f0f65 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 17:37:36 +0200
Subject: [PATCH 2/4] Add support for cross compilation

This changes the logic that defines ARCH (and HOSTARCH) to take CROSS_COMPILE
into account. Also, $prefix is not assigned, so that the default will be what
is on the path rather than hardcoded in /usr/bin.

This results in the build doing the right thing if CROSS_COMPILE is set in the
environment and no ARCH or prefix options are passed to make, aligning it with
most other CROSS_COMPILE compatible projects.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:26:38 -04:00
Nigel Croxon
7a98d83fc3 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 16:50:45 +0200
Subject: [PATCH 1/4] Restrict GNU_EFI_USE_MS_ABI GCC version test to x86_64

The version test only applies to x86_64 builds, so no need to do it
for other archs.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:25:03 -04:00
Nigel Croxon
f42974dd9a From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:42:23 -0700
Subject: [PATCH 4/4] Use Shell protocols to retrieve argc/argv, when
 available.

New header files efishellintf.h efishellparm.h are coming from EDK
II, initial location and license at top of files. Only modifications:
 - efishellintf.h: s/EFI_FILE_PROTOCOL/EFI_FILE/ + expand BITx macros (1<<x)
 - efishellparm.h: typedef VOID *SHELL_FILE_HANDLE to avoid including
   ShellBase.h
 - both: removed extern EFI_GUID variable decls

This also adds apps/t8.c, a simple demo.

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:21:16 -04:00
Nigel Croxon
a61fa058e9 From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:41:52 -0700
Subject: [PATCH 3/4] document format of LoadedImage::LoadOptions data

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:17:32 -04:00
Nigel Croxon
2f440200c8 From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:39:37 -0700
Subject: [PATCH 2/4] Use OpenProtocol instead of HandleProtocol

UEFI 2.x recommends OpenProtocol instead of HandleProtocol.

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:15:59 -04:00
Nigel Croxon
7f173da1e5 From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:30:07 -0700
Subject: [PATCH 1/4] move cmdline parser to its own file

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:14:26 -04:00