mirror of
https://github.com/ziglang/zig.git
synced 2025-12-30 18:13:19 +00:00
coff: add base relocation related types
This commit is contained in:
parent
f559ea95b1
commit
d3eaabd285
@ -310,6 +310,84 @@ pub const ImageDataDirectory = extern struct {
|
||||
size: u32,
|
||||
};
|
||||
|
||||
pub const BaseRelocationDirectoryEntry = extern struct {
|
||||
/// The image base plus the page RVA is added to each offset to create the VA where the base relocation must be applied.
|
||||
page_rva: u32,
|
||||
|
||||
/// The total number of bytes in the base relocation block, including the Page RVA and Block Size fields and the Type/Offset fields that follow.
|
||||
block_size: u32,
|
||||
};
|
||||
|
||||
pub const BaseRelocation = packed struct {
|
||||
/// Stored in the remaining 12 bits of the WORD, an offset from the starting address that was specified in the Page RVA field for the block.
|
||||
/// This offset specifies where the base relocation is to be applied.
|
||||
offset: u12,
|
||||
|
||||
/// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied.
|
||||
@"type": BaseRelocationType,
|
||||
};
|
||||
|
||||
pub const BaseRelocationType = enum(u4) {
|
||||
/// The base relocation is skipped. This type can be used to pad a block.
|
||||
ABSOLUTE = 0,
|
||||
|
||||
/// 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.
|
||||
HIGH = 1,
|
||||
|
||||
/// 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.
|
||||
LOW = 2,
|
||||
|
||||
/// The base relocation applies all 32 bits of the difference to the 32-bit field at offset.
|
||||
HIGHLOW = 3,
|
||||
|
||||
/// 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.
|
||||
HIGHADJ = 4,
|
||||
|
||||
/// When the machine type is MIPS, the base relocation applies to a MIPS jump instruction.
|
||||
MIPS_JMPADDR = 5,
|
||||
|
||||
/// This relocation is meaningful only when the machine type is ARM or Thumb.
|
||||
/// The base relocation applies the 32-bit address of a symbol across a consecutive MOVW/MOVT instruction pair.
|
||||
// ARM_MOV32 = 5,
|
||||
|
||||
/// This relocation is only meaningful when the machine type is RISC-V.
|
||||
/// The base relocation applies to the high 20 bits of a 32-bit absolute address.
|
||||
// RISCV_HIGH20 = 5,
|
||||
|
||||
/// Reserved, must be zero.
|
||||
RESERVED = 6,
|
||||
|
||||
/// This relocation is meaningful only when the machine type is Thumb.
|
||||
/// The base relocation applies the 32-bit address of a symbol to a consecutive MOVW/MOVT instruction pair.
|
||||
THUMB_MOV32 = 7,
|
||||
|
||||
/// This relocation is only meaningful when the machine type is RISC-V.
|
||||
/// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V I-type instruction format.
|
||||
// RISCV_LOW12I = 7,
|
||||
|
||||
/// This relocation is only meaningful when the machine type is RISC-V.
|
||||
/// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V S-type instruction format.
|
||||
RISCV_LOW12S = 8,
|
||||
|
||||
/// This relocation is only meaningful when the machine type is LoongArch 32-bit.
|
||||
/// The base relocation applies to a 32-bit absolute address formed in two consecutive instructions.
|
||||
// LOONGARCH32_MARK_LA = 8,
|
||||
|
||||
/// This relocation is only meaningful when the machine type is LoongArch 64-bit.
|
||||
/// The base relocation applies to a 64-bit absolute address formed in four consecutive instructions.
|
||||
// LOONGARCH64_MARK_LA = 8,
|
||||
|
||||
/// The relocation is only meaningful when the machine type is MIPS.
|
||||
/// The base relocation applies to a MIPS16 jump instruction.
|
||||
MIPS_JMPADDR16 = 9,
|
||||
|
||||
/// The base relocation applies the difference to the 64-bit field at offset.
|
||||
DIR64 = 10,
|
||||
};
|
||||
|
||||
pub const DebugDirectoryEntry = extern struct {
|
||||
characteristics: u32,
|
||||
time_date_stamp: u32,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user