This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFC PATCH, binutils, ARM 4/11, ping] Use getters/setters to access ARM branch type
- From: Thomas Preudhomme <thomas dot preudhomme at foss dot arm dot com>
- To: binutils at sourceware dot org
- Cc: Nick Clifton <nickc at redhat dot com>
- Date: Mon, 04 Apr 2016 15:13:35 +0100
- Subject: Re: [RFC PATCH, binutils, ARM 4/11, ping] Use getters/setters to access ARM branch type
- Authentication-results: sourceware.org; auth=none
- References: <004c01d13d57$975ae2a0$c610a7e0$ at foss dot arm dot com> <1744390 dot rRxysHBH6A at e108577-lin> <56FBE5A6 dot 5030306 at redhat dot com>
On Wednesday 30 March 2016 15:41:42 Nick Clifton wrote:
> Hi Thomas,
>
> > Ping?
>
> Oops - sorry.
>
> >> *** bfd/ChangeLog ***
> >>
> >> 2015-12-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
> >>
> >> * 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/ChangeLog ***
> >>
> >> 2015-12-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
> >>
> >> * config/tc-arm.c (arm_adjust_symtab): Use
> >> ARM_SET_SYM_BRANCH_TYPE
> >>
> >> to set branch type of a symbol.
> >>
> >>
> >> *** include/elf/ChangeLog ***
> >>
> >> 2015-12-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
> >>
> >> * arm.h (ARM_SYM_BRANCH_TYPE): Replace by ...
> >> (ARM_GET_SYM_BRANCH_TYPE): ... this ...
> >> (ARM_SET_SYM_BRANCH_TYPE): ... and this.
> >>
> >> *** ld/ChangeLog ***
> >>
> >> 2015-12-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
> >>
> >> (gld${EMULATION_NAME}_finish): Use ARM_GET_SYM_BRANCH_TYPE to
> >> get
> >> branch type of a symbol.
> >>
> >> *** opcodes/ChangeLog ***
> >>
> >> 2015-12-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
> >>
> >> * arm-dis.c (get_sym_code_type): Use ARM_GET_SYM_BRANCH_TYPE to
> >> get
> >> branch type of a symbol.
> >> (print_insn): Likewise.
>
> Approved - please apply - but ...
>
> >> *** gdb/ChangeLog ***
> >>
> >> 2015-12-16 Thomas Preud'homme <thomas.preudhomme@arm.com>
> >>
> >> * arm-tdep.c (arm_elf_make_msymbol_special): Use
> >> ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol.
>
> This change will need approval from a GDB maintainer.
Yes of course, I'll submit to gdb as well.
>
> >> -#define ARM_SYM_BRANCH_TYPE(SYM) \
> >> - ((enum arm_st_branch_type) (SYM)->st_target_internal)
> >> +#define ARM_GET_SYM_BRANCH_TYPE(SYM_TARGET_INTERNAL) \
> >> + ((enum arm_st_branch_type) ((SYM_TARGET_INTERNAL) & 3))
> >> +#define ARM_SET_SYM_BRANCH_TYPE(SYM_TARGET_INTERNAL,TYPE) \
> >> + ((SYM_TARGET_INTERNAL) = ((SYM_TARGET_INTERNAL) & ~3) | ((TYPE) & 3))
>
> It occurs to me that an out-of-range value for the TYPE parameter to the
> ARM_SET_SYM_BRANCH_TYPE macro ought to be flagged as an error, and not
> silently truncated. You could probably let the compiler's enum checking do
> this...
Any advice on how to catch any growth in terms of enum size? The point is for
later commit [1] to start using currently unused bits but we need to make sure
these new macros are updated if branch type enum increase in size.
[1] https://sourceware.org/ml/binutils/2016-03/msg00379.html
Best regards,
Thomas