Commit | Line | Data |
---|---|---|
28c9d252 | 1 | /* AVR-specific support for 32-bit ELF. |
250d07de | 2 | Copyright (C) 2006-2021 Free Software Foundation, Inc. |
28c9d252 NC |
3 | |
4 | Written by Bjoern Haase <bjoern.m.haase@web.de> | |
5 | ||
6 | This file is part of BFD, the Binary File Descriptor library. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
cd123cb7 | 10 | the Free Software Foundation; either version 3 of the License, or |
28c9d252 NC |
11 | (at your option) any later version. |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
68ffbac6 | 20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, |
28c9d252 NC |
21 | Boston, MA 02110-1301, USA. */ |
22 | ||
23 | ||
24 | /* These four functions will be called from the ld back-end. */ | |
25 | ||
26 | extern void | |
27 | elf32_avr_setup_params (struct bfd_link_info *, bfd *, asection *, | |
0a1b45a2 | 28 | bool, bool, bool, bfd_vma, bool); |
28c9d252 NC |
29 | |
30 | extern int | |
31 | elf32_avr_setup_section_lists (bfd *, struct bfd_link_info *); | |
32 | ||
0a1b45a2 AM |
33 | extern bool |
34 | elf32_avr_size_stubs (bfd *, struct bfd_link_info *, bool); | |
28c9d252 | 35 | |
0a1b45a2 | 36 | extern bool |
28c9d252 | 37 | elf32_avr_build_stubs (struct bfd_link_info *); |
fdd410ac AB |
38 | |
39 | /* The name of the section into which the property records are stored. */ | |
40 | #define AVR_PROPERTY_RECORD_SECTION_NAME ".avr.prop" | |
41 | ||
42 | /* The current version number for the format of the property records. */ | |
43 | #define AVR_PROPERTY_RECORDS_VERSION 1 | |
44 | ||
45 | /* The size of the header that is written to the property record section | |
46 | before the property records are written out. */ | |
47 | #define AVR_PROPERTY_SECTION_HEADER_SIZE 4 | |
48 | ||
49 | /* This holds a single property record in memory, the structure of this | |
50 | data when written out to the ELF section is more compressed. */ | |
51 | ||
52 | struct avr_property_record | |
53 | { | |
54 | /* The section and offset for this record. */ | |
55 | asection *section; | |
56 | bfd_vma offset; | |
57 | ||
58 | /* The type of this record. */ | |
59 | enum { | |
60 | RECORD_ORG = 0, | |
61 | RECORD_ORG_AND_FILL = 1, | |
62 | RECORD_ALIGN = 2, | |
63 | RECORD_ALIGN_AND_FILL = 3 | |
64 | } type; | |
65 | ||
66 | /* Type specific data. */ | |
67 | union | |
68 | { | |
69 | /* RECORD_ORG and RECORD_ORG_AND_FILL. */ | |
70 | struct | |
71 | { | |
72 | unsigned long fill; | |
73 | } org; | |
74 | ||
75 | /* RECORD_ALIGN and RECORD_ALIGN_AND_FILL. */ | |
76 | struct | |
77 | { | |
78 | unsigned long bytes; | |
79 | unsigned long fill; | |
80 | ||
81 | /* This field is used during linker relaxation to track the number of | |
07d6d2b8 AM |
82 | bytes that have been opened up before this alignment directive. |
83 | When we have enough bytes available it is possible to move the | |
84 | re-align this directive backwards while still maintaining the | |
85 | alignment requirement. */ | |
fdd410ac AB |
86 | unsigned long preceding_deleted; |
87 | } align; | |
88 | } data; | |
89 | }; | |
137c83d6 AB |
90 | |
91 | struct avr_property_record_list | |
92 | { | |
93 | /* The version number tells us the structure of the property record data | |
94 | within the section. See AVR_PROPERTY_RECORDS_VERSION. */ | |
95 | bfd_byte version; | |
96 | ||
97 | /* The flags field is currently unused. This should be set to 0. */ | |
98 | bfd_byte flags; | |
99 | ||
100 | /* The number of property records. This is stored as a 2-byte value in | |
101 | the section contents. */ | |
102 | unsigned long record_count; | |
103 | ||
104 | /* The section from which the property records were loaded. This is the | |
105 | actual section containing the records, not the section(s) to which the | |
106 | records apply. */ | |
107 | asection *section; | |
108 | ||
109 | /* The actual property records. */ | |
110 | struct avr_property_record *records; | |
111 | }; | |
112 | ||
113 | /* Load the property records from ABFD, return NULL if there are non | |
114 | found, otherwise return pointer to dynamically allocated memory. The | |
115 | memory for the header and all of the records are allocated in a single | |
116 | block, as such only the header needs to be freed. */ | |
117 | ||
118 | extern struct avr_property_record_list *avr_elf32_load_property_records (bfd *abfd); | |
119 | ||
120 | /* Return a string that is the name of the property record pointed to by REC. */ | |
121 | extern const char *avr_elf32_property_record_name (struct avr_property_record *rec); |