Commit Graph

510 Commits

Author SHA1 Message Date
Nigel Croxon
a5e8881923
Merge pull request #38 from gmbr3/v4_0
Add ix86 and ARM32 MacOS (embedded ELF) CI/CD
2024-07-18 06:57:21 -04:00
Callum Farmer
06320f8fb3
Don't edit the riscv subsystem if using objcopy
* Only needed in binary mode

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
e092a94869
Add non-objcopy IA32 crt0/lds
* Needed by embedded (MacOS) ELF toolchain

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
644e03821e
Tune for new MacOS toolchains
* Doesn't seem to like nocombreloc
* i686 doesn't have the efi-app-ia32 target (bug in binutils??)
* Set float manually on ARM32 due to generic toolchain
* Ensure _DYNAMIC symbol exists

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
8f5c321507
Better detect the correct MacOS toolchain
* We need ELF not Mach-O

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
5d4ada9352
Add missing parts to elf.h
* Missing LGPL-2.1+ license
* Add missing REL definitions

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:36 +01:00
Callum Farmer
d416122fd8
Add extra archs to MacOS CI/CD
* Add x86, ARM32
* RISC-V won't work until binutils remove the shared library embedded
  ELF blocker

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:20 +01:00
Nigel Croxon
feddb5ad3c
Merge pull request #37 from gmbr3/v4_0
Add macOS support
2024-07-15 07:37:24 -04:00
Callum Farmer
16a913e01c
Disable norelro on macOS
The no platform GNU ELF linker rejects it

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-14 18:50:40 +01:00
Callum Farmer
b6f99c7ac5
Add substitute elf.h for macOS
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-14 18:50:39 +01:00
Callum Farmer
f19216bf87
Add macOS toolchain
Fixes ncroxon/gnu-efi#36

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-14 18:50:17 +01:00
Nigel Croxon
33727c2abe
Merge pull request #34 from gmbr3/riscv
Toolchain fixes + RISCV64 objcopy move + AARCH64 non-objcopy restore
2024-07-06 20:48:55 -04:00
Callum Farmer
2765122e67
X86_64: We use RELA not REL
Weird huh? GNU ld uses RELA but no addends, as soon as
you get an addend from LLD, this code breaks

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:02 +01:00
Callum Farmer
9c953ddf27
Make old ABI func static
Otherwise, LLVM will emit an extern symbol if -O0 is used
which will break the build

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:02 +01:00
Callum Farmer
f77e4e8a8e
Force DWARF 4 on LLVM
Otherwise readelf just throws an absolute blowup :(

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
0c0b91b9f9
PC file missing from clean
The pkgconfig file was not being removed
by clean, add the missing statement

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
21f87c2b1e
Fixup riscv64 objcopy move
Detect new enough objcopy

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
353984bb97
Move riscv64 default to objcopy
Fixes ncroxon/gnu-efi#11

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
23715d6389
Restore non-objcopy ARM64 crt0/lds
* An up-to-date version of it anyways
* Useful for systems without objcopy 2.38+

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
9fb0825a6b
Output ELF data file on Linux CI/CD
* Useful for checking moved/new ELF sections

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:00 +01:00
Callum Farmer
771b632092
Add Linux musl-libc toolchain
* Use gcc as compiler and bfd as linker
* Use musl toolchain prefixes
* musl doesn't have any Ubuntu cross toolchains
  so x86_64 only

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:43:42 +01:00
Callum Farmer
16c9eedafb
Add Linux LLVM toolchain
* Use clang as compiler and LLD as linker

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
d9b395ac03
Make CopyMemC call CopyMem
* The last part of this: I hope :)
* ISO C permits overwriting of Src even if it marks Src as CONST
* UEFI marks Src as NON CONST, so forward calls via this function
* Allows us to keep in-line with shim without causing Werror havoc with other downstreams

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
c03d395571
Disable uninitialized error on GCC
Gives error on 'Red' in bltgrid.c which is initialized
by the looks of it?

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
f8ebcfc077
Use char16_t literals
Add char16_t('u') literals
Remove wchar_t('L') literals

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-06-24 19:34:51 +01:00
Callum Farmer
ce1ec9d27b
Make CHAR8 use unsigned char
* Means we don't have to switch the implementation of char to unsigned char
* Matches the underlying type of char8_t from C++20

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-06-24 19:34:51 +01:00
Callum Farmer
edfda7c396
Make CHAR16 use uint16_t
musl-libc doesn't like fshort-wchar so remove wchar_t usage
Use uint16_t as char16_t can be up to 32bits
Fixes ncroxon/gnu-efi#16

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-06-24 19:34:18 +01:00
Nigel Croxon
9e479726ed
Merge pull request #33 from pbatard/msvc
Apply stdbool/stdint MSVC fixes
2024-06-04 08:45:42 -04:00
Pete Batard
96e3b8469c
Apply stdbool/stdint MSVC fixes
It seems that while Visual Studio can support the C23 standard, Microsoft didn't get the memo
about no longer requiring stdbool.h for true/false, so add an exception for that.

Also harmonize the inclusion of stdint.h for IA32 and IA64 so that, just like for other archs,
it is not limited to GNU-like compilers only.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-06-03 21:13:41 +01:00
Nigel Croxon
2a44cea3f3
Merge pull request #31 from pbatard/drv0
Fix driver EFI subsystem for VS and RISCV64 and add driver testing
2024-05-28 08:40:32 -04:00
Pete Batard
0248433f2c
Add driver testing to the test list
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-24 10:29:50 +01:00
Pete Batard
eeb0e6a830
Fix RISCV64 not setting the subsystem according to EFI_SUBSYSTEM
The RISCV64 toolchain does not support 16-bit variable relocation from assembly,
and even if it did support relocations, it would not properly set the subsystem
from --defsym. So we add an extra step on RISCV64, post objcopy, to set the field
manually (using dd and /bin/echo to output the relevant byte, as GNU Make's echo
does not support -ne).
Closes ncroxon/gnu-efi#27.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-24 10:29:49 +01:00
Pete Batard
5d0de491f1
Fix drv0 not being properly set to Boot Service Driver for Visual Studio
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-24 10:29:35 +01:00
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