+ (Rel->r_offset - SecShdr->sh_addr)),\r
EFI_IMAGE_REL_BASED_DIR64);\r
break;\r
- case R_X86_64_32S:\r
+ //\r
+ // R_X86_64_32 and R_X86_64_32S are ELF64 relocations emitted when using\r
+ // the SYSV X64 ABI small non-position-independent code model.\r
+ // R_X86_64_32 is used for unsigned 32-bit immediates with a 32-bit operand\r
+ // size. The value is either not extended, or zero-extended to 64 bits.\r
+ // R_X86_64_32S is used for either signed 32-bit non-rip-relative displacements\r
+ // or signed 32-bit immediates with a 64-bit operand size. The value is\r
+ // sign-extended to 64 bits.\r
+ // EFI_IMAGE_REL_BASED_HIGHLOW is a PE relocation that uses 32-bit arithmetic\r
+ // for rebasing an image.\r
+ // EFI PE binaries declare themselves EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE and\r
+ // may load above 2GB. If an EFI PE binary with a converted R_X86_64_32S\r
+ // relocation is loaded above 2GB, the value will get sign-extended to the\r
+ // negative part of the 64-bit address space. The negative part of the 64-bit\r
+ // address space is unmapped, so accessing such an address page-faults.\r
+ // In order to support R_X86_64_32S, it is necessary to unset\r
+ // EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE, and the EFI PE loader must implement\r
+ // this flag and abstain from loading such a PE binary above 2GB.\r
+ // Since this feature is not supported, support for R_X86_64_32S (and hence\r
+ // the small non-position-independent code model) is disabled.\r
+ //\r
+ // case R_X86_64_32S:\r
case R_X86_64_32:\r
VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",\r
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));\r