diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2015-01-08 20:55:10 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2015-02-25 23:15:02 +0000 |
commit | fdd410ac7a07dfb47dcb992201000582a280d8b2 (patch) | |
tree | 1a68c9b9d5cf73d3e9f227ee5a46183652dcd498 /bfd | |
parent | ac99436572d903781c124fa3cc72d83360202b76 (diff) | |
download | gdb-fdd410ac7a07dfb47dcb992201000582a280d8b2.zip gdb-fdd410ac7a07dfb47dcb992201000582a280d8b2.tar.gz gdb-fdd410ac7a07dfb47dcb992201000582a280d8b2.tar.bz2 |
avr/gas: Write out data to track .org/.align usage.
Adds support to the assembler to write out data for tracking the use of
.org and .align directives. This data is collected within the assembler
and written out to a section ".avr.prop" (if there's anything to write
out).
This patch does not add any tests. The next patch in this series will
add a better mechanism for visualising the contents of .avr.prop which
will make writing tests much easier.
This patch also does not make any use of this collected data, that will
also come along in a later patch; the intended consumer is the linker,
during linker relaxation this information will be used to ensure that
the .org and .align directives are honoured.
bfd/ChangeLog:
* elf32-avr.h (AVR_PROPERTY_RECORD_SECTION_NAME): Define.
(AVR_PROPERTY_RECORDS_VERSION): Define.
(AVR_PROPERTY_SECTION_HEADER_SIZE): Define.
(struct avr_property_record): New structure.
gas/ChangeLog:
* config/tc-avr.c: Add elf32-avr.h include.
(struct avr_property_record_link): New structure.
(avr_output_property_section_header): New function.
(avr_record_size): New function.
(avr_output_property_record): New function.
(avr_create_property_section): New function.
(avr_handle_align): New function.
(exclude_section_from_property_tables): New function.
(create_record_for_frag): New function.
(append_records_for_section): New function.
(avr_create_and_fill_property_section): New function.
(avr_post_relax_hook): New function.
* config/tc-avr.h (md_post_relax_hook): Define.
(avr_post_relax_hook): Declare.
(HANDLE_ALIGN): Define.
(avr_handle_align): Declare.
(strut avr_frag_data): New structure.
(TC_FRAG_TYPE): Define.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf32-avr.h | 52 |
2 files changed, 59 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 57b7fd1..af2d2ba 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2015-02-25 Andrew Burgess <andrew.burgess@embecosm.com> + + * elf32-avr.h (AVR_PROPERTY_RECORD_SECTION_NAME): Define. + (AVR_PROPERTY_RECORDS_VERSION): Define. + (AVR_PROPERTY_SECTION_HEADER_SIZE): Define. + (struct avr_property_record): New structure. + 2015-02-24 Nick Clifton <nickc@redhat.com> * elf32-v850.c (v850_set_note): New function. Creates a Renesas diff --git a/bfd/elf32-avr.h b/bfd/elf32-avr.h index 6eb3154..688b706 100644 --- a/bfd/elf32-avr.h +++ b/bfd/elf32-avr.h @@ -36,3 +36,55 @@ elf32_avr_size_stubs (bfd *, struct bfd_link_info *, bfd_boolean); extern bfd_boolean elf32_avr_build_stubs (struct bfd_link_info *); + +/* The name of the section into which the property records are stored. */ +#define AVR_PROPERTY_RECORD_SECTION_NAME ".avr.prop" + +/* The current version number for the format of the property records. */ +#define AVR_PROPERTY_RECORDS_VERSION 1 + +/* The size of the header that is written to the property record section + before the property records are written out. */ +#define AVR_PROPERTY_SECTION_HEADER_SIZE 4 + +/* This holds a single property record in memory, the structure of this + data when written out to the ELF section is more compressed. */ + +struct avr_property_record +{ + /* The section and offset for this record. */ + asection *section; + bfd_vma offset; + + /* The type of this record. */ + enum { + RECORD_ORG = 0, + RECORD_ORG_AND_FILL = 1, + RECORD_ALIGN = 2, + RECORD_ALIGN_AND_FILL = 3 + } type; + + /* Type specific data. */ + union + { + /* RECORD_ORG and RECORD_ORG_AND_FILL. */ + struct + { + unsigned long fill; + } org; + + /* RECORD_ALIGN and RECORD_ALIGN_AND_FILL. */ + struct + { + unsigned long bytes; + unsigned long fill; + + /* This field is used during linker relaxation to track the number of + bytes that have been opened up before this alignment directive. + When we have enough bytes available it is possible to move the + re-align this directive backwards while still maintaining the + alignment requirement. */ + unsigned long preceding_deleted; + } align; + } data; +}; |