ImageTool: Fix ARM image generation

This commit is contained in:
Marvin Häuser 2023-04-08 11:17:24 +02:00
parent 7b210acbc6
commit 373bb081ee
2 changed files with 7 additions and 3 deletions

View File

@ -634,7 +634,11 @@ CreateIntermediate (
++NumRelocs; ++NumRelocs;
} }
} else if (mEhdr->e_machine == EM_ARM) { } else if (mEhdr->e_machine == EM_ARM) {
if ((ELF_R_TYPE(Rel->r_info) == R_ARM_THM_MOVW_ABS_NC)
|| (ELF_R_TYPE(Rel->r_info) == R_ARM_RABS32)
|| (ELF_R_TYPE(Rel->r_info) == R_ARM_ABS32)) {
++NumRelocs;
}
} }
#endif #endif
} }

View File

@ -25,7 +25,7 @@ typedef struct {
uint32_t RelocTableSize; uint32_t RelocTableSize;
uint32_t HiiTableSize; uint32_t HiiTableSize;
uint32_t DebugTableSize; uint32_t DebugTableSize;
uint16_t FileAlignment; uint32_t FileAlignment;
} image_tool_pe_emit_context_t; } image_tool_pe_emit_context_t;
static static
@ -887,7 +887,7 @@ ToolImageEmitPe (
memset (&Context, 0, sizeof (Context)); memset (&Context, 0, sizeof (Context));
Context.Image = Image; Context.Image = Image;
Context.FileAlignment = (uint16_t)Image->SegmentInfo.SegmentAlignment; Context.FileAlignment = Image->SegmentInfo.SegmentAlignment;
Result = EmitPeGetHeaderSizes (Image, &Context.HdrInfo); Result = EmitPeGetHeaderSizes (Image, &Context.HdrInfo);
if (!Result) { if (!Result) {