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:
152 .{* This structure is used for a comdat section, as in PE. A comdat
153 . section is associated with a particular symbol. When the linker
154 . sees a comdat section, it keeps only one of the sections with a
159 . {* The name of the symbol associated with a comdat section. *}
163 . comdat section. This is only meaningful to the object file format
171 . {* The name of the section; the name isn't a copy, the pointer is
178 . {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *}
181 . {* The next section in the list belonging to the BFD, or NULL. *}
184 . {* The field flags contains attributes of the section. Some
191 . {* Tells the OS to allocate space for this section when loading.
192 . This is clear for a section containing debug information only. *}
195 . {* Tells the OS to load the section from the file when loading.
196 . This is clear for a .bss section. *}
199 . {* The section contains data still to be relocated, so there is
209 . {* A signal to the OS that the section contains read only data. *}
212 . {* The section contains code only. *}
215 . {* The section contains data only. *}
218 . {* The section will reside in ROM. *}
221 . {* The section contains constructor information. This section
225 . section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
233 . {* The section has contents - a data section could be
234 . <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
238 . {* An instruction to the linker to not output the section
242 . {* The section is a COFF shared library section. This flag is
243 . only for the linker. If this type of section appears in
253 . {* The section contains thread local data. *}
256 . {* The section has GOT references. This flag is only for the
259 . in this section, which indicate to the linker that the section
264 . {* The section contains common symbols (symbols may be defined
271 . {* The section contains only debugging information. For
273 . strip tests this flag to see if a section can be
277 . {* The contents of this section are held in memory pointed to
282 . {* The contents of this section are to be excluded by the
287 . {* The contents of this section are to be sorted based on the sum of
290 . appended to the end of the section in an unspecified order. *}
294 . discarded, rather than being combined into a single section as
321 . {* This section was created by the linker as part of dynamic
327 . {* This section should not be subject to garbage collection. *}
330 . {* This section contains "short" data, and should be placed
334 . {* This section contains data which may be shared with other
338 . {* When a section with this flag is being linked, then if the size of
339 . the input section is less than a page, it should not cross a page
340 . boundary. If the size of the input section is one page or more, it
344 . {* Conditionally link this section; do not link if there are no
345 . references found to any symbol in the section. *}
348 . {* Attempt to merge identical entities in the section.
357 . {* This section contains data about section groups. *}
360 . {* End of section flags. *}
374 . output sections that have an input section. *}
393 . {* Nonzero if this section uses RELA relocations, rather than REL. *}
399 . {* Nonzero if this section needs the relax finalize pass. *}
402 . {* Nonzero if this section has a gp reloc. *}
415 . {* The virtual memory address of the section - where it will be
423 . {* The load address of the section - where it would be in a
424 . rom image; really only used for writing section header
428 . {* The size of the section in octets, as it will be output.
429 . Contains a value even if the section has no contents (e.g., the
433 . {* The original size on disk of the section, in octets. Normally this
438 . {* If this section is going to be output, then this value is the
439 . offset in *bytes* into the output section of the first byte in the
440 . input section (byte ==> smallest addressable unit on the
442 . 100th octet (8-bit quantity) in the output section, this value
447 . {* The output section through which to map on output. *}
450 . {* The alignment requirement of the section, as an exponent of 2 -
454 . {* If an input section, a pointer to a vector of relocation
455 . records for the data in this section. *}
458 . {* If an output section, a pointer to a vector of pointers to
459 . relocation records for the data in this section. *}
468 . {* File position of section data. *}
496 . {* Points to the kept section if this section is a link-once section,
500 . {* When a section is being output, this value changes as more
504 . {* What the section number is in the target world. *}
509 . {* If this is a constructor section then here is a list of the
513 . {* The BFD which owns the section. *}
516 . {* A symbol which points at this section only. *}
534 .{* The absolute section. *}
538 .{* Pointer to the undefined section. *}
542 .{* Pointer to the common section. *}
545 .{* Pointer to the indirect section. *}
560 .#define bfd_get_section_size_before_reloc(section) \
561 . ((section)->_raw_size)
562 .#define bfd_get_section_size_after_reloc(section) \
563 . ((section)->reloc_done ? (section)->_cooked_size \
596 /* the_bfd, name, value, attr, section [, udata] */
598 #define GLOBAL_SYM_INIT(NAME, SECTION) \ argument
599 { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }}
601 #define GLOBAL_SYM_INIT(NAME, SECTION) \ argument
602 { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION }
672 asection section; member
675 /* Initialize an entry in the section hash table. */
695 memset (&((struct section_hash_entry *) entry)->section, 0, in bfd_section_hash_newfunc()
705 /* Initializes a new section. NEWSECT->NAME is already set. */
716 /* Create a symbol whose only job is to point to this section. This in bfd_section_init()
718 of a section. */ in bfd_section_init()
725 newsect->symbol->section = newsect; in bfd_section_init()
743 section prototypes, , typedef asection, Sections
745 Section prototypes
747 These are the functions exported by the section handling part of BFD.
758 Clears the section list, and also resets the section count and
786 <<strcmp>> on the name (or better yet, base it on the section flags
787 or something else) for each section.
797 return &sh->section; in bfd_get_section_by_name()
811 Invent a section name that is unique in @var{abfd} by tacking
856 Create a new empty section called @var{name}
858 BFD @var{abfd}. An attempt to create a section with a name which
860 section chain.
901 newsect = &sh->section; in bfd_make_section_old_way()
904 /* Section already exists. */ in bfd_make_section_old_way()
920 Create a new empty section called @var{name} and attach it to the end of
921 the chain of sections for @var{abfd}. Create a new section even if there
922 is already a section with that name.
945 newsect = &sh->section; in bfd_make_section_anyway()
948 /* We are making a section of the same name. It can't go in in bfd_make_section_anyway()
949 section_htab without generating a unique section name and in bfd_make_section_anyway()
970 bfd_set_error ()) without changing the section chain if there is already a
971 section named @var{name}. If there is an error, return <<NULL>> and set
997 newsect = &sh->section; in bfd_make_section()
1000 /* Section already exists. */ in bfd_make_section()
1017 Set the attributes of the section @var{sec} in the BFD
1022 The section cannot have one or more of the attributes
1023 requested. For example, a .bss section in <<a.out>> may not
1030 sec_ptr section, in bfd_set_section_flags() argument
1034 /* If you try to copy a text section from an input file (where it in bfd_set_section_flags()
1046 section->flags = flags; in bfd_set_section_flags()
1061 Call the provided function @var{func} for each section
1070 | section *p;
1112 /* Once you've started writing to any section you cannot create or change in bfd_set_section_size()
1133 (bfd *abfd, asection *section, const void *data,
1137 Sets the contents of the section @var{section} in BFD
1139 data is written to the output section starting at offset
1145 The output section does not have the <<SEC_HAS_CONTENTS>>
1161 sec_ptr section, in bfd_set_section_contents() argument
1168 if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS)) in bfd_set_section_contents()
1174 sz = bfd_get_section_size_now (abfd, section); in bfd_set_section_contents()
1203 if (section->contents in bfd_set_section_contents()
1204 && location != section->contents + offset) in bfd_set_section_contents()
1205 memcpy (section->contents + offset, location, (size_t) count); in bfd_set_section_contents()
1208 (abfd, section, location, offset, count))) in bfd_set_section_contents()
1223 (bfd *abfd, asection *section, void *location, file_ptr offset,
1227 Read data from @var{section} in BFD @var{abfd}
1229 offset of @var{offset} from the start of the input section,
1233 flag set are requested or if the section does not have the
1241 sec_ptr section, in bfd_get_section_contents() argument
1248 if (section->flags & SEC_CONSTRUCTOR) in bfd_get_section_contents()
1256 sz = section->_raw_size; in bfd_get_section_contents()
1270 if ((section->flags & SEC_HAS_CONTENTS) == 0) in bfd_get_section_contents()
1276 if ((section->flags & SEC_IN_MEMORY) != 0) in bfd_get_section_contents()
1278 memcpy (location, section->contents + offset, (size_t) count); in bfd_get_section_contents()
1283 (abfd, section, location, offset, count)); in bfd_get_section_contents()
1295 Copy private section information from @var{isec} in the BFD
1296 @var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
1314 (struct bfd_link_info *info, asection *section);
1317 Remove @var{section} from the output. If the output section
1333 /* If the section wasn't assigned to an output section, or the in _bfd_strip_section_from_output()
1334 section has been discarded by the linker script, there's nothing in _bfd_strip_section_from_output()
1340 /* If the output section has other (non-excluded) input sections, we in _bfd_strip_section_from_output()
1347 /* If the output section is empty, flag it for removal too. in _bfd_strip_section_from_output()