|
From: Andrew F. <af...@ap...> - 2010-06-12 20:40:09
|
I'm not sure if anyone has tested the UnixPkg for x86_64? I checked the GcShellPkg in, but I did most of my work in OS X 32-bit, since Xcode does not support the x86_64 EFI ABI. The GOT is the Global Offset Table. The GOT is usually referenced by code in a PC relative way, but it contains absolute addresses. Relocations for images (not objects) are much simpler in PE/COFF than in ELF. When we do the conversion for ELF to PE/COFF these are the only types of relocations that can end up in the PE/COFF image file: 0.0.1. Base Relocation Types Constant Value Description IMAGE_REL_BASED_ABSOLUTE 0 The base relocation is skipped. This type can be used to pad a block. IMAGE_REL_BASED_HIGH 1 The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the high value of a 32-bit word. IMAGE_REL_BASED_LOW 2 The base relocation adds the low 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the low half of a 32-bit word. IMAGE_REL_BASED_HIGHLOW 3 The base relocation applies all 32 bits of the difference to the 32-bit field at offset. IMAGE_REL_BASED_HIGHADJ 4 The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the high value of a 32-bit word. The low 16 bits of the 32-bit value are stored in the 16-bit word that follows this base relocation. This means that this base relocation occupies two slots. IMAGE_REL_BASED_MIPS_JMPADDR 5 The base relocation applies to a MIPS jump instruction. 6 Reserved, must be zero. 7 Reserved, must be zero. IMAGE_REL_BASED_MIPS_JMPADDR16 9 The base relocation applies to a MIPS16 jump instruction. IMAGE_REL_BASED_DIR64 10 The base relocation applies the difference to the 64-bit field at offset. ELF mixes object relocations and image relocations together in its documentation and usage. ELF/GCC also seems to have this assumption that a relocatable image must by a dynamically loadable image. So what you can see in the ELF relocations for an image is both object and image relocations. Some of the object oriented relocations are PC relative stuff so they don't need to be moved into the PE/COFF relocations (not to mention there is not a mapping for them). So if this EFL GOT JMP Slot relocation is PC relative you can update GenFw to just skip it. If it is not PC relative then you need to map it into one of the above PE/COFF relocation entries. Andrew Fish On Jun 12, 2010, at 4:28 AM, Lu, Ken wrote: > R_X86_64_JMP_SLOT |