Home | History | Annotate | Download | only in bfd

Lines Matching refs:section

1 /* Object file "section" support for the BFD library.
23 SECTION
27 section abstraction. A single BFD may have any number of
31 Sections are supported in BFD in <<section.c>>.
34 @* Section Input::
35 @* Section Output::
37 @* section prototypes::
41 Section Input, Section Output, Sections, Sections
43 Section input
45 When a BFD is opened for reading, the section structures are
48 Each section has a name which describes the section in the
57 constructor data, or an application may add a section (using
59 BFD. For example, the linker creates an extra section
64 the section descriptor is created. Some targets may leave the
74 Section Output, typedef asection, Section Input, Sections
77 Section output
87 section must be written. (If the section is being created from
88 scratch, <<output_section>> should probably point to the section
93 the output sections. The output section structure can be
94 considered a filter for the input section: the output section
96 input section determines the offset into the output section of
99 E.g., to create a section "O", starting at 0x100, 0x123 long,
104 | section name "A"
107 | output_section -----------> section name "O"
109 | section name "B" | size 0x123
117 The data within a section is stored in a @dfn{link_order}.
119 abstraction allows a section to grow and shrink within itself.
143 typedef asection, section prototypes, Section Output, Sections
147 Here is the section structure:
153 . {* The name of the section; the name isn't a copy, the pointer is
160 . {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *}
163 . {* The next section in the list belonging to the BFD, or NULL. *}
166 . {* The previous section in the list belonging to the BFD, or NULL. *}
169 . {* The field flags contains attributes of the section. Some
176 . {* Tells the OS to allocate space for this section when loading.
177 . This is clear for a section containing debug information only. *}
180 . {* Tells the OS to load the section from the file when loading.
181 . This is clear for a .bss section. *}
184 . {* The section contains data still to be relocated, so there is
188 . {* A signal to the OS that the section contains read only data. *}
191 . {* The section contains code only. *}
194 . {* The section contains data only. *}
197 . {* The section will reside in ROM. *}
200 . {* The section contains constructor information. This section
204 . section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
212 . {* The section has contents - a data section could be
213 . <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
217 . {* An instruction to the linker to not output the section
221 . {* The section contains thread local data. *}
224 . {* The section has GOT references. This flag is only for the
227 . in this section, which indicate to the linker that the section
232 . {* The section contains common symbols (symbols may be defined
239 . {* The section contains only debugging information. For
241 . strip tests this flag to see if a section can be
245 . {* The contents of this section are held in memory pointed to
250 . {* The contents of this section are to be excluded by the
255 . {* The contents of this section are to be sorted based on the sum of
258 . appended to the end of the section in an unspecified order. *}
262 . discarded, rather than being combined into a single section as
290 . {* This section was created by the linker as part of dynamic
296 . {* This section should not be subject to garbage collection.
297 . Also set to inform the linker that this section should not be
301 . {* This section contains "short" data, and should be placed
305 . {* Attempt to merge identical entities in the section.
314 . {* This section contains data about section groups. *}
317 . {* The section is a COFF shared library section. This flag is
318 . only for the linker. If this type of section appears in
328 . {* This input section should be copied to output in reverse order
333 . {* This section contains data which may be shared with other
337 . {* When a section with this flag is being linked, then if the size of
338 . the input section is less than a page, it should not cross a page
339 . boundary. If the size of the input section is one page or more,
344 . {* Conditionally link this section; do not link if there are no
345 . references found to any symbol in the section. This is for TI
349 . {* Indicate that section has the no read flag set. This happens
353 . {* End of section flags. *}
364 . output sections that have an input section. *}
370 . {* Section compression status. *}
390 . {* Nonzero if this section uses RELA relocations, rather than REL. *}
405 . {* The virtual memory address of the section - where it will be
413 . {* The load address of the section - where it would be in a
414 . rom image; really only used for writing section header
418 . {* The size of the section in octets, as it will be output.
419 . Contains a value even if the section has no contents (e.g., the
423 . {* For input sections, the original size on disk of the section, in
424 . octets. This field should be set for any section whose size is
426 . the linker relaxation scheme doesn't cache altered section and
429 section multiple times. For output sections, rawsize holds the
430 . section size calculated on a previous linker relaxation pass. *}
433 . {* The compressed size of the section in octets. *}
443 . {* If this section is going to be output, then this value is the
444 . offset in *bytes* into the output section of the first byte in the
445 . input section (byte ==> smallest addressable unit on the
447 . 100th octet (8-bit quantity) in the output section, this value
452 . {* The output section through which to map on output. *}
455 . {* The alignment requirement of the section, as an exponent of 2 -
459 . {* If an input section, a pointer to a vector of relocation
460 . records for the data in this section. *}
463 . {* If an output section, a pointer to a vector of pointers to
464 . relocation records for the data in this section. *}
473 . {* File position of section data. *}
498 . {* Points to the kept section if this section is a link-once section,
502 . {* When a section is being output, this value changes as more
506 . {* What the section number is in the target world. *}
511 . {* If this is a constructor section then here is a list of the
515 . {* The BFD which owns the section. *}
518 . {* A symbol which points at this section only. *}
523 . a list of input sections attached to an output section. Later,
579 .{* Pointer to the common section. *}
581 .{* Pointer to the undefined section. *}
583 .{* Pointer to the absolute section. *}
585 .{* Pointer to the indirect section. *}
731 /* the_bfd, name, value, attr, section [, udata] */
733 #define GLOBAL_SYM_INIT(NAME, SECTION) \
734 { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
736 #define GLOBAL_SYM_INIT(NAME, SECTION) \
737 { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
762 /* Initialize an entry in the section hash table. */
782 memset (&((struct section_hash_entry *) entry)->section, 0,
792 /* Create a symbol whose only job is to point to this section. This
794 of a section. */
805 newsect->symbol->section = newsect;
812 /* Initializes a new section. NEWSECT->NAME is already set. */
835 section prototypes, , typedef asection, Sections
837 Section prototypes
839 These are the functions exported by the section handling part of BFD.
850 Clears the section list, and also resets the section count and
873 Return the most recently created section attached to @var{abfd}
874 named @var{name}. Return NULL if no such section exists.
884 return &sh->section;
897 Given @var{sec} is a section returned by @code{bfd_get_section_by_name},
898 return the next most recently created section attached to the same
899 BFD with the same name. Return NULL if no such section exists.
910 ((char *) sec - offsetof (struct section_hash_entry, section)));
919 return &sh->section;
932 Return the linker created section attached to @var{abfd}
933 named @var{name}. Return NULL if no such section exists.
958 Call the provided function @var{func} for each section
965 It returns the first section for which @var{func} returns true,
987 section, user_storage))
988 return &sh->section;
1006 Invent a section name that is unique in @var{abfd} by tacking
1051 Create a new empty section called @var{name}
1053 BFD @var{abfd}. An attempt to create a section with a name which
1055 section chain.
1095 newsect = &sh->section;
1098 /* Section already exists. */
1107 and ind sections to tack on format specific section data.
1108 Also, create a proper section symbol. */
1123 Create a new empty section called @var{name} and attach it to the end of
1124 the chain of sections for @var{abfd}. Create a new section even if there
1125 is already a section with that name. Also set the attributes of the
1126 new section to the value @var{flags}.
1150 newsect = &sh->section;
1153 /* We are making a section of the same name. Put it in the
1154 section hash table. Even though we can't find it directly by a
1155 hash lookup, we'll be able to find the section by traversing
1165 newsect = &new_sh->section;
1181 Create a new empty section called @var{name} and attach it to the end of
1182 the chain of sections for @var{abfd}. Create a new section even if there
1183 is already a section with that name.
1206 bfd_set_error ()) without changing the section chain if there is already a
1207 section named @var{name}. Also set the attributes of the new section to
1235 newsect = &sh->section;
1238 /* Section already exists. */
1256 bfd_set_error ()) without changing the section chain if there is already a
1257 section named @var{name}. If there is an error, return <<NULL>> and set
1276 Set the attributes of the section @var{sec} in the BFD
1281 The section cannot have one or more of the attributes
1282 requested. For example, a .bss section in <<a.out>> may not
1289 sec_ptr section,
1292 section->flags = flags;
1305 Rename section @var{sec} in @var{abfd} to @var{newname}.
1314 ((char *) sec - offsetof (struct section_hash_entry, section));
1315 sh->section.name = newname;
1330 Call the provided function @var{func} for each section
1371 Call the provided function @var{operation} for each section
1377 It returns the first section for which @var{operation} returns true.
1416 /* Once you've started writing to any section you cannot create or change
1435 (bfd *abfd, asection *section, const void *data,
1439 Sets the contents of the section @var{section} in BFD
1441 data is written to the output section starting at offset
1447 The output section does not have the <<SEC_HAS_CONTENTS>>
1458 sec_ptr section,
1465 if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS))
1471 sz = section->size;
1488 if (section->contents
1489 && location != section->contents + offset)
1490 memcpy (section->contents + offset, location, (size_t) count);
1493 (abfd, section, location, offset, count)))
1508 (bfd *abfd, asection *section, void *location, file_ptr offset,
1512 Read data from @var{section} in BFD @var{abfd}
1514 offset of @var{offset} from the start of the input section,
1518 flag set are requested or if the section does not have the
1526 sec_ptr section,
1533 if (section->flags & SEC_CONSTRUCTOR)
1539 if (abfd->direction != write_direction && section->rawsize != 0)
1540 sz = section->rawsize;
1542 sz = section->size;
1556 if ((section->flags & SEC_HAS_CONTENTS) == 0)
1562 if ((section->flags & SEC_IN_MEMORY) != 0)
1564 if (section->contents == NULL)
1569 section->flags &= ~ SEC_IN_MEMORY;
1574 memmove (location, section->contents + offset, (size_t) count);
1579 (abfd, section, location, offset, count));
1588 (bfd *abfd, asection *section, bfd_byte **buf);
1591 Read all data from @var{section} in BFD @var{abfd}
1610 Copy private section information from @var{isec} in the BFD
1611 @var{ibfd} to the section @var{osec} in the BFD @var{obfd}.