/* pe-arm64.pk -- PE COFF implementation for GNU poke, ARM64.  */

/* Copyright (C) 2022, 2023, 2024 Jose E. Marchesi.  */

/* This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* Relocation types.  */

var PE_ARM64_R_ABSOLUTE = 0x0000UH,
    PE_ARM64_R_ADDR32 = 0x0001UH,
    PE_ARM64_R_ADDR32NB = 0x0002UH,
    PE_ARM64_R_BRANCH26 = 0x0003UH,
    PE_ARM64_R_PAGEBASE_REL21 = 0x0004UH,
    PE_ARM64_R_REL21 = 0x0005UH,
    PE_ARM64_R_PAGEOFFSET_12A = 0x0006UH,
    PE_ARM64_R_PAGEOFFSET_12L = 0x0007UH,
    PE_ARM64_R_SECREL = 0x0008UH,
    PE_ARM64_R_SECREL_LOW12A = 0x0009UH,
    PE_ARM64_R_SECREL_HIGH12A = 0x000AUH,
    PE_ARM64_R_SECREL_LOW12L = 0x000BUH,
    PE_ARM64_R_TOKEN = 0x000CUH,
    PE_ARM64_R_SECTION = 0x000DUH,
    PE_ARM64_R_ADDR64 = 0x000EUH,
    PE_ARM64_R_BRANCH19 = 0x000FUH,
    PE_ARM64_R_BRANCH14 = 0x0010UH,
    PE_ARM64_R_REL32 = 0x0011UH;

/* Relocation struct.  */

type PE_ARM64_Reloc =
  struct
  {
    offset<uint<32>,B> r_vaddr;
    uint<32> r_symndx;
    uint<16> r_type;
    offset<uint<32>,B> r_offset;
  };
