From d230c91de9ff7cc1595ef776aa3d21d4e8073aa1 Mon Sep 17 00:00:00 2001 From: Vitaly Cheptsov Date: Sun, 12 Feb 2023 09:55:07 +0300 Subject: [PATCH] MdePkg/BasePeCoffLib2: Remove DEBUG_RAISE on invalid DebugDir size EfiBoot images contain a sum of EFI_IMAGE_DEBUG_DIRECTORY_ENTRY and EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY sizes in DebugDir size. Since our XCODE5 toolchain generates NB10 debug entries and we do not have access to Apple DEBUG symbols, just ignore this debug information. Signed-off-by: Vitaly Cheptsov --- MdePkg/Library/BasePeCoffLib2/PeCoffDebug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/BasePeCoffLib2/PeCoffDebug.c b/MdePkg/Library/BasePeCoffLib2/PeCoffDebug.c index 833ebfc95b..41c0636c82 100644 --- a/MdePkg/Library/BasePeCoffLib2/PeCoffDebug.c +++ b/MdePkg/Library/BasePeCoffLib2/PeCoffDebug.c @@ -119,7 +119,12 @@ PeCoffGetPdbPath ( // Verify the Debug Directory has a well-formed size. // if (DebugDir->Size % sizeof (*DebugEntries) != 0) { - DEBUG_RAISE (); + // + // Some Apple-made images contain a sum of EFI_IMAGE_DEBUG_DIRECTORY_ENTRY + // and EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY sizes in DebugDir size. + // Since this violates the spec and nobody but Apple has access + // to the DEBUG symbols, just ignore this debug information. + // return RETURN_UNSUPPORTED; } //