aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-03-25 21:12:36 +0000
committerJoseph Myers <joseph@codesourcery.com>2010-03-25 21:12:36 +0000
commit40b365969f7fd035dfa0c6ffe729fd2501b5f11d (patch)
tree759a27054778d995f168ca703e90f4f073545060 /binutils/readelf.c
parentaa7d318d60c595f97230f45575c882c73f7bdcf7 (diff)
downloadgdb-40b365969f7fd035dfa0c6ffe729fd2501b5f11d.zip
gdb-40b365969f7fd035dfa0c6ffe729fd2501b5f11d.tar.gz
gdb-40b365969f7fd035dfa0c6ffe729fd2501b5f11d.tar.bz2
bfd:
* Makefile.am (ALL_MACHINES): Add cpu-tic6x.lo. (ALL_MACHINES_CFILES): Add cpu-tic6x.c. (BFD32_BACKENDS): Add elf32-tic6x.lo. (BFD32_BACKENDS_CFILES): Add elf32-tic6x.c. * Makefile.in: Regenerate. * archures.c (bfd_arch_tic6x, bfd_tic6x_arch): New. (bfd_archures_list): Update. * config.bfd (tic6x-*-elf): New. * configure.in (bfd_elf32_tic6x_be_vec, bfd_elf32_tic6x_le_vec): New. * configure: Regenerate. * cpu-tic6x.c, elf32-tic6x.c: New. * reloc.c (BFD_RELOC_C6000_PCR_S21, BFD_RELOC_C6000_PCR_S12, BFD_RELOC_C6000_PCR_S10, BFD_RELOC_C6000_PCR_S7, BFD_RELOC_C6000_ABS_S16, BFD_RELOC_C6000_ABS_L16, BFD_RELOC_C6000_ABS_H16, BFD_RELOC_C6000_SBR_U15_B, BFD_RELOC_C6000_SBR_U15_H, BFD_RELOC_C6000_SBR_U15_W, BFD_RELOC_C6000_SBR_S16, BFD_RELOC_C6000_SBR_L16_B, BFD_RELOC_C6000_SBR_L16_H, BFD_RELOC_C6000_SBR_L16_W, BFD_RELOC_C6000_SBR_H16_B, BFD_RELOC_C6000_SBR_H16_H, BFD_RELOC_C6000_SBR_H16_W, BFD_RELOC_C6000_SBR_GOT_U15_W, BFD_RELOC_C6000_SBR_GOT_L16_W, BFD_RELOC_C6000_SBR_GOT_H16_W, BFD_RELOC_C6000_DSBT_INDEX, BFD_RELOC_C6000_PREL31, BFD_RELOC_C6000_COPY, BFD_RELOC_C6000_ALIGN, BFD_RELOC_C6000_FPHEAD, BFD_RELOC_C6000_NOCMP): New. * targets.c (bfd_elf32_tic6x_be_vec, bfd_elf32_tic6x_le_vec): New. (_bfd_target_vector): Update. * bfd-in2.h, libbfd.h: Regenerate. binutils: * MAINTAINERS: Add self as TI C6X maintainer. * NEWS: Add news entry for TI C6X support. * readelf.c: Include elf/tic6x.h. (guess_is_rela): Handle EM_TI_C6000. (dump_relocations): Likewise. (get_tic6x_dynamic_type): New. (get_dynamic_type): Call it. (get_machine_flags): Handle EF_C6000_REL. (get_osabi_name): Handle machine-specific values only for relevant machines. Handle C6X values. (get_tic6x_segment_type): New. (get_segment_type): Call it. (get_tic6x_section_type_name): New. (get_section_type_name): Call it. (is_32bit_abs_reloc, is_16bit_abs_reloc, is_none_reloc): Handle EM_TI_C6000. gas: * Makefile.am (TARGET_CPU_CFILES): Add config/tc-tic6x.c. (TARGET_CPU_HFILES): Add config/tc-tic6x.h. * Makefile.in: Regenerate. * NEWS: Add news entry for TI C6X support. * app.c (do_scrub_chars): Handle "||^" for TI C6X. Handle TC_PREDICATE_START_CHAR and TC_PREDICATE_END_CHAR. Keep spaces in operands if TC_KEEP_OPERAND_SPACES. * configure.tgt (tic6x-*-*): New. * config/tc-ia64.h (TC_PREDICATE_START_CHAR, TC_PREDICATE_END_CHAR): Define. * config/tc-tic6x.c, config/tc-tic6x.h: New. * doc/Makefile.am (CPU_DOCS): Add c-tic6x.texi. * doc/Makefile.in: Regenerate. * doc/all.texi (TIC6X): Define. * doc/as.texinfo: Add TI C6X documentation. Include c-tic6x.texi. * doc/c-tic6x.texi: New. gas/testsuite: * gas/tic6x: New directory and testcases. include: * dis-asm.h (print_insn_tic6x): Declare. include/elf: * common.h (ELFOSABI_C6000_ELFABI, ELFOSABI_C6000_LINUX): Define. * tic6x.h: New. include/opcode: * tic6x-control-registers.h, tic6x-insn-formats.h, tic6x-opcode-table.h, tic6x.h: New. ld: * Makefile.am (ALL_EMULATIONS): Add eelf32_tic6x_be.o and eelf32_tic6x_le.o. (eelf32_tic6x_be.c, eelf32_tic6x_le.c): New. * NEWS: Add news entry for TI C6X support. * configure.tgt (tic6x-*-*): New. * emulparams/elf32_tic6x_be.sh, emulparams/elf32_tic6x_le.sh: New. ld/testsuite: * ld-elf/flags1.d, ld-elf/merge.d: XFAIL for tic6x-*-*. * ld-elf/sec-to-seg.exp: Set B_test_same_seg to 0 for tic6x-*-*. * ld-tic6x: New directory and testcases. opcodes: * Makefile.am (TARGET_LIBOPCODES_CFILES): Add tic6x-dis.c. * Makefile.in: Regenerate. * configure.in (bfd_tic6x_arch): New. * configure: Regenerate. * disassemble.c (ARCH_tic6x): Define if ARCH_all. (disassembler): Handle TI C6X. * tic6x-dis.c: New.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c116
1 files changed, 114 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index beaf947..ba4fd9b 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -137,6 +137,7 @@
#include "elf/sh.h"
#include "elf/sparc.h"
#include "elf/spu.h"
+#include "elf/tic6x.h"
#include "elf/v850.h"
#include "elf/vax.h"
#include "elf/x86-64.h"
@@ -648,6 +649,7 @@ guess_is_rela (unsigned int e_machine)
case EM_SPARC32PLUS:
case EM_SPARCV9:
case EM_SPU:
+ case EM_TI_C6000:
case EM_V850:
case EM_CYGNUS_V850:
case EM_VAX:
@@ -1261,6 +1263,10 @@ dump_relocations (FILE * file,
case EM_C166:
rtype = elf_xc16x_reloc_type (type);
break;
+
+ case EM_TI_C6000:
+ rtype = elf_tic6x_reloc_type (type);
+ break;
}
if (rtype == NULL)
@@ -1638,6 +1644,21 @@ get_score_dynamic_type (unsigned long type)
}
}
+static const char *
+get_tic6x_dynamic_type (unsigned long type)
+{
+ switch (type)
+ {
+ case DT_C6000_GSYM_OFFSET: return "C6000_GSYM_OFFSET";
+ case DT_C6000_GSTR_OFFSET: return "C6000_GSTR_OFFSET";
+ case DT_C6000_DSBT_BASE: return "C6000_DSBT_BASE";
+ case DT_C6000_DSBT_SIZE: return "C6000_DSBT_SIZE";
+ case DT_C6000_PREEMPTMAP: return "C6000_PREEMPTMAP";
+ case DT_C6000_DSBT_INDEX: return "C6000_DSBT_INDEX";
+ default:
+ return NULL;
+ }
+}
static const char *
get_dynamic_type (unsigned long type)
@@ -1750,6 +1771,9 @@ get_dynamic_type (unsigned long type)
case EM_SCORE:
result = get_score_dynamic_type (type);
break;
+ case EM_TI_C6000:
+ result = get_tic6x_dynamic_type (type);
+ break;
default:
result = NULL;
break;
@@ -2544,6 +2568,10 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
case EM_S390:
if (e_flags & EF_S390_HIGH_GPRS)
strcat (buf, ", highgprs");
+
+ case EM_TI_C6000:
+ if ((e_flags & EF_C6000_REL))
+ strcat (buf, ", relocatable module");
}
}
@@ -2573,9 +2601,42 @@ get_osabi_name (unsigned int osabi)
case ELFOSABI_NSK: return "HP - Non-Stop Kernel";
case ELFOSABI_AROS: return "AROS";
case ELFOSABI_FENIXOS: return "FenixOS";
- case ELFOSABI_STANDALONE: return _("Standalone App");
- case ELFOSABI_ARM: return "ARM";
default:
+ if (osabi >= 64)
+ switch (elf_header.e_machine)
+ {
+ case EM_ARM:
+ switch (osabi)
+ {
+ case ELFOSABI_ARM: return "ARM";
+ default:
+ break;
+ }
+ break;
+
+ case EM_MSP430:
+ case EM_MSP430_OLD:
+ switch (osabi)
+ {
+ case ELFOSABI_STANDALONE: return _("Standalone App");
+ default:
+ break;
+ }
+ break;
+
+ case EM_TI_C6000:
+ switch (osabi)
+ {
+ case ELFOSABI_C6000_ELFABI: return _("Bare-metal C6000");
+ case ELFOSABI_C6000_LINUX: return "Linux C6000";
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
snprintf (buff, sizeof (buff), _("<unknown: %x>"), osabi);
return buff;
}
@@ -2663,6 +2724,19 @@ get_ia64_segment_type (unsigned long type)
}
static const char *
+get_tic6x_segment_type (unsigned long type)
+{
+ switch (type)
+ {
+ case PT_C6000_PHATTR: return "C6000_PHATTR";
+ default:
+ break;
+ }
+
+ return NULL;
+}
+
+static const char *
get_segment_type (unsigned long p_type)
{
static char buff[32];
@@ -2703,6 +2777,9 @@ get_segment_type (unsigned long p_type)
case EM_IA_64:
result = get_ia64_segment_type (p_type);
break;
+ case EM_TI_C6000:
+ result = get_tic6x_segment_type (p_type);
+ break;
default:
result = NULL;
break;
@@ -2864,6 +2941,33 @@ get_arm_section_type_name (unsigned int sh_type)
}
static const char *
+get_tic6x_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
+ case SHT_C6000_UNWIND:
+ return "C6000_UNWIND";
+ case SHT_C6000_PREEMPTMAP:
+ return "C6000_PREEMPTMAP";
+ case SHT_C6000_ATTRIBUTES:
+ return "C6000_ATTRIBUTES";
+ case SHT_TI_ICODE:
+ return "TI_ICODE";
+ case SHT_TI_XREF:
+ return "TI_XREF";
+ case SHT_TI_HANDLER:
+ return "TI_HANDLER";
+ case SHT_TI_INITINFO:
+ return "TI_INITINFO";
+ case SHT_TI_PHATTRS:
+ return "TI_PHATTRS";
+ default:
+ break;
+ }
+ return NULL;
+}
+
+static const char *
get_section_type_name (unsigned int sh_type)
{
static char buff[32];
@@ -2921,6 +3025,9 @@ get_section_type_name (unsigned int sh_type)
case EM_ARM:
result = get_arm_section_type_name (sh_type);
break;
+ case EM_TI_C6000:
+ result = get_tic6x_section_type_name (sh_type);
+ break;
default:
result = NULL;
break;
@@ -8801,6 +8908,8 @@ is_32bit_abs_reloc (unsigned int reloc_type)
|| reloc_type == 23; /* R_SPARC_UA32. */
case EM_SPU:
return reloc_type == 6; /* R_SPU_ADDR32 */
+ case EM_TI_C6000:
+ return reloc_type == 1; /* R_C6000_ABS32. */
case EM_CYGNUS_V850:
case EM_V850:
return reloc_type == 6; /* R_V850_ABS32. */
@@ -8984,6 +9093,8 @@ is_16bit_abs_reloc (unsigned int reloc_type)
case EM_ALTERA_NIOS2:
case EM_NIOS32:
return reloc_type == 9; /* R_NIOS_16. */
+ case EM_TI_C6000:
+ return reloc_type == 2; /* R_C6000_ABS16. */
case EM_XC16X:
case EM_C166:
return reloc_type == 2; /* R_XC16C_ABS_16. */
@@ -9020,6 +9131,7 @@ is_none_reloc (unsigned int reloc_type)
case EM_L1OM: /* R_X86_64_NONE. */
case EM_MN10300: /* R_MN10300_NONE. */
case EM_M32R: /* R_M32R_NONE. */
+ case EM_TI_C6000:/* R_C6000_NONE. */
case EM_XC16X:
case EM_C166: /* R_XC16X_NONE. */
return reloc_type == 0;