2012-02-24 10:15:21 +08:00
|
|
|
//===-- ARMFixupKinds.h - ARM Specific Fixup Entries ------------*- C++ -*-===//
|
2010-11-04 09:12:30 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H
|
|
|
|
#define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H
|
2010-11-04 09:12:30 +08:00
|
|
|
|
|
|
|
#include "llvm/MC/MCFixup.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace ARM {
|
|
|
|
enum Fixups {
|
2010-12-02 08:28:45 +08:00
|
|
|
// fixup_arm_ldst_pcrel_12 - 12-bit PC relative relocation for symbol
|
|
|
|
// addresses
|
|
|
|
fixup_arm_ldst_pcrel_12 = FirstTargetFixupKind,
|
2010-12-15 05:28:29 +08:00
|
|
|
|
2010-12-09 09:51:07 +08:00
|
|
|
// fixup_t2_ldst_pcrel_12 - Equivalent to fixup_arm_ldst_pcrel_12, with
|
|
|
|
// the 16-bit halfwords reordered.
|
|
|
|
fixup_t2_ldst_pcrel_12,
|
2010-12-15 05:28:29 +08:00
|
|
|
|
2011-12-20 07:06:24 +08:00
|
|
|
// fixup_arm_pcrel_10_unscaled - 10-bit PC relative relocation for symbol
|
|
|
|
// addresses used in LDRD/LDRH/LDRB/etc. instructions. All bits are encoded.
|
|
|
|
fixup_arm_pcrel_10_unscaled,
|
2010-12-02 03:18:46 +08:00
|
|
|
// fixup_arm_pcrel_10 - 10-bit PC relative relocation for symbol addresses
|
2010-12-08 08:18:36 +08:00
|
|
|
// used in VFP instructions where the lower 2 bits are not encoded
|
2010-12-02 03:18:46 +08:00
|
|
|
// (so it's encoded as an 8-bit immediate).
|
|
|
|
fixup_arm_pcrel_10,
|
2010-12-08 08:18:36 +08:00
|
|
|
// fixup_t2_pcrel_10 - Equivalent to fixup_arm_pcrel_10, accounting for
|
2010-12-09 08:27:41 +08:00
|
|
|
// the short-swapped encoding of Thumb2 instructions.
|
2010-12-08 08:18:36 +08:00
|
|
|
fixup_t2_pcrel_10,
|
2016-01-25 18:26:26 +08:00
|
|
|
// fixup_arm_pcrel_9 - 9-bit PC relative relocation for symbol addresses
|
|
|
|
// used in VFP instructions where bit 0 not encoded (so it's encoded as an
|
|
|
|
// 8-bit immediate).
|
|
|
|
fixup_arm_pcrel_9,
|
|
|
|
// fixup_t2_pcrel_9 - Equivalent to fixup_arm_pcrel_9, accounting for
|
|
|
|
// the short-swapped encoding of Thumb2 instructions.
|
|
|
|
fixup_t2_pcrel_9,
|
2010-12-15 06:28:03 +08:00
|
|
|
// fixup_thumb_adr_pcrel_10 - 10-bit PC relative relocation for symbol
|
|
|
|
// addresses where the lower 2 bits are not encoded (so it's encoded as an
|
|
|
|
// 8-bit immediate).
|
|
|
|
fixup_thumb_adr_pcrel_10,
|
2010-12-02 08:28:45 +08:00
|
|
|
// fixup_arm_adr_pcrel_12 - 12-bit PC relative relocation for the ADR
|
|
|
|
// instruction.
|
|
|
|
fixup_arm_adr_pcrel_12,
|
2010-12-14 08:36:49 +08:00
|
|
|
// fixup_t2_adr_pcrel_12 - 12-bit PC relative relocation for the ADR
|
|
|
|
// instruction.
|
|
|
|
fixup_t2_adr_pcrel_12,
|
2011-02-05 03:47:15 +08:00
|
|
|
// fixup_arm_condbranch - 24-bit PC relative relocation for conditional branch
|
|
|
|
// instructions.
|
|
|
|
fixup_arm_condbranch,
|
|
|
|
// fixup_arm_uncondbranch - 24-bit PC relative relocation for
|
|
|
|
// branch instructions. (unconditional)
|
|
|
|
fixup_arm_uncondbranch,
|
2010-12-15 05:28:29 +08:00
|
|
|
// fixup_t2_condbranch - 20-bit PC relative relocation for Thumb2 direct
|
2010-12-14 03:31:11 +08:00
|
|
|
// uconditional branch instructions.
|
|
|
|
fixup_t2_condbranch,
|
2010-12-15 05:28:29 +08:00
|
|
|
// fixup_t2_uncondbranch - 20-bit PC relative relocation for Thumb2 direct
|
2010-12-14 03:31:11 +08:00
|
|
|
// branch unconditional branch instructions.
|
|
|
|
fixup_t2_uncondbranch,
|
2010-12-09 07:01:43 +08:00
|
|
|
|
2010-12-11 02:21:33 +08:00
|
|
|
// fixup_arm_thumb_br - 12-bit fixup for Thumb B instructions.
|
|
|
|
fixup_arm_thumb_br,
|
|
|
|
|
2012-03-30 17:15:32 +08:00
|
|
|
// The following fixups handle the ARM BL instructions. These can be
|
|
|
|
// conditionalised; however, the ARM ELF ABI requires a different relocation
|
|
|
|
// in that case: R_ARM_JUMP24 instead of R_ARM_CALL. The difference is that
|
|
|
|
// R_ARM_CALL is allowed to change the instruction to a BLX inline, which has
|
|
|
|
// no conditional version; R_ARM_JUMP24 would have to insert a veneer.
|
|
|
|
//
|
|
|
|
// MachO does not draw a distinction between the two cases, so it will treat
|
|
|
|
// fixup_arm_uncondbl and fixup_arm_condbl as identical fixups.
|
|
|
|
|
|
|
|
// fixup_arm_uncondbl - Fixup for unconditional ARM BL instructions.
|
|
|
|
fixup_arm_uncondbl,
|
|
|
|
|
|
|
|
// fixup_arm_condbl - Fixup for ARM BL instructions with nontrivial
|
|
|
|
// conditionalisation.
|
|
|
|
fixup_arm_condbl,
|
2012-02-28 05:36:23 +08:00
|
|
|
|
|
|
|
// fixup_arm_blx - Fixup for ARM BLX instructions.
|
|
|
|
fixup_arm_blx,
|
|
|
|
|
2011-05-27 11:46:51 +08:00
|
|
|
// fixup_arm_thumb_bl - Fixup for Thumb BL instructions.
|
2010-12-07 07:57:07 +08:00
|
|
|
fixup_arm_thumb_bl,
|
2010-11-12 02:04:49 +08:00
|
|
|
|
2010-12-09 08:39:08 +08:00
|
|
|
// fixup_arm_thumb_blx - Fixup for Thumb BLX instructions.
|
|
|
|
fixup_arm_thumb_blx,
|
|
|
|
|
2010-12-10 03:50:12 +08:00
|
|
|
// fixup_arm_thumb_cb - Fixup for Thumb branch instructions.
|
|
|
|
fixup_arm_thumb_cb,
|
2010-12-09 07:01:43 +08:00
|
|
|
|
2010-12-08 09:57:09 +08:00
|
|
|
// fixup_arm_thumb_cp - Fixup for Thumb load/store from constant pool instrs.
|
|
|
|
fixup_arm_thumb_cp,
|
|
|
|
|
2010-12-15 06:26:49 +08:00
|
|
|
// fixup_arm_thumb_bcc - Fixup for Thumb conditional branching instructions.
|
2010-12-11 01:13:40 +08:00
|
|
|
fixup_arm_thumb_bcc,
|
|
|
|
|
2010-11-19 07:37:15 +08:00
|
|
|
// The next two are for the movt/movw pair
|
|
|
|
// the 16bit imm field are split into imm{15-12} and imm{11-0}
|
|
|
|
fixup_arm_movt_hi16, // :upper16:
|
|
|
|
fixup_arm_movw_lo16, // :lower16:
|
2011-01-14 10:38:49 +08:00
|
|
|
fixup_t2_movt_hi16, // :upper16:
|
|
|
|
fixup_t2_movw_lo16, // :lower16:
|
2010-11-19 07:37:15 +08:00
|
|
|
|
Fix for pr24346: arm asm label calculation error in sub
Some ARM instructions encode 32-bit immediates as a 8-bit integer (0-255)
and a 4-bit rotation (0-30, even) in its least significant 12 bits. The
original fixup, FK_Data_4, patches the instruction by the value bit-to-bit,
regardless of the encoding. For example, assuming the label L1 and L2 are
0x0 and 0x104 respectively, the following instruction:
add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260
would be assembled to the following, which adds 1 to r0, instead of 260:
e2800104 add r0, r0, #4, 2 ; equivalently 1
The new fixup kind fixup_arm_mod_imm takes care of the encoding:
e2800f41 add r0, r0, #260
Patch by Ting-Yuan Huang!
llvm-svn: 265122
2016-04-01 17:40:47 +08:00
|
|
|
// fixup_arm_mod_imm - Fixup for mod_imm
|
|
|
|
fixup_arm_mod_imm,
|
|
|
|
|
2010-11-12 02:04:49 +08:00
|
|
|
// Marker
|
|
|
|
LastTargetFixupKind,
|
|
|
|
NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
|
2010-11-04 09:12:30 +08:00
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
|
|
|
}
|
2010-11-04 09:12:30 +08:00
|
|
|
|
|
|
|
#endif
|