@@ -852,6 +852,59 @@ enum InfoAccessType
852852 IAT_RELPVALUE // The value needs to be accessed via a relative indirection
853853};
854854
855+ enum class CorInfoReloc
856+ {
857+ NONE,
858+
859+ // General relocation types
860+ DIRECT, // Direct/absolute pointer sized address
861+ RELATIVE32, // 32-bit relative address from byte following reloc
862+
863+ // Arm64 relocs
864+ ARM64_BRANCH26, // Arm64: B, BL
865+ ARM64_PAGEBASE_REL21, // ADRP
866+ ARM64_PAGEOFFSET_12A, // ADD/ADDS (immediate) with zero shift, for page offset
867+ // Linux arm64
868+ ARM64_LIN_TLSDESC_ADR_PAGE21,
869+ ARM64_LIN_TLSDESC_LD64_LO12,
870+ ARM64_LIN_TLSDESC_ADD_LO12,
871+ ARM64_LIN_TLSDESC_CALL,
872+ // Windows arm64
873+ ARM64_WIN_TLS_SECREL_HIGH12A, // ADD high 12-bit offset for tls
874+ ARM64_WIN_TLS_SECREL_LOW12A, // ADD low 12-bit offset for tls
875+
876+ // Windows x64
877+ AMD64_WIN_SECREL,
878+
879+ // Linux x64
880+ // GD model
881+ AMD64_LIN_TLSGD,
882+
883+ // Arm32 relocs
884+ ARM32_THUMB_BRANCH24, // Thumb2: B, BL
885+ ARM32_THUMB_MOV32, // Thumb2: MOVW/MOVT
886+ // The identifier for ARM32-specific PC-relative address
887+ // computation corresponds to the following instruction
888+ // sequence:
889+ // l0: movw rX, #imm_lo // 4 byte
890+ // l4: movt rX, #imm_hi // 4 byte
891+ // l8: add rX, pc <- after this instruction rX = relocTarget
892+ //
893+ // Program counter at l8 is address of l8 + 4
894+ // Address of relocated movw/movt is l0
895+ // So, imm should be calculated as the following:
896+ // imm = relocTarget - (l8 + 4) = relocTarget - (l0 + 8 + 4) = relocTarget - (l_0 + 12)
897+ // So, the value of offset correction is 12
898+ ARM32_THUMB_MOV32_PCREL, // Thumb2: MOVW/MOVT
899+
900+ // LoongArch64 relocs
901+ LOONGARCH64_PC, // LoongArch64: pcalau12i+imm12
902+ LOONGARCH64_JIR, // LoongArch64: pcaddu18i+jirl
903+
904+ // RISCV64 relocs
905+ RISCV64_PC, // RiscV64: auipc
906+ };
907+
855908enum CorInfoGCType
856909{
857910 TYPE_GC_NONE, // no embedded objectrefs
@@ -3399,50 +3452,6 @@ class ICorDynamicInfo : public ICorStaticInfo
33993452 virtual CORINFO_METHOD_HANDLE getSpecialCopyHelper (CORINFO_CLASS_HANDLE type) = 0;
34003453};
34013454
3402- /* *********************************************************************************/
3403-
3404- // It would be nicer to use existing IMAGE_REL_XXX constants instead of defining our own here...
3405- #define IMAGE_REL_BASED_REL32 0x10
3406- #define IMAGE_REL_BASED_THUMB_BRANCH24 0x13
3407- #define IMAGE_REL_SECREL 0x104
3408-
3409- // Linux x64
3410- // GD model
3411- #define IMAGE_REL_TLSGD 0x105
3412-
3413- // Linux arm64
3414- // TLSDESC (dynamic)
3415- #define IMAGE_REL_AARCH64_TLSDESC_ADR_PAGE21 0x107
3416- #define IMAGE_REL_AARCH64_TLSDESC_LD64_LO12 0x108
3417- #define IMAGE_REL_AARCH64_TLSDESC_ADD_LO12 0x109
3418- #define IMAGE_REL_AARCH64_TLSDESC_CALL 0x10A
3419-
3420- // The identifier for ARM32-specific PC-relative address
3421- // computation corresponds to the following instruction
3422- // sequence:
3423- // l0: movw rX, #imm_lo // 4 byte
3424- // l4: movt rX, #imm_hi // 4 byte
3425- // l8: add rX, pc <- after this instruction rX = relocTarget
3426- //
3427- // Program counter at l8 is address of l8 + 4
3428- // Address of relocated movw/movt is l0
3429- // So, imm should be calculated as the following:
3430- // imm = relocTarget - (l8 + 4) = relocTarget - (l0 + 8 + 4) = relocTarget - (l_0 + 12)
3431- // So, the value of offset correction is 12
3432- //
3433- #define IMAGE_REL_BASED_REL_THUMB_MOV32_PCREL 0x14
3434-
3435- //
3436- // LOONGARCH64 relocation types
3437- //
3438- #define IMAGE_REL_LOONGARCH64_PC 0x0003
3439- #define IMAGE_REL_LOONGARCH64_JIR 0x0004
3440-
3441- //
3442- // RISCV64 relocation types
3443- //
3444- #define IMAGE_REL_RISCV64_PC 0x0003
3445-
34463455/* *********************************************************************************/
34473456#ifdef TARGET_64BIT
34483457#define USE_PER_FRAME_PINVOKE_INIT
0 commit comments