diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2015-01-08 21:55:43 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2015-02-25 23:17:27 +0000 |
commit | 137c83d69fad77677cc818593f9399caa777a0c5 (patch) | |
tree | 3a3c32502d2caca7ede6a974a35bf3e960224abd /binutils | |
parent | fdd410ac7a07dfb47dcb992201000582a280d8b2 (diff) | |
download | gdb-137c83d69fad77677cc818593f9399caa777a0c5.zip gdb-137c83d69fad77677cc818593f9399caa777a0c5.tar.gz gdb-137c83d69fad77677cc818593f9399caa777a0c5.tar.bz2 |
avr/objdump: Support dumping .avr.prop section.
Add support to objdump for dumping the .avr.prop section in a structured
way.
binutils/ChangeLog:
* od-elf32_avr.c: Add elf32-avr.h include.
(OPT_AVRPROP): Define.
(options[]): Add 'avr-prop' entry.
(elf32_avr_help): Add avr-prop help text.
(elf32_avr_dump_avr_prop): New function.
(elf32_avr_dump): Add check for avr-prop.
bfd/ChangeLog:
* elf32-avr.h (struct avr_property_header): New strucure.
(avr_elf32_load_property_records): Declare.
(avr_elf32_property_record_name): Declare.
* elf32-avr.c: Add bfd_stdint.h include.
(retrieve_local_syms): New function.
(get_elf_r_symndx_section): New function.
(get_elf_r_symndx_offset): New function.
(internal_reloc_compare): New function.
(struct avr_find_section_data): New structure.
(avr_is_section_for_address): New function.
(avr_find_section_for_address): New function.
(avr_elf32_load_records_from_section): New function.
(avr_elf32_load_property_records): New function.
(avr_elf32_property_record_name): New function.
gas/testsuite/ChangeLog:
* gas/avr/avr-prop-1.d: New file.
* gas/avr/avr-prop-1.s: New file.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 9 | ||||
-rw-r--r-- | binutils/od-elf32_avr.c | 54 |
2 files changed, 63 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 421fbe3..c61a2bd 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,12 @@ +2015-02-25 Andrew Burgess <andrew.burgess@embecosm.com> + + * od-elf32_avr.c: Add elf32-avr.h include. + (OPT_AVRPROP): Define. + (options[]): Add 'avr-prop' entry. + (elf32_avr_help): Add avr-prop help text. + (elf32_avr_dump_avr_prop): New function. + (elf32_avr_dump): Add check for avr-prop. + 2015-02-24 Nick Clifton <nickc@redhat.com> * readelf.c (get_machine_flags): Remove deprecated V850 machine diff --git a/binutils/od-elf32_avr.c b/binutils/od-elf32_avr.c index 5e828fb..5635964 100644 --- a/binutils/od-elf32_avr.c +++ b/binutils/od-elf32_avr.c @@ -31,14 +31,17 @@ #include "bfd.h" #include "elf/external.h" #include "elf/internal.h" +#include "elf32-avr.h" /* Index of the options in the options[] array. */ #define OPT_MEMUSAGE 0 +#define OPT_AVRPROP 1 /* List of actions. */ static struct objdump_private_option options[] = { { "mem-usage", 0 }, + { "avr-prop", 0}, { NULL, 0 } }; @@ -50,6 +53,7 @@ elf32_avr_help (FILE *stream) fprintf (stream, _("\ For AVR ELF files:\n\ mem-usage Display memory usage\n\ + avr-prop Display contents of .avr.prop section\n\ ")); } @@ -234,10 +238,60 @@ elf32_avr_dump_mem_usage (bfd *abfd) } static void +elf32_avr_dump_avr_prop (bfd *abfd) +{ + struct avr_property_record_list *r_list; + unsigned int i; + + r_list = avr_elf32_load_property_records (abfd); + if (r_list == NULL) + return; + + printf ("\nContents of `%s' section:\n\n", r_list->section->name); + + printf (" Version: %d\n", r_list->version); + printf (" Flags: %#x\n\n", r_list->flags); + + for (i = 0; i < r_list->record_count; ++i) + { + printf (" %d %s @ %s + %#08lx (%#08lx)\n", + i, + avr_elf32_property_record_name (&r_list->records [i]), + r_list->records [i].section->name, + r_list->records [i].offset, + (bfd_get_section_vma (abfd, r_list->records [i].section) + + r_list->records [i].offset)); + switch (r_list->records [i].type) + { + case RECORD_ORG: + /* Nothing else to print. */ + break; + case RECORD_ORG_AND_FILL: + printf (" Fill: %#08lx\n", + r_list->records [i].data.org.fill); + break; + case RECORD_ALIGN: + printf (" Align: %#08lx\n", + r_list->records [i].data.align.bytes); + break; + case RECORD_ALIGN_AND_FILL: + printf (" Align: %#08lx, Fill: %#08lx\n", + r_list->records [i].data.align.bytes, + r_list->records [i].data.org.fill); + break; + } + } + + free (r_list); +} + +static void elf32_avr_dump (bfd *abfd) { if (options[OPT_MEMUSAGE].selected) elf32_avr_dump_mem_usage (abfd); + if (options[OPT_AVRPROP].selected) + elf32_avr_dump_avr_prop (abfd); } const struct objdump_private_desc objdump_private_desc_elf32_avr = |