Lines Matching full:section
1 /* Object file "section" support for the BFD library.
24 SECTION
28 section abstraction. A single BFD may have any number of
32 Sections are supported in BFD in <<section.c>>.
35 @* Section Input::
36 @* Section Output::
38 @* section prototypes::
42 Section Input, Section Output, Sections, Sections
44 Section input
46 When a BFD is opened for reading, the section structures are
49 Each section has a name which describes the section in the
58 constructor data, or an application may add a section (using
60 BFD. For example, the linker creates an extra section
65 the section descriptor is created. Some targets may leave the
75 Section Output, typedef asection, Section Input, Sections
78 Section output
88 section must be written. (If the section is being created from
89 scratch, <<output_section>> should probably point to the section
94 the output sections. The output section structure can be
95 considered a filter for the input section: the output section
97 input section determines the offset into the output section of
100 E.g., to create a section "O", starting at 0x100, 0x123 long,
105 | section name "A"
108 | output_section -----------> section name "O"
110 | section name "B" | size 0x123
118 The data within a section is stored in a @dfn{link_order}.
120 abstraction allows a section to grow and shrink within itself.
144 typedef asection, section prototypes, Section Output, Sections
148 Here is the section structure:
154 . {* The name of the section; the name isn't a copy, the pointer is
161 . {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *}
164 . {* The next section in the list belonging to the BFD, or NULL. *}
167 . {* The previous section in the list belonging to the BFD, or NULL. *}
170 . {* The field flags contains attributes of the section. Some
177 . {* Tells the OS to allocate space for this section when loading.
178 . This is clear for a section containing debug information only. *}
181 . {* Tells the OS to load the section from the file when loading.
182 . This is clear for a .bss section. *}
185 . {* The section contains data still to be relocated, so there is
189 . {* A signal to the OS that the section contains read only data. *}
192 . {* The section contains code only. *}
195 . {* The section contains data only. *}
198 . {* The section will reside in ROM. *}
201 . {* The section contains constructor information. This section
205 . section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
213 . {* The section has contents - a data section could be
214 . <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
218 . {* An instruction to the linker to not output the section
222 . {* The section contains thread local data. *}
225 . {* The section has GOT references. This flag is only for the
228 . in this section, which indicate to the linker that the section
233 . {* The section contains common symbols (symbols may be defined
240 . {* The section contains only debugging information. For
242 . strip tests this flag to see if a section can be
246 . {* The contents of this section are held in memory pointed to
251 . {* The contents of this section are to be excluded by the
256 . {* The contents of this section are to be sorted based on the sum of
259 . appended to the end of the section in an unspecified order. *}
263 . discarded, rather than being combined into a single section as
291 . {* This section was created by the linker as part of dynamic
297 . {* This section should not be subject to garbage collection. *}
300 . {* This section contains "short" data, and should be placed
304 . {* Attempt to merge identical entities in the section.
313 . {* This section contains data about section groups. *}
316 . {* The section is a COFF shared library section. This flag is
317 . only for the linker. If this type of section appears in
327 . {* This section contains data which may be shared with other
331 . {* When a section with this flag is being linked, then if the size of
332 . the input section is less than a page, it should not cross a page
333 . boundary. If the size of the input section is one page or more,
338 . {* Conditionally link this section; do not link if there are no
339 . references found to any symbol in the section. This is for TI
343 . {* End of section flags. *}
354 . output sections that have an input section. *}
374 . {* Nonzero if this section uses RELA relocations, rather than REL. *}
380 . {* Nonzero if this section has TLS related relocations. *}
383 . {* Nonzero if this section has a gp reloc. *}
386 . {* Nonzero if this section needs the relax finalize pass. *}
394 . {* The virtual memory address of the section - where it will be
402 . {* The load address of the section - where it would be in a
403 . rom image; really only used for writing section header
407 . {* The size of the section in octets, as it will be output.
408 . Contains a value even if the section has no contents (e.g., the
412 . {* For input sections, the original size on disk of the section, in
415 . doesn't cache altered section and reloc contents (stabs, eh_frame,
417 . needs to be kept to read the section multiple times.
418 . For output sections, rawsize holds the section size calculated on
422 . {* If this section is going to be output, then this value is the
423 . offset in *bytes* into the output section of the first byte in the
424 . input section (byte ==> smallest addressable unit on the
426 . 100th octet (8-bit quantity) in the output section, this value
431 . {* The output section through which to map on output. *}
434 . {* The alignment requirement of the section, as an exponent of 2 -
438 . {* If an input section, a pointer to a vector of relocation
439 . records for the data in this section. *}
442 . {* If an output section, a pointer to a vector of pointers to
443 . relocation records for the data in this section. *}
452 . {* File position of section data. *}
477 . {* Points to the kept section if this section is a link-once section,
481 . {* When a section is being output, this value changes as more
485 . {* What the section number is in the target world. *}
490 . {* If this is a constructor section then here is a list of the
494 . {* The BFD which owns the section. *}
497 . {* A symbol which points at this section only. *}
502 . a list of input sections attached to an output section. Later,
521 .{* The absolute section. *}
525 .{* Pointer to the undefined section. *}
529 .{* Pointer to the common section. *}
532 .{* Pointer to the indirect section. *}
684 /* the_bfd, name, value, attr, section [, udata] */
686 #define GLOBAL_SYM_INIT(NAME, SECTION) \ argument
687 { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }}
689 #define GLOBAL_SYM_INIT(NAME, SECTION) \ argument
690 { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION }
716 /* Initialize an entry in the section hash table. */
736 memset (&((struct section_hash_entry *) entry)->section, 0, in bfd_section_hash_newfunc()
746 /* Initializes a new section. NEWSECT->NAME is already set. */
757 /* Create a symbol whose only job is to point to this section. This in bfd_section_init()
759 of a section. */ in bfd_section_init()
766 newsect->symbol->section = newsect; in bfd_section_init()
783 section prototypes, , typedef asection, Sections
785 Section prototypes
787 These are the functions exported by the section handling part of BFD.
798 Clears the section list, and also resets the section count and
826 <<strcmp>> on the name (or better yet, base it on the section flags
827 or something else) for each section.
837 return &sh->section; in bfd_get_section_by_name()
854 Call the provided function @var{func} for each section
861 It returns the first section for which @var{func} returns true,
883 if ((*operation) (abfd, &sh->section, user_storage)) in bfd_get_section_by_name_if()
884 return &sh->section; in bfd_get_section_by_name_if()
902 Invent a section name that is unique in @var{abfd} by tacking
947 Create a new empty section called @var{name}
949 BFD @var{abfd}. An attempt to create a section with a name which
951 section chain.
992 newsect = &sh->section; in bfd_make_section_old_way()
995 /* Section already exists. */ in bfd_make_section_old_way()
1012 Create a new empty section called @var{name} and attach it to the end of
1013 the chain of sections for @var{abfd}. Create a new section even if there
1014 is already a section with that name. Also set the attributes of the
1015 new section to the value @var{flags}.
1039 newsect = &sh->section; in bfd_make_section_anyway_with_flags()
1042 /* We are making a section of the same name. Put it in the in bfd_make_section_anyway_with_flags()
1043 section hash table. Even though we can't find it directly by a in bfd_make_section_anyway_with_flags()
1044 hash lookup, we'll be able to find the section by traversing in bfd_make_section_anyway_with_flags()
1054 newsect = &new_sh->section; in bfd_make_section_anyway_with_flags()
1070 Create a new empty section called @var{name} and attach it to the end of
1071 the chain of sections for @var{abfd}. Create a new section even if there
1072 is already a section with that name.
1095 bfd_set_error ()) without changing the section chain if there is already a
1096 section named @var{name}. Also set the attributes of the new section to
1124 newsect = &sh->section; in bfd_make_section_with_flags()
1127 /* Section already exists. */ in bfd_make_section_with_flags()
1145 bfd_set_error ()) without changing the section chain if there is already a
1146 section named @var{name}. If there is an error, return <<NULL>> and set
1165 Set the attributes of the section @var{sec} in the BFD
1170 The section cannot have one or more of the attributes
1171 requested. For example, a .bss section in <<a.out>> may not
1178 sec_ptr section, in bfd_set_section_flags() argument
1181 section->flags = flags; in bfd_set_section_flags()
1196 Call the provided function @var{func} for each section
1205 | section *p;
1237 Call the provided function @var{operation} for each section
1243 It returns the first section for which @var{operation} returns true.
1282 /* Once you've started writing to any section you cannot create or change in bfd_set_section_size()
1301 (bfd *abfd, asection *section, const void *data,
1305 Sets the contents of the section @var{section} in BFD
1307 data is written to the output section starting at offset
1313 The output section does not have the <<SEC_HAS_CONTENTS>>
1324 sec_ptr section, in bfd_set_section_contents() argument
1331 if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS)) in bfd_set_section_contents()
1337 sz = section->size; in bfd_set_section_contents()
1354 if (section->contents in bfd_set_section_contents()
1355 && location != section->contents + offset) in bfd_set_section_contents()
1356 memcpy (section->contents + offset, location, (size_t) count); in bfd_set_section_contents()
1359 (abfd, section, location, offset, count))) in bfd_set_section_contents()
1374 (bfd *abfd, asection *section, void *location, file_ptr offset,
1378 Read data from @var{section} in BFD @var{abfd}
1380 offset of @var{offset} from the start of the input section,
1384 flag set are requested or if the section does not have the
1392 sec_ptr section, in bfd_get_section_contents() argument
1399 if (section->flags & SEC_CONSTRUCTOR) in bfd_get_section_contents()
1405 sz = section->rawsize ? section->rawsize : section->size; in bfd_get_section_contents()
1419 if ((section->flags & SEC_HAS_CONTENTS) == 0) in bfd_get_section_contents()
1425 if ((section->flags & SEC_IN_MEMORY) != 0) in bfd_get_section_contents()
1427 memcpy (location, section->contents + offset, (size_t) count); in bfd_get_section_contents()
1432 (abfd, section, location, offset, count)); in bfd_get_section_contents()
1441 (bfd *abfd, asection *section, bfd_byte **buf);
1444 Read all data from @var{section} in BFD @var{abfd}
1474 Copy private section information from @var{isec} in the BFD
1475 @var{ibfd} to the section @var{osec} in the BFD @var{obfd}.