Commit Graph

427 Commits

Author SHA1 Message Date
Nigel Croxon 4ecd540d46
Merge pull request #28 from pbatard/pbatard
Add RISCV64 testing support and default to clean compiler output
2024-05-21 13:29:24 -04:00
Nigel Croxon dee84a8948
Merge pull request #30 from pbatard/fixes
Fix double reference to route80h.efi in apps
2024-05-21 13:27:58 -04:00
Pete Batard 0cdd5584a0
Fix double reference to route80h.efi in apps
Commit 625bdb6368 reorganized the apps list but
also duplicated route80h.efi so remove the extra one, as having two instances
produces an error when running 'make install'.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-21 13:55:09 +01:00
Pete Batard b50b0a0a2c
Add RISCV64 testing support
Requires a recent QEMU (for the pflash0 options) and therefore Ubuntu 24.04.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-21 11:46:42 +01:00
Pete Batard 2d6d426b8c
Enable silent rules for compiler output
This is similar to using automake's silent rules and, just as with automake,
can be disabled by invoking 'make V=1'.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-21 11:45:20 +01:00
Nigel Croxon 7440e5ebb7
Merge pull request #26 from pbatard/Resolve-Conflicts
Add build time QEMU/UEFI tests
2024-05-20 09:24:38 -04:00
Pete Batard 23c505d548
Merge branch 'master' into Resolve-Conflicts 2024-05-20 15:21:24 +02:00
Nigel Croxon 34754d941f
Merge pull request #25 from gmbr3/RuntimeError
Multiple fixes
2024-05-20 09:02:57 -04:00
Callum Farmer 39681d7a0f
Add test for old ABIs of ReallocatePool and CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:15:20 +01:00
Callum Farmer e3c7731bcc
Fixup functions for new ReallocatePool
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:15:20 +01:00
Callum Farmer eaa624e71d
Add legacy defines for CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:15:19 +01:00
Callum Farmer f3656c8800
Move ReallocatePool to EDK2 ABI
Fixes ncroxon/gnu-efi#9

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:14:01 +01:00
Callum Farmer 1e8900a92b
Switch everything to Unix line endings
I wondered why a patch didn't apply :(

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 14:22:26 +01:00
Callum Farmer 8ad6c33424
PC: Add useful variables
* Add efi_machine_type_name and gnu_efi_arch from fwupd-efi

* Add gnu_efi_default_is_objcopy so downstreams know if the crt0 goes objcopy

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 14:22:11 +01:00
Callum Farmer c339e077c8
Restore old CopyMem as CopyMemC
CopyMemC cos CONST Src

Reverts 6b9dae0bef

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 13:56:07 +01:00
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