- if (bfd_target_efi_p (*target_ptr))
- {
- /* Skip incompatible arch. */
- if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
- continue;
-
- if (efi)
- {
-no_match:
- /* TARGET_PTR is an EFI backend. Don't match
- TARGET with a EFI file. */
- bfd_preserve_restore (abfd, &preserve);
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
- else if (bfd_target_pei_p (*target_ptr))
- {
- /* Skip incompatible arch. */
- if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
- continue;
-
- if (!efi)
- {
- /* TARGET_PTR is a PE backend. Don't match
- TARGET with a PE file. */
- goto no_match;
- }
- }
- }
-
- bfd_preserve_finish (abfd, &preserve);