Skip to content

Commit

Permalink
Tidy up crt0 generator
Browse files Browse the repository at this point in the history
Signed-off-by: Callum Farmer <[email protected]>
  • Loading branch information
gmbr3 authored and superm1 committed Feb 17, 2024
1 parent 1a794fc commit 8ae7b81
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
22 changes: 21 additions & 1 deletion efi/crt0/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
arch_crt_source = 'crt0-efi-@[email protected]'.format(gnu_efi_path_arch)

crt0_compile_args = compile_args

# Subsystem
crt0_compile_args += ['-DEFI_SUBSYSTEM=10']

# Section data
nr_sections = 4
if get_option('efi_sbat_distro_id') != ''
crt0_compile_args += ['-DUSING_SBAT']
nr_sections = nr_sections + 1
endif
if uswid.found()
crt0_compile_args += ['-DUSING_SBOM']
nr_sections = nr_sections + 1
endif
crt0_compile_args += ['-DNR_SECTIONS=@0@'.format(nr_sections)]


o_crt0 = custom_target('efi_crt0',
input : arch_crt_source,
output : arch_crt,
command : [cc.cmd_array(), '-c', '@INPUT@', '-o', '@OUTPUT@']
+ compile_args)
+ crt0_compile_args)

19 changes: 4 additions & 15 deletions efi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -222,26 +222,15 @@ endif
if objcopy_manualsymbols
# older objcopy for Aarch64, ARM32 and RISC-V are not EFI capable.
# Use 'binary' instead, and add required symbols manually.
efi_ldflags += ['--defsym=EFI_SUBSYSTEM=0xa']
if efi_crtdir != join_paths(meson.current_build_dir(), 'crt0')
# Using system so without crt0 generator
efi_ldflags += ['--defsym=EFI_SUBSYSTEM=0xa']
endif
efi_format = ['-O', 'binary']
else
efi_format = ['--target=efi-app-@0@'.format(gnu_efi_arch)]
endif

# Section data
if objcopy_manualsymbols
nr_sections = 4
if get_option('efi_sbat_distro_id') != ''
compile_args += ['-DUSING_SBAT']
nr_sections = nr_sections + 1
endif
if uswid.found()
compile_args += ['-DUSING_SBOM']
nr_sections = nr_sections + 1
endif
compile_args += ['-DNR_SECTIONS=@0@'.format(nr_sections)]
endif

libgcc_file_name = run_command(cc.cmd_array(), '-print-libgcc-file-name', check: true).stdout().strip()
efi_name = 'fwupd@[email protected]'.format(EFI_MACHINE_TYPE_NAME)

Expand Down

0 comments on commit 8ae7b81

Please sign in to comment.