From: Jan Kiszka <[email protected]> Use a wildcard to catch all relocation sections of EFI binaries. This will help adding ARM support and simplifies the logic for the rest.
On x86, we now include .reloc.init_array which was forgotten so far. Consequently, we have to drop the open-coded watchdog probe handler relocation. Signed-off-by: Jan Kiszka <[email protected]> --- Makefile.am | 9 ++++----- main.c | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index ad0bfac..8d550ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -274,8 +274,7 @@ $(efi_solib): $(efi_objects) $(efi_loadername): $(efi_solib) $(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \ - -j .dynsym -j .rel -j .rela -j .reloc -j .init_array \ - -j .rela.got -j .rela.data $(objcopy_format) $< $@ + -j .dynsym -j .rel* -j .init_array $(objcopy_format) $< $@ $(kernel_stub_solib): $(kernel_stub_objects) $(AM_V_CCLD)$(LD) $(efi_ldflags) $(kernel_stub_objects) \ @@ -284,9 +283,9 @@ $(kernel_stub_solib): $(kernel_stub_objects) $(kernel_stub_name): $(kernel_stub_solib) $(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \ - -j .dynsym -j .rel -j .rela -j .reloc -j .rela.got -j .rela.data \ - $(objcopy_format) $< $@ -endif + -j .dynsym -j .rel* $(objcopy_format) $< $@ + +endif # BOOTLOADER $(top_builddir)/tools/bg_setenv-bg_envtools.o: $(GEN_VERSION_H) diff --git a/main.c b/main.c index 897913b..8fa3ab3 100644 --- a/main.c +++ b/main.c @@ -32,7 +32,7 @@ extern CHAR16 *boot_medium_path; typedef EFI_STATUS (*WATCHDOG_PROBE)(EFI_PCI_IO *, UINT16, UINT16, UINTN); -static EFI_STATUS probe_watchdogs(EFI_LOADED_IMAGE *loaded_image, UINTN timeout) +static EFI_STATUS probe_watchdogs(UINTN timeout) { if (init_array_end - init_array_start == 0) { if (timeout > 0) { @@ -85,8 +85,7 @@ static EFI_STATUS probe_watchdogs(EFI_LOADED_IMAGE *loaded_image, UINTN timeout) for (const unsigned long *entry = init_array_start; entry < init_array_end; entry++) { - WATCHDOG_PROBE probe = (WATCHDOG_PROBE) - (UINT8 * ) loaded_image->ImageBase + *entry; + WATCHDOG_PROBE probe = (WATCHDOG_PROBE) *entry; if ((status = probe(pci_io, PCI_GET_VENDOR_ID(value), PCI_GET_PRODUCT_ID(value), timeout)) == EFI_SUCCESS) { @@ -173,7 +172,7 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) WARNING(L"Cannot close volumes.\n", status); } - status = probe_watchdogs(loaded_image, bg_loader_params.timeout); + status = probe_watchdogs(bg_loader_params.timeout); if (EFI_ERROR(status)) { error_exit(L"Cannot probe watchdog", status); } -- 2.35.3 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/965fdbfeda384968f2c9a458f2d247ecc3a85d50.1655731805.git.jan.kiszka%40siemens.com.
