| ... | ... | @@ -310,6 +310,84 @@ pub const ImageDataDirectory = extern struct { |
| 310 | 310 | size: u32, |
| 311 | 311 | }; |
| 312 | 312 | |
| 313 | pub const BaseRelocationDirectoryEntry = extern struct { |
| 314 | /// The image base plus the page RVA is added to each offset to create the VA where the base relocation must be applied. |
| 315 | page_rva: u32, |
| 316 | |
| 317 | /// 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. |
| 318 | block_size: u32, |
| 319 | }; |
| 320 | |
| 321 | pub const BaseRelocation = packed struct { |
| 322 | /// 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. |
| 323 | /// This offset specifies where the base relocation is to be applied. |
| 324 | offset: u12, |
| 325 | |
| 326 | /// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied. |
| 327 | @"type": BaseRelocationType, |
| 328 | }; |
| 329 | |
| 330 | pub const BaseRelocationType = enum(u4) { |
| 331 | /// The base relocation is skipped. This type can be used to pad a block. |
| 332 | ABSOLUTE = 0, |
| 333 | |
| 334 | /// 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. |
| 335 | HIGH = 1, |
| 336 | |
| 337 | /// 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. |
| 338 | LOW = 2, |
| 339 | |
| 340 | /// The base relocation applies all 32 bits of the difference to the 32-bit field at offset. |
| 341 | HIGHLOW = 3, |
| 342 | |
| 343 | /// The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. |
| 344 | /// The 16-bit field represents the high value of a 32-bit word. |
| 345 | /// The low 16 bits of the 32-bit value are stored in the 16-bit word that follows this base relocation. |
| 346 | /// This means that this base relocation occupies two slots. |
| 347 | HIGHADJ = 4, |
| 348 | |
| 349 | /// When the machine type is MIPS, the base relocation applies to a MIPS jump instruction. |
| 350 | MIPS_JMPADDR = 5, |
| 351 | |
| 352 | /// This relocation is meaningful only when the machine type is ARM or Thumb. |
| 353 | /// The base relocation applies the 32-bit address of a symbol across a consecutive MOVW/MOVT instruction pair. |
| 354 | // ARM_MOV32 = 5, |
| 355 | |
| 356 | /// This relocation is only meaningful when the machine type is RISC-V. |
| 357 | /// The base relocation applies to the high 20 bits of a 32-bit absolute address. |
| 358 | // RISCV_HIGH20 = 5, |
| 359 | |
| 360 | /// Reserved, must be zero. |
| 361 | RESERVED = 6, |
| 362 | |
| 363 | /// This relocation is meaningful only when the machine type is Thumb. |
| 364 | /// The base relocation applies the 32-bit address of a symbol to a consecutive MOVW/MOVT instruction pair. |
| 365 | THUMB_MOV32 = 7, |
| 366 | |
| 367 | /// This relocation is only meaningful when the machine type is RISC-V. |
| 368 | /// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V I-type instruction format. |
| 369 | // RISCV_LOW12I = 7, |
| 370 | |
| 371 | /// This relocation is only meaningful when the machine type is RISC-V. |
| 372 | /// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V S-type instruction format. |
| 373 | RISCV_LOW12S = 8, |
| 374 | |
| 375 | /// This relocation is only meaningful when the machine type is LoongArch 32-bit. |
| 376 | /// The base relocation applies to a 32-bit absolute address formed in two consecutive instructions. |
| 377 | // LOONGARCH32_MARK_LA = 8, |
| 378 | |
| 379 | /// This relocation is only meaningful when the machine type is LoongArch 64-bit. |
| 380 | /// The base relocation applies to a 64-bit absolute address formed in four consecutive instructions. |
| 381 | // LOONGARCH64_MARK_LA = 8, |
| 382 | |
| 383 | /// The relocation is only meaningful when the machine type is MIPS. |
| 384 | /// The base relocation applies to a MIPS16 jump instruction. |
| 385 | MIPS_JMPADDR16 = 9, |
| 386 | |
| 387 | /// The base relocation applies the difference to the 64-bit field at offset. |
| 388 | DIR64 = 10, |
| 389 | }; |
| 390 | |
| 313 | 391 | pub const DebugDirectoryEntry = extern struct { |
| 314 | 392 | characteristics: u32, |
| 315 | 393 | time_date_stamp: u32, |