mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 23:26:51 +08:00
Apply Thoams de Lellis's patch to fic disassembly of Thumb instructions when
bounded by non-function labels.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2000-01-27 Thomas de Lellis <tdel@wrs.com>
|
||||||
|
|
||||||
|
* elf32-arm.h (elf32_arm_get_symbol_type): If a symbol has the
|
||||||
|
STT_ARM_16BIT flag set, but it is not attached to a data object
|
||||||
|
return STT_ARM_16BIT so that it will be treated as code by the
|
||||||
|
disassembler.
|
||||||
|
|
||||||
2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
|
2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
|
||||||
|
|
||||||
* coff-i386.c (i3coff_object_p): Remove prototype.
|
* coff-i386.c (i3coff_object_p): Remove prototype.
|
||||||
|
@ -714,7 +714,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
|
|||||||
{
|
{
|
||||||
case R_ARM_PC24:
|
case R_ARM_PC24:
|
||||||
/* This one is a call from arm code. We need to look up
|
/* This one is a call from arm code. We need to look up
|
||||||
the target of the call. If it is a thumb target, we
|
the target of the call. If it is a thumb target, we
|
||||||
insert glue. */
|
insert glue. */
|
||||||
|
|
||||||
if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC)
|
if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC)
|
||||||
@ -723,7 +723,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
|
|||||||
|
|
||||||
case R_ARM_THM_PC22:
|
case R_ARM_THM_PC22:
|
||||||
/* This one is a call from thumb code. We look
|
/* This one is a call from thumb code. We look
|
||||||
up the target of the call. If it is not a thumb
|
up the target of the call. If it is not a thumb
|
||||||
target, we insert glue. */
|
target, we insert glue. */
|
||||||
|
|
||||||
if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC)
|
if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC)
|
||||||
@ -737,6 +737,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error_return:
|
error_return:
|
||||||
if (free_relocs != NULL)
|
if (free_relocs != NULL)
|
||||||
free (free_relocs);
|
free (free_relocs);
|
||||||
@ -744,8 +745,8 @@ error_return:
|
|||||||
free (free_contents);
|
free (free_contents);
|
||||||
if (free_extsyms != NULL)
|
if (free_extsyms != NULL)
|
||||||
free (free_extsyms);
|
free (free_extsyms);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The thumb form of a long branch is a bit finicky, because the offset
|
/* The thumb form of a long branch is a bit finicky, because the offset
|
||||||
@ -2103,10 +2104,22 @@ elf32_arm_get_symbol_type (elf_sym, type)
|
|||||||
Elf_Internal_Sym * elf_sym;
|
Elf_Internal_Sym * elf_sym;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
if (ELF_ST_TYPE (elf_sym->st_info) == STT_ARM_TFUNC)
|
switch (ELF_ST_TYPE (elf_sym->st_info))
|
||||||
return ELF_ST_TYPE (elf_sym->st_info);
|
{
|
||||||
else
|
case STT_ARM_TFUNC:
|
||||||
return type;
|
return ELF_ST_TYPE (elf_sym->st_info);
|
||||||
|
break;
|
||||||
|
case STT_ARM_16BIT:
|
||||||
|
/* If the symbol is not an object, return the STT_ARM_16BIT flag.
|
||||||
|
This allows us to distinguish between data used by Thumb instructions
|
||||||
|
and non-data (which is probably code) inside Thumb regions of an
|
||||||
|
executable. */
|
||||||
|
if (type != STT_OBJECT)
|
||||||
|
return ELF_ST_TYPE (elf_sym->st_info);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static asection *
|
static asection *
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2000-01-27 Thomas de Lellis <tdel@windriver.com>
|
||||||
|
|
||||||
|
* config/tc-arm.c (armadjust_symtab): If the assembler is in
|
||||||
|
Thumb mode but the label seen was not declared as '.thumb_func'
|
||||||
|
then set the ST_INFO type to STT_ARM_16BIT mode. This allows
|
||||||
|
correct disassembly of Thumb code bounded by non function labels.
|
||||||
|
|
||||||
2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
|
2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
|
||||||
|
|
||||||
* Makefile.am (MULTI_CFILES): Add config/e-i386aout.c
|
* Makefile.am (MULTI_CFILES): Add config/e-i386aout.c
|
||||||
|
@ -6888,12 +6888,14 @@ arm_adjust_symtab ()
|
|||||||
{
|
{
|
||||||
if (ARM_IS_THUMB (sym))
|
if (ARM_IS_THUMB (sym))
|
||||||
{
|
{
|
||||||
|
elf_sym = elf_symbol (symbol_get_bfdsym (sym));
|
||||||
|
bind = ELF_ST_BIND (elf_sym);
|
||||||
|
|
||||||
|
/* If it's a .thumb_func, declare it as so, else tag label as .code 16. */
|
||||||
if (THUMB_IS_FUNC (sym))
|
if (THUMB_IS_FUNC (sym))
|
||||||
{
|
elf_sym->internal_elf_sym.st_info = ELF_ST_INFO (bind, STT_ARM_TFUNC);
|
||||||
elf_sym = elf_symbol (symbol_get_bfdsym (sym));
|
else
|
||||||
bind = ELF_ST_BIND (elf_sym);
|
elf_sym->internal_elf_sym.st_info = ELF_ST_INFO (bind, STT_ARM_16BIT);
|
||||||
elf_sym->internal_elf_sym.st_info = ELF_ST_INFO (bind, STT_ARM_TFUNC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2000-01-27 Thomas de Lellis <tdel@windriver.com>
|
||||||
|
|
||||||
|
* arm.h (STT_ARM_TFUNC): Define in terms of STT_LOPROC.
|
||||||
|
(STT_ARM_16BIT): New flag. Denotes a label that was defined in
|
||||||
|
Thumb block but was does not identify a function.
|
||||||
|
|
||||||
2000-01-20 Nick Clifton <nickc@cygnus.com>
|
2000-01-20 Nick Clifton <nickc@cygnus.com>
|
||||||
|
|
||||||
* common.h (EM_MCORE): Fix spelling of Motorola.
|
* common.h (EM_MCORE): Fix spelling of Motorola.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* ARM ELF support for BFD.
|
/* ARM ELF support for BFD.
|
||||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#define EF_APCS_26 0x08
|
#define EF_APCS_26 0x08
|
||||||
#define EF_APCS_FLOAT 0x10
|
#define EF_APCS_FLOAT 0x10
|
||||||
#define EF_PIC 0x20
|
#define EF_PIC 0x20
|
||||||
#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
|
#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use. */
|
||||||
#define EF_NEW_ABI 0x80
|
#define EF_NEW_ABI 0x80
|
||||||
#define EF_OLD_ABI 0x100
|
#define EF_OLD_ABI 0x100
|
||||||
#define EF_SOFT_FLOAT 0x200
|
#define EF_SOFT_FLOAT 0x200
|
||||||
@ -41,15 +41,16 @@
|
|||||||
#define F_PIC EF_PIC
|
#define F_PIC EF_PIC
|
||||||
#define F_SOFT_FLOAT EF_SOFT_FLOAT
|
#define F_SOFT_FLOAT EF_SOFT_FLOAT
|
||||||
|
|
||||||
/* Additional symbol types for Thumb */
|
/* Additional symbol types for Thumb. */
|
||||||
#define STT_ARM_TFUNC 0xd
|
#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
|
||||||
|
#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
|
||||||
|
|
||||||
/* ARM-specific values for sh_flags */
|
/* ARM-specific values for sh_flags. */
|
||||||
#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point */
|
#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */
|
||||||
#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step */
|
#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */
|
||||||
|
|
||||||
/* ARM-specific program header flags */
|
/* ARM-specific program header flags. */
|
||||||
#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base */
|
#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */
|
||||||
|
|
||||||
/* Relocation types. */
|
/* Relocation types. */
|
||||||
START_RELOC_NUMBERS (elf_arm_reloc_type)
|
START_RELOC_NUMBERS (elf_arm_reloc_type)
|
||||||
@ -82,8 +83,8 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
|
|||||||
FAKE_RELOC (LAST_INVALID_RELOC1, 99)
|
FAKE_RELOC (LAST_INVALID_RELOC1, 99)
|
||||||
RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100)
|
RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100)
|
||||||
RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101)
|
RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101)
|
||||||
RELOC_NUMBER (R_ARM_THM_PC11, 102) /* cygnus extension to abi: thumb unconditional branch */
|
RELOC_NUMBER (R_ARM_THM_PC11, 102) /* Cygnus extension to abi: Thumb unconditional branch */
|
||||||
RELOC_NUMBER (R_ARM_THM_PC9, 103) /* cygnus extension to abi: thumb conditional branch */
|
RELOC_NUMBER (R_ARM_THM_PC9, 103) /* Cygnus extension to abi: Thumb conditional branch */
|
||||||
FAKE_RELOC (FIRST_INVALID_RELOC2, 104)
|
FAKE_RELOC (FIRST_INVALID_RELOC2, 104)
|
||||||
FAKE_RELOC (LAST_INVALID_RELOC2, 248)
|
FAKE_RELOC (LAST_INVALID_RELOC2, 248)
|
||||||
RELOC_NUMBER (R_ARM_RXPC25, 249)
|
RELOC_NUMBER (R_ARM_RXPC25, 249)
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2000-01-27 Thomas de Lellis <tdel@windriver.com>
|
||||||
|
|
||||||
|
* arm-dis.c (printf_insn_big_arm): Treat ELF symbols with the
|
||||||
|
ARM_STT_16BIT flag as Thumb code symbols.
|
||||||
|
|
||||||
|
* arm-dis.c (printf_insn_little_arm): Ditto.
|
||||||
|
|
||||||
2000-01-25 Thomas de Lellis <tdel@windriver.com>
|
2000-01-25 Thomas de Lellis <tdel@windriver.com>
|
||||||
|
|
||||||
* arm-dis.c (printf_insn_thumb): Prevent double dumping
|
* arm-dis.c (printf_insn_thumb): Prevent double dumping
|
||||||
|
@ -871,15 +871,13 @@ print_insn_big_arm (pc, info)
|
|||||||
unsigned char b[4];
|
unsigned char b[4];
|
||||||
long given;
|
long given;
|
||||||
int status;
|
int status;
|
||||||
coff_symbol_type * cs;
|
|
||||||
elf_symbol_type * es;
|
|
||||||
int is_thumb;
|
int is_thumb;
|
||||||
|
|
||||||
if (info->disassembler_options)
|
if (info->disassembler_options)
|
||||||
{
|
{
|
||||||
parse_disassembler_options (info->disassembler_options);
|
parse_disassembler_options (info->disassembler_options);
|
||||||
|
|
||||||
/* To avoid repeated parsing of this option, we remove it here. */
|
/* To avoid repeated parsing of the options, we remove it here. */
|
||||||
info->disassembler_options = NULL;
|
info->disassembler_options = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -889,6 +887,8 @@ print_insn_big_arm (pc, info)
|
|||||||
{
|
{
|
||||||
if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
|
if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
|
||||||
{
|
{
|
||||||
|
coff_symbol_type * cs;
|
||||||
|
|
||||||
cs = coffsymbol (*info->symbols);
|
cs = coffsymbol (*info->symbols);
|
||||||
is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
|
is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
|
||||||
|| cs->native->u.syment.n_sclass == C_THUMBSTAT
|
|| cs->native->u.syment.n_sclass == C_THUMBSTAT
|
||||||
@ -898,9 +898,11 @@ print_insn_big_arm (pc, info)
|
|||||||
}
|
}
|
||||||
else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
|
else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
|
||||||
{
|
{
|
||||||
|
elf_symbol_type * es;
|
||||||
|
|
||||||
es = *(elf_symbol_type **)(info->symbols);
|
es = *(elf_symbol_type **)(info->symbols);
|
||||||
is_thumb = ELF_ST_TYPE (es->internal_elf_sym.st_info) ==
|
is_thumb = (ELF_ST_TYPE (es->internal_elf_sym.st_info) == STT_ARM_TFUNC)
|
||||||
STT_ARM_TFUNC;
|
|| (ELF_ST_TYPE (es->internal_elf_sym.st_info) == STT_ARM_16BIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,15 +955,13 @@ print_insn_little_arm (pc, info)
|
|||||||
unsigned char b[4];
|
unsigned char b[4];
|
||||||
long given;
|
long given;
|
||||||
int status;
|
int status;
|
||||||
coff_symbol_type * cs;
|
|
||||||
elf_symbol_type * es;
|
|
||||||
int is_thumb;
|
int is_thumb;
|
||||||
|
|
||||||
if (info->disassembler_options)
|
if (info->disassembler_options)
|
||||||
{
|
{
|
||||||
parse_disassembler_options (info->disassembler_options);
|
parse_disassembler_options (info->disassembler_options);
|
||||||
|
|
||||||
/* To avoid repeated parsing of this option, we remove it here. */
|
/* To avoid repeated parsing of the options, we remove it here. */
|
||||||
info->disassembler_options = NULL;
|
info->disassembler_options = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,6 +971,8 @@ print_insn_little_arm (pc, info)
|
|||||||
{
|
{
|
||||||
if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
|
if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
|
||||||
{
|
{
|
||||||
|
coff_symbol_type * cs;
|
||||||
|
|
||||||
cs = coffsymbol (*info->symbols);
|
cs = coffsymbol (*info->symbols);
|
||||||
is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
|
is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
|
||||||
|| cs->native->u.syment.n_sclass == C_THUMBSTAT
|
|| cs->native->u.syment.n_sclass == C_THUMBSTAT
|
||||||
@ -980,9 +982,11 @@ print_insn_little_arm (pc, info)
|
|||||||
}
|
}
|
||||||
else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
|
else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour)
|
||||||
{
|
{
|
||||||
|
elf_symbol_type * es;
|
||||||
|
|
||||||
es = *(elf_symbol_type **)(info->symbols);
|
es = *(elf_symbol_type **)(info->symbols);
|
||||||
is_thumb = ELF_ST_TYPE (es->internal_elf_sym.st_info) ==
|
is_thumb = (ELF_ST_TYPE (es->internal_elf_sym.st_info) == STT_ARM_TFUNC)
|
||||||
STT_ARM_TFUNC;
|
|| (ELF_ST_TYPE (es->internal_elf_sym.st_info) == STT_ARM_16BIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user