aboutsummaryrefslogtreecommitdiff
path: root/include/elf
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2016-05-10 16:14:23 +0100
committerThomas Preud'homme <thomas.preudhomme@arm.com>2016-05-10 16:17:04 +0100
commit39d911fc3c6519799ca1af4365d4b56f9d71ca94 (patch)
tree8f99c16b480ca5369c40ff0f432f7a64dc276e7b /include/elf
parent6bde4c52fb2d49572d365612f222a42b4d316f09 (diff)
downloadgdb-39d911fc3c6519799ca1af4365d4b56f9d71ca94.zip
gdb-39d911fc3c6519799ca1af4365d4b56f9d71ca94.tar.gz
gdb-39d911fc3c6519799ca1af4365d4b56f9d71ca94.tar.bz2
Use getters/setters to access ARM branch type
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * elf32-arm.c (elf32_arm_size_stubs): Use new macros ARM_GET_SYM_BRANCH_TYPE and ARM_SET_SYM_BRANCH_TYPE to respectively get and set branch type of a symbol. (bfd_elf32_arm_process_before_allocation): Likewise. (elf32_arm_relocate_section): Likewise and fix identation along the way. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_symbol): Likewise. (elf32_arm_swap_symbol_in): Likewise. (elf32_arm_swap_symbol_out): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Use ARM_SET_SYM_BRANCH_TYPE to set branch type of a symbol. gdb/ * arm-tdep.c (arm_elf_make_msymbol_special): Use ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol. include/ * arm.h (enum arm_st_branch_type): Add new ST_BRANCH_ENUM_SIZE enumerator. (NUM_ENUM_ARM_ST_BRANCH_TYPE_BITS): New macro. (ENUM_ARM_ST_BRANCH_TYPE_BITMASK): Likewise. (ARM_SYM_BRANCH_TYPE): Replace by ... (ARM_GET_SYM_BRANCH_TYPE): This and ... (ARM_SET_SYM_BRANCH_TYPE): This in two versions depending on whether BFD_ASSERT is defined or not. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol. opcodes/ * arm-dis.c (get_sym_code_type): Use ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol. (print_insn): Likewise.
Diffstat (limited to 'include/elf')
-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 bd9fd8b..bafc03c 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 */