From 137c83d69fad77677cc818593f9399caa777a0c5 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 8 Jan 2015 21:55:43 +0000 Subject: 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. --- bfd/elf32-avr.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'bfd/elf32-avr.h') diff --git a/bfd/elf32-avr.h b/bfd/elf32-avr.h index 688b706..0ddb562 100644 --- a/bfd/elf32-avr.h +++ b/bfd/elf32-avr.h @@ -88,3 +88,35 @@ struct avr_property_record } align; } data; }; + +struct avr_property_record_list +{ + /* The version number tells us the structure of the property record data + within the section. See AVR_PROPERTY_RECORDS_VERSION. */ + bfd_byte version; + + /* The flags field is currently unused. This should be set to 0. */ + bfd_byte flags; + + /* The number of property records. This is stored as a 2-byte value in + the section contents. */ + unsigned long record_count; + + /* The section from which the property records were loaded. This is the + actual section containing the records, not the section(s) to which the + records apply. */ + asection *section; + + /* The actual property records. */ + struct avr_property_record *records; +}; + +/* Load the property records from ABFD, return NULL if there are non + found, otherwise return pointer to dynamically allocated memory. The + memory for the header and all of the records are allocated in a single + block, as such only the header needs to be freed. */ + +extern struct avr_property_record_list *avr_elf32_load_property_records (bfd *abfd); + +/* Return a string that is the name of the property record pointed to by REC. */ +extern const char *avr_elf32_property_record_name (struct avr_property_record *rec); -- cgit v1.1