aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'include/elf/arm.h')
-rw-r--r--include/elf/arm.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/include/elf/arm.h b/include/elf/arm.h
index bd9fd8bcf54..bafc03c52ee 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -359,10 +359,29 @@ enum arm_st_branch_type {
ST_BRANCH_TO_ARM,
ST_BRANCH_TO_THUMB,
ST_BRANCH_LONG,
- ST_BRANCH_UNKNOWN
+ ST_BRANCH_UNKNOWN,
+ ST_BRANCH_ENUM_SIZE
};
-#define ARM_SYM_BRANCH_TYPE(SYM) \
- ((enum arm_st_branch_type) (SYM)->st_target_internal)
+#define NUM_ENUM_ARM_ST_BRANCH_TYPE_BITS 2
+#define ENUM_ARM_ST_BRANCH_TYPE_BITMASK \
+ ((1 << NUM_ENUM_ARM_ST_BRANCH_TYPE_BITS) - 1)
+
+#define ARM_GET_SYM_BRANCH_TYPE(STI) \
+ ((enum arm_st_branch_type) ((STI) & ENUM_ARM_ST_BRANCH_TYPE_BITMASK))
+#ifdef BFD_ASSERT
+#define ARM_SET_SYM_BRANCH_TYPE(STI, TYPE) \
+ do { \
+ BFD_ASSERT (TYPE <= ST_BRANCH_ENUM_SIZE); \
+ BFD_ASSERT ((1 << NUM_ENUM_ARM_ST_BRANCH_TYPE_BITS) \
+ >= ST_BRANCH_ENUM_SIZE); \
+ (STI) = (((STI) & ~ENUM_ARM_ST_BRANCH_TYPE_BITMASK) \
+ | ((TYPE) & ENUM_ARM_ST_BRANCH_TYPE_BITMASK)); \
+ } while (0)
+#else
+#define ARM_SET_SYM_BRANCH_TYPE(STI, TYPE) \
+ (STI) = (((STI) & ~ENUM_ARM_ST_BRANCH_TYPE_BITMASK) \
+ | ((TYPE) & ENUM_ARM_ST_BRANCH_TYPE_BITMASK))
+#endif
#endif /* _ELF_ARM_H */