binutils-gdb/bfd/elf32-avr.h

123 lines
4.0 KiB
C
Raw Normal View History

2006-05-24 15:36:12 +08:00
/* AVR-specific support for 32-bit ELF.
Copyright (C) 2006-2015 Free Software Foundation, Inc.
2006-05-24 15:36:12 +08:00
Written by Bjoern Haase <bjoern.m.haase@web.de>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
2006-05-24 15:36:12 +08:00
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Remove trailing white spaces in bfd * aout0.c: Remove trailing white spaces. * archive.c: Likewise. * archures.c: Likewise. * bfd-in.h: Likewise. * bfd-in2.h: Likewise. * coff-alpha.c: Likewise. * coff-i860.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-tic80.c: Likewise. * coff-x86_64.c: Likewise. * coff-z80.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * compress.c: Likewise. * corefile.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-crx.c: Likewise. * cpu-h8300.c: Likewise. * cpu-i386.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m68k.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-sh.c: Likewise. * cpu-xc16x.c: Likewise. * dwarf2.c: Likewise. * ecofflink.c: Likewise. * ecoffswap.h: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-vxworks.c: Likewise. * elf32-avr.c: Likewise. * elf32-avr.h: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.h: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-v850.c: Likewise. * elf32-xc16x.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * ieee.c: Likewise. * libcoff.h: Likewise. * libpei.h: Likewise. * libxcoff.h: Likewise. * linker.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mach-o.h: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c: Likewise. * pef-traceback.h: Likewise. * pei-x86_64.c: Likewise. * peicode.h: Likewise. * plugin.c: Likewise. * reloc.c: Likewise. * riscix.c: Likewise. * section.c: Likewise. * som.c: Likewise. * syms.c: Likewise. * tekhex.c: Likewise. * ticoff.h: Likewise. * vaxbsd.c: Likewise. * xcofflink.c: Likewise. * xtensa-isa.c: Likewise.
2013-01-11 04:03:55 +08:00
Foundation, Inc., 51 Franklin Street - Fifth Floor,
2006-05-24 15:36:12 +08:00
Boston, MA 02110-1301, USA. */
/* These four functions will be called from the ld back-end. */
extern void
elf32_avr_setup_params (struct bfd_link_info *, bfd *, asection *,
bfd_boolean, bfd_boolean, bfd_boolean,
bfd_vma, bfd_boolean);
extern int
elf32_avr_setup_section_lists (bfd *, struct bfd_link_info *);
extern bfd_boolean
elf32_avr_size_stubs (bfd *, struct bfd_link_info *, bfd_boolean);
extern bfd_boolean
elf32_avr_build_stubs (struct bfd_link_info *);
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.
2015-01-09 04:55:10 +08:00
/* 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;
};
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);