133965Sjdp/* Object file "section" support for the BFD library. 278828Sobrien Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3275718Sjhibbits 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 433965Sjdp Free Software Foundation, Inc. 533965Sjdp Written by Cygnus Support. 633965Sjdp 733965SjdpThis file is part of BFD, the Binary File Descriptor library. 833965Sjdp 933965SjdpThis program is free software; you can redistribute it and/or modify 1033965Sjdpit under the terms of the GNU General Public License as published by 1133965Sjdpthe Free Software Foundation; either version 2 of the License, or 1233965Sjdp(at your option) any later version. 1333965Sjdp 1433965SjdpThis program is distributed in the hope that it will be useful, 1533965Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of 1633965SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1733965SjdpGNU General Public License for more details. 1833965Sjdp 1933965SjdpYou should have received a copy of the GNU General Public License 2033965Sjdpalong with this program; if not, write to the Free Software 21218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2233965Sjdp 2333965Sjdp/* 2433965SjdpSECTION 2533965Sjdp Sections 2633965Sjdp 2733965Sjdp The raw data contained within a BFD is maintained through the 2833965Sjdp section abstraction. A single BFD may have any number of 2933965Sjdp sections. It keeps hold of them by pointing to the first; 3033965Sjdp each one points to the next in the list. 3133965Sjdp 3233965Sjdp Sections are supported in BFD in <<section.c>>. 3333965Sjdp 3433965Sjdp@menu 3533965Sjdp@* Section Input:: 3633965Sjdp@* Section Output:: 3733965Sjdp@* typedef asection:: 3833965Sjdp@* section prototypes:: 3933965Sjdp@end menu 4033965Sjdp 4133965SjdpINODE 4233965SjdpSection Input, Section Output, Sections, Sections 4333965SjdpSUBSECTION 4433965Sjdp Section input 4533965Sjdp 4633965Sjdp When a BFD is opened for reading, the section structures are 4733965Sjdp created and attached to the BFD. 4833965Sjdp 4933965Sjdp Each section has a name which describes the section in the 5033965Sjdp outside world---for example, <<a.out>> would contain at least 5133965Sjdp three sections, called <<.text>>, <<.data>> and <<.bss>>. 5233965Sjdp 5333965Sjdp Names need not be unique; for example a COFF file may have several 5433965Sjdp sections named <<.data>>. 5533965Sjdp 5633965Sjdp Sometimes a BFD will contain more than the ``natural'' number of 5733965Sjdp sections. A back end may attach other sections containing 5833965Sjdp constructor data, or an application may add a section (using 5933965Sjdp <<bfd_make_section>>) to the sections attached to an already open 6033965Sjdp BFD. For example, the linker creates an extra section 6133965Sjdp <<COMMON>> for each input file's BFD to hold information about 6233965Sjdp common storage. 6333965Sjdp 6433965Sjdp The raw data is not necessarily read in when 6533965Sjdp the section descriptor is created. Some targets may leave the 6633965Sjdp data in place until a <<bfd_get_section_contents>> call is 6733965Sjdp made. Other back ends may read in all the data at once. For 6833965Sjdp example, an S-record file has to be read once to determine the 6933965Sjdp size of the data. An IEEE-695 file doesn't contain raw data in 7033965Sjdp sections, but data and relocation expressions intermixed, so 7133965Sjdp the data area has to be parsed to get out the data and 7233965Sjdp relocations. 7333965Sjdp 7433965SjdpINODE 7533965SjdpSection Output, typedef asection, Section Input, Sections 7633965Sjdp 7733965SjdpSUBSECTION 7833965Sjdp Section output 7933965Sjdp 8033965Sjdp To write a new object style BFD, the various sections to be 8133965Sjdp written have to be created. They are attached to the BFD in 8233965Sjdp the same way as input sections; data is written to the 8333965Sjdp sections using <<bfd_set_section_contents>>. 8433965Sjdp 8533965Sjdp Any program that creates or combines sections (e.g., the assembler 8633965Sjdp and linker) must use the <<asection>> fields <<output_section>> and 8733965Sjdp <<output_offset>> to indicate the file sections to which each 8833965Sjdp section must be written. (If the section is being created from 8933965Sjdp scratch, <<output_section>> should probably point to the section 9033965Sjdp itself and <<output_offset>> should probably be zero.) 9133965Sjdp 9233965Sjdp The data to be written comes from input sections attached 9333965Sjdp (via <<output_section>> pointers) to 9433965Sjdp the output sections. The output section structure can be 9533965Sjdp considered a filter for the input section: the output section 9633965Sjdp determines the vma of the output data and the name, but the 9733965Sjdp input section determines the offset into the output section of 9833965Sjdp the data to be written. 9933965Sjdp 10033965Sjdp E.g., to create a section "O", starting at 0x100, 0x123 long, 10133965Sjdp containing two subsections, "A" at offset 0x0 (i.e., at vma 10233965Sjdp 0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the <<asection>> 10333965Sjdp structures would look like: 10433965Sjdp 10533965Sjdp| section name "A" 10633965Sjdp| output_offset 0x00 10733965Sjdp| size 0x20 10833965Sjdp| output_section -----------> section name "O" 10933965Sjdp| | vma 0x100 11033965Sjdp| section name "B" | size 0x123 11133965Sjdp| output_offset 0x20 | 11233965Sjdp| size 0x103 | 11333965Sjdp| output_section --------| 11433965Sjdp 11533965SjdpSUBSECTION 11633965Sjdp Link orders 11733965Sjdp 11833965Sjdp The data within a section is stored in a @dfn{link_order}. 11933965Sjdp These are much like the fixups in <<gas>>. The link_order 12033965Sjdp abstraction allows a section to grow and shrink within itself. 12133965Sjdp 12233965Sjdp A link_order knows how big it is, and which is the next 12333965Sjdp link_order and where the raw data for it is; it also points to 12433965Sjdp a list of relocations which apply to it. 12533965Sjdp 12633965Sjdp The link_order is used by the linker to perform relaxing on 12733965Sjdp final code. The compiler creates code which is as big as 12833965Sjdp necessary to make it work without relaxing, and the user can 12933965Sjdp select whether to relax. Sometimes relaxing takes a lot of 13033965Sjdp time. The linker runs around the relocations to see if any 13133965Sjdp are attached to data which can be shrunk, if so it does it on 13233965Sjdp a link_order by link_order basis. 13333965Sjdp 13433965Sjdp*/ 13533965Sjdp 136218822Sdim#include "sysdep.h" 13733965Sjdp#include "bfd.h" 13833965Sjdp#include "libbfd.h" 13960484Sobrien#include "bfdlink.h" 14033965Sjdp 14133965Sjdp/* 14233965SjdpDOCDD 14333965SjdpINODE 14433965Sjdptypedef asection, section prototypes, Section Output, Sections 14533965SjdpSUBSECTION 14633965Sjdp typedef asection 14733965Sjdp 14833965Sjdp Here is the section structure: 14933965Sjdp 15033965SjdpCODE_FRAGMENT 15133965Sjdp. 152130561Sobrien.typedef struct bfd_section 15333965Sjdp.{ 15477298Sobrien. {* The name of the section; the name isn't a copy, the pointer is 15577298Sobrien. the same as that passed to bfd_make_section. *} 15677298Sobrien. const char *name; 15733965Sjdp. 15877298Sobrien. {* A unique sequence number. *} 15977298Sobrien. int id; 16033965Sjdp. 16189857Sobrien. {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *} 16277298Sobrien. int index; 16333965Sjdp. 16477298Sobrien. {* The next section in the list belonging to the BFD, or NULL. *} 165130561Sobrien. struct bfd_section *next; 16633965Sjdp. 167218822Sdim. {* The previous section in the list belonging to the BFD, or NULL. *} 168218822Sdim. struct bfd_section *prev; 169218822Sdim. 17077298Sobrien. {* The field flags contains attributes of the section. Some 17177298Sobrien. flags are read in from the object file, and some are 17277298Sobrien. synthesized from other information. *} 17377298Sobrien. flagword flags; 17477298Sobrien. 17533965Sjdp.#define SEC_NO_FLAGS 0x000 17633965Sjdp. 17777298Sobrien. {* Tells the OS to allocate space for this section when loading. 17877298Sobrien. This is clear for a section containing debug information only. *} 17933965Sjdp.#define SEC_ALLOC 0x001 18033965Sjdp. 18177298Sobrien. {* Tells the OS to load the section from the file when loading. 18277298Sobrien. This is clear for a .bss section. *} 18333965Sjdp.#define SEC_LOAD 0x002 18433965Sjdp. 18577298Sobrien. {* The section contains data still to be relocated, so there is 18677298Sobrien. some relocation information too. *} 18733965Sjdp.#define SEC_RELOC 0x004 18833965Sjdp. 18977298Sobrien. {* A signal to the OS that the section contains read only data. *} 190218822Sdim.#define SEC_READONLY 0x008 19133965Sjdp. 19277298Sobrien. {* The section contains code only. *} 193218822Sdim.#define SEC_CODE 0x010 19433965Sjdp. 19577298Sobrien. {* The section contains data only. *} 196218822Sdim.#define SEC_DATA 0x020 19733965Sjdp. 19877298Sobrien. {* The section will reside in ROM. *} 199218822Sdim.#define SEC_ROM 0x040 20033965Sjdp. 20177298Sobrien. {* The section contains constructor information. This section 20277298Sobrien. type is used by the linker to create lists of constructors and 20377298Sobrien. destructors used by <<g++>>. When a back end sees a symbol 20477298Sobrien. which should be used in a constructor list, it creates a new 20577298Sobrien. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches 20677298Sobrien. the symbol to it, and builds a relocation. To build the lists 20777298Sobrien. of constructors, all the linker has to do is catenate all the 20877298Sobrien. sections called <<__CTOR_LIST__>> and relocate the data 20977298Sobrien. contained within - exactly the operations it would peform on 21077298Sobrien. standard data. *} 211218822Sdim.#define SEC_CONSTRUCTOR 0x080 21233965Sjdp. 21377298Sobrien. {* The section has contents - a data section could be 21477298Sobrien. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be 21577298Sobrien. <<SEC_HAS_CONTENTS>> *} 216218822Sdim.#define SEC_HAS_CONTENTS 0x100 21733965Sjdp. 21877298Sobrien. {* An instruction to the linker to not output the section 21977298Sobrien. even if it has information which would normally be written. *} 220218822Sdim.#define SEC_NEVER_LOAD 0x200 22133965Sjdp. 222104834Sobrien. {* The section contains thread local data. *} 223218822Sdim.#define SEC_THREAD_LOCAL 0x400 224104834Sobrien. 22577298Sobrien. {* The section has GOT references. This flag is only for the 22677298Sobrien. linker, and is currently only used by the elf32-hppa back end. 22777298Sobrien. It will be set if global offset table references were detected 22877298Sobrien. in this section, which indicate to the linker that the section 22977298Sobrien. contains PIC code, and must be handled specially when doing a 23077298Sobrien. static link. *} 231218822Sdim.#define SEC_HAS_GOT_REF 0x800 23277298Sobrien. 23377298Sobrien. {* The section contains common symbols (symbols may be defined 23477298Sobrien. multiple times, the value of a symbol is the amount of 23577298Sobrien. space it requires, and the largest symbol value is the one 23677298Sobrien. used). Most targets have exactly one of these (which we 23777298Sobrien. translate to bfd_com_section_ptr), but ECOFF has two. *} 238218822Sdim.#define SEC_IS_COMMON 0x1000 23933965Sjdp. 24077298Sobrien. {* The section contains only debugging information. For 24177298Sobrien. example, this is set for ELF .debug and .stab sections. 24277298Sobrien. strip tests this flag to see if a section can be 24377298Sobrien. discarded. *} 244218822Sdim.#define SEC_DEBUGGING 0x2000 24533965Sjdp. 24677298Sobrien. {* The contents of this section are held in memory pointed to 24777298Sobrien. by the contents field. This is checked by bfd_get_section_contents, 24877298Sobrien. and the data is retrieved from memory if appropriate. *} 249218822Sdim.#define SEC_IN_MEMORY 0x4000 25033965Sjdp. 25177298Sobrien. {* The contents of this section are to be excluded by the 25277298Sobrien. linker for executable and shared objects unless those 25377298Sobrien. objects are to be further relocated. *} 254218822Sdim.#define SEC_EXCLUDE 0x8000 25533965Sjdp. 25689857Sobrien. {* The contents of this section are to be sorted based on the sum of 25789857Sobrien. the symbol and addend values specified by the associated relocation 25889857Sobrien. entries. Entries without associated relocation entries will be 25989857Sobrien. appended to the end of the section in an unspecified order. *} 260218822Sdim.#define SEC_SORT_ENTRIES 0x10000 26133965Sjdp. 26277298Sobrien. {* When linking, duplicate sections of the same name should be 26377298Sobrien. discarded, rather than being combined into a single section as 26477298Sobrien. is usually done. This is similar to how common symbols are 26577298Sobrien. handled. See SEC_LINK_DUPLICATES below. *} 266218822Sdim.#define SEC_LINK_ONCE 0x20000 26733965Sjdp. 26877298Sobrien. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker 26977298Sobrien. should handle duplicate sections. *} 270218822Sdim.#define SEC_LINK_DUPLICATES 0x40000 27133965Sjdp. 27277298Sobrien. {* This value for SEC_LINK_DUPLICATES means that duplicate 27377298Sobrien. sections with the same name should simply be discarded. *} 27433965Sjdp.#define SEC_LINK_DUPLICATES_DISCARD 0x0 27533965Sjdp. 27677298Sobrien. {* This value for SEC_LINK_DUPLICATES means that the linker 27777298Sobrien. should warn if there are any duplicate sections, although 27877298Sobrien. it should still only link one copy. *} 279218822Sdim.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000 28033965Sjdp. 28177298Sobrien. {* This value for SEC_LINK_DUPLICATES means that the linker 28277298Sobrien. should warn if any duplicate sections are a different size. *} 283218822Sdim.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000 28433965Sjdp. 28577298Sobrien. {* This value for SEC_LINK_DUPLICATES means that the linker 28677298Sobrien. should warn if any duplicate sections contain different 28777298Sobrien. contents. *} 288218822Sdim.#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ 289218822Sdim. (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) 29033965Sjdp. 29177298Sobrien. {* This section was created by the linker as part of dynamic 29277298Sobrien. relocation or other arcane processing. It is skipped when 29377298Sobrien. going through the first-pass output, trusting that someone 29477298Sobrien. else up the line will take care of it later. *} 295218822Sdim.#define SEC_LINKER_CREATED 0x200000 29633965Sjdp. 297218822Sdim. {* This section should not be subject to garbage collection. 298218822Sdim. Also set to inform the linker that this section should not be 299218822Sdim. listed in the link map as discarded. *} 300218822Sdim.#define SEC_KEEP 0x400000 30160484Sobrien. 30277298Sobrien. {* This section contains "short" data, and should be placed 30377298Sobrien. "near" the GP. *} 304218822Sdim.#define SEC_SMALL_DATA 0x800000 30560484Sobrien. 30689857Sobrien. {* Attempt to merge identical entities in the section. 30789857Sobrien. Entity size is given in the entsize field. *} 308218822Sdim.#define SEC_MERGE 0x1000000 30989857Sobrien. 31089857Sobrien. {* If given with SEC_MERGE, entities to merge are zero terminated 31189857Sobrien. strings where entsize specifies character size instead of fixed 31289857Sobrien. size entries. *} 313218822Sdim.#define SEC_STRINGS 0x2000000 31489857Sobrien. 31589857Sobrien. {* This section contains data about section groups. *} 316218822Sdim.#define SEC_GROUP 0x4000000 31789857Sobrien. 318218822Sdim. {* The section is a COFF shared library section. This flag is 319218822Sdim. only for the linker. If this type of section appears in 320218822Sdim. the input file, the linker must copy it to the output file 321218822Sdim. without changing the vma or size. FIXME: Although this 322218822Sdim. was originally intended to be general, it really is COFF 323218822Sdim. specific (and the flag was renamed to indicate this). It 324218822Sdim. might be cleaner to have some more general mechanism to 325218822Sdim. allow the back end to control what the linker does with 326218822Sdim. sections. *} 327218822Sdim.#define SEC_COFF_SHARED_LIBRARY 0x10000000 328218822Sdim. 329218822Sdim. {* This section contains data which may be shared with other 330218822Sdim. executables or shared objects. This is for COFF only. *} 331218822Sdim.#define SEC_COFF_SHARED 0x20000000 332218822Sdim. 333218822Sdim. {* When a section with this flag is being linked, then if the size of 334218822Sdim. the input section is less than a page, it should not cross a page 335218822Sdim. boundary. If the size of the input section is one page or more, 336218822Sdim. it should be aligned on a page boundary. This is for TI 337218822Sdim. TMS320C54X only. *} 338218822Sdim.#define SEC_TIC54X_BLOCK 0x40000000 339218822Sdim. 340218822Sdim. {* Conditionally link this section; do not link if there are no 341218822Sdim. references found to any symbol in the section. This is for TI 342218822Sdim. TMS320C54X only. *} 343218822Sdim.#define SEC_TIC54X_CLINK 0x80000000 344218822Sdim. 34577298Sobrien. {* End of section flags. *} 34633965Sjdp. 34777298Sobrien. {* Some internal packed boolean fields. *} 34833965Sjdp. 34977298Sobrien. {* See the vma field. *} 35077298Sobrien. unsigned int user_set_vma : 1; 35133965Sjdp. 35277298Sobrien. {* A mark flag used by some of the linker backends. *} 35377298Sobrien. unsigned int linker_mark : 1; 35433965Sjdp. 35578828Sobrien. {* Another mark flag used by some of the linker backends. Set for 35689857Sobrien. output sections that have an input section. *} 35778828Sobrien. unsigned int linker_has_input : 1; 35878828Sobrien. 359218822Sdim. {* Mark flags used by some linker backends for garbage collection. *} 36077298Sobrien. unsigned int gc_mark : 1; 361218822Sdim. unsigned int gc_mark_from_eh : 1; 36233965Sjdp. 363130561Sobrien. {* The following flags are used by the ELF linker. *} 364130561Sobrien. 365130561Sobrien. {* Mark sections which have been allocated to segments. *} 36677298Sobrien. unsigned int segment_mark : 1; 36733965Sjdp. 368130561Sobrien. {* Type of sec_info information. *} 369130561Sobrien. unsigned int sec_info_type:3; 370130561Sobrien.#define ELF_INFO_TYPE_NONE 0 371130561Sobrien.#define ELF_INFO_TYPE_STABS 1 372130561Sobrien.#define ELF_INFO_TYPE_MERGE 2 373130561Sobrien.#define ELF_INFO_TYPE_EH_FRAME 3 374130561Sobrien.#define ELF_INFO_TYPE_JUST_SYMS 4 375130561Sobrien. 376130561Sobrien. {* Nonzero if this section uses RELA relocations, rather than REL. *} 377130561Sobrien. unsigned int use_rela_p:1; 378130561Sobrien. 379218822Sdim. {* Bits used by various backends. The generic code doesn't touch 380218822Sdim. these fields. *} 381218822Sdim. 382218822Sdim. {* Nonzero if this section has TLS related relocations. *} 383130561Sobrien. unsigned int has_tls_reloc:1; 384130561Sobrien. 385275718Sjhibbits. {* Nonzero if this section has a call to __tls_get_addr. *} 386275718Sjhibbits. unsigned int has_tls_get_addr_call:1; 387275718Sjhibbits. 388218822Sdim. {* Nonzero if this section has a gp reloc. *} 389218822Sdim. unsigned int has_gp_reloc:1; 390218822Sdim. 391130561Sobrien. {* Nonzero if this section needs the relax finalize pass. *} 392130561Sobrien. unsigned int need_finalize_relax:1; 393130561Sobrien. 394218822Sdim. {* Whether relocations have been processed. *} 395218822Sdim. unsigned int reloc_done : 1; 396130561Sobrien. 39777298Sobrien. {* End of internal packed boolean fields. *} 39833965Sjdp. 39977298Sobrien. {* The virtual memory address of the section - where it will be 40077298Sobrien. at run time. The symbols are relocated against this. The 40177298Sobrien. user_set_vma flag is maintained by bfd; if it's not set, the 40277298Sobrien. backend can assign addresses (for example, in <<a.out>>, where 40377298Sobrien. the default address for <<.data>> is dependent on the specific 40477298Sobrien. target and various flags). *} 40577298Sobrien. bfd_vma vma; 40633965Sjdp. 40777298Sobrien. {* The load address of the section - where it would be in a 40877298Sobrien. rom image; really only used for writing section header 40991041Sobrien. information. *} 41077298Sobrien. bfd_vma lma; 41133965Sjdp. 41277298Sobrien. {* The size of the section in octets, as it will be output. 41377298Sobrien. Contains a value even if the section has no contents (e.g., the 414218822Sdim. size of <<.bss>>). *} 415218822Sdim. bfd_size_type size; 41633965Sjdp. 417218822Sdim. {* For input sections, the original size on disk of the section, in 418218822Sdim. octets. This field is used by the linker relaxation code. It is 419218822Sdim. currently only set for sections where the linker relaxation scheme 420218822Sdim. doesn't cache altered section and reloc contents (stabs, eh_frame, 421218822Sdim. SEC_MERGE, some coff relaxing targets), and thus the original size 422218822Sdim. needs to be kept to read the section multiple times. 423218822Sdim. For output sections, rawsize holds the section size calculated on 424218822Sdim. a previous linker relaxation pass. *} 425218822Sdim. bfd_size_type rawsize; 42633965Sjdp. 42777298Sobrien. {* If this section is going to be output, then this value is the 42877298Sobrien. offset in *bytes* into the output section of the first byte in the 42977298Sobrien. input section (byte ==> smallest addressable unit on the 43077298Sobrien. target). In most cases, if this was going to start at the 43177298Sobrien. 100th octet (8-bit quantity) in the output section, this value 43277298Sobrien. would be 100. However, if the target byte size is 16 bits 43377298Sobrien. (bfd_octets_per_byte is "2"), this value would be 50. *} 43477298Sobrien. bfd_vma output_offset; 43533965Sjdp. 43677298Sobrien. {* The output section through which to map on output. *} 437130561Sobrien. struct bfd_section *output_section; 43833965Sjdp. 43977298Sobrien. {* The alignment requirement of the section, as an exponent of 2 - 44077298Sobrien. e.g., 3 aligns to 2^3 (or 8). *} 44177298Sobrien. unsigned int alignment_power; 44233965Sjdp. 44377298Sobrien. {* If an input section, a pointer to a vector of relocation 44477298Sobrien. records for the data in this section. *} 44577298Sobrien. struct reloc_cache_entry *relocation; 44633965Sjdp. 44777298Sobrien. {* If an output section, a pointer to a vector of pointers to 44877298Sobrien. relocation records for the data in this section. *} 44977298Sobrien. struct reloc_cache_entry **orelocation; 45033965Sjdp. 45191041Sobrien. {* The number of relocation records in one of the above. *} 45277298Sobrien. unsigned reloc_count; 45333965Sjdp. 45477298Sobrien. {* Information below is back end specific - and not always used 45577298Sobrien. or updated. *} 45633965Sjdp. 45777298Sobrien. {* File position of section data. *} 45877298Sobrien. file_ptr filepos; 45933965Sjdp. 46077298Sobrien. {* File position of relocation info. *} 46177298Sobrien. file_ptr rel_filepos; 46233965Sjdp. 46377298Sobrien. {* File position of line data. *} 46477298Sobrien. file_ptr line_filepos; 46533965Sjdp. 46677298Sobrien. {* Pointer to data for applications. *} 467130561Sobrien. void *userdata; 46833965Sjdp. 46977298Sobrien. {* If the SEC_IN_MEMORY flag is set, this points to the actual 47077298Sobrien. contents. *} 47177298Sobrien. unsigned char *contents; 47233965Sjdp. 47377298Sobrien. {* Attached line number information. *} 47477298Sobrien. alent *lineno; 47560484Sobrien. 47677298Sobrien. {* Number of line number records. *} 47777298Sobrien. unsigned int lineno_count; 47833965Sjdp. 47989857Sobrien. {* Entity size for merging purposes. *} 48089857Sobrien. unsigned int entsize; 48189857Sobrien. 482130561Sobrien. {* Points to the kept section if this section is a link-once section, 483130561Sobrien. and is discarded. *} 484130561Sobrien. struct bfd_section *kept_section; 485130561Sobrien. 48677298Sobrien. {* When a section is being output, this value changes as more 48777298Sobrien. linenumbers are written out. *} 48877298Sobrien. file_ptr moving_line_filepos; 48933965Sjdp. 49077298Sobrien. {* What the section number is in the target world. *} 49177298Sobrien. int target_index; 49233965Sjdp. 493130561Sobrien. void *used_by_bfd; 49433965Sjdp. 49577298Sobrien. {* If this is a constructor section then here is a list of the 49677298Sobrien. relocations created to relocate items within it. *} 49777298Sobrien. struct relent_chain *constructor_chain; 49877298Sobrien. 49977298Sobrien. {* The BFD which owns the section. *} 50077298Sobrien. bfd *owner; 50177298Sobrien. 50291041Sobrien. {* A symbol which points at this section only. *} 503130561Sobrien. struct bfd_symbol *symbol; 504130561Sobrien. struct bfd_symbol **symbol_ptr_ptr; 50577298Sobrien. 506218822Sdim. {* Early in the link process, map_head and map_tail are used to build 507218822Sdim. a list of input sections attached to an output section. Later, 508218822Sdim. output sections use these fields for a list of bfd_link_order 509218822Sdim. structs. *} 510218822Sdim. union { 511218822Sdim. struct bfd_link_order *link_order; 512218822Sdim. struct bfd_section *s; 513218822Sdim. } map_head, map_tail; 51491041Sobrien.} asection; 51533965Sjdp. 51677298Sobrien.{* These sections are global, and are managed by BFD. The application 51777298Sobrien. and target back end are not permitted to change the values in 51877298Sobrien. these sections. New code should use the section_ptr macros rather 51977298Sobrien. than referring directly to the const sections. The const sections 52077298Sobrien. may eventually vanish. *} 52133965Sjdp.#define BFD_ABS_SECTION_NAME "*ABS*" 52233965Sjdp.#define BFD_UND_SECTION_NAME "*UND*" 52333965Sjdp.#define BFD_COM_SECTION_NAME "*COM*" 52433965Sjdp.#define BFD_IND_SECTION_NAME "*IND*" 52533965Sjdp. 52691041Sobrien.{* The absolute section. *} 527130561Sobrien.extern asection bfd_abs_section; 52833965Sjdp.#define bfd_abs_section_ptr ((asection *) &bfd_abs_section) 52933965Sjdp.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) 53091041Sobrien.{* Pointer to the undefined section. *} 531130561Sobrien.extern asection bfd_und_section; 53233965Sjdp.#define bfd_und_section_ptr ((asection *) &bfd_und_section) 53333965Sjdp.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) 53491041Sobrien.{* Pointer to the common section. *} 535130561Sobrien.extern asection bfd_com_section; 53633965Sjdp.#define bfd_com_section_ptr ((asection *) &bfd_com_section) 53791041Sobrien.{* Pointer to the indirect section. *} 538130561Sobrien.extern asection bfd_ind_section; 53933965Sjdp.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section) 54033965Sjdp.#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) 54133965Sjdp. 54289857Sobrien.#define bfd_is_const_section(SEC) \ 54389857Sobrien. ( ((SEC) == bfd_abs_section_ptr) \ 54489857Sobrien. || ((SEC) == bfd_und_section_ptr) \ 54589857Sobrien. || ((SEC) == bfd_com_section_ptr) \ 54689857Sobrien. || ((SEC) == bfd_ind_section_ptr)) 54789857Sobrien. 54889857Sobrien.{* Macros to handle insertion and deletion of a bfd's sections. These 54989857Sobrien. only handle the list pointers, ie. do not adjust section_count, 55089857Sobrien. target_index etc. *} 551218822Sdim.#define bfd_section_list_remove(ABFD, S) \ 55289857Sobrien. do \ 55389857Sobrien. { \ 554218822Sdim. asection *_s = S; \ 555218822Sdim. asection *_next = _s->next; \ 556218822Sdim. asection *_prev = _s->prev; \ 557218822Sdim. if (_prev) \ 558218822Sdim. _prev->next = _next; \ 559218822Sdim. else \ 560218822Sdim. (ABFD)->sections = _next; \ 561218822Sdim. if (_next) \ 562218822Sdim. _next->prev = _prev; \ 563218822Sdim. else \ 564218822Sdim. (ABFD)->section_last = _prev; \ 56589857Sobrien. } \ 56689857Sobrien. while (0) 567218822Sdim.#define bfd_section_list_append(ABFD, S) \ 56889857Sobrien. do \ 56989857Sobrien. { \ 57089857Sobrien. asection *_s = S; \ 571218822Sdim. bfd *_abfd = ABFD; \ 572218822Sdim. _s->next = NULL; \ 573218822Sdim. if (_abfd->section_last) \ 574218822Sdim. { \ 575218822Sdim. _s->prev = _abfd->section_last; \ 576218822Sdim. _abfd->section_last->next = _s; \ 577218822Sdim. } \ 578218822Sdim. else \ 579218822Sdim. { \ 580218822Sdim. _s->prev = NULL; \ 581218822Sdim. _abfd->sections = _s; \ 582218822Sdim. } \ 583218822Sdim. _abfd->section_last = _s; \ 58489857Sobrien. } \ 58589857Sobrien. while (0) 586218822Sdim.#define bfd_section_list_prepend(ABFD, S) \ 587218822Sdim. do \ 588218822Sdim. { \ 589218822Sdim. asection *_s = S; \ 590218822Sdim. bfd *_abfd = ABFD; \ 591218822Sdim. _s->prev = NULL; \ 592218822Sdim. if (_abfd->sections) \ 593218822Sdim. { \ 594218822Sdim. _s->next = _abfd->sections; \ 595218822Sdim. _abfd->sections->prev = _s; \ 596218822Sdim. } \ 597218822Sdim. else \ 598218822Sdim. { \ 599218822Sdim. _s->next = NULL; \ 600218822Sdim. _abfd->section_last = _s; \ 601218822Sdim. } \ 602218822Sdim. _abfd->sections = _s; \ 603218822Sdim. } \ 604218822Sdim. while (0) 605218822Sdim.#define bfd_section_list_insert_after(ABFD, A, S) \ 606218822Sdim. do \ 607218822Sdim. { \ 608218822Sdim. asection *_a = A; \ 609218822Sdim. asection *_s = S; \ 610218822Sdim. asection *_next = _a->next; \ 611218822Sdim. _s->next = _next; \ 612218822Sdim. _s->prev = _a; \ 613218822Sdim. _a->next = _s; \ 614218822Sdim. if (_next) \ 615218822Sdim. _next->prev = _s; \ 616218822Sdim. else \ 617218822Sdim. (ABFD)->section_last = _s; \ 618218822Sdim. } \ 619218822Sdim. while (0) 620218822Sdim.#define bfd_section_list_insert_before(ABFD, B, S) \ 621218822Sdim. do \ 622218822Sdim. { \ 623218822Sdim. asection *_b = B; \ 624218822Sdim. asection *_s = S; \ 625218822Sdim. asection *_prev = _b->prev; \ 626218822Sdim. _s->prev = _prev; \ 627218822Sdim. _s->next = _b; \ 628218822Sdim. _b->prev = _s; \ 629218822Sdim. if (_prev) \ 630218822Sdim. _prev->next = _s; \ 631218822Sdim. else \ 632218822Sdim. (ABFD)->sections = _s; \ 633218822Sdim. } \ 634218822Sdim. while (0) 635218822Sdim.#define bfd_section_removed_from_list(ABFD, S) \ 636218822Sdim. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) 63789857Sobrien. 638218822Sdim.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ 639218822Sdim. {* name, id, index, next, prev, flags, user_set_vma, *} \ 640218822Sdim. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ 641218822Sdim. \ 642218822Sdim. {* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, *} \ 643218822Sdim. 0, 0, 1, 0, \ 644218822Sdim. \ 645218822Sdim. {* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, *} \ 646218822Sdim. 0, 0, 0, 0, \ 647218822Sdim. \ 648275718Sjhibbits. {* has_tls_get_addr_call, has_gp_reloc, need_finalize_relax, *} \ 649275718Sjhibbits. 0, 0, 0, \ 650218822Sdim. \ 651275718Sjhibbits. {* reloc_done, vma, lma, size, rawsize *} \ 652275718Sjhibbits. 0, 0, 0, 0, 0, \ 653218822Sdim. \ 654218822Sdim. {* output_offset, output_section, alignment_power, *} \ 655218822Sdim. 0, (struct bfd_section *) &SEC, 0, \ 656218822Sdim. \ 657218822Sdim. {* relocation, orelocation, reloc_count, filepos, rel_filepos, *} \ 658218822Sdim. NULL, NULL, 0, 0, 0, \ 659218822Sdim. \ 660218822Sdim. {* line_filepos, userdata, contents, lineno, lineno_count, *} \ 661218822Sdim. 0, NULL, NULL, NULL, 0, \ 662218822Sdim. \ 663218822Sdim. {* entsize, kept_section, moving_line_filepos, *} \ 664218822Sdim. 0, NULL, 0, \ 665218822Sdim. \ 666218822Sdim. {* target_index, used_by_bfd, constructor_chain, owner, *} \ 667218822Sdim. 0, NULL, NULL, NULL, \ 668218822Sdim. \ 669218822Sdim. {* symbol, symbol_ptr_ptr, *} \ 670218822Sdim. (struct bfd_symbol *) SYM, &SEC.symbol, \ 671218822Sdim. \ 672218822Sdim. {* map_head, map_tail *} \ 673218822Sdim. { NULL }, { NULL } \ 674218822Sdim. } 675218822Sdim. 67633965Sjdp*/ 67733965Sjdp 67860484Sobrien/* We use a macro to initialize the static asymbol structures because 67960484Sobrien traditional C does not permit us to initialize a union member while 68060484Sobrien gcc warns if we don't initialize it. */ 68160484Sobrien /* the_bfd, name, value, attr, section [, udata] */ 68260484Sobrien#ifdef __STDC__ 68360484Sobrien#define GLOBAL_SYM_INIT(NAME, SECTION) \ 68460484Sobrien { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }} 68560484Sobrien#else 68660484Sobrien#define GLOBAL_SYM_INIT(NAME, SECTION) \ 68760484Sobrien { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION } 68860484Sobrien#endif 68960484Sobrien 69033965Sjdp/* These symbols are global, not specific to any BFD. Therefore, anything 69133965Sjdp that tries to change them is broken, and should be repaired. */ 69260484Sobrien 69333965Sjdpstatic const asymbol global_syms[] = 69433965Sjdp{ 69560484Sobrien GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, &bfd_com_section), 69660484Sobrien GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, &bfd_und_section), 69760484Sobrien GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, &bfd_abs_section), 69860484Sobrien GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section) 69933965Sjdp}; 70033965Sjdp 701218822Sdim#define STD_SECTION(SEC, FLAGS, NAME, IDX) \ 702218822Sdim asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], \ 703218822Sdim NAME, IDX) 70433965Sjdp 705218822SdimSTD_SECTION (bfd_com_section, SEC_IS_COMMON, BFD_COM_SECTION_NAME, 0); 706218822SdimSTD_SECTION (bfd_und_section, 0, BFD_UND_SECTION_NAME, 1); 707218822SdimSTD_SECTION (bfd_abs_section, 0, BFD_ABS_SECTION_NAME, 2); 708218822SdimSTD_SECTION (bfd_ind_section, 0, BFD_IND_SECTION_NAME, 3); 70933965Sjdp#undef STD_SECTION 71033965Sjdp 71189857Sobrien/* Initialize an entry in the section hash table. */ 71289857Sobrien 71389857Sobrienstruct bfd_hash_entry * 714130561Sobrienbfd_section_hash_newfunc (struct bfd_hash_entry *entry, 715130561Sobrien struct bfd_hash_table *table, 716130561Sobrien const char *string) 71789857Sobrien{ 71889857Sobrien /* Allocate the structure if it has not already been allocated by a 71989857Sobrien subclass. */ 72089857Sobrien if (entry == NULL) 72189857Sobrien { 722107492Sobrien entry = (struct bfd_hash_entry *) 723107492Sobrien bfd_hash_allocate (table, sizeof (struct section_hash_entry)); 72489857Sobrien if (entry == NULL) 72589857Sobrien return entry; 72689857Sobrien } 72789857Sobrien 72889857Sobrien /* Call the allocation method of the superclass. */ 72989857Sobrien entry = bfd_hash_newfunc (entry, table, string); 73089857Sobrien if (entry != NULL) 731130561Sobrien memset (&((struct section_hash_entry *) entry)->section, 0, 732130561Sobrien sizeof (asection)); 73389857Sobrien 73489857Sobrien return entry; 73589857Sobrien} 73689857Sobrien 73789857Sobrien#define section_hash_lookup(table, string, create, copy) \ 73889857Sobrien ((struct section_hash_entry *) \ 73989857Sobrien bfd_hash_lookup ((table), (string), (create), (copy))) 74089857Sobrien 741218822Sdim/* Create a symbol whose only job is to point to this section. This 742218822Sdim is useful for things like relocs which are relative to the base 743218822Sdim of a section. */ 74489857Sobrien 745218822Sdimbfd_boolean 746218822Sdim_bfd_generic_new_section_hook (bfd *abfd, asection *newsect) 74789857Sobrien{ 74889857Sobrien newsect->symbol = bfd_make_empty_symbol (abfd); 74989857Sobrien if (newsect->symbol == NULL) 750218822Sdim return FALSE; 75189857Sobrien 75289857Sobrien newsect->symbol->name = newsect->name; 75389857Sobrien newsect->symbol->value = 0; 75489857Sobrien newsect->symbol->section = newsect; 75589857Sobrien newsect->symbol->flags = BSF_SECTION_SYM; 75689857Sobrien 75789857Sobrien newsect->symbol_ptr_ptr = &newsect->symbol; 758218822Sdim return TRUE; 759218822Sdim} 76089857Sobrien 761218822Sdim/* Initializes a new section. NEWSECT->NAME is already set. */ 762218822Sdim 763218822Sdimstatic asection * 764218822Sdimbfd_section_init (bfd *abfd, asection *newsect) 765218822Sdim{ 766218822Sdim static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ 767218822Sdim 768218822Sdim newsect->id = section_id; 769218822Sdim newsect->index = abfd->section_count; 770218822Sdim newsect->owner = abfd; 771218822Sdim 77289857Sobrien if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect))) 77389857Sobrien return NULL; 77489857Sobrien 77589857Sobrien section_id++; 77689857Sobrien abfd->section_count++; 777218822Sdim bfd_section_list_append (abfd, newsect); 77889857Sobrien return newsect; 77989857Sobrien} 78089857Sobrien 78133965Sjdp/* 78233965SjdpDOCDD 78333965SjdpINODE 78433965Sjdpsection prototypes, , typedef asection, Sections 78533965SjdpSUBSECTION 78633965Sjdp Section prototypes 78733965Sjdp 78833965SjdpThese are the functions exported by the section handling part of BFD. 78933965Sjdp*/ 79033965Sjdp 79133965Sjdp/* 79233965SjdpFUNCTION 79389857Sobrien bfd_section_list_clear 79489857Sobrien 79589857SobrienSYNOPSIS 79689857Sobrien void bfd_section_list_clear (bfd *); 79789857Sobrien 79889857SobrienDESCRIPTION 79989857Sobrien Clears the section list, and also resets the section count and 80089857Sobrien hash table entries. 80189857Sobrien*/ 80289857Sobrien 80389857Sobrienvoid 804130561Sobrienbfd_section_list_clear (bfd *abfd) 80589857Sobrien{ 80689857Sobrien abfd->sections = NULL; 807218822Sdim abfd->section_last = NULL; 80889857Sobrien abfd->section_count = 0; 809130561Sobrien memset (abfd->section_htab.table, 0, 81089857Sobrien abfd->section_htab.size * sizeof (struct bfd_hash_entry *)); 81189857Sobrien} 81289857Sobrien 81389857Sobrien/* 81489857SobrienFUNCTION 81533965Sjdp bfd_get_section_by_name 81633965Sjdp 81733965SjdpSYNOPSIS 818130561Sobrien asection *bfd_get_section_by_name (bfd *abfd, const char *name); 81933965Sjdp 82033965SjdpDESCRIPTION 82133965Sjdp Run through @var{abfd} and return the one of the 82233965Sjdp <<asection>>s whose name matches @var{name}, otherwise <<NULL>>. 82333965Sjdp @xref{Sections}, for more information. 82433965Sjdp 82533965Sjdp This should only be used in special cases; the normal way to process 82633965Sjdp all sections of a given name is to use <<bfd_map_over_sections>> and 82733965Sjdp <<strcmp>> on the name (or better yet, base it on the section flags 82833965Sjdp or something else) for each section. 82933965Sjdp*/ 83033965Sjdp 83133965Sjdpasection * 832130561Sobrienbfd_get_section_by_name (bfd *abfd, const char *name) 83333965Sjdp{ 83489857Sobrien struct section_hash_entry *sh; 83533965Sjdp 836130561Sobrien sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE); 83789857Sobrien if (sh != NULL) 83889857Sobrien return &sh->section; 83989857Sobrien 84033965Sjdp return NULL; 84133965Sjdp} 84233965Sjdp 84377298Sobrien/* 84477298SobrienFUNCTION 845218822Sdim bfd_get_section_by_name_if 846218822Sdim 847218822SdimSYNOPSIS 848218822Sdim asection *bfd_get_section_by_name_if 849218822Sdim (bfd *abfd, 850218822Sdim const char *name, 851218822Sdim bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), 852218822Sdim void *obj); 853218822Sdim 854218822SdimDESCRIPTION 855218822Sdim Call the provided function @var{func} for each section 856218822Sdim attached to the BFD @var{abfd} whose name matches @var{name}, 857218822Sdim passing @var{obj} as an argument. The function will be called 858218822Sdim as if by 859218822Sdim 860218822Sdim| func (abfd, the_section, obj); 861218822Sdim 862218822Sdim It returns the first section for which @var{func} returns true, 863218822Sdim otherwise <<NULL>>. 864218822Sdim 865218822Sdim*/ 866218822Sdim 867218822Sdimasection * 868218822Sdimbfd_get_section_by_name_if (bfd *abfd, const char *name, 869218822Sdim bfd_boolean (*operation) (bfd *, 870218822Sdim asection *, 871218822Sdim void *), 872218822Sdim void *user_storage) 873218822Sdim{ 874218822Sdim struct section_hash_entry *sh; 875218822Sdim unsigned long hash; 876218822Sdim 877218822Sdim sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE); 878218822Sdim if (sh == NULL) 879218822Sdim return NULL; 880218822Sdim 881218822Sdim hash = sh->root.hash; 882218822Sdim do 883218822Sdim { 884218822Sdim if ((*operation) (abfd, &sh->section, user_storage)) 885218822Sdim return &sh->section; 886218822Sdim sh = (struct section_hash_entry *) sh->root.next; 887218822Sdim } 888218822Sdim while (sh != NULL && sh->root.hash == hash 889218822Sdim && strcmp (sh->root.string, name) == 0); 890218822Sdim 891218822Sdim return NULL; 892218822Sdim} 893218822Sdim 894218822Sdim/* 895218822SdimFUNCTION 89677298Sobrien bfd_get_unique_section_name 89733965Sjdp 89877298SobrienSYNOPSIS 899130561Sobrien char *bfd_get_unique_section_name 900130561Sobrien (bfd *abfd, const char *templat, int *count); 90177298Sobrien 90277298SobrienDESCRIPTION 90377298Sobrien Invent a section name that is unique in @var{abfd} by tacking 90477298Sobrien a dot and a digit suffix onto the original @var{templat}. If 90577298Sobrien @var{count} is non-NULL, then it specifies the first number 90677298Sobrien tried as a suffix to generate a unique name. The value 90777298Sobrien pointed to by @var{count} will be incremented in this case. 90877298Sobrien*/ 90977298Sobrien 91077298Sobrienchar * 911130561Sobrienbfd_get_unique_section_name (bfd *abfd, const char *templat, int *count) 91277298Sobrien{ 91377298Sobrien int num; 91477298Sobrien unsigned int len; 91577298Sobrien char *sname; 91677298Sobrien 91777298Sobrien len = strlen (templat); 918130561Sobrien sname = bfd_malloc (len + 8); 91977298Sobrien if (sname == NULL) 92077298Sobrien return NULL; 921104834Sobrien memcpy (sname, templat, len); 92277298Sobrien num = 1; 92377298Sobrien if (count != NULL) 92477298Sobrien num = *count; 92577298Sobrien 92677298Sobrien do 92777298Sobrien { 92877298Sobrien /* If we have a million sections, something is badly wrong. */ 92977298Sobrien if (num > 999999) 93077298Sobrien abort (); 93177298Sobrien sprintf (sname + len, ".%d", num++); 93277298Sobrien } 933130561Sobrien while (section_hash_lookup (&abfd->section_htab, sname, FALSE, FALSE)); 93477298Sobrien 93577298Sobrien if (count != NULL) 93677298Sobrien *count = num; 93777298Sobrien return sname; 93877298Sobrien} 93977298Sobrien 94033965Sjdp/* 94133965SjdpFUNCTION 94233965Sjdp bfd_make_section_old_way 94333965Sjdp 94433965SjdpSYNOPSIS 945130561Sobrien asection *bfd_make_section_old_way (bfd *abfd, const char *name); 94633965Sjdp 94733965SjdpDESCRIPTION 94833965Sjdp Create a new empty section called @var{name} 94933965Sjdp and attach it to the end of the chain of sections for the 95033965Sjdp BFD @var{abfd}. An attempt to create a section with a name which 95133965Sjdp is already in use returns its pointer without changing the 95233965Sjdp section chain. 95333965Sjdp 95433965Sjdp It has the funny name since this is the way it used to be 95533965Sjdp before it was rewritten.... 95633965Sjdp 95733965Sjdp Possible errors are: 95833965Sjdp o <<bfd_error_invalid_operation>> - 95933965Sjdp If output has already started for this BFD. 96033965Sjdp o <<bfd_error_no_memory>> - 96133965Sjdp If memory allocation fails. 96233965Sjdp 96333965Sjdp*/ 96433965Sjdp 96533965Sjdpasection * 966130561Sobrienbfd_make_section_old_way (bfd *abfd, const char *name) 96733965Sjdp{ 96889857Sobrien asection *newsect; 96989857Sobrien 97089857Sobrien if (abfd->output_has_begun) 97133965Sjdp { 97289857Sobrien bfd_set_error (bfd_error_invalid_operation); 97389857Sobrien return NULL; 97433965Sjdp } 97589857Sobrien 97689857Sobrien if (strcmp (name, BFD_ABS_SECTION_NAME) == 0) 977218822Sdim newsect = bfd_abs_section_ptr; 978218822Sdim else if (strcmp (name, BFD_COM_SECTION_NAME) == 0) 979218822Sdim newsect = bfd_com_section_ptr; 980218822Sdim else if (strcmp (name, BFD_UND_SECTION_NAME) == 0) 981218822Sdim newsect = bfd_und_section_ptr; 982218822Sdim else if (strcmp (name, BFD_IND_SECTION_NAME) == 0) 983218822Sdim newsect = bfd_ind_section_ptr; 984218822Sdim else 985218822Sdim { 986218822Sdim struct section_hash_entry *sh; 98789857Sobrien 988218822Sdim sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); 989218822Sdim if (sh == NULL) 990218822Sdim return NULL; 99189857Sobrien 992218822Sdim newsect = &sh->section; 993218822Sdim if (newsect->name != NULL) 994218822Sdim { 995218822Sdim /* Section already exists. */ 996218822Sdim return newsect; 997218822Sdim } 99889857Sobrien 999218822Sdim newsect->name = name; 1000218822Sdim return bfd_section_init (abfd, newsect); 1001218822Sdim } 100289857Sobrien 1003218822Sdim /* Call new_section_hook when "creating" the standard abs, com, und 1004218822Sdim and ind sections to tack on format specific section data. 1005218822Sdim Also, create a proper section symbol. */ 1006218822Sdim if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect))) 100789857Sobrien return NULL; 1008218822Sdim return newsect; 100933965Sjdp} 101033965Sjdp 101133965Sjdp/* 101233965SjdpFUNCTION 1013218822Sdim bfd_make_section_anyway_with_flags 101433965Sjdp 101533965SjdpSYNOPSIS 1016218822Sdim asection *bfd_make_section_anyway_with_flags 1017218822Sdim (bfd *abfd, const char *name, flagword flags); 101833965Sjdp 101933965SjdpDESCRIPTION 102033965Sjdp Create a new empty section called @var{name} and attach it to the end of 102133965Sjdp the chain of sections for @var{abfd}. Create a new section even if there 1022218822Sdim is already a section with that name. Also set the attributes of the 1023218822Sdim new section to the value @var{flags}. 102433965Sjdp 102533965Sjdp Return <<NULL>> and set <<bfd_error>> on error; possible errors are: 102633965Sjdp o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}. 102733965Sjdp o <<bfd_error_no_memory>> - If memory allocation fails. 102833965Sjdp*/ 102933965Sjdp 103033965Sjdpsec_ptr 1031218822Sdimbfd_make_section_anyway_with_flags (bfd *abfd, const char *name, 1032218822Sdim flagword flags) 103333965Sjdp{ 103489857Sobrien struct section_hash_entry *sh; 103533965Sjdp asection *newsect; 103633965Sjdp 103733965Sjdp if (abfd->output_has_begun) 103833965Sjdp { 103933965Sjdp bfd_set_error (bfd_error_invalid_operation); 104033965Sjdp return NULL; 104133965Sjdp } 104233965Sjdp 1043130561Sobrien sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); 104489857Sobrien if (sh == NULL) 104533965Sjdp return NULL; 104633965Sjdp 104789857Sobrien newsect = &sh->section; 104889857Sobrien if (newsect->name != NULL) 104977298Sobrien { 1050218822Sdim /* We are making a section of the same name. Put it in the 1051218822Sdim section hash table. Even though we can't find it directly by a 1052218822Sdim hash lookup, we'll be able to find the section by traversing 1053218822Sdim sh->root.next quicker than looking at all the bfd sections. */ 1054218822Sdim struct section_hash_entry *new_sh; 1055218822Sdim new_sh = (struct section_hash_entry *) 1056218822Sdim bfd_section_hash_newfunc (NULL, &abfd->section_htab, name); 1057218822Sdim if (new_sh == NULL) 105889857Sobrien return NULL; 1059218822Sdim 1060218822Sdim new_sh->root = sh->root; 1061218822Sdim sh->root.next = &new_sh->root; 1062218822Sdim newsect = &new_sh->section; 106377298Sobrien } 106433965Sjdp 1065218822Sdim newsect->flags = flags; 106689857Sobrien newsect->name = name; 106789857Sobrien return bfd_section_init (abfd, newsect); 106833965Sjdp} 106933965Sjdp 107033965Sjdp/* 107133965SjdpFUNCTION 1072218822Sdim bfd_make_section_anyway 107333965Sjdp 107433965SjdpSYNOPSIS 1075218822Sdim asection *bfd_make_section_anyway (bfd *abfd, const char *name); 107633965Sjdp 107733965SjdpDESCRIPTION 1078218822Sdim Create a new empty section called @var{name} and attach it to the end of 1079218822Sdim the chain of sections for @var{abfd}. Create a new section even if there 1080218822Sdim is already a section with that name. 1081218822Sdim 1082218822Sdim Return <<NULL>> and set <<bfd_error>> on error; possible errors are: 1083218822Sdim o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}. 1084218822Sdim o <<bfd_error_no_memory>> - If memory allocation fails. 1085218822Sdim*/ 1086218822Sdim 1087218822Sdimsec_ptr 1088218822Sdimbfd_make_section_anyway (bfd *abfd, const char *name) 1089218822Sdim{ 1090218822Sdim return bfd_make_section_anyway_with_flags (abfd, name, 0); 1091218822Sdim} 1092218822Sdim 1093218822Sdim/* 1094218822SdimFUNCTION 1095218822Sdim bfd_make_section_with_flags 1096218822Sdim 1097218822SdimSYNOPSIS 1098218822Sdim asection *bfd_make_section_with_flags 1099218822Sdim (bfd *, const char *name, flagword flags); 1100218822Sdim 1101218822SdimDESCRIPTION 110233965Sjdp Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling 110333965Sjdp bfd_set_error ()) without changing the section chain if there is already a 1104218822Sdim section named @var{name}. Also set the attributes of the new section to 1105218822Sdim the value @var{flags}. If there is an error, return <<NULL>> and set 110633965Sjdp <<bfd_error>>. 110733965Sjdp*/ 110833965Sjdp 110933965Sjdpasection * 1110218822Sdimbfd_make_section_with_flags (bfd *abfd, const char *name, 1111218822Sdim flagword flags) 111233965Sjdp{ 111389857Sobrien struct section_hash_entry *sh; 111489857Sobrien asection *newsect; 111533965Sjdp 111689857Sobrien if (abfd->output_has_begun) 111733965Sjdp { 111889857Sobrien bfd_set_error (bfd_error_invalid_operation); 111989857Sobrien return NULL; 112033965Sjdp } 112133965Sjdp 112289857Sobrien if (strcmp (name, BFD_ABS_SECTION_NAME) == 0 112389857Sobrien || strcmp (name, BFD_COM_SECTION_NAME) == 0 112489857Sobrien || strcmp (name, BFD_UND_SECTION_NAME) == 0 112589857Sobrien || strcmp (name, BFD_IND_SECTION_NAME) == 0) 112689857Sobrien return NULL; 112733965Sjdp 1128130561Sobrien sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); 112989857Sobrien if (sh == NULL) 113089857Sobrien return NULL; 113189857Sobrien 113289857Sobrien newsect = &sh->section; 113389857Sobrien if (newsect->name != NULL) 113433965Sjdp { 113589857Sobrien /* Section already exists. */ 1136130561Sobrien return NULL; 113733965Sjdp } 113833965Sjdp 113989857Sobrien newsect->name = name; 1140218822Sdim newsect->flags = flags; 114189857Sobrien return bfd_section_init (abfd, newsect); 114233965Sjdp} 114333965Sjdp 114433965Sjdp/* 114533965SjdpFUNCTION 1146218822Sdim bfd_make_section 1147218822Sdim 1148218822SdimSYNOPSIS 1149218822Sdim asection *bfd_make_section (bfd *, const char *name); 1150218822Sdim 1151218822SdimDESCRIPTION 1152218822Sdim Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling 1153218822Sdim bfd_set_error ()) without changing the section chain if there is already a 1154218822Sdim section named @var{name}. If there is an error, return <<NULL>> and set 1155218822Sdim <<bfd_error>>. 1156218822Sdim*/ 1157218822Sdim 1158218822Sdimasection * 1159218822Sdimbfd_make_section (bfd *abfd, const char *name) 1160218822Sdim{ 1161218822Sdim return bfd_make_section_with_flags (abfd, name, 0); 1162218822Sdim} 1163218822Sdim 1164218822Sdim/* 1165218822SdimFUNCTION 116633965Sjdp bfd_set_section_flags 116733965Sjdp 116833965SjdpSYNOPSIS 1169130561Sobrien bfd_boolean bfd_set_section_flags 1170130561Sobrien (bfd *abfd, asection *sec, flagword flags); 117133965Sjdp 117233965SjdpDESCRIPTION 117333965Sjdp Set the attributes of the section @var{sec} in the BFD 1174130561Sobrien @var{abfd} to the value @var{flags}. Return <<TRUE>> on success, 1175130561Sobrien <<FALSE>> on error. Possible error returns are: 117633965Sjdp 117733965Sjdp o <<bfd_error_invalid_operation>> - 117833965Sjdp The section cannot have one or more of the attributes 117933965Sjdp requested. For example, a .bss section in <<a.out>> may not 118033965Sjdp have the <<SEC_HAS_CONTENTS>> field set. 118133965Sjdp 118233965Sjdp*/ 118333965Sjdp 1184130561Sobrienbfd_boolean 1185130561Sobrienbfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, 1186130561Sobrien sec_ptr section, 1187130561Sobrien flagword flags) 118833965Sjdp{ 118933965Sjdp section->flags = flags; 1190130561Sobrien return TRUE; 119133965Sjdp} 119233965Sjdp 119333965Sjdp/* 119433965SjdpFUNCTION 119533965Sjdp bfd_map_over_sections 119633965Sjdp 119733965SjdpSYNOPSIS 1198130561Sobrien void bfd_map_over_sections 1199130561Sobrien (bfd *abfd, 1200130561Sobrien void (*func) (bfd *abfd, asection *sect, void *obj), 1201130561Sobrien void *obj); 120233965Sjdp 120333965SjdpDESCRIPTION 120433965Sjdp Call the provided function @var{func} for each section 120533965Sjdp attached to the BFD @var{abfd}, passing @var{obj} as an 120633965Sjdp argument. The function will be called as if by 120733965Sjdp 1208130561Sobrien| func (abfd, the_section, obj); 120933965Sjdp 1210130561Sobrien This is the preferred method for iterating over sections; an 121133965Sjdp alternative would be to use a loop: 121233965Sjdp 121333965Sjdp| section *p; 121433965Sjdp| for (p = abfd->sections; p != NULL; p = p->next) 1215130561Sobrien| func (abfd, p, ...) 121633965Sjdp 121733965Sjdp*/ 121833965Sjdp 121933965Sjdpvoid 1220130561Sobrienbfd_map_over_sections (bfd *abfd, 1221130561Sobrien void (*operation) (bfd *, asection *, void *), 1222130561Sobrien void *user_storage) 122333965Sjdp{ 122433965Sjdp asection *sect; 122533965Sjdp unsigned int i = 0; 122633965Sjdp 122733965Sjdp for (sect = abfd->sections; sect != NULL; i++, sect = sect->next) 122833965Sjdp (*operation) (abfd, sect, user_storage); 122933965Sjdp 123033965Sjdp if (i != abfd->section_count) /* Debugging */ 123133965Sjdp abort (); 123233965Sjdp} 123333965Sjdp 123433965Sjdp/* 123533965SjdpFUNCTION 1236218822Sdim bfd_sections_find_if 1237218822Sdim 1238218822SdimSYNOPSIS 1239218822Sdim asection *bfd_sections_find_if 1240218822Sdim (bfd *abfd, 1241218822Sdim bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), 1242218822Sdim void *obj); 1243218822Sdim 1244218822SdimDESCRIPTION 1245218822Sdim Call the provided function @var{operation} for each section 1246218822Sdim attached to the BFD @var{abfd}, passing @var{obj} as an 1247218822Sdim argument. The function will be called as if by 1248218822Sdim 1249218822Sdim| operation (abfd, the_section, obj); 1250218822Sdim 1251218822Sdim It returns the first section for which @var{operation} returns true. 1252218822Sdim 1253218822Sdim*/ 1254218822Sdim 1255218822Sdimasection * 1256218822Sdimbfd_sections_find_if (bfd *abfd, 1257218822Sdim bfd_boolean (*operation) (bfd *, asection *, void *), 1258218822Sdim void *user_storage) 1259218822Sdim{ 1260218822Sdim asection *sect; 1261218822Sdim 1262218822Sdim for (sect = abfd->sections; sect != NULL; sect = sect->next) 1263218822Sdim if ((*operation) (abfd, sect, user_storage)) 1264218822Sdim break; 1265218822Sdim 1266218822Sdim return sect; 1267218822Sdim} 1268218822Sdim 1269218822Sdim/* 1270218822SdimFUNCTION 127133965Sjdp bfd_set_section_size 127233965Sjdp 127333965SjdpSYNOPSIS 1274130561Sobrien bfd_boolean bfd_set_section_size 1275130561Sobrien (bfd *abfd, asection *sec, bfd_size_type val); 127633965Sjdp 127733965SjdpDESCRIPTION 127833965Sjdp Set @var{sec} to the size @var{val}. If the operation is 1279130561Sobrien ok, then <<TRUE>> is returned, else <<FALSE>>. 128033965Sjdp 128133965Sjdp Possible error returns: 128233965Sjdp o <<bfd_error_invalid_operation>> - 128333965Sjdp Writing has started to the BFD, so setting the size is invalid. 128433965Sjdp 128533965Sjdp*/ 128633965Sjdp 1287130561Sobrienbfd_boolean 1288130561Sobrienbfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val) 128933965Sjdp{ 129033965Sjdp /* Once you've started writing to any section you cannot create or change 129177298Sobrien the size of any others. */ 129233965Sjdp 129333965Sjdp if (abfd->output_has_begun) 129433965Sjdp { 129533965Sjdp bfd_set_error (bfd_error_invalid_operation); 1296130561Sobrien return FALSE; 129733965Sjdp } 129833965Sjdp 1299218822Sdim ptr->size = val; 1300130561Sobrien return TRUE; 130133965Sjdp} 130233965Sjdp 130333965Sjdp/* 130433965SjdpFUNCTION 130533965Sjdp bfd_set_section_contents 130633965Sjdp 130733965SjdpSYNOPSIS 1308130561Sobrien bfd_boolean bfd_set_section_contents 1309130561Sobrien (bfd *abfd, asection *section, const void *data, 1310130561Sobrien file_ptr offset, bfd_size_type count); 131133965Sjdp 131233965SjdpDESCRIPTION 131333965Sjdp Sets the contents of the section @var{section} in BFD 131433965Sjdp @var{abfd} to the data starting in memory at @var{data}. The 131533965Sjdp data is written to the output section starting at offset 131660484Sobrien @var{offset} for @var{count} octets. 131733965Sjdp 1318130561Sobrien Normally <<TRUE>> is returned, else <<FALSE>>. Possible error 131933965Sjdp returns are: 132033965Sjdp o <<bfd_error_no_contents>> - 132133965Sjdp The output section does not have the <<SEC_HAS_CONTENTS>> 132233965Sjdp attribute, so nothing can be written to it. 132333965Sjdp o and some more too 132433965Sjdp 132533965Sjdp This routine is front end to the back end function 132633965Sjdp <<_bfd_set_section_contents>>. 132733965Sjdp 132833965Sjdp*/ 132933965Sjdp 1330130561Sobrienbfd_boolean 1331130561Sobrienbfd_set_section_contents (bfd *abfd, 1332130561Sobrien sec_ptr section, 1333130561Sobrien const void *location, 1334130561Sobrien file_ptr offset, 1335130561Sobrien bfd_size_type count) 133633965Sjdp{ 133733965Sjdp bfd_size_type sz; 133833965Sjdp 133933965Sjdp if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS)) 134033965Sjdp { 134133965Sjdp bfd_set_error (bfd_error_no_contents); 1342130561Sobrien return FALSE; 134333965Sjdp } 134433965Sjdp 1345218822Sdim sz = section->size; 134689857Sobrien if ((bfd_size_type) offset > sz 134789857Sobrien || count > sz 134889857Sobrien || offset + count > sz 134989857Sobrien || count != (size_t) count) 135033965Sjdp { 135133965Sjdp bfd_set_error (bfd_error_bad_value); 1352130561Sobrien return FALSE; 135333965Sjdp } 135433965Sjdp 1355218822Sdim if (!bfd_write_p (abfd)) 135633965Sjdp { 135733965Sjdp bfd_set_error (bfd_error_invalid_operation); 1358130561Sobrien return FALSE; 135933965Sjdp } 136033965Sjdp 136177298Sobrien /* Record a copy of the data in memory if desired. */ 136277298Sobrien if (section->contents 1363130561Sobrien && location != section->contents + offset) 136489857Sobrien memcpy (section->contents + offset, location, (size_t) count); 136577298Sobrien 136633965Sjdp if (BFD_SEND (abfd, _bfd_set_section_contents, 136733965Sjdp (abfd, section, location, offset, count))) 136833965Sjdp { 1369130561Sobrien abfd->output_has_begun = TRUE; 1370130561Sobrien return TRUE; 137133965Sjdp } 137233965Sjdp 1373130561Sobrien return FALSE; 137433965Sjdp} 137533965Sjdp 137633965Sjdp/* 137733965SjdpFUNCTION 137833965Sjdp bfd_get_section_contents 137933965Sjdp 138033965SjdpSYNOPSIS 1381130561Sobrien bfd_boolean bfd_get_section_contents 1382130561Sobrien (bfd *abfd, asection *section, void *location, file_ptr offset, 1383130561Sobrien bfd_size_type count); 138433965Sjdp 138533965SjdpDESCRIPTION 138633965Sjdp Read data from @var{section} in BFD @var{abfd} 138733965Sjdp into memory starting at @var{location}. The data is read at an 138833965Sjdp offset of @var{offset} from the start of the input section, 138933965Sjdp and is read for @var{count} bytes. 139033965Sjdp 139133965Sjdp If the contents of a constructor with the <<SEC_CONSTRUCTOR>> 139233965Sjdp flag set are requested or if the section does not have the 139333965Sjdp <<SEC_HAS_CONTENTS>> flag set, then the @var{location} is filled 1394130561Sobrien with zeroes. If no errors occur, <<TRUE>> is returned, else 1395130561Sobrien <<FALSE>>. 139633965Sjdp 139733965Sjdp*/ 1398130561Sobrienbfd_boolean 1399130561Sobrienbfd_get_section_contents (bfd *abfd, 1400130561Sobrien sec_ptr section, 1401130561Sobrien void *location, 1402130561Sobrien file_ptr offset, 1403130561Sobrien bfd_size_type count) 140433965Sjdp{ 140533965Sjdp bfd_size_type sz; 140633965Sjdp 140733965Sjdp if (section->flags & SEC_CONSTRUCTOR) 140833965Sjdp { 140989857Sobrien memset (location, 0, (size_t) count); 1410130561Sobrien return TRUE; 141133965Sjdp } 141233965Sjdp 1413218822Sdim sz = section->rawsize ? section->rawsize : section->size; 141489857Sobrien if ((bfd_size_type) offset > sz 141589857Sobrien || count > sz 141689857Sobrien || offset + count > sz 141789857Sobrien || count != (size_t) count) 141833965Sjdp { 141933965Sjdp bfd_set_error (bfd_error_bad_value); 1420130561Sobrien return FALSE; 142133965Sjdp } 142233965Sjdp 142333965Sjdp if (count == 0) 142433965Sjdp /* Don't bother. */ 1425130561Sobrien return TRUE; 142633965Sjdp 142733965Sjdp if ((section->flags & SEC_HAS_CONTENTS) == 0) 142833965Sjdp { 142989857Sobrien memset (location, 0, (size_t) count); 1430130561Sobrien return TRUE; 143133965Sjdp } 143233965Sjdp 143333965Sjdp if ((section->flags & SEC_IN_MEMORY) != 0) 143433965Sjdp { 143533965Sjdp memcpy (location, section->contents + offset, (size_t) count); 1436130561Sobrien return TRUE; 143733965Sjdp } 143833965Sjdp 143933965Sjdp return BFD_SEND (abfd, _bfd_get_section_contents, 144033965Sjdp (abfd, section, location, offset, count)); 144133965Sjdp} 144233965Sjdp 144333965Sjdp/* 144433965SjdpFUNCTION 1445218822Sdim bfd_malloc_and_get_section 1446218822Sdim 1447218822SdimSYNOPSIS 1448218822Sdim bfd_boolean bfd_malloc_and_get_section 1449218822Sdim (bfd *abfd, asection *section, bfd_byte **buf); 1450218822Sdim 1451218822SdimDESCRIPTION 1452218822Sdim Read all data from @var{section} in BFD @var{abfd} 1453218822Sdim into a buffer, *@var{buf}, malloc'd by this function. 1454218822Sdim*/ 1455218822Sdim 1456218822Sdimbfd_boolean 1457218822Sdimbfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf) 1458218822Sdim{ 1459218822Sdim bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size; 1460218822Sdim bfd_byte *p = NULL; 1461218822Sdim 1462218822Sdim *buf = p; 1463218822Sdim if (sz == 0) 1464218822Sdim return TRUE; 1465218822Sdim 1466218822Sdim p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size); 1467218822Sdim if (p == NULL) 1468218822Sdim return FALSE; 1469218822Sdim *buf = p; 1470218822Sdim 1471218822Sdim return bfd_get_section_contents (abfd, sec, p, 0, sz); 1472218822Sdim} 1473218822Sdim/* 1474218822SdimFUNCTION 147533965Sjdp bfd_copy_private_section_data 147633965Sjdp 147733965SjdpSYNOPSIS 1478130561Sobrien bfd_boolean bfd_copy_private_section_data 1479130561Sobrien (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); 148033965Sjdp 148133965SjdpDESCRIPTION 148233965Sjdp Copy private section information from @var{isec} in the BFD 148333965Sjdp @var{ibfd} to the section @var{osec} in the BFD @var{obfd}. 1484130561Sobrien Return <<TRUE>> on success, <<FALSE>> on error. Possible error 148533965Sjdp returns are: 148633965Sjdp 148733965Sjdp o <<bfd_error_no_memory>> - 148833965Sjdp Not enough memory exists to create private data for @var{osec}. 148933965Sjdp 149033965Sjdp.#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ 149133965Sjdp. BFD_SEND (obfd, _bfd_copy_private_section_data, \ 149233965Sjdp. (ibfd, isection, obfd, osection)) 149333965Sjdp*/ 149460484Sobrien 149560484Sobrien/* 149660484SobrienFUNCTION 1497218822Sdim bfd_generic_is_group_section 149860484Sobrien 149960484SobrienSYNOPSIS 1500218822Sdim bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); 150160484Sobrien 150260484SobrienDESCRIPTION 1503218822Sdim Returns TRUE if @var{sec} is a member of a group. 1504218822Sdim*/ 1505104834Sobrien 1506218822Sdimbfd_boolean 1507218822Sdimbfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, 1508218822Sdim const asection *sec ATTRIBUTE_UNUSED) 150960484Sobrien{ 1510218822Sdim return FALSE; 1511104834Sobrien} 151260484Sobrien 1513104834Sobrien/* 1514104834SobrienFUNCTION 1515104834Sobrien bfd_generic_discard_group 151660484Sobrien 1517104834SobrienSYNOPSIS 1518130561Sobrien bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); 151989857Sobrien 1520104834SobrienDESCRIPTION 1521104834Sobrien Remove all members of @var{group} from the output. 1522104834Sobrien*/ 1523104834Sobrien 1524130561Sobrienbfd_boolean 1525130561Sobrienbfd_generic_discard_group (bfd *abfd ATTRIBUTE_UNUSED, 1526130561Sobrien asection *group ATTRIBUTE_UNUSED) 1527104834Sobrien{ 1528130561Sobrien return TRUE; 152960484Sobrien} 1530