[ARM] Use getters/setters to access ARM branch type

Message ID 3219422.otqiV2U3aN@e108577-lin
State New, archived
Headers

Commit Message

Thomas Preud'homme May 10, 2016, 2:39 p.m. UTC
  This patch is part of a patch series to add support for ARMv8-M security
extension[1] to GNU ld. This specific patch changes all accesses to the
branch type stored in the st_target_internal field of a Elf_Internal_Sym
structure or in the target_internal field of a elf_link_hash_entry
structure by getter and setters. This is required by subsequent patches to
also store in these fields whether a symbol is a special symbol indicating
a secure entry function.

[1] Software requirements for ARMv8-M security extension are described in
document ARM-ECM-0359818 [2] [2] Available on http://infocenter.arm.com in
Developer guides and articles > Software development > ARMĀ®v8-M Security
Extensions: Requirements on Development Tools

Please find below the gdb part of the ChangeLog and patch. For the full 
version, please see [2].

[2] https://sourceware.org/ml/binutils/2016-05/msg00040.html

*** 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.




Is this ok for the master branch?

Best regards,

Thomas
  

Comments

Yao Qi May 10, 2016, 3:11 p.m. UTC | #1
Thomas Preudhomme <thomas.preudhomme@foss.arm.com> writes:

> @@ -8467,7 +8467,8 @@ coff_sym_is_thumb (int val)
>  static void
>  arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
>  {
> -  if (ARM_SYM_BRANCH_TYPE (&((elf_symbol_type *)sym)->internal_elf_sym)
> +  elf_symbol_type *elfsym = (elf_symbol_type *) sym;

We need a blank line here.

> +  if (ARM_GET_SYM_BRANCH_TYPE (elfsym->internal_elf_sym.st_target_internal)
>        == ST_BRANCH_TO_THUMB)
>      MSYMBOL_SET_SPECIAL (msym);

Patch is OK to me.
  
Thomas Preud'homme May 10, 2016, 3:32 p.m. UTC | #2
On Tuesday 10 May 2016 16:11:51 Yao Qi wrote:
> Thomas Preudhomme <thomas.preudhomme@foss.arm.com> writes:
> > @@ -8467,7 +8467,8 @@ coff_sym_is_thumb (int val)
> > 
> >  static void
> >  arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
> >  {
> > 
> > -  if (ARM_SYM_BRANCH_TYPE (&((elf_symbol_type *)sym)->internal_elf_sym)
> > +  elf_symbol_type *elfsym = (elf_symbol_type *) sym;
> 
> We need a blank line here.
> 
> > +  if (ARM_GET_SYM_BRANCH_TYPE
> > (elfsym->internal_elf_sym.st_target_internal)> 
> >        == ST_BRANCH_TO_THUMB)
> >      
> >      MSYMBOL_SET_SPECIAL (msym);
> 
> Patch is OK to me.

Committed with the above changes.

Thanks. Best regards,

Thomas
  

Patch

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 
5a2d490df77905d6cf6a82041c7304b57581a82d..d02bdb27b99d7fc4d179e8e51c1a421c7c101da8 
100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8467,7 +8467,8 @@  coff_sym_is_thumb (int val)
 static void
 arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
 {
-  if (ARM_SYM_BRANCH_TYPE (&((elf_symbol_type *)sym)->internal_elf_sym)
+  elf_symbol_type *elfsym = (elf_symbol_type *) sym;
+  if (ARM_GET_SYM_BRANCH_TYPE (elfsym->internal_elf_sym.st_target_internal)
       == ST_BRANCH_TO_THUMB)
     MSYMBOL_SET_SPECIAL (msym);
 }