Commit Graph

462 Commits

Author SHA1 Message Date
Pete Batard
46aca420cc
Add build time QEMU UEFI tests
Use OVMF/AVMF and the UEFI Shell in a QEMU environment to validate that the
UEFI executables we build do run and produce the expected output.

The tests to run are flexibly defined is test_list.txt and can be expanded.

At this stage, only x64, ia32, aa64 and arm are run, which rely on the UEFI
firmwares found at https://github.com/pbatard/EfiFs/tree/gh-pages/AAVMF and
https://github.com/pbatard/EfiFs/tree/gh-pages/OVMF as well as Shell builds
from https://github.com/pbatard/UEFI-Shell.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:12:11 +01:00
Pete Batard
da5fe74408
Create GitHub Actions artifacts
This makes the apps/*.efi files available for download and testing after each build.
Also clean up the GitHub Actions workflows a little bit.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:11:25 +01:00
Pete Batard
9e2483ab62
Fix output of test apps to produce CRLF rather than LFCR
LFCR results in unwanted blank lines being added on serial output.
CRLF is what UEFI actually uses.
Also fix unneeded CR added to Print() optput in tcc.c.

These fixes are needed to to use these application for build time tests.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:11:13 +01:00
Pete Batard
5dee8b0339
Fix MinGW EFI applications
The EFI subsystem and application entrypoint were not being set for MinGW builds
and we don't need to go through objcopy either, so fix that.
Also make sure that the link options can be understood by the compiler, which
is what we use for linking, and remove the extra GNU_EFI_USE_MS_ABI, that was
already automatically added.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 15:37:16 +01:00
Nigel Croxon
52c3c36e34
Merge pull request #24 from pbatard/master
Actually make the apps build with MinGW
2024-05-16 14:44:42 -04:00
Pete Batard
625bdb6368
Actually make the apps build with MinGW
To builds the apps with MinGW, the CRT0 library must be ignored because
it is ELF specific and we don't need to go through ELF relocations.
We also apply the GNU_EFI_USE_MS_ABI (since we have it), remove the -z
flags, that are invalid in MinGW, and clean up the apps Makefile.

Note that setjump and debughook are excluded from MinGW builds as they
use constructs that are not available there.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-16 17:50:10 +01:00
Nigel Croxon
ccfe18558c
Merge pull request #23 from pbatard/master
Actually define STATIC as static
2024-05-16 08:55:38 -04:00
Pete Batard
f719f7d838
Actually define STATIC as static
Should be the same as EDK2, per:
https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h#L264

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-16 13:01:13 +01:00
Nigel Croxon
e1024aba22
Merge pull request #22 from pbatard/master
Fix exception on ARM32 with VS2022 when Print() is invoked
2024-05-14 16:20:26 -04:00
Pete Batard
0c7af72ba8
Fix exception on ARM32 with VS2022 when Print() is invoked
On ARM32 only, it appears that whenever Visual Studio inlines the FloatToString()
call (which it does for Release builds), the resulting executable produces an
"Undefined OpCode Exception" on Print() invocation, regardless of whether there
is an actual float to string conversion occurring there.

To work around this, add an explicit clause to prevent inlining, and do so on all
platform just in case.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-14 13:56:03 +01:00
Pete Batard
f2f17bfb16
Add a new EFI_NOINLINE macro and clean up eficompiler.h
Guard the macros by the compilers they should explicitly apply to and
add a #error in case the compiler has no alignment directive defined,
as ignoring alignment is likely to produce runtime errors.
Also prefer _MSC_VER to _MSC_EXTENSIONS, as _MSC_EXTENSIONS may not
always be defined by the MSVC compiler.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-14 13:55:59 +01:00
Nigel Croxon
9bd6d4ad54
Merge pull request #21 from pbatard/master
Fix a copy/paste error with the SMBIOS3TableGuid definition
2024-05-13 06:44:04 -04:00
Pete Batard
e2499f758a
Fix a copy/paste error with the SMBIOS3TableGuid definition
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-13 11:30:26 +01:00
Nigel Croxon
50772688f0
Merge pull request #20 from pbatard/MinGW
Add MinGW workflow builds
2024-05-09 10:18:01 -04:00
Pete Batard
08f9ea33dc
Add MinGW workflow builds for Linux and Windows
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:59:13 +01:00
Pete Batard
b74c52f8ba
Fix detection of Ubuntu/MinGW version
For downright incomprehensible reasons the Ubuntu/MinGW folks have decided that MinGW on
Ubuntu should no longer report the compiler's version as '<major>.<minor>', but instead as
'<major>-win32', which of course breaks any script that attempts to read version numbers.

This results in MinGW compilation of gnu-efi on Ubuntu producing the error:
  /bin/sh: 1: [: Illegal number: 10-win32

Fix this by replacing any '-win32' in the -dumpversion report with '.0' so that we get an
approximate version number back again.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:58:00 +01:00
Pete Batard
630ea144cb
Fix MinGW compilation
Per binutils/docs/as/Section.html, COFF assembly, which is what MinGW uses, does not
allow @type/%type, which is an ELF-only thing. As a result, trying to assemble the
recently modified ctor.S with MinGW produces the error:
  Error: junk at end of line, first unrecognized character is `,'
Fix this by making sure ELF-specifics are only added within ELF-guarded sections.

Note: This fixes the now deleted https://sourceforge.net/p/gnu-efi/bugs/38/

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:56:57 +01:00
Pete Batard
36d3313805
Clean up Linux/gcc and Windows/VS2022 workflow files
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:55:44 +01:00
Pete Batard
399313e148
Allow UEFI shorthands to be specified for the arch
The UEFI shorthands, as used in /efi/boot/boot###.efi, can now be used to specify the arch.
This basically adds 'x64' and 'mips64' as valid arch specifiers.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:54:49 +01:00
Nigel Croxon
0f2bee2834
Merge pull request #19 from pbatard/master
Fix ‘asm’ undeclared error for MIPS builds
2024-05-08 08:59:57 -04:00
Pete Batard
91cb708816 Fix ‘asm’ undeclared error for MIPS builds
As explained at https://stackoverflow.com/a/49830956/1069307, 'asm' is a GNU
extension that will produce an error when using a non GNU standard like -std=c11.
With recent commit 9b1e06cd0c having fixed our use
of -std=c11, the MIPS build failed with the error above.

With this sorted, we also re-enable the MIPS gcc build in GitHub Actions.
2024-05-08 13:54:10 +01:00
Nigel Croxon
a77c70718d
Merge pull request #18 from pbatard/master
Add GitHub Actions Linux/gcc and Windows/VS2022 CI builds
2024-05-08 08:05:08 -04:00
Nigel Croxon
1cf29645c6
Merge pull request #8 from hughsie/hughsie/Copright
Replace 'Copright' with 'Copyright' in file headers
2024-05-08 08:01:56 -04:00
Pete Batard
c30d23da8f Add GitHub Actions builds 2024-05-08 13:00:08 +01:00
Pete Batard
18fe24f01f Add Visual Studio 2022 solution files
* setjmp is not added as an app as it relies on non MSVC compatible assembly.
2024-05-08 12:16:56 +01:00
Pete Batard
130ebd8f04 Fix MSVC sample compilation 2024-05-08 10:51:58 +01:00
Pete Batard
ac8d6944c2 Use EDK2 compatible names for SMBIOS and AsciiStr functions and GUIDs 2024-05-08 10:51:43 +01:00
Richard Hughes
8272cd905e
Replace 'Copright' with 'Copyright' in file headers
This was hopefully just a typo that has been cargo-culted around the codebase.

It certainly confuses the Red Hat license checker and makes the code copyright
clear.
2024-05-07 13:03:52 +01:00
Nigel Croxon
bfaaec428b
Merge pull request #6 from gmbr3/RuntimeError
Align RTLIB CopyMem/SetMem with normal versions
2024-04-30 07:15:32 -04:00
Nigel Croxon
145c056b83
Merge pull request #5 from gmbr3/fixes
Disable RELRO
2024-04-30 07:14:16 -04:00
Callum Farmer
6b9dae0bef
Fixup string functions for new CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-04-27 18:26:21 +01:00
Callum Farmer
f5bb548df5
Align RTLIB CopyMem/SetMem with normal versions
Looks like 699e452654 broke rEFInd
(189e405630/)
2024-04-25 15:27:26 +01:00
Callum Farmer
a0111e0df1
Disable RELRO
No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file

Unbreaks lld usage which complains about linker script
Fixes ncroxon/gnu-efi#4
2024-04-24 12:04:48 +01:00
Nigel Croxon
4dc70fdf45
Merge pull request #3 from gmbr3/eh_frame_hdr
lds: Add eh_frame_hdr section
2024-04-01 11:35:32 -04:00
Callum Farmer
c7ee41c6c4
lds: Add eh_frame_hdr section
A new section has appeared, move it to the correct place
Copy of fwupd/fwupd-efi#59

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-04-01 16:04:02 +01:00
Nigel Croxon
2b0c490219 Bump revision to VERSION = 3.0.18 2024-03-22 10:24:28 -04:00
Peter Jones
31913f8489 Make: make TOPDIR actually work and get rid of unused CDIR
Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:28 -04:00
Peter Jones
95dbde278c make: Make "make clean" use @ and rm -v everywhere
This makes our "make clean" commands show what they've /removed/, rather
than what the shell code that will be run is.

Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:28 -04:00
Soop
13ac2e8b3f Make apps link against the local gnuefi and crt objects
Signed-off-by: Richard Hughes <richard@hughsie.com>
2024-03-22 10:24:28 -04:00
Callum Farmer
e2355ed7fb Remove 64k gap on ARM32
While binutils 2.25 incorrectly changed the page size
to 64K, the second part of that fix prevents the bug
anyways

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:28 -04:00
Callum Farmer
792715e5e9 arm64 lds: move 64K gap to reloc
The PE32 header means code ends at end of text, unlike
ELF where its mostly dynamic

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:28 -04:00
Callum Farmer
419e257f34 ctors.S: Align with linker scripts
Remove end padding
Change start padding to 16

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Xiaotian Wu
e5b1a35303 add non-executable GNU stack marking on ELF-linux
Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
2024-03-22 10:24:23 -04:00
Xiaotian Wu
feedeaa339 Make loongarch64 use efi-app-loongarch64
Binutils 2.41 now supports efi-app-loongarch64, so to use this we must add a
dummy reloc section and remove the PE header definition from crt0 as this will
conflict with the version added by objcopy

Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
2024-03-22 10:24:23 -04:00
Xiaotian Wu
fe31748c87 Add some definitions for LoongArch
Added CHAR8, CHAR16, WCHAR and VOID type definitions for LoongArch
2024-03-22 10:24:23 -04:00
Callum Farmer
d27431f679 Add EFI_NORETURN for declspec
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
593e13f670 Rename ALIGN to EFI_ALIGN
Avoid conflict with other libraries

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
2c47753ad3 Update OS Indications to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
86b8b5ea78 Update memory types to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
30bf99b81e Update error/warning codes to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00